Skip to content

Commit f1ae970

Browse files
AlphaStreamfabpot
authored andcommitted
Make Doctrine's dependency injection test less fragile.
[Doctrine][DependencyInjection] The test checks that a few items are ordered according to the value of their 'priority' attribute. However, a few of the items have the same value of this attribute. RegisterEventListenersAndSubscribersPass doesn't use a stable sorting, yet the test asserts that items that are 'equal' shall go in the original order. Modified so that the order of the original items is not checked.
1 parent 55b35a2 commit f1ae970

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ public function testProcessEventSubscribersWithPriorities()
139139
;
140140

141141
$this->process($container);
142-
$this->assertEquals(array('c', 'd', 'e', 'b', 'a'), $this->getServiceOrder($container, 'addEventSubscriber'));
142+
$serviceOrder = $this->getServiceOrder($container, 'addEventSubscriber');
143+
$unordered = array_splice($serviceOrder, 0, 3);
144+
sort($unordered);
145+
$this->assertEquals(array('c', 'd', 'e'), $unordered);
146+
$this->assertEquals(array('b', 'a'), $serviceOrder);
143147
}
144148

145149
private function process(ContainerBuilder $container)

0 commit comments

Comments
 (0)