xref: /PHP-8.2/sapi/cli/tests/012-2.phpt (revision 959e5787)
1--TEST--
2more invalid arguments and error messages
3--EXTENSIONS--
4readline
5--SKIPIF--
6<?php include "skipif.inc"; ?>
7--FILE--
8<?php
9
10$php = getenv('TEST_PHP_EXECUTABLE');
11
12// -r : behavior = CLI_DIRECT
13// -F / -R / -B / -E : behavior = PROCESS_STDIN
14// -l : behavior = LINT
15// -s : behavior = HIGHLIGHT
16// -w : behavior = STRIP
17
18var_dump(`"$php" -n -r "echo 1;" -F some.php`);
19var_dump(`"$php" -n -r "echo 2;" -f some.php`);
20var_dump(`"$php" -n -r "echo 3;" -l`); // ignores linting
21var_dump(`"$php" -n -r "echo 4;" -R some.php`);
22var_dump(`"$php" -n -r "echo 5;" -B ""`);
23var_dump(`"$php" -n -a -B ""`);
24var_dump(`"$php" -n -r "echo 6;" -E ""`);
25var_dump(`"$php" -n -a -E ""`);
26var_dump(`"$php" -n -r "echo 7;" -s`);
27var_dump(`"$php" -n -r "echo 8;" -w`);
28var_dump(`"$php" -n -l -r "echo 9;"`);
29
30echo "Done\n";
31?>
32--EXPECT--
33string(57) "Either execute direct code, process stdin or use a file.
34"
35string(57) "Either execute direct code, process stdin or use a file.
36"
37string(1) "3"
38string(57) "Either execute direct code, process stdin or use a file.
39"
40string(57) "Either execute direct code, process stdin or use a file.
41"
42string(57) "Either execute direct code, process stdin or use a file.
43"
44string(57) "Either execute direct code, process stdin or use a file.
45"
46string(57) "Either execute direct code, process stdin or use a file.
47"
48string(42) "Source highlighting only works for files.
49"
50string(39) "Source stripping only works for files.
51"
52string(57) "Either execute direct code, process stdin or use a file.
53"
54Done
55