Annotation of embedaddon/php/ext/tokenizer/tests/token_get_all_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test token_get_all() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : array token_get_all(string $source)
! 6: * Description : splits the given source into an array of PHP languange tokens
! 7: * Source code: ext/tokenizer/tokenizer.c
! 8: */
! 9:
! 10: echo "*** Testing token_get_all() : basic functionality ***\n";
! 11:
! 12: // with php open/close tags
! 13: $source = '<?php echo "Hello World"; ?>';
! 14: echo "-- source string with PHP open and close tags --\n";
! 15: var_dump( token_get_all($source) );
! 16:
! 17: // without php open/close tags testing for T_INLINE_HTML
! 18: $source = "echo 'Hello World';";
! 19: echo "-- source string without PHP open and close tags --\n";
! 20: var_dump( token_get_all($source) );
! 21:
! 22: echo "Done"
! 23: ?>
! 24: --EXPECTF--
! 25: *** Testing token_get_all() : basic functionality ***
! 26: -- source string with PHP open and close tags --
! 27: array(7) {
! 28: [0]=>
! 29: array(3) {
! 30: [0]=>
! 31: int(368)
! 32: [1]=>
! 33: string(6) "<?php "
! 34: [2]=>
! 35: int(1)
! 36: }
! 37: [1]=>
! 38: array(3) {
! 39: [0]=>
! 40: int(316)
! 41: [1]=>
! 42: string(4) "echo"
! 43: [2]=>
! 44: int(1)
! 45: }
! 46: [2]=>
! 47: array(3) {
! 48: [0]=>
! 49: int(371)
! 50: [1]=>
! 51: string(1) " "
! 52: [2]=>
! 53: int(1)
! 54: }
! 55: [3]=>
! 56: array(3) {
! 57: [0]=>
! 58: int(315)
! 59: [1]=>
! 60: string(13) ""Hello World""
! 61: [2]=>
! 62: int(1)
! 63: }
! 64: [4]=>
! 65: string(1) ";"
! 66: [5]=>
! 67: array(3) {
! 68: [0]=>
! 69: int(371)
! 70: [1]=>
! 71: string(1) " "
! 72: [2]=>
! 73: int(1)
! 74: }
! 75: [6]=>
! 76: array(3) {
! 77: [0]=>
! 78: int(370)
! 79: [1]=>
! 80: string(2) "?>"
! 81: [2]=>
! 82: int(1)
! 83: }
! 84: }
! 85: -- source string without PHP open and close tags --
! 86: array(1) {
! 87: [0]=>
! 88: array(3) {
! 89: [0]=>
! 90: int(311)
! 91: [1]=>
! 92: string(19) "echo 'Hello World';"
! 93: [2]=>
! 94: int(1)
! 95: }
! 96: }
! 97: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>