Annotation of embedaddon/php/ext/tokenizer/tests/token_get_all_error.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test token_get_all() function : error conditions 
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: echo "*** Testing token_get_all() : error conditions ***\n";
                     13: 
                     14: // with zero arguments
                     15: echo "\n-- Testing token_get_all() function with zero arguments --\n";
                     16: var_dump( token_get_all());
                     17: 
                     18: // with one more than the expected number of arguments
                     19: echo "-- Testing token_get_all() function with more than expected no. of arguments --\n";
                     20: $source = '<?php ?>';
                     21: $extra_arg = 10;
                     22: var_dump( token_get_all($source, $extra_arg));
                     23: 
                     24: echo "Done"
                     25: ?>
                     26: --EXPECTF--
                     27: *** Testing token_get_all() : error conditions ***
                     28: 
                     29: -- Testing token_get_all() function with zero arguments --
                     30: 
                     31: Warning: token_get_all() expects exactly 1 parameter, 0 given in %s on line %d
                     32: NULL
                     33: -- Testing token_get_all() function with more than expected no. of arguments --
                     34: 
                     35: Warning: token_get_all() expects exactly 1 parameter, 2 given in %s on line %d
                     36: NULL
                     37: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>