public function ContainerBuilderTest::testRegisteredAndLoadedExtension

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php, line 487

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testRegisteredAndLoadedExtension() {
  if (!class_exists('Symfony\\Component\\Config\\Resource\\FileResource')) {
    $this
      ->markTestSkipped('The "Config" component is not available');
  }
  $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
    ->registerExtension($extension);
  $container
    ->loadFromExtension('project', array(
    'foo' => 'bar',
  ));
  $container
    ->compile();
}