0
|
1 --TEST--
|
|
2 Test for Console_CommandLine::parse() method (special cases 2).
|
|
3 --SKIPIF--
|
|
4 <?php if(php_sapi_name()!='cli') echo 'skip'; ?>
|
|
5 --ARGS--
|
|
6 -t foo bar -f 2>&1
|
|
7 --FILE--
|
|
8 <?php
|
|
9
|
|
10 require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'tests.inc.php';
|
|
11
|
|
12 try {
|
|
13 $parser = buildParser1();
|
|
14 $parser->force_posix = true;
|
|
15 $result = $parser->parse();
|
|
16 var_dump($result);
|
|
17 } catch (Console_CommandLine_Exception $exc) {
|
|
18 $parser->displayError($exc->getMessage());
|
|
19 }
|
|
20
|
|
21 ?>
|
|
22 --EXPECTF--
|
|
23 object(Console_CommandLine_Result)#%d (4) {
|
|
24 ["options"]=>
|
|
25 array(11) {
|
|
26 ["true"]=>
|
|
27 bool(true)
|
|
28 ["false"]=>
|
|
29 NULL
|
|
30 ["int"]=>
|
|
31 int(1)
|
|
32 ["float"]=>
|
|
33 float(1)
|
|
34 ["string"]=>
|
|
35 NULL
|
|
36 ["counter"]=>
|
|
37 NULL
|
|
38 ["callback"]=>
|
|
39 NULL
|
|
40 ["array"]=>
|
|
41 array(2) {
|
|
42 [0]=>
|
|
43 string(4) "spam"
|
|
44 [1]=>
|
|
45 string(3) "egg"
|
|
46 }
|
|
47 ["password"]=>
|
|
48 NULL
|
|
49 ["help"]=>
|
|
50 NULL
|
|
51 ["version"]=>
|
|
52 NULL
|
|
53 }
|
|
54 ["args"]=>
|
|
55 array(2) {
|
|
56 ["simple"]=>
|
|
57 string(3) "foo"
|
|
58 ["multiple"]=>
|
|
59 array(2) {
|
|
60 [0]=>
|
|
61 string(3) "bar"
|
|
62 [1]=>
|
|
63 string(2) "-f"
|
|
64 }
|
|
65 }
|
|
66 ["command_name"]=>
|
|
67 bool(false)
|
|
68 ["command"]=>
|
|
69 bool(false)
|
|
70 }
|