You are here

public function ContainerBuilderTest::testRegisteredAndLoadedExtension in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testRegisteredAndLoadedExtension()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 666

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testRegisteredAndLoadedExtension() {
  $extension = $this
    ->getMock('Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface');
  $extension
    ->expects($this
    ->exactly(2))
    ->method('getAlias')
    ->will($this
    ->returnValue('project'));
  $extension
    ->expects($this
    ->once())
    ->method('load')
    ->with(array(
    array(
      'foo' => 'bar',
    ),
  ));
  $container = new ContainerBuilder();
  $container
    ->setResourceTracking(false);
  $container
    ->registerExtension($extension);
  $container
    ->loadFromExtension('project', array(
    'foo' => 'bar',
  ));
  $container
    ->compile();
}