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