You are here

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

@covers Symfony\Component\DependencyInjection\ContainerBuilder::createService

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCreateService() {
  $builder = new ContainerBuilder();
  $builder
    ->register('foo1', 'Bar\\FooClass')
    ->setFile(__DIR__ . '/Fixtures/includes/foo.php');
  $this
    ->assertInstanceOf('\\Bar\\FooClass', $builder
    ->get('foo1'), '->createService() requires the file defined by the service definition');
  $builder
    ->register('foo2', 'Bar\\FooClass')
    ->setFile(__DIR__ . '/Fixtures/includes/%file%.php');
  $builder
    ->setParameter('file', 'foo');
  $this
    ->assertInstanceOf('\\Bar\\FooClass', $builder
    ->get('foo2'), '->createService() replaces parameters in the file provided by the service definition');
}