MergeExtensionConfigurationPassTest.php 2.3 KB

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