SonataAdminExtensionTest.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Tests\DependencyInjection;
  11. use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
  12. use Sonata\AdminBundle\DependencyInjection\SonataAdminExtension;
  13. class SonataAdminExtensionTest extends AbstractExtensionTestCase
  14. {
  15. public function testHasServiceDefinitionForLockExtension()
  16. {
  17. $this->container->setParameter('kernel.bundles', array());
  18. $this->load(array('options' => array('lock_protection' => true)));
  19. $this->assertContainerBuilderHasService('sonata.admin.lock.extension');
  20. }
  21. public function testNotHasServiceDefinitionForLockExtension()
  22. {
  23. $this->container->setParameter('kernel.bundles', array());
  24. $this->load(array('options' => array('lock_protection' => false)));
  25. $this->assertContainerBuilderNotHasService('sonata.admin.lock.extension');
  26. }
  27. public function testLoadsExporterServiceDefinitionWhenExporterBundleIsRegistered()
  28. {
  29. $this->container->setParameter('kernel.bundles', array('SonataExporterBundle' => 'whatever'));
  30. $this->load();
  31. $this->assertContainerBuilderHasService(
  32. 'sonata.admin.admin_exporter',
  33. 'Sonata\AdminBundle\Bridge\Exporter\AdminExporter'
  34. );
  35. }
  36. protected function getContainerExtensions()
  37. {
  38. return array(new SonataAdminExtension());
  39. }
  40. }