File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
tests/Stecman/Component/Symfony/Console/BashCompletion Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -82,8 +82,11 @@ public function runCompletion()
8282 }
8383
8484 $ cmdName = $ this ->getInput ()->getFirstArgument ();
85- if ($ this ->application ->has ($ cmdName )) {
86- $ this ->command = $ this ->application ->get ($ cmdName );
85+
86+ try {
87+ $ this ->command = $ this ->application ->find ($ cmdName );
88+ } catch (\InvalidArgumentException $ e ) {
89+ // Exception thrown, when multiple or none commands are found.
8790 }
8891
8992 $ process = array (
Original file line number Diff line number Diff line change @@ -131,4 +131,16 @@ public function completionAwareCommandDataProvider()
131131 ),
132132 );
133133 }
134+
135+ public function testShortCommandMatched ()
136+ {
137+ $ handler = $ this ->createHandler ('app w:n --deploy ' );
138+ $ this ->assertEquals (array ('--deploy:jazz-hands ' ), $ this ->getTerms ($ handler ->runCompletion ()));
139+ }
140+
141+ public function testShortCommandNotMatched ()
142+ {
143+ $ handler = $ this ->createHandler ('app w --deploy ' );
144+ $ this ->assertEquals (array (), $ this ->getTerms ($ handler ->runCompletion ()));
145+ }
134146}
You can’t perform that action at this time.
0 commit comments