public function ContainerBuilderTest::testAddObjectResource in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php \Symfony\Component\DependencyInjection\Tests\ContainerBuilderTest::testAddObjectResource()
@covers Symfony\Component\DependencyInjection\ContainerBuilder::addObjectResource
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ ContainerBuilderTest.php, line 544
Class
Namespace
Symfony\Component\DependencyInjection\TestsCode
public function testAddObjectResource() {
$container = new ContainerBuilder();
$container
->setResourceTracking(false);
$container
->addObjectResource(new \BarClass());
$this
->assertEmpty($container
->getResources(), 'No resources get registered without resource tracking');
$container
->setResourceTracking(true);
$container
->addObjectResource(new \BarClass());
$resources = $container
->getResources();
$this
->assertCount(1, $resources, '1 resource was registered');
/* @var $resource \Symfony\Component\Config\Resource\FileResource */
$resource = end($resources);
$this
->assertInstanceOf('Symfony\\Component\\Config\\Resource\\FileResource', $resource);
$this
->assertSame(realpath(__DIR__ . '/Fixtures/includes/classes.php'), realpath($resource
->getResource()));
}