You are here

public function ContainerBuilderTest::testResources in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testResources()

@covers Symfony\Component\DependencyInjection\ContainerBuilder::getResources @covers Symfony\Component\DependencyInjection\ContainerBuilder::addResource

File

vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php, line 621

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testResources() {
  $container = new ContainerBuilder();
  $container
    ->addResource($a = new FileResource(__DIR__ . '/Fixtures/xml/services1.xml'));
  $container
    ->addResource($b = new FileResource(__DIR__ . '/Fixtures/xml/services2.xml'));
  $resources = array();
  foreach ($container
    ->getResources() as $resource) {
    if (false === strpos($resource, '.php')) {
      $resources[] = $resource;
    }
  }
  $this
    ->assertEquals(array(
    $a,
    $b,
  ), $resources, '->getResources() returns an array of resources read for the current configuration');
  $this
    ->assertSame($container, $container
    ->setResources(array()));
  $this
    ->assertEquals(array(), $container
    ->getResources());
}