tony2001 Thu Jun 28 14:51:35 2007 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array array_change_key_case_errors.phpt
array_change_key_case_variation.phpt
Modified files:
/php-src/ext/standard/tests/array array_change_key_case.phpt
Log:
MFH
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_change_key_case.phpt?r1=1.2.6.1&r2=1.2.6.2&diff_format=u
Index: php-src/ext/standard/tests/array/array_change_key_case.phpt
diff -u php-src/ext/standard/tests/array/array_change_key_case.phpt:1.2.6.1
php-src/ext/standard/tests/array/array_change_key_case.phpt:1.2.6.2
--- php-src/ext/standard/tests/array/array_change_key_case.phpt:1.2.6.1 Sat May
12 09:53:30 2007
+++ php-src/ext/standard/tests/array/array_change_key_case.phpt Thu Jun 28
14:51:35 2007
@@ -58,30 +58,6 @@
echo "\n";
}
-echo "\n*** Testing possible variations ***\n";
-$int_var = -19;
-$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
-
-/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
-var_dump(array_change_key_case($item, "CASE_UPPER"));
-var_dump(array_change_key_case($item, 5));
-
-/* when keys are different in terms of only case */
-/* should return one value key pair with key being in lowercase */
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) )
);
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5),
"CASE_UPPER" ) );
-
-/* should return one value key pair with key being in uppercase */
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3),
CASE_UPPER ) );
-var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5
) );
-
-echo "\n*** Testing error conditions ***\n";
-/* generate different failure conditions */
-var_dump( array_change_key_case($int_var) ); // args less than expected
-var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first
argument
-var_dump( array_change_key_case() ); // Zero argument
-var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more
than expected numbers
-
echo "end\n";
?>
--EXPECTF--
@@ -838,56 +814,4 @@
string(4) "four"
}
-
-*** Testing possible variations ***
-array(4) {
- ["one"]=>
- int(1)
- ["two"]=>
- int(2)
- ["three"]=>
- int(3)
- ["four"]=>
- string(4) "four"
-}
-array(4) {
- ["ONE"]=>
- int(1)
- ["TWO"]=>
- int(2)
- ["THREE"]=>
- int(3)
- ["FOUR"]=>
- string(4) "four"
-}
-array(1) {
- ["one"]=>
- int(4)
-}
-array(1) {
- ["one"]=>
- int(5)
-}
-array(1) {
- ["ONE"]=>
- int(3)
-}
-array(1) {
- ["ONE"]=>
- int(2)
-}
-
-*** Testing error conditions ***
-
-Warning: array_change_key_case(): The argument should be an array in %s on
line %d
-bool(false)
-
-Warning: array_change_key_case(): The argument should be an array in %s on
line %d
-bool(false)
-
-Warning: Wrong parameter count for array_change_key_case() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for array_change_key_case() in %s on line %d
-NULL
end
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_change_key_case_errors.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_change_key_case_errors.phpt
+++ php-src/ext/standard/tests/array/array_change_key_case_errors.phpt
--TEST--
Test array_change_key_case() function - 3
--FILE--
<?php
/* generate different failure conditions */
$int_var = -19;
$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
var_dump( array_change_key_case($int_var) ); // args less than expected
var_dump( array_change_key_case($int_var, CASE_UPPER) ); // invalid first
argument
var_dump( array_change_key_case() ); // Zero argument
var_dump( array_change_key_case($item, $item["one"], "CASE_UPPER") ); // more
than expected numbers
echo "end\n";
?>
--EXPECTF--
Warning: array_change_key_case() expects parameter 1 to be array, integer given
in %s on line %d
NULL
Warning: array_change_key_case() expects parameter 1 to be array, integer given
in %s on line %d
NULL
Warning: array_change_key_case() expects at least 1 parameter, 0 given in %s on
line %d
NULL
Warning: array_change_key_case() expects at most 2 parameters, 3 given in %s on
line %d
NULL
end
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_change_key_case_variation.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_change_key_case_variation.phpt
+++ php-src/ext/standard/tests/array/array_change_key_case_variation.phpt
--TEST--
Test array_change_key_case() function - 2
--FILE--
<?php
$item = array ("one" => 1, "two" => 2, "THREE" => 3, "FOUR" => "four");
/* use 'case' argument other than CASE_LOWER & CASE_UPPER */
var_dump(array_change_key_case($item, "CASE_UPPER"));
var_dump(array_change_key_case($item, 5));
/* when keys are different in terms of only case */
/* should return one value key pair with key being in lowercase */
var_dump( array_change_key_case( array("ONE" => 1, "one" => 3, "One" => 4) ) );
var_dump( array_change_key_case( array("ONE" => 1, "one" => 6, "One" => 5),
"CASE_UPPER" ) );
/* should return one value key pair with key being in uppercase */
var_dump( array_change_key_case( array("ONE" => 1, "one" => 2, "One" => 3),
CASE_UPPER ) );
var_dump( array_change_key_case( array("ONE" => 1, "one" => 1, "One" => 2), 5 )
);
echo "end\n";
?>
--EXPECTF--
Warning: array_change_key_case() expects parameter 2 to be long, string given
in %s on line %d
NULL
array(4) {
["ONE"]=>
int(1)
["TWO"]=>
int(2)
["THREE"]=>
int(3)
["FOUR"]=>
string(4) "four"
}
array(1) {
["one"]=>
int(4)
}
Warning: array_change_key_case() expects parameter 2 to be long, string given
in %s on line %d
NULL
array(1) {
["ONE"]=>
int(3)
}
array(1) {
["ONE"]=>
int(2)
}
end
--UEXPECTF--
Warning: array_change_key_case() expects parameter 2 to be long, Unicode string
given in %s on line %d
NULL
array(4) {
[u"ONE"]=>
int(1)
[u"TWO"]=>
int(2)
[u"THREE"]=>
int(3)
[u"FOUR"]=>
unicode(4) "four"
}
array(1) {
[u"one"]=>
int(4)
}
Warning: array_change_key_case() expects parameter 2 to be long, Unicode string
given in %s on line %d
NULL
array(1) {
[u"ONE"]=>
int(3)
}
array(1) {
[u"ONE"]=>
int(2)
}
end
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php