Annotation of embedaddon/php/ext/standard/tests/array/array_rand_error.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test array_rand() function : error conditions 
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : mixed array_rand(array input [, int num_req])
        !             6:  * Description: Return key/keys for random entry/entries in the array 
        !             7:  * Source code: ext/standard/array.c
        !             8: */
        !             9: 
        !            10: echo "*** Testing array_rand() : error conditions ***\n";
        !            11: 
        !            12: // Zero arguments
        !            13: echo "\n-- Testing array_rand() function with Zero arguments --\n";
        !            14: var_dump( array_rand() );
        !            15: 
        !            16: //Test array_rand with one more than the expected number of arguments
        !            17: echo "\n-- Testing array_rand() function with more than expected no. of arguments --\n";
        !            18: $input = array(1, 2);
        !            19: $num_req = 10;
        !            20: $extra_arg = 10;
        !            21: var_dump( array_rand($input,$num_req, $extra_arg) );
        !            22: 
        !            23: echo "Done";
        !            24: ?>
        !            25: --EXPECTF--
        !            26: *** Testing array_rand() : error conditions ***
        !            27: 
        !            28: -- Testing array_rand() function with Zero arguments --
        !            29: 
        !            30: Warning: array_rand() expects at least 1 parameter, 0 given in %s on line %d
        !            31: NULL
        !            32: 
        !            33: -- Testing array_rand() function with more than expected no. of arguments --
        !            34: 
        !            35: Warning: array_rand() expects at most 2 parameters, 3 given in %s on line %d
        !            36: NULL
        !            37: Done
        !            38: 

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