xref: /PHP-5.3/sapi/cgi/tests/003.phpt (revision a772d7c3)
1--TEST--
2strip comments and whitespace with -w
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9
10include "include.inc";
11
12$php = get_cgi_path();
13reset_env_vars();
14
15$filename = dirname(__FILE__).'/003.test.php';
16$code ='
17<?php
18/* some test script */
19
20class test { /* {{{ */
21	public $var = "test"; //test var
22#perl style comment
23	private $pri; /* private attr */
24
25	function foo(/* void */) {
26	}
27}
28/* }}} */
29
30?>
31';
32
33file_put_contents($filename, $code);
34
35var_dump(`$php -n -w "$filename"`);
36var_dump(`$php -n -w "wrong"`);
37var_dump(`echo "<?php /* comment */ class test {\n // comment \n function foo() {} } ?>" | $php -n -w`);
38
39@unlink($filename);
40
41echo "Done\n";
42?>
43--EXPECTF--
44string(%d) "X-Powered-By: PHP/%s
45Content-type: text/html%r; charset=.*|%r
46
47
48<?php
49 class test { public $var = "test"; private $pri; function foo() { } } ?>
50"
51string(%d) "Status: 404 Not Found
52X-Powered-By: PHP/%s
53Content-type: text/html%r; charset=.*|%r
54
55No input file specified.
56"
57string(%d) "X-Powered-By: PHP/%s
58Content-type: text/html%r; charset=.*|%r
59
60<?php  class test { function foo() {} } ?>
61"
62Done
63