smantoorThu Sep 11 10:48:12 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/array
array_intersect_key_variation8.phpt
array_intersect_key_error.phpt
array_intersect_key_variation1.phpt
array_intersect_key_variation2.phpt
array_intersect_key_variation3.phpt
array_intersect_key_variation4.phpt
array_intersect_key_variation5.phpt
array_intersect_key_variation6.phpt
array_intersect_key_variation7.phpt
Log:
New testcases for array_intersect_key() function
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_key_variation8.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_key_variation8.phpt
+++ php-src/ext/standard/tests/array/array_intersect_key_variation8.phpt
--TEST--
Test array_intersect_key() function : usage variation - Passing Multi
dimensional array
--FILE--
?php
/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
* Description: Returns the entries of arr1 that have keys which are present in
all the other arguments.
* Source code: ext/standard/array.c
*/
echo *** Testing array_intersect_key() : usage variation ***\n;
/// Initialise function arguments not being substituted (if any)
$array1 = array(
'first' = array('blue' = 1, 'red' = 2),
'second' = array('yellow' = 7),
'third' = array(0 ='zero'),
);
$array2 = array (
'first' = array('blue' = 1, 'red' = 2,),
'second' = array('cyan' = 8),
'fourth' = array(2 = 'two'),
);
var_dump( array_intersect_key($array1, $array2) );
var_dump( array_intersect_key($array2,$array1 ) );
?
===DONE===
--EXPECTF--
*** Testing array_intersect_key() : usage variation ***
array(2) {
[ufirst]=
array(2) {
[ublue]=
int(1)
[ured]=
int(2)
}
[usecond]=
array(1) {
[uyellow]=
int(7)
}
}
array(2) {
[ufirst]=
array(2) {
[ublue]=
int(1)
[ured]=
int(2)
}
[usecond]=
array(1) {
[ucyan]=
int(8)
}
}
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_key_error.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_key_error.phpt
+++ php-src/ext/standard/tests/array/array_intersect_key_error.phpt
--TEST--
Test array_intersect_key() function : error conditions
--FILE--
?php
/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
* Description: Returns the entries of arr1 that have keys which are present in
all the other arguments.
* Source code: ext/standard/array.c
*/
echo *** Testing array_intersect_key() : error conditions ***\n;
//Initialise function arguments
$array1 = array('blue' = 1, 'red' = 2, 'green' = 3, 'purple' = 4);
// Testing array_intersect_key with one less than the expected number of
arguments
echo \n-- Testing array_intersect_key() function with less than expected no.
of arguments --\n;
var_dump( array_intersect_key($array1) );
// Testing array_intersect_key with one less than the expected number of
arguments
echo \n-- Testing array_intersect_key() function with no arguments --\n;
var_dump( array_intersect_key() );
?
===DONE===
--EXPECTF--
*** Testing array_intersect_key() : error conditions ***
-- Testing array_intersect_key() function with less than expected no. of
arguments --
Warning: array_intersect_key(): at least 2 parameters are required, 1 given in
%s on line %d
NULL
-- Testing array_intersect_key() function with no arguments --
Warning: array_intersect_key(): at least 2 parameters are required, 0 given in
%s on line %d
NULL
===DONE===
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_intersect_key_variation1.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/array_intersect_key_variation1.phpt
+++ php-src/ext/standard/tests/array/array_intersect_key_variation1.phpt
--TEST--
Test array_intersect_key() function : usage variation - Passing unexpected
values to first argument
--FILE--
?php
/* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
* Description: Returns the entries of arr1 that have keys which are present in
all the other arguments.
* Source code: ext/standard/array.c
*/
echo *** Testing array_intersect_key() : usage variation ***\n;
// Initialise function arguments not being substituted (if any)
$array2 = array('blue' = 1, 'red' = 2, 'green' = 3, 'purple' = 4);
$array3 = array('green' = 5, 'blue' = 6, 'yellow' = 7, 'cyan' = 8);
//get an unset variable
$unset_var = 10;
unset