You are here

public function ContainerBuilderTest::testResources 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::testResources()

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

File

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

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());
}