merged branch pborreli/bug-7860 (PR #7863)
This PR was merged into the 2.2 branch.
Discussion
----------
[Console] is not ambiguous anymore if it has a perfect match command name (closes #7860)
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes, locally
| Fixed tickets | #7860
| License | MIT
| Doc PR | no
Commits
-------
be34917
[Console] find command even if its name is a namespace too (closes #7860)
This commit is contained in:
commit
b4b4326a10
|
@ -580,6 +580,10 @@ class Application
|
|||
return $this->get($abbrevs[$searchName][0]);
|
||||
}
|
||||
|
||||
if (isset($abbrevs[$searchName]) && in_array($searchName, $abbrevs[$searchName])) {
|
||||
return $this->get($searchName);
|
||||
}
|
||||
|
||||
if (isset($abbrevs[$searchName]) && count($abbrevs[$searchName]) > 1) {
|
||||
$suggestions = $this->getAbbreviationSuggestions($abbrevs[$searchName]);
|
||||
|
||||
|
|
|
@ -219,6 +219,16 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||
}
|
||||
}
|
||||
|
||||
public function testFindCommandEqualNamespace()
|
||||
{
|
||||
$application = new Application();
|
||||
$application->add(new \Foo3Command());
|
||||
$application->add(new \Foo4Command());
|
||||
|
||||
$this->assertInstanceOf('Foo3Command', $application->find('foo3:bar'), '->find() returns the good command even if a namespace has same name');
|
||||
$this->assertInstanceOf('Foo4Command', $application->find('foo3:bar:toh'), '->find() returns a command even if its namespace equals another command name');
|
||||
}
|
||||
|
||||
public function testFindAlternativeExceptionMessage()
|
||||
{
|
||||
$application = new Application();
|
||||
|
|
Reference in New Issue