Annotation of embedaddon/php/ext/standard/tests/strings/highlight_file.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: highlight_file() tests
3: --INI--
4: highlight.string=#DD0000
5: highlight.comment=#FF9900
6: highlight.keyword=#007700
7: highlight.default=#0000BB
8: highlight.html=#000000
9: allow_url_include=1
10: allow_url_fopen=1
11: --FILE--
12: <?php
13:
14: $filename = dirname(__FILE__)."/highlight_file.dat";
15:
16: var_dump(highlight_file());
17: var_dump(highlight_file($filename));
18:
19: var_dump(highlight_file('data:,<?php echo "test"; ?>'));
20:
21: var_dump(highlight_file('data:,<?php echo "test ?>'));
22:
23: $data = '
24: <?php
25: class test {
26: public $var = 1;
27: private function foo() { echo "foo"; }
28: public function bar() { var_dump(test::foo()); }
29: }
30: ?>';
31:
32: file_put_contents($filename, $data);
33: var_dump(highlight_file($filename));
34:
35:
36: @unlink($filename);
37: echo "Done\n";
38: ?>
39: --EXPECTF--
40: Warning: highlight_file() expects at least 1 parameter, 0 given in %s on line %d
41: bool(false)
42:
43: Warning: highlight_file(%shighlight_file.dat): failed to open stream: No such file or directory in %s on line %d
44:
45: Warning: highlight_file(): Failed opening '%shighlight_file.dat' for highlighting in %s on line %d
46: bool(false)
47: <code><span style="color: #000000">
48: <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test"</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span>
49: </span>
50: </code>bool(true)
51: <code><span style="color: #000000">
52: <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"test ?></span>
53: </span>
54: </code>bool(true)
55: <code><span style="color: #000000">
56: <br /><span style="color: #0000BB"><?php <br /> </span><span style="color: #007700">class </span><span style="color: #0000BB">test </span><span style="color: #007700">{ <br /> public </span><span style="color: #0000BB">$var </span><span style="color: #007700">= </span><span style="color: #0000BB">1</span><span style="color: #007700">; <br /> private function </span><span style="color: #0000BB">foo</span><span style="color: #007700">() { echo </span><span style="color: #DD0000">"foo"</span><span style="color: #007700">; }<br /> public function </span><span style="color: #0000BB">bar</span><span style="color: #007700">() { </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">test</span><span style="color: #007700">::</span><span style="color: #0000BB">foo</span><span style="color: #007700">()); }<br /> } <br /></span><span style="color: #0000BB">?></span>
57: </span>
58: </code>bool(true)
59: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>