You are here

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

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

File

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

Class

ContainerBuilderTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testGetAliases() {
  $builder = new ContainerBuilder();
  $builder
    ->setAlias('bar', 'foo');
  $builder
    ->setAlias('foobar', 'foo');
  $builder
    ->setAlias('moo', new Alias('foo', false));
  $aliases = $builder
    ->getAliases();
  $this
    ->assertEquals('foo', (string) $aliases['bar']);
  $this
    ->assertTrue($aliases['bar']
    ->isPublic());
  $this
    ->assertEquals('foo', (string) $aliases['foobar']);
  $this
    ->assertEquals('foo', (string) $aliases['moo']);
  $this
    ->assertFalse($aliases['moo']
    ->isPublic());
  $builder
    ->register('bar', 'stdClass');
  $this
    ->assertFalse($builder
    ->hasAlias('bar'));
  $builder
    ->set('foobar', 'stdClass');
  $builder
    ->set('moo', 'stdClass');
  $this
    ->assertCount(0, $builder
    ->getAliases(), '->getAliases() does not return aliased services that have been overridden');
}