@@ -613,7 +613,6 @@ function testRunCommandMain() {
613
613
$ Mock = $ this ->getMock ('Shell ' , array ('main ' , 'startup ' ), array (), '' , false );
614
614
615
615
$ Mock ->expects ($ this ->once ())->method ('main ' )->will ($ this ->returnValue (true ));
616
- $ Mock ->expects ($ this ->once ())->method ('startup ' );
617
616
$ result = $ Mock ->runCommand (null , array ());
618
617
$ this ->assertTrue ($ result );
619
618
}
@@ -628,7 +627,6 @@ function testRunCommandBaseclassMethod() {
628
627
$ methods = get_class_methods ('Shell ' );
629
628
$ Mock = $ this ->getMock ('Shell ' , array ('startup ' ), array (), '' , false );
630
629
631
- $ Mock ->expects ($ this ->once ())->method ('startup ' );
632
630
$ Mock ->expects ($ this ->never ())->method ('hr ' );
633
631
$ result = $ Mock ->runCommand ('hr ' , array ());
634
632
}
@@ -638,7 +636,7 @@ function testRunCommandBaseclassMethod() {
638
636
*
639
637
* @return void
640
638
*/
641
- function testHelpParamTriggeringHelp () {
639
+ function testRunCommandTriggeringHelp () {
642
640
$ Parser = $ this ->getMock ('ConsoleOptionParser ' , array (), array (), '' , false );
643
641
$ Parser ->expects ($ this ->once ())->method ('parse ' )
644
642
->with (array ('--help ' ))
@@ -649,8 +647,22 @@ function testHelpParamTriggeringHelp() {
649
647
$ Shell ->expects ($ this ->once ())->method ('_getOptionParser ' )
650
648
->will ($ this ->returnValue ($ Parser ));
651
649
$ Shell ->expects ($ this ->once ())->method ('out ' );
652
- $ Shell ->expects ($ this ->once ())->method ('startup ' );
653
650
654
651
$ Shell ->runCommand (null , array ('--help ' ));
655
652
}
653
+
654
+ /**
655
+ * test that runCommand will call runCommand on the task.
656
+ *
657
+ * @return void
658
+ */
659
+ function testRunCommandHittingTask () {
660
+ $ Shell = $ this ->getMock ('Shell ' , array ('hasTask ' ), array (), '' , false );
661
+ $ task = $ this ->getMock ('Shell ' , array ('execute ' ), array (), '' , false );
662
+ $ Shell ->tasks = array ('RunCommand ' );
663
+ $ Shell ->expects ($ this ->once ())->method ('hasTask ' )->will ($ this ->returnValue (true ));
664
+ $ Shell ->RunCommand = $ task ;
665
+
666
+ $ Shell ->runCommand ('run_command ' , array ());
667
+ }
656
668
}
0 commit comments