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