File tree 2 files changed +19
-1
lines changed
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)
95
95
{
96
96
$ this ->description = $ description ;
97
97
}
98
+
99
+ /**
100
+ * @return Command
101
+ */
102
+ public function getCommand ()
103
+ {
104
+ return $ this ->command ;
105
+ }
98
106
}
Original file line number Diff line number Diff line change 5
5
use PHPUnit \Framework \TestCase ;
6
6
use tflori \Commands \Command ;
7
7
use tflori \Commands \Commands ;
8
- use tflori \Getopt \Getopt ;
9
8
use tflori \Getopt \Option ;
10
9
11
10
class ParseTest extends TestCase
@@ -66,4 +65,15 @@ public function testAddsOptionsFromCommand()
66
65
self ::assertSame (1 , $ commands ->getOption ('a ' ));
67
66
self ::assertSame (1 , $ commands ->getOption ('b ' ));
68
67
}
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
+ }
69
79
}
You can’t perform that action at this time.
0 commit comments