* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sonata\AdminBundle\Tests\DependencyInjection; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; use Sonata\AdminBundle\DependencyInjection\SonataAdminExtension; class SonataAdminExtensionTest extends AbstractExtensionTestCase { public function testHasServiceDefinitionForLockExtension() { $this->container->setParameter('kernel.bundles', array()); $this->load(array('options' => array('lock_protection' => true))); $this->assertContainerBuilderHasService('sonata.admin.lock.extension'); } public function testNotHasServiceDefinitionForLockExtension() { $this->container->setParameter('kernel.bundles', array()); $this->load(array('options' => array('lock_protection' => false))); $this->assertContainerBuilderNotHasService('sonata.admin.lock.extension'); } public function testLoadsExporterServiceDefinitionWhenExporterBundleIsRegistered() { $this->container->setParameter('kernel.bundles', array('SonataExporterBundle' => 'whatever')); $this->load(); $this->assertContainerBuilderHasService( 'sonata.admin.admin_exporter', 'Sonata\AdminBundle\Bridge\Exporter\AdminExporter' ); } protected function getContainerExtensions() { return array(new SonataAdminExtension()); } }