Annotation of embedaddon/php/ext/standard/tests/array/array_shift_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test array_shift() function : error conditions - Pass incorrect number of args
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : mixed array_shift(array &$stack)
                      6:  * Description: Pops an element off the beginning of the array 
                      7:  * Source code: ext/standard/array.c 
                      8:  */
                      9: 
                     10: /*
                     11:  * Pass incorrect number of arguments to array_shift() to test behaviour
                     12:  */
                     13: 
                     14: echo "*** Testing array_shift() : error conditions ***\n";
                     15: 
                     16: // Zero arguments
                     17: echo "\n-- Testing array_shift() function with Zero arguments --\n";
                     18: var_dump( array_shift() );
                     19: 
                     20: //Test array_shift with one more than the expected number of arguments
                     21: echo "\n-- Testing array_shift() function with more than expected no. of arguments --\n";
                     22: $stack = array(1, 2);
                     23: $extra_arg = 10;
                     24: var_dump( array_shift($stack, $extra_arg) );
                     25: 
                     26: echo "Done";
                     27: ?>
                     28: --EXPECTF--
                     29: *** Testing array_shift() : error conditions ***
                     30: 
                     31: -- Testing array_shift() function with Zero arguments --
                     32: 
                     33: Warning: array_shift() expects exactly 1 parameter, 0 given in %s on line %d
                     34: NULL
                     35: 
                     36: -- Testing array_shift() function with more than expected no. of arguments --
                     37: 
                     38: Warning: array_shift() expects exactly 1 parameter, 2 given in %s on line %d
                     39: NULL
                     40: Done

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