Skip to content

Commit

Permalink
Add test for tagged iterator with numeric index
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Yuzhanin authored and nicolas-grekas committed Mar 12, 2020
1 parent 2bf9991 commit 7aa4e10
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
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 7aa4e10

Please sign in to comment.