Skip to content

Commit 0f63bb0

Browse files
committed
Add more test-cases
1 parent e546fec commit 0f63bb0

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

Tests/Compiler/ResolveInstanceofConditionalsPassTest.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,29 @@ public function testBadInterfaceForAutomaticInstanceofIsOk()
205205
public function testProcessForAutoconfiguredCalls()
206206
{
207207
$container = new ContainerBuilder();
208-
$container->registerForAutoconfiguration(parent::class)->addMethodCall('setLogger');
209208

210-
$def = $container->register('foo', self::class)->setAutoconfigured(true);
211-
$this->assertFalse($def->hasMethodCall('setLogger'), 'Definition shouldn\'t have method call yet.');
209+
$expected = array(
210+
array('setFoo', array(
211+
'plain_value',
212+
'%some_parameter%'
213+
)),
214+
array('callBar', array()),
215+
array('isBaz', array()),
216+
);
212217

213-
(new ResolveInstanceofConditionalsPass())->process($container);
218+
$container->registerForAutoconfiguration(parent::class)->addMethodCall('setFoo', $expected[0][1]);
219+
$container->registerForAutoconfiguration(self::class)->addMethodCall('callBar');
214220

215-
$this->assertTrue(
216-
$container->findDefinition('foo')->hasMethodCall('setLogger'),
217-
'Definition should have "setLogger" method call.'
221+
$def = $container->register('foo', self::class)->setAutoconfigured(true)->addMethodCall('isBaz');
222+
$this->assertEquals(
223+
array(array('isBaz', array())),
224+
$def->getMethodCalls(),
225+
'Definition shouldn\'t have only one method call.'
218226
);
227+
228+
(new ResolveInstanceofConditionalsPass())->process($container);
229+
230+
$this->assertEquals($expected, $container->findDefinition('foo')->getMethodCalls());
219231
}
220232

221233
/**

0 commit comments

Comments
 (0)