File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -95,4 +95,12 @@ public function setDescription($description)
9595 {
9696 $ this ->description = $ description ;
9797 }
98+
99+ /**
100+ * @return Command
101+ */
102+ public function getCommand ()
103+ {
104+ return $ this ->command ;
105+ }
98106}
Original file line number Diff line number Diff line change 55use PHPUnit \Framework \TestCase ;
66use tflori \Commands \Command ;
77use tflori \Commands \Commands ;
8- use tflori \Getopt \Getopt ;
98use tflori \Getopt \Option ;
109
1110class ParseTest extends TestCase
@@ -66,4 +65,15 @@ public function testAddsOptionsFromCommand()
6665 self ::assertSame (1 , $ commands ->getOption ('a ' ));
6766 self ::assertSame (1 , $ commands ->getOption ('b ' ));
6867 }
68+
69+ public function testStoresTheCalledCommand ()
70+ {
71+ $ commands = new Commands ();
72+ $ command = new Command ('help ' , 'Show the help for command ' , 'var_dump ' );
73+ $ commands ->addCommand ($ command );
74+
75+ $ commands ->parse ('help ' );
76+
77+ self ::assertSame ($ command , $ commands ->getCommand ());
78+ }
6979}
You can’t perform that action at this time.
0 commit comments