xref: /php-src/sapi/cli/tests/011.phpt (revision ac5920f9)
1--TEST--
2syntax check
3--SKIPIF--
4<?php include "skipif.inc"; ?>
5--FILE--
6<?php
7
8$php = getenv('TEST_PHP_EXECUTABLE_ESCAPED');
9
10$filename = __DIR__."/011.test.php";
11$filename_escaped = escapeshellarg($filename);
12
13$code = '
14<?php
15
16$test = "var";
17
18class test {
19    private $var;
20}
21
22echo test::$var;
23
24?>
25';
26
27file_put_contents($filename, $code);
28
29var_dump(`$php -n -l $filename_escaped`);
30var_dump(`$php -n -l some.unknown`);
31
32$code = '
33<?php
34
35class test
36    private $var;
37}
38
39?>
40';
41
42file_put_contents($filename, $code);
43
44var_dump(`$php -n -l $filename_escaped`);
45
46@unlink($filename);
47
48echo "Done\n";
49?>
50--EXPECTF--
51string(%d) "No syntax errors detected in %s011.test.php
52"
53Could not open input file: some.unknown
54NULL
55string(%d) "
56Parse error: %s expecting %s{%s in %s on line %d
57Errors parsing %s011.test.php
58"
59Done
60