Annotation of embedaddon/php/ext/tokenizer/tests/token_get_all_variation18.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test token_get_all() function : usage variations - with HTML code
1.1.1.2 ! misho 3: --SKIPIF--
! 4: <?php if (!extension_loaded("tokenizer")) print "skip"; ?>
1.1 misho 5: --FILE--
6: <?php
7: /* Prototype : array token_get_all(string $source)
8: * Description: splits the given source into an array of PHP languange tokens
9: * Source code: ext/tokenizer/tokenizer.c
10: */
11:
12: /*
13: * Testing token_get_all() with source string containing HTML code with PHP
14: * HTML tags are considered to be T_INLINE_HTML(311)
15: */
16:
17: echo "*** Testing token_get_all() : 'source' string with HTML tags ***\n";
18:
19: $source = '
20: <html>
21: <body>
22: Testing HTML
23: </body>
24: </html>"
25:
26: <?php
27: echo "php code with HTML";
28: ?>';
29: var_dump( token_get_all($source));
30:
31: echo "Done"
32: ?>
33: --EXPECTF--
34: *** Testing token_get_all() : 'source' string with HTML tags ***
35: array(9) {
36: [0]=>
37: array(3) {
38: [0]=>
1.1.1.2 ! misho 39: int(%d)
1.1 misho 40: [1]=>
41: string(48) "
42: <html>
43: <body>
44: Testing HTML
45: </body>
46: </html>"
47:
48: "
49: [2]=>
50: int(1)
51: }
52: [1]=>
53: array(3) {
54: [0]=>
1.1.1.2 ! misho 55: int(%d)
1.1 misho 56: [1]=>
57: string(6) "<?php "
58: [2]=>
59: int(8)
60: }
61: [2]=>
62: array(3) {
63: [0]=>
1.1.1.2 ! misho 64: int(%d)
1.1 misho 65: [1]=>
66: string(3) "
67: "
68: [2]=>
69: int(8)
70: }
71: [3]=>
72: array(3) {
73: [0]=>
1.1.1.2 ! misho 74: int(%d)
1.1 misho 75: [1]=>
76: string(4) "echo"
77: [2]=>
78: int(9)
79: }
80: [4]=>
81: array(3) {
82: [0]=>
1.1.1.2 ! misho 83: int(%d)
1.1 misho 84: [1]=>
85: string(1) " "
86: [2]=>
87: int(9)
88: }
89: [5]=>
90: array(3) {
91: [0]=>
1.1.1.2 ! misho 92: int(%d)
1.1 misho 93: [1]=>
94: string(20) ""php code with HTML""
95: [2]=>
96: int(9)
97: }
98: [6]=>
99: string(1) ";"
100: [7]=>
101: array(3) {
102: [0]=>
1.1.1.2 ! misho 103: int(%d)
1.1 misho 104: [1]=>
105: string(1) "
106: "
107: [2]=>
108: int(9)
109: }
110: [8]=>
111: array(3) {
112: [0]=>
1.1.1.2 ! misho 113: int(%d)
1.1 misho 114: [1]=>
115: string(2) "?>"
116: [2]=>
117: int(10)
118: }
119: }
120: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>