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