Skip to content

Commit 4b94274

Browse files
committed
minor #15940 [Console] don't rely on internal sort implementation om test (xabbuh)
This PR was merged into the 2.8 branch. Discussion ---------- [Console] don't rely on internal sort implementation om test | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14894 | License | MIT | Doc PR | PHP does not guarantuee how array elements with the same value will be sorted when applying `asort()`. Since all namespaces used in the test produce the same Levenshtein value, we should only check for presence of these namespaces instead of comparing the exact order. Commits ------- 3011fa0 don't rely on internal sort implementation in test
2 parents 6ae7d95 + 3011fa0 commit 4b94274

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,10 @@ public function testFindAlternativeNamespace()
441441
$this->fail('->find() throws a CommandNotFoundException if namespace does not exist');
442442
} catch (\Exception $e) {
443443
$this->assertInstanceOf('Symfony\Component\Console\Exception\CommandNotFoundException', $e, '->find() throws a CommandNotFoundException if namespace does not exist');
444-
$this->assertSame(array('foo3', 'foo1', 'foo'), $e->getAlternatives());
444+
$this->assertCount(3, $e->getAlternatives());
445+
$this->assertContains('foo', $e->getAlternatives());
446+
$this->assertContains('foo1', $e->getAlternatives());
447+
$this->assertContains('foo3', $e->getAlternatives());
445448
$this->assertRegExp('/There are no commands defined in the "foo2" namespace./', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative');
446449
$this->assertRegExp('/foo/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo"');
447450
$this->assertRegExp('/foo1/', $e->getMessage(), '->find() throws a CommandNotFoundException if namespace does not exist, with alternative : "foo1"');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy