File tree Expand file tree Collapse file tree 2 files changed +65
-0
lines changed
Expand file tree Collapse file tree 2 files changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,19 @@ public function getName() : string
8282 return $ this ->name = $ name ;
8383 }
8484
85+ /**
86+ * Set command name.
87+ *
88+ * @param string $name
89+ *
90+ * @return static
91+ */
92+ public function setName (string $ name ) : static
93+ {
94+ $ this ->name = $ name ;
95+ return $ this ;
96+ }
97+
8598 /**
8699 * Get command description.
87100 *
@@ -96,6 +109,19 @@ public function getDescription() : string
96109 return $ this ->description = $ description ;
97110 }
98111
112+ /**
113+ * Set command description.
114+ *
115+ * @param string $description
116+ *
117+ * @return static
118+ */
119+ public function setDescription (string $ description ) : static
120+ {
121+ $ this ->description = $ description ;
122+ return $ this ;
123+ }
124+
99125 /**
100126 * Get command usage.
101127 *
@@ -107,6 +133,19 @@ public function getUsage() : string
107133 return $ this ->usage ;
108134 }
109135
136+ /**
137+ * Set command usage.
138+ *
139+ * @param string $usage
140+ *
141+ * @return static
142+ */
143+ public function setUsage (string $ usage ) : static
144+ {
145+ $ this ->usage = $ usage ;
146+ return $ this ;
147+ }
148+
110149 /**
111150 * Get command options.
112151 *
@@ -118,6 +157,19 @@ public function getOptions() : array
118157 return $ this ->options ;
119158 }
120159
160+ /**
161+ * Set command options.
162+ *
163+ * @param array<string,string> $options
164+ *
165+ * @return static
166+ */
167+ public function setOptions (array $ options ) : static
168+ {
169+ $ this ->options = $ options ;
170+ return $ this ;
171+ }
172+
121173 /**
122174 * Tells if the command is active.
123175 *
Original file line number Diff line number Diff line change @@ -21,18 +21,31 @@ protected function setUp() : void
2121 $ this ->command = new CommandMock (new Console ());
2222 }
2323
24+ public function testName () : void
25+ {
26+ self ::assertSame ('test ' , $ this ->command ->getName ());
27+ $ this ->command ->setName ('Foo ' );
28+ self ::assertSame ('Foo ' , $ this ->command ->getName ());
29+ }
30+
2431 public function testDescription () : void
2532 {
2633 self ::assertSame ('Lorem ipsum ' , $ this ->command ->getDescription ());
34+ $ this ->command ->setDescription ('Foo bar. ' );
35+ self ::assertSame ('Foo bar. ' , $ this ->command ->getDescription ());
2736 }
2837
2938 public function testUsage () : void
3039 {
3140 self ::assertSame ('test ' , $ this ->command ->getUsage ());
41+ $ this ->command ->setUsage ('foo ' );
42+ self ::assertSame ('foo ' , $ this ->command ->getUsage ());
3243 }
3344
3445 public function testOptions () : void
3546 {
3647 self ::assertSame (['-b ' => 'foo bar ' ], $ this ->command ->getOptions ());
48+ $ this ->command ->setOptions (['-a ' => 'baz ' ]);
49+ self ::assertSame (['-a ' => 'baz ' ], $ this ->command ->getOptions ());
3750 }
3851}
You can’t perform that action at this time.
0 commit comments