0
|
1 --TEST--
|
|
2 Test for Console_CommandLine::addCommand() method.
|
|
3 --FILE--
|
|
4 <?php
|
|
5
|
|
6 require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tests.inc.php';
|
|
7
|
|
8 $parser = new Console_CommandLine();
|
|
9 $parser->addCommand('cmd1');
|
|
10 $parser->addCommand('cmd2', array(
|
|
11 'description' => 'description of cmd2'
|
|
12 ));
|
|
13 $cmd3 = new Console_CommandLine_Command(array(
|
|
14 'name' => 'cmd3',
|
|
15 'description' => 'description of cmd3'
|
|
16 ));
|
|
17 $parser->addCommand($cmd3);
|
|
18
|
|
19 var_dump(array_keys($parser->commands));
|
|
20 var_dump($parser->commands['cmd2']->description);
|
|
21 var_dump($parser->commands['cmd3']->description);
|
|
22
|
|
23 ?>
|
|
24 --EXPECT--
|
|
25 array(3) {
|
|
26 [0]=>
|
|
27 string(4) "cmd1"
|
|
28 [1]=>
|
|
29 string(4) "cmd2"
|
|
30 [2]=>
|
|
31 string(4) "cmd3"
|
|
32 }
|
|
33 string(19) "description of cmd2"
|
|
34 string(19) "description of cmd3"
|