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

1.1     ! misho       1: --TEST--
        !             2: Test usort() function : error conditions - Pass incorrect number of arguments
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : bool usort(array $array_arg, string $cmp_function)
        !             6:  * Description: Sort an array by values using a user-defined comparison function 
        !             7:  * Source code: ext/standard/array.c
        !             8:  */
        !             9: 
        !            10: /*
        !            11:  * Pass incorrect number of arguments to usort() to test behaviour
        !            12:  */
        !            13: 
        !            14: echo "*** Testing usort() : error conditions ***\n";
        !            15: 
        !            16: //Test usort with one more than the expected number of arguments
        !            17: echo "\n-- Testing usort() function with more than expected no. of arguments --\n";
        !            18: $array_arg = array(1, 2);
        !            19: $cmp_function = 'string_val';
        !            20: $extra_arg = 10;
        !            21: var_dump( usort($array_arg, $cmp_function, $extra_arg) );
        !            22: 
        !            23: // Testing usort with one less than the expected number of arguments
        !            24: echo "\n-- Testing usort() function with less than expected no. of arguments --\n";
        !            25: $array_arg = array(1, 2);
        !            26: var_dump( usort($array_arg) );
        !            27: ?>
        !            28: ===DONE===
        !            29: --EXPECTF--
        !            30: *** Testing usort() : error conditions ***
        !            31: 
        !            32: -- Testing usort() function with more than expected no. of arguments --
        !            33: 
        !            34: Warning: usort() expects exactly 2 parameters, 3 given in %s on line %d
        !            35: NULL
        !            36: 
        !            37: -- Testing usort() function with less than expected no. of arguments --
        !            38: 
        !            39: Warning: usort() expects exactly 2 parameters, 1 given in %s on line %d
        !            40: NULL
        !            41: ===DONE===

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