public function AutoAliasServicePassTest::testProcessWithManualAlias in Service Container 7
Same name and namespace in other branches
- 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Compiler/AutoAliasServicePassTest.php \Symfony\Component\DependencyInjection\Tests\Compiler\AutoAliasServicePassTest::testProcessWithManualAlias()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Compiler/ AutoAliasServicePassTest.php, line 72
Class
Namespace
Symfony\Component\DependencyInjection\Tests\CompilerCode
public function testProcessWithManualAlias() {
$container = new ContainerBuilder();
$container
->register('example', 'Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassDefault')
->addTag('auto_alias', array(
'format' => '%existing%.example',
));
$container
->register('mysql.example', 'Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassMysql');
$container
->register('mariadb.example', 'Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassMariadb');
$container
->setAlias('example', 'mariadb.example');
$container
->setParameter('existing', 'mysql');
$pass = new AutoAliasServicePass();
$pass
->process($container);
$this
->assertTrue($container
->hasAlias('example'));
$this
->assertEquals('mariadb.example', $container
->getAlias('example'));
$this
->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Tests\\Compiler\\ServiceClassMariaDb', $container
->get('example'));
}