minor #35954 Add test for tagged iterator with numeric index (Denis Yuzhanin)

This PR was submitted for the 5.0 branch but it was merged into the 4.4 branch instead.

Discussion
----------

Add test for tagged iterator with numeric index

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| License       | MIT

This is just a new test case for bug in issue #35953

Commits
-------

7aa4e10473 Add test for tagged iterator with numeric index
This commit is contained in:
Nicolas Grekas 2020-03-12 18:03:42 +01:00
commit b913b860c4
1 changed files with 16 additions and 0 deletions

View File

@ -37,4 +37,20 @@ class ResolveTaggedIteratorArgumentPassTest extends TestCase
$expected->setValues([new Reference('b'), new Reference('c'), new Reference('a')]);
$this->assertEquals($expected, $properties['foos']);
}
public function testProcessWithIndexes()
{
$container = new ContainerBuilder();
$container->register('service_a', 'stdClass')->addTag('foo', ['key' => '1']);
$container->register('service_b', 'stdClass')->addTag('foo', ['key' => '2']);
$container->register('service_c', 'stdClass')->setProperty('foos', new TaggedIteratorArgument('foo', 'key'));
(new ResolveTaggedIteratorArgumentPass())->process($container);
$properties = $container->getDefinition('service_c')->getProperties();
$expected = new TaggedIteratorArgument('foo', 'key');
$expected->setValues(['1' => new Reference('service_a'), '2' => new Reference('service_b')]);
$this->assertEquals($expected, $properties['foos']);
}
}