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

1.1     ! misho       1: --TEST--
        !             2: Test array_fill() function : error conditions 
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : proto array array_fill(int start_key, int num, mixed val)
        !             6:  * Description: Create an array containing num elements starting with index start_key each initialized to val 
        !             7:  * Source code: ext/standard/array.c
        !             8: */
        !             9: 
        !            10: 
        !            11: echo "*** Testing array_fill() : error conditions ***\n";
        !            12: 
        !            13: // Zero arguments
        !            14: echo "-- Testing array_fill() function with Zero arguments --\n";
        !            15: var_dump( array_fill() );
        !            16: 
        !            17: // More than  expected number of arguments
        !            18: echo "-- Testing array_fill() function with more than expected no. of arguments --\n";
        !            19: $start_key = 0;
        !            20: $num = 2;
        !            21: $val = 1;
        !            22: $extra_arg = 10;
        !            23: var_dump( array_fill($start_key,$num,$val, $extra_arg) );
        !            24: 
        !            25: // Less than the expected number of arguments
        !            26: echo "-- Testing array_fill() function with less than expected no. of arguments --\n";
        !            27: $start_key = 0;
        !            28: $num = 2;
        !            29: var_dump( array_fill($start_key,$num) );
        !            30: 
        !            31: //calling array_fill with negative values for 'num' parameter
        !            32: $num = -1;
        !            33: var_dump( array_fill($start_key,$num,$val) );
        !            34: 
        !            35: //callin array_fill with 'num' equal to zero value
        !            36: $num = 0;
        !            37: var_dump( array_fill($start_key,$num,$val) );
        !            38: 
        !            39: echo "Done";
        !            40: ?>
        !            41: --EXPECTF--
        !            42: *** Testing array_fill() : error conditions ***
        !            43: -- Testing array_fill() function with Zero arguments --
        !            44: 
        !            45: Warning: array_fill() expects exactly 3 parameters, 0 given in %s on line %d
        !            46: NULL
        !            47: -- Testing array_fill() function with more than expected no. of arguments --
        !            48: 
        !            49: Warning: array_fill() expects exactly 3 parameters, 4 given in %s on line %d
        !            50: NULL
        !            51: -- Testing array_fill() function with less than expected no. of arguments --
        !            52: 
        !            53: Warning: array_fill() expects exactly 3 parameters, 2 given in %s on line %d
        !            54: NULL
        !            55: 
        !            56: Warning: array_fill(): Number of elements must be positive in %s on line %d
        !            57: bool(false)
        !            58: 
        !            59: Warning: array_fill(): Number of elements must be positive in %s on line %d
        !            60: bool(false)
        !            61: Done

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