Skip to content

Commit

Permalink
minor #35954 Add test for tagged iterator with numeric index (Denis Y…
Browse files Browse the repository at this point in the history
…uzhanin)

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
-------

7aa4e10 Add test for tagged iterator with numeric index
  • Loading branch information
nicolas-grekas committed Mar 12, 2020
2 parents 2bf9991 + 7aa4e10 commit b913b86
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -37,4 +37,20 @@ public function testProcess()
$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']);
}
}

0 comments on commit b913b86

Please sign in to comment.