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()
82
82
}
83
83
84
84
$ 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.
87
90
}
88
91
89
92
$ process = array (
Original file line number Diff line number Diff line change @@ -131,4 +131,16 @@ public function completionAwareCommandDataProvider()
131
131
),
132
132
);
133
133
}
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
+ }
134
146
}
You can’t perform that action at this time.
0 commit comments