From e6b238275fb3aae2386dd3a149fb44afac00a707 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Fri, 24 Apr 2009 17:13:49 +0000 Subject: [PATCH] Fix tests (mostly MFB) --- .../tests/array/array_filter_variation9.phpt | 6 +- .../tests/array/array_key_exists.phpt | 26 ++---- .../tests/array/array_key_exists_object1.phpt | 38 ++++----- .../tests/array/array_key_exists_object2.phpt | 38 ++++----- .../array/array_key_exists_variation2.phpt | 4 +- .../tests/array/array_push_error2.phpt | 12 +-- .../tests/array/array_unique_error.phpt | 6 +- .../tests/array/array_unique_variation2.phpt | 80 +++++++++---------- .../tests/array/array_unique_variation6.phpt | 6 +- .../tests/array/array_walk_object1.phpt | 14 +++- .../tests/array/array_walk_objects.phpt | 17 ++-- .../tests/array/array_walk_rec_objects.phpt | 17 ++-- .../array/array_walk_recursive_object1.phpt | 14 +++- ext/standard/tests/array/bug44929.phpt | 2 +- 14 files changed, 144 insertions(+), 136 deletions(-) diff --git a/ext/standard/tests/array/array_filter_variation9.phpt b/ext/standard/tests/array/array_filter_variation9.phpt index d0ac77d653..480f4df2ab 100644 --- a/ext/standard/tests/array/array_filter_variation9.phpt +++ b/ext/standard/tests/array/array_filter_variation9.phpt @@ -45,7 +45,9 @@ array(6) { [5]=> int(1000) } -array(8) { + +Warning: chr() expects parameter 1 to be long, Unicode string given in %s +array(7) { [0]=> int(0) [1]=> @@ -58,8 +60,6 @@ array(8) { int(100) [5]=> int(1000) - [6]=> - unicode(5) "Hello" [7]=> NULL } diff --git a/ext/standard/tests/array/array_key_exists.phpt b/ext/standard/tests/array/array_key_exists.phpt index d777058481..c1d7fe3727 100644 --- a/ext/standard/tests/array/array_key_exists.phpt +++ b/ext/standard/tests/array/array_key_exists.phpt @@ -118,7 +118,7 @@ var_dump(array_key_exists("var", $key_check_obj->arr)); //found, key is in memb var_dump( array_key_exists($key_check_obj, $key_check_obj) ); echo "Done\n"; ?> ---EXPECTF-- +--EXPECTF-- *** Testing basic functionalities *** -- Iteration 1 -- bool(true) @@ -280,23 +280,13 @@ Warning: array_key_exists(): The first argument should be either a string or an bool(false) *** Testing operation on objects *** - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(false) +bool(false) +bool(true) +bool(false) +bool(true) bool(true) -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +Warning: array_key_exists(): The first argument should be either a string or an integer in %s on line %d +bool(false) Done diff --git a/ext/standard/tests/array/array_key_exists_object1.phpt b/ext/standard/tests/array/array_key_exists_object1.phpt index 4e6c2db4af..4ffafc4539 100644 --- a/ext/standard/tests/array/array_key_exists_object1.phpt +++ b/ext/standard/tests/array/array_key_exists_object1.phpt @@ -52,35 +52,29 @@ echo "Done"; -- Do not assign a value to $class1->var3 -- $key = var1: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(true) $key = var3: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(true) $class1: -object(myClass)#%d (3) { - [u"var1"]=> - unicode(1) "a" - [u"var2"]=> - unicode(1) "b" - [u"var3"]=> +object(myClass)#1 (3) { + [%b|u%"var1"]=> + %unicode|string%(1) "a" + [%b|u%"var2"]=> + %unicode|string%(1) "b" + [%b|u%"var3"]=> NULL } -- Assign a value to $class2->var3 -- $key = var3: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(true) $class2: -object(myClass)#%d (3) { - [u"var1"]=> - unicode(1) "x" - [u"var2"]=> - unicode(1) "y" - [u"var3"]=> - unicode(1) "z" +object(myClass)#2 (3) { + [%b|u%"var1"]=> + %unicode|string%(1) "x" + [%b|u%"var2"]=> + %unicode|string%(1) "y" + [%b|u%"var3"]=> + %unicode|string%(1) "z" } Done diff --git a/ext/standard/tests/array/array_key_exists_object2.phpt b/ext/standard/tests/array/array_key_exists_object2.phpt index 44aaee3670..39bb129e39 100644 --- a/ext/standard/tests/array/array_key_exists_object2.phpt +++ b/ext/standard/tests/array/array_key_exists_object2.phpt @@ -54,39 +54,31 @@ echo "Done"; -- Do not assign a value to $class1->var3 -- $key = var1: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(true) $key = var2: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(false) $key = var3: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(false) $class1: object(myClass)#1 (3) { - [u"var1"]=> - unicode(1) "a" - [u"var2":protected]=> - unicode(1) "b" - [u"var3":u"myClass":private]=> + [%b|u%"var1"]=> + %unicode|string%(1) "a" + [%b|u%"var2":protected]=> + %unicode|string%(1) "b" + [%b|u%"var3":%b|u%"myClass":private]=> NULL } -- Assign a value to $class2->var3 -- $key = var3: - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(false) $class2: object(myClass)#2 (3) { - [u"var1"]=> - unicode(1) "x" - [u"var2":protected]=> - unicode(1) "y" - [u"var3":u"myClass":private]=> - unicode(1) "z" + [%b|u%"var1"]=> + %unicode|string%(1) "x" + [%b|u%"var2":protected]=> + %unicode|string%(1) "y" + [%b|u%"var3":%b|u%"myClass":private]=> + %unicode|string%(1) "z" } Done diff --git a/ext/standard/tests/array/array_key_exists_variation2.phpt b/ext/standard/tests/array/array_key_exists_variation2.phpt index 1fc9a3d110..f736356e49 100644 --- a/ext/standard/tests/array/array_key_exists_variation2.phpt +++ b/ext/standard/tests/array/array_key_exists_variation2.phpt @@ -206,9 +206,7 @@ Warning: array_key_exists() expects parameter 2 to be array, Unicode string give NULL -- Iteration 22 -- - -Warning: array_key_exists() expects parameter 2 to be array, object given in %s on line %d -NULL +bool(false) -- Iteration 23 -- diff --git a/ext/standard/tests/array/array_push_error2.phpt b/ext/standard/tests/array/array_push_error2.phpt index 528bedc34b..4e0aad0848 100644 --- a/ext/standard/tests/array/array_push_error2.phpt +++ b/ext/standard/tests/array/array_push_error2.phpt @@ -28,22 +28,22 @@ echo "Done"; *** Testing array_push() : error conditions *** int(3) array(3) { - [-2147483647]=> + [-%d]=> unicode(3) "min" - [2147483647]=> + [%d]=> unicode(3) "max" - [-2147483648]=> + [-%d]=> unicode(3) "new" } Warning: array_push(): Cannot add element to the array as the next element is already occupied in %s on line %d bool(false) array(3) { - [-2147483647]=> + [-%d]=> unicode(3) "min" - [2147483647]=> + [%d]=> unicode(3) "max" - [-2147483648]=> + [-%d]=> unicode(3) "new" } Done diff --git a/ext/standard/tests/array/array_unique_error.phpt b/ext/standard/tests/array/array_unique_error.phpt index 05c10ac765..9da3dfcad6 100644 --- a/ext/standard/tests/array/array_unique_error.phpt +++ b/ext/standard/tests/array/array_unique_error.phpt @@ -17,7 +17,7 @@ var_dump( array_unique() ); echo "\n-- Testing array_unique() function with more than expected no. of arguments --\n"; $input = array(1, 2); $extra_arg = 10; -var_dump( array_unique($input, $extra_arg) ); +var_dump( array_unique($input, SORT_NUMERIC, $extra_arg) ); echo "Done"; ?> @@ -26,11 +26,11 @@ echo "Done"; -- Testing array_unique() function with zero arguments -- -Warning: array_unique() expects exactly 1 parameter, 0 given in %s on line %d +Warning: array_unique() expects at least 1 parameter, 0 given in %s on line %d NULL -- Testing array_unique() function with more than expected no. of arguments -- -Warning: array_unique() expects exactly 1 parameter, 2 given in %s on line %d +Warning: array_unique() expects at most 2 parameters, 3 given in %s on line %d NULL Done diff --git a/ext/standard/tests/array/array_unique_variation2.phpt b/ext/standard/tests/array/array_unique_variation2.phpt index e5fc798291..6e375f2494 100644 --- a/ext/standard/tests/array/array_unique_variation2.phpt +++ b/ext/standard/tests/array/array_unique_variation2.phpt @@ -74,13 +74,13 @@ $inputs = array ( $iterator = 1; foreach($inputs as $input) { echo "-- Iteration $iterator --\n"; - var_dump( array_unique($input) ); + var_dump( array_unique($input, SORT_STRING) ); $iterator++; } echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing array_unique() : Passing different arrays to $input argument *** -- Iteration 1 -- array(2) { @@ -114,38 +114,38 @@ array(1) { -- Iteration 6 -- array(4) { [0]=> - unicode(3) "a " + %unicode|string%(3) "a " [1]=> - unicode(5) "aaaa + %unicode|string%(5) "aaaa " [2]=> - unicode(1) "b" + %unicode|string%(1) "b" [4]=> - unicode(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" + %unicode|string%(27) "\[\]\!\@\#$\%\^\&\*\(\)\{\}" } -- Iteration 7 -- array(4) { [0]=> - unicode(5) "a\v\f" + %unicode|string%(5) "a\v\f" [1]=> - unicode(6) "aaaa\r" + %unicode|string%(6) "aaaa\r" [2]=> - unicode(1) "b" + %unicode|string%(1) "b" [4]=> - unicode(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" + %unicode|string%(28) "\[\]\!\@\#\$\%\^\&\*\(\)\{\}" } -- Iteration 8 -- array(3) { - [u"h1"]=> - unicode(1) " + [%b|u%"h1"]=> + %unicode|string%(1) " " - [u"h2"]=> - unicode(88) "hello world + [%b|u%"h2"]=> + %unicode|string%(88) "hello world The quick brown fox jumped over; the lazy dog This is a double quoted string" - [u"h3"]=> - unicode(88) "hello + [%b|u%"h3"]=> + %unicode|string%(88) "hello world 1111 != 2222 heredoc @@ -154,15 +154,15 @@ double quoted string. with different white spaces" -- Iteration 9 -- array(2) { [1]=> - unicode(3) "one" + %unicode|string%(3) "one" [2]=> - unicode(3) "two" + %unicode|string%(3) "two" } -- Iteration 10 -- array(2) { - [u"one"]=> + [%b|u%"one"]=> int(1) - [u"two"]=> + [%b|u%"two"]=> int(2) } -- Iteration 11 -- @@ -176,55 +176,55 @@ array(3) { } -- Iteration 12 -- array(2) { - [u"one"]=> - unicode(3) "ten" - [u"two"]=> - unicode(6) "twenty" + [%b|u%"one"]=> + %unicode|string%(3) "ten" + [%b|u%"two"]=> + %unicode|string%(6) "twenty" } -- Iteration 13 -- array(3) { - [u"one"]=> + [%b|u%"one"]=> int(1) [2]=> - unicode(3) "two" + %unicode|string%(3) "two" [4]=> - unicode(4) "four" + %unicode|string%(4) "four" } -- Iteration 14 -- array(2) { - [u""]=> - unicode(4) "null" - [u"NULL"]=> + [%b|u%""]=> + %unicode|string%(4) "null" + [%b|u%"NULL"]=> NULL } -- Iteration 15 -- array(4) { [1]=> - unicode(4) "true" + %unicode|string%(4) "true" [0]=> - unicode(5) "false" - [u"false"]=> + %unicode|string%(5) "false" + [%b|u%"false"]=> bool(false) - [u"true"]=> + [%b|u%"true"]=> bool(true) } -- Iteration 16 -- array(2) { - [u""]=> - unicode(6) "emptys" - [u"emptyd"]=> - unicode(0) "" + [%b|u%""]=> + %unicode|string%(6) "emptys" + [%b|u%"emptyd"]=> + %unicode|string%(0) "" } -- Iteration 17 -- array(2) { [1]=> - unicode(0) "" + %unicode|string%(0) "" [6]=> bool(true) } -- Iteration 18 -- array(3) { - [u""]=> + [%b|u%""]=> int(4) [0]=> int(5) diff --git a/ext/standard/tests/array/array_unique_variation6.phpt b/ext/standard/tests/array/array_unique_variation6.phpt index 1bd1ad159a..82442bdfad 100644 --- a/ext/standard/tests/array/array_unique_variation6.phpt +++ b/ext/standard/tests/array/array_unique_variation6.phpt @@ -29,16 +29,16 @@ $input = array( 5 => $value4 ); -var_dump( array_unique($input) ); +var_dump( array_unique($input, SORT_STRING) ); echo "Done"; ?> ---EXPECT-- +--EXPECTF-- *** Testing array_unique() : array with reference variables for $input argument *** array(2) { [0]=> int(0) [1]=> - &unicode(5) "hello" + &%unicode|string%(5) "hello" } Done diff --git a/ext/standard/tests/array/array_walk_object1.phpt b/ext/standard/tests/array/array_walk_object1.phpt index f6cbce018f..342e760ce8 100644 --- a/ext/standard/tests/array/array_walk_object1.phpt +++ b/ext/standard/tests/array/array_walk_object1.phpt @@ -51,7 +51,17 @@ echo "Done" ?> --EXPECTF-- *** Testing array_walk() : object functionality *** +%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value" +int(10) +int(1) -Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d -NULL +%unicode|string%(9) "pub_value" +int(10) +int(1) + +%unicode|string%(12) "%r\0%r*%r\0%rpro_value" +int(10) +int(1) + +bool(true) Done diff --git a/ext/standard/tests/array/array_walk_objects.phpt b/ext/standard/tests/array/array_walk_objects.phpt index 9b7a8167de..506d1cafcf 100644 --- a/ext/standard/tests/array/array_walk_objects.phpt +++ b/ext/standard/tests/array/array_walk_objects.phpt @@ -29,9 +29,16 @@ array_walk($var, "walk"); echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d - -Warning: array_walk() expects parameter 1 to be array, object given in %s on line %d - -Warning: array_walk() expects parameter 1 to be array, Unicode string given in %s on line %d +%unicode|string%(3) "foo" +%unicode|string%(3) "foo" +%unicode|string%(3) "bar" +%unicode|string%(3) "bar" +%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri" +%unicode|string%(12) "test_private" +%unicode|string%(10) "%r\0%r*%r\0%rvar_pro" +%unicode|string%(14) "test_protected" +%unicode|string%(7) "var_pub" +%unicode|string%(11) "test_public" + +Warning: array_walk() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d Done diff --git a/ext/standard/tests/array/array_walk_rec_objects.phpt b/ext/standard/tests/array/array_walk_rec_objects.phpt index 9e608c1e4c..bbd30f37f0 100644 --- a/ext/standard/tests/array/array_walk_rec_objects.phpt +++ b/ext/standard/tests/array/array_walk_rec_objects.phpt @@ -29,9 +29,16 @@ array_walk_recursive($var, "walk"); echo "Done\n"; ?> --EXPECTF-- -Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d - -Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d - -Warning: array_walk_recursive() expects parameter 1 to be array, Unicode string given in %s on line %d +%unicode|string%(3) "foo" +%unicode|string%(3) "foo" +%unicode|string%(3) "bar" +%unicode|string%(3) "bar" +%unicode|string%(13) "%r\0%rtest%r\0%rvar_pri" +%unicode|string%(12) "test_private" +%unicode|string%(10) "%r\0%r*%r\0%rvar_pro" +%unicode|string%(14) "test_protected" +%unicode|string%(7) "var_pub" +%unicode|string%(11) "test_public" + +Warning: array_walk_recursive() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d Done diff --git a/ext/standard/tests/array/array_walk_recursive_object1.phpt b/ext/standard/tests/array/array_walk_recursive_object1.phpt index 16a56d37d0..7ddced7766 100644 --- a/ext/standard/tests/array/array_walk_recursive_object1.phpt +++ b/ext/standard/tests/array/array_walk_recursive_object1.phpt @@ -49,7 +49,17 @@ echo "Done" ?> --EXPECTF-- *** Testing array_walk_recursive() : object functionality *** +%unicode|string%(18) "%r\0%rMyClass%r\0%rpri_value" +int(10) +int(1) -Warning: array_walk_recursive() expects parameter 1 to be array, object given in %s on line %d -NULL +%unicode|string%(9) "pub_value" +int(10) +int(1) + +%unicode|string%(12) "%r\0%r*%r\0%rpro_value" +int(10) +int(1) + +bool(true) Done diff --git a/ext/standard/tests/array/bug44929.phpt b/ext/standard/tests/array/bug44929.phpt index dd2b0db077..f82ecd0526 100644 --- a/ext/standard/tests/array/bug44929.phpt +++ b/ext/standard/tests/array/bug44929.phpt @@ -2,7 +2,7 @@ Bug #44929 (natsort doesn't handle leading zeros well) --FILE-- -- 2.40.0