comparison vendor/pear/console_commandline/tests/console_commandline_addcommand.phpt @ 0:1e000243b222

vanilla 1.3.3 distro, I hope
author Charlie Root
date Thu, 04 Jan 2018 15:50:29 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e000243b222
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"