diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/array_combine_error2.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/array_combine_error2.phpt')
-rw-r--r-- | ext/standard/tests/array/array_combine_error2.phpt | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_combine_error2.phpt b/ext/standard/tests/array/array_combine_error2.phpt new file mode 100644 index 0000000..4224f1c --- /dev/null +++ b/ext/standard/tests/array/array_combine_error2.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test array_combine() function : error conditions - empty array +--FILE-- +<?php +/* Prototype : array array_combine(array $keys, array $values) + * Description: Creates an array by using the elements of the first parameter as keys + * and the elements of the second as the corresponding values + * Source code: ext/standard/array.c +*/ + +echo "*** Testing array_combine() : error conditions specific to array_combine() ***\n"; + +// Testing array_combine by passing empty arrays to $keys and $values arguments +echo "\n-- Testing array_combine() function with empty arrays --\n"; +var_dump( array_combine(array(), array()) ); + +// Testing array_combine by passing empty array to $keys +echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n"; +var_dump( array_combine(array(), array(1, 2)) ); + +// Testing array_combine by passing empty array to $values +echo "\n-- Testing array_combine() function with empty array for \$values argument --\n"; +var_dump( array_combine(array(1, 2), array()) ); + +// Testing array_combine with arrays having unequal number of elements +echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n"; +var_dump( array_combine(array(1, 2), array(1, 2, 3)) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing array_combine() : error conditions specific to array_combine() *** + +-- Testing array_combine() function with empty arrays -- +array(0) { +} + +-- Testing array_combine() function with empty array for $keys argument -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) + +-- Testing array_combine() function with empty array for $values argument -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) + +-- Testing array_combine() function by passing array with unequal number of elements -- + +Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d +bool(false) +Done |