minor #12058 [Doctrine][DependencyInjection] Make a test less fragile. (AlphaStream)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #12058).
Discussion
----------
[Doctrine][DependencyInjection] Make a test less fragile.
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.
| Q | A
| ------------- | ---
| Bug fix? | [no]
| New feature? | [no]
| BC breaks? | [no]
| Deprecations? | [no]
| Tests pass? | [yes]
| Fixed tickets | [none]
| License | MIT
| Doc PR | [none]
Commits
-------
f1ae970
Make Doctrine's dependency injection test less fragile.
This commit is contained in:
commit
2ecbf87aa3
@ -139,7 +139,11 @@ class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_Te
|
|||||||
;
|
;
|
||||||
|
|
||||||
$this->process($container);
|
$this->process($container);
|
||||||
$this->assertEquals(array('c', 'd', 'e', 'b', 'a'), $this->getServiceOrder($container, 'addEventSubscriber'));
|
$serviceOrder = $this->getServiceOrder($container, 'addEventSubscriber');
|
||||||
|
$unordered = array_splice($serviceOrder, 0, 3);
|
||||||
|
sort($unordered);
|
||||||
|
$this->assertEquals(array('c', 'd', 'e'), $unordered);
|
||||||
|
$this->assertEquals(array('b', 'a'), $serviceOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function process(ContainerBuilder $container)
|
private function process(ContainerBuilder $container)
|
||||||
|
Reference in New Issue
Block a user