Add more test-cases
This commit is contained in:
parent
2612f81052
commit
15c45ee40a
@ -205,17 +205,29 @@ class ResolveInstanceofConditionalsPassTest extends TestCase
|
|||||||
public function testProcessForAutoconfiguredCalls()
|
public function testProcessForAutoconfiguredCalls()
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$container->registerForAutoconfiguration(parent::class)->addMethodCall('setLogger');
|
|
||||||
|
|
||||||
$def = $container->register('foo', self::class)->setAutoconfigured(true);
|
$expected = array(
|
||||||
$this->assertFalse($def->hasMethodCall('setLogger'), 'Definition shouldn\'t have method call yet.');
|
array('setFoo', array(
|
||||||
|
'plain_value',
|
||||||
|
'%some_parameter%'
|
||||||
|
)),
|
||||||
|
array('callBar', array()),
|
||||||
|
array('isBaz', array()),
|
||||||
|
);
|
||||||
|
|
||||||
|
$container->registerForAutoconfiguration(parent::class)->addMethodCall('setFoo', $expected[0][1]);
|
||||||
|
$container->registerForAutoconfiguration(self::class)->addMethodCall('callBar');
|
||||||
|
|
||||||
|
$def = $container->register('foo', self::class)->setAutoconfigured(true)->addMethodCall('isBaz');
|
||||||
|
$this->assertEquals(
|
||||||
|
array(array('isBaz', array())),
|
||||||
|
$def->getMethodCalls(),
|
||||||
|
'Definition shouldn\'t have only one method call.'
|
||||||
|
);
|
||||||
|
|
||||||
(new ResolveInstanceofConditionalsPass())->process($container);
|
(new ResolveInstanceofConditionalsPass())->process($container);
|
||||||
|
|
||||||
$this->assertTrue(
|
$this->assertEquals($expected, $container->findDefinition('foo')->getMethodCalls());
|
||||||
$container->findDefinition('foo')->hasMethodCall('setLogger'),
|
|
||||||
'Definition should have "setLogger" method call.'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user