MergeExtensionConfigurationPassTest.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  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 Symfony\Component\HttpKernel\Tests\DependencyInjection;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
  13. class MergeExtensionConfigurationPassTest extends TestCase
  14. {
  15. public function testAutoloadMainExtension()
  16. {
  17. $container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerBuilder')->setMethods(array('getExtensionConfig', 'loadFromExtension', 'getParameterBag', 'getDefinitions', 'getAliases', 'getExtensions'))->getMock();
  18. $params = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag')->getMock();
  19. $container->expects($this->at(0))
  20. ->method('getExtensionConfig')
  21. ->with('loaded')
  22. ->will($this->returnValue(array(array())));
  23. $container->expects($this->at(1))
  24. ->method('getExtensionConfig')
  25. ->with('notloaded')
  26. ->will($this->returnValue(array()));
  27. $container->expects($this->once())
  28. ->method('loadFromExtension')
  29. ->with('notloaded', array());
  30. $container->expects($this->any())
  31. ->method('getParameterBag')
  32. ->will($this->returnValue($params));
  33. $params->expects($this->any())
  34. ->method('all')
  35. ->will($this->returnValue(array()));
  36. $container->expects($this->any())
  37. ->method('getDefinitions')
  38. ->will($this->returnValue(array()));
  39. $container->expects($this->any())
  40. ->method('getAliases')
  41. ->will($this->returnValue(array()));
  42. $container->expects($this->any())
  43. ->method('getExtensions')
  44. ->will($this->returnValue(array()));
  45. $configPass = new MergeExtensionConfigurationPass(array('loaded', 'notloaded'));
  46. $configPass->process($container);
  47. }
  48. }