File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,18 @@ public function removeCommands(array $names) : static
233233 return $ this ;
234234 }
235235
236+ /**
237+ * Tells if it has a command.
238+ *
239+ * @param string $name Command name
240+ *
241+ * @return bool
242+ */
243+ public function hasCommand (string $ name ) : bool
244+ {
245+ return $ this ->getCommand ($ name ) !== null ;
246+ }
247+
236248 /**
237249 * Run the Console.
238250 */
Original file line number Diff line number Diff line change @@ -165,6 +165,13 @@ public function testRemoveCommands() : void
165165 self ::assertNull ($ this ->console ->getCommand ('help ' ));
166166 }
167167
168+ public function testHasCommand () : void
169+ {
170+ self ::assertTrue ($ this ->console ->hasCommand ('about ' ));
171+ $ this ->console ->removeCommand ('about ' );
172+ self ::assertFalse ($ this ->console ->hasCommand ('about ' ));
173+ }
174+
168175 public function testCommandString () : void
169176 {
170177 $ this ->console ->addCommands ([
You can’t perform that action at this time.
0 commit comments