$aliased->
addMethodCall('setBar',
[new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE
)]);
$builder->
setDefinition('aliased',
$aliased);
$builder->
setAlias('alias', 'aliased'
);
$this->
assertEquals(new \
stdClass(),
$builder->
get('alias'
));
} public function testAddGetCompilerPass() { $builder =
new ContainerBuilder();
$builder->
setResourceTracking(false
);
$defaultPasses =
$builder->
getCompiler()->
getPassConfig()->
getPasses();
$builder->
addCompilerPass($pass1 =
$this->
createMock(CompilerPassInterface::
class), PassConfig::TYPE_BEFORE_OPTIMIZATION, -5
);
$builder->
addCompilerPass($pass2 =
$this->
createMock(CompilerPassInterface::
class), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10
);
$passes =
$builder->
getCompiler()->
getPassConfig()->
getPasses();
$this->
assertCount(\
count($passes) - 2,
$defaultPasses);
// Pass 1 is executed later
$this->
assertTrue(array_search($pass1,
$passes, true
) >
array_search($pass2,
$passes, true
));
} public function testCreateService() {