@@ -54,6 +54,14 @@ public function testSetApplication()
54
54
$ command = new \TestCommand ();
55
55
$ command ->setApplication ($ application );
56
56
$ this ->assertEquals ($ application , $ command ->getApplication (), '->setApplication() sets the current application ' );
57
+ $ this ->assertEquals ($ application ->getHelperSet (), $ command ->getHelperSet ());
58
+ }
59
+
60
+ public function testSetApplicationNull ()
61
+ {
62
+ $ command = new \TestCommand ();
63
+ $ command ->setApplication (null );
64
+ $ this ->assertNull ($ command ->getHelperSet ());
57
65
}
58
66
59
67
public function testSetGetDefinition ()
@@ -156,6 +164,13 @@ public function testGetSetAliases()
156
164
$ this ->assertEquals (array ('name1 ' ), $ command ->getAliases (), '->setAliases() sets the aliases ' );
157
165
}
158
166
167
+ public function testSetAliasesNull ()
168
+ {
169
+ $ command = new \TestCommand ();
170
+ $ this ->setExpectedException ('InvalidArgumentException ' );
171
+ $ command ->setAliases (null );
172
+ }
173
+
159
174
public function testGetSynopsis ()
160
175
{
161
176
$ command = new \TestCommand ();
@@ -164,6 +179,15 @@ public function testGetSynopsis()
164
179
$ this ->assertEquals ('namespace:name [--foo] [--] [<bar>] ' , $ command ->getSynopsis (), '->getSynopsis() returns the synopsis ' );
165
180
}
166
181
182
+ public function testAddGetUsages ()
183
+ {
184
+ $ command = new \TestCommand ();
185
+ $ command ->addUsage ('foo1 ' );
186
+ $ command ->addUsage ('foo2 ' );
187
+ $ this ->assertContains ('namespace:name foo1 ' , $ command ->getUsages ());
188
+ $ this ->assertContains ('namespace:name foo2 ' , $ command ->getUsages ());
189
+ }
190
+
167
191
public function testGetHelper ()
168
192
{
169
193
$ application = new Application ();
@@ -275,8 +299,8 @@ public function testRunReturnsIntegerExitCode()
275
299
276
300
$ command = $ this ->getMock ('TestCommand ' , array ('execute ' ));
277
301
$ command ->expects ($ this ->once ())
278
- ->method ('execute ' )
279
- ->will ($ this ->returnValue ('2.3 ' ));
302
+ ->method ('execute ' )
303
+ ->will ($ this ->returnValue ('2.3 ' ));
280
304
$ exitCode = $ command ->run (new StringInput ('' ), new NullOutput ());
281
305
$ this ->assertSame (2 , $ exitCode , '->run() returns integer exit code (casts numeric to int) ' );
282
306
}
@@ -297,6 +321,17 @@ public function testRunReturnsAlwaysInteger()
297
321
$ this ->assertSame (0 , $ command ->run (new StringInput ('' ), new NullOutput ()));
298
322
}
299
323
324
+ public function testRunWithProcessTitle ()
325
+ {
326
+ $ command = new \TestCommand ();
327
+ $ command ->setApplication (new Application ());
328
+ $ command ->setProcessTitle ('foo ' );
329
+ $ this ->assertSame (0 , $ command ->run (new StringInput ('' ), new NullOutput ()));
330
+ if (function_exists ('cli_set_process_title ' )) {
331
+ $ this ->assertEquals ('foo ' , cli_get_process_title ());
332
+ }
333
+ }
334
+
300
335
public function testSetCode ()
301
336
{
302
337
$ command = new \TestCommand ();
0 commit comments