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

1.1       misho       1: --TEST--
                      2: Test array_fill_keys() function : variation of parameter 
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : proto array array_fill_keys(array keys, mixed val)
                      6:  * Description: Create an array using the elements of the first parameter as keys each initialized to val 
                      7:  * Source code: ext/standard/array.c
                      8:  * Alias to functions: 
                      9:  */
                     10: 
                     11: /* Testing with unexpected argument types */
                     12: 
                     13: echo "*** Testing array_fill_keys() : parameter variations ***\n";
                     14: 
                     15: $simpleStr = "simple";
                     16: $fp = fopen(__FILE__, "r");
                     17: $bool = false;
                     18: $float = 2.4;
                     19: $array = array("one", "two");
                     20: $nullVal = null;
                     21: 
                     22: echo "\n-- Testing array_fill_keys() function with both wrong arguments --\n";
                     23: var_dump( array_fill_keys($bool, $float) );
                     24: 
                     25: echo "\n-- Testing array_fill_keys() function with unusual second arguments --\n";
                     26: var_dump( array_fill_keys($array, $fp) );
                     27: 
                     28: echo "\n-- Testing array_fill_keys() function with mixed array --\n";
                     29: var_dump( array_fill_keys($nullVal, $simpleStr) );
                     30: 
                     31: fclose($fp);
                     32: echo "Done";
                     33: ?>
                     34: --EXPECTF--
                     35: *** Testing array_fill_keys() : parameter variations ***
                     36: 
                     37: -- Testing array_fill_keys() function with both wrong arguments --
                     38: 
                     39: Warning: array_fill_keys() expects parameter 1 to be array, boolean given in %sarray_fill_keys_variation3.php on line %d
                     40: NULL
                     41: 
                     42: -- Testing array_fill_keys() function with unusual second arguments --
                     43: array(2) {
                     44:   ["one"]=>
                     45:   resource(%d) of type (stream)
                     46:   ["two"]=>
                     47:   resource(%d) of type (stream)
                     48: }
                     49: 
                     50: -- Testing array_fill_keys() function with mixed array --
                     51: 
                     52: Warning: array_fill_keys() expects parameter 1 to be array, null given in %sarray_fill_keys_variation3.php on line %d
                     53: NULL
                     54: Done

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