MergeExtensionConfigurationPassTest.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
  12. class MergeExtensionConfigurationPassTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testAutoloadMainExtension()
  15. {
  16. $container = $this->getMock(
  17. 'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
  18. array(
  19. 'getExtensionConfig',
  20. 'loadFromExtension',
  21. 'getParameterBag',
  22. 'getDefinitions',
  23. 'getAliases',
  24. 'getExtensions',
  25. )
  26. );
  27. $params = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag');
  28. $container->expects($this->at(0))
  29. ->method('getExtensionConfig')
  30. ->with('loaded')
  31. ->will($this->returnValue(array(array())));
  32. $container->expects($this->at(1))
  33. ->method('getExtensionConfig')
  34. ->with('notloaded')
  35. ->will($this->returnValue(array()));
  36. $container->expects($this->once())
  37. ->method('loadFromExtension')
  38. ->with('notloaded', array());
  39. $container->expects($this->any())
  40. ->method('getParameterBag')
  41. ->will($this->returnValue($params));
  42. $params->expects($this->any())
  43. ->method('all')
  44. ->will($this->returnValue(array()));
  45. $container->expects($this->any())
  46. ->method('getDefinitions')
  47. ->will($this->returnValue(array()));
  48. $container->expects($this->any())
  49. ->method('getAliases')
  50. ->will($this->returnValue(array()));
  51. $container->expects($this->any())
  52. ->method('getExtensions')
  53. ->will($this->returnValue(array()));
  54. $configPass = new MergeExtensionConfigurationPass(array('loaded', 'notloaded'));
  55. $configPass->process($container);
  56. }
  57. }