xref: /PHP-5.3/sapi/cli/tests/017.phpt (revision 37660519)
1--TEST--
2CLI -a and libedit
3--SKIPIF--
4<?php
5include "skipif.inc";
6if (!extension_loaded('readline') || readline_info('done') !== NULL) {
7	die ("skip need readline support using libedit");
8}
9?>
10--FILE--
11<?php
12$php = getenv('TEST_PHP_EXECUTABLE');
13
14$codes = array();
15
16$codes[1] = <<<EOT
17echo 'Hello world';
18exit
19EOT;
20
21$codes[] = <<<EOT
22echo 'multine
23single
24quote';
25exit
26EOT;
27
28$codes[] = <<<EOT
29echo <<<HEREDOC
30Here
31comes
32the
33doc
34HEREDOC;
35EOT;
36
37$codes[] = <<<EOT
38if (0) {
39    echo "I'm not there";
40}
41echo "Done";
42EOT;
43
44$codes[] = <<<EOT
45function a_function_with_some_name() {
46    echo "I was called!";
47}
48a_function_w	);
49EOT;
50
51foreach ($codes as $key => $code) {
52	echo "\n--------------\nSnippet no. $key:\n--------------\n";
53	$code = escapeshellarg($code);
54	echo `echo $code | "$php" -a`, "\n";
55}
56
57echo "\nDone\n";
58?>
59--EXPECTF--
60--------------
61Snippet no. 1:
62--------------
63Interactive shell
64
65Hello world
66
67
68--------------
69Snippet no. 2:
70--------------
71Interactive shell
72
73multine
74single
75quote
76
77
78--------------
79Snippet no. 3:
80--------------
81Interactive shell
82
83Here
84comes
85the
86doc
87
88
89--------------
90Snippet no. 4:
91--------------
92Interactive shell
93
94Done
95
96
97--------------
98Snippet no. 5:
99--------------
100Interactive shell
101
102
103Parse error: syntax error, unexpected ')' in php shell code on line 1
104
105
106Done
107