8000 minor #35954 Add test for tagged iterator with numeric index (Denis Y… · symfony/symfony@b913b86 · GitHub
[go: up one dir, main page]

Skip to content

Commit b913b86

Browse files
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 ------- 7aa4e10 Add test for tagged iterator with numeric index
2 parents 2bf9991 + 7aa4e10 commit b913b86

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveTaggedIteratorArgumentPassTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,20 @@ public function testProcess()
3737
$expected->setValues([new Reference('b'), new Reference('c'), new Reference('a')]);
3838
$this->assertEquals($expected, $properties['foos']);
3939
}
40+
41+
public function testProcessWithIndexes()
42+
{
43+
$container = new ContainerBuilder();
44+
$container->register('service_a', 'stdClass')->addTag('foo', ['key' => '1']);
45+
$container->register('service_b', 'stdClass')->addTag('foo', ['key' => '2']);
46+
$container->register('service_c', 'stdClass')->setProperty('foos', new TaggedIteratorArgument('foo', 'key'));
47+
48+
(new ResolveTaggedIteratorArgumentPass())->process($container);
49+
50+
$properties = $container->getDefinition('service_c')->getProperties();
51< 53BE /code>+
52+
$expected = new TaggedIteratorArgument('foo', 'key');
53+
$expected->setValues(['1' => new Reference('service_a'), '2' => new Reference('service_b')]);
54+
$this->assertEquals($expected, $properties['foos']);
55+
}
4056
}

0 commit comments

Comments
 (0)
0