[Console] find command even if its name is a namespace too (closes #7860)
This commit is contained in:
parent
609b5ff08c
commit
be34917448
|
@ -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