From 97fffa7826713be27f3715863695b6128ebab5a3 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 24 Jan 2011 02:48:15 +0000 Subject: [PATCH] fix tests --- .../tests/DateTime_construct_variation2.phpt | 38 +++++++++++++--- ext/date/tests/date_create_variation2.phpt | 44 ++++++++++++++----- ext/date/tests/dateinterval_errors.phpt | 13 ------ ext/date/tests/gmstrftime_variation22.phpt | 14 +++--- ext/date/tests/strftime_variation22.phpt | 14 +++--- 5 files changed, 79 insertions(+), 44 deletions(-) delete mode 100644 ext/date/tests/dateinterval_errors.phpt diff --git a/ext/date/tests/DateTime_construct_variation2.phpt b/ext/date/tests/DateTime_construct_variation2.phpt index 5f754ecc02..b1d80f9002 100644 --- a/ext/date/tests/DateTime_construct_variation2.phpt +++ b/ext/date/tests/DateTime_construct_variation2.phpt @@ -114,7 +114,7 @@ fclose( $file_handle); ?> ===DONE=== ---EXPECT-- +--EXPECTF-- *** Testing new DateTime() : usage variation - unexpected values to second argument $timezone*** -- int 0 -- @@ -151,10 +151,24 @@ FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array gi FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given -- uppercase NULL -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, null given +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- lowercase null -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, null given +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- lowercase true -- FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, boolean given @@ -193,10 +207,24 @@ FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object g FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object given -- undefined var -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, null given +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- unset var -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, null given +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- resource -- FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, resource given diff --git a/ext/date/tests/date_create_variation2.phpt b/ext/date/tests/date_create_variation2.phpt index 25e5a2a352..c43ccb0699 100644 --- a/ext/date/tests/date_create_variation2.phpt +++ b/ext/date/tests/date_create_variation2.phpt @@ -166,14 +166,24 @@ Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s bool(false) -- uppercase NULL -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- lowercase null -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- lowercase true -- @@ -236,14 +246,24 @@ Warning: date_create() expects parameter 2 to be DateTimeZone, object given in % bool(false) -- undefined var -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- unset var -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) +object(DateTime)#%d (3) { + ["date"]=> + string(19) "2005-07-14 22:30:41" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} -- resource -- diff --git a/ext/date/tests/dateinterval_errors.phpt b/ext/date/tests/dateinterval_errors.phpt deleted file mode 100644 index 505484c0cc..0000000000 --- a/ext/date/tests/dateinterval_errors.phpt +++ /dev/null @@ -1,13 +0,0 @@ ---TEST-- -DateInterval: Getter and setter errors ---FILE-- -y = 1984; -var_dump($d->y); -var_dump($d->asdf, $d->y); -?> ---EXPECTF-- -int(1984) - -Fatal error: main(): Unknown property (asdf) in %sdateinterval_errors.php on line 5 diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt index 788433562e..c8f51fc895 100644 --- a/ext/date/tests/gmstrftime_variation22.phpt +++ b/ext/date/tests/gmstrftime_variation22.phpt @@ -35,24 +35,24 @@ $inputs = array( foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmstrftime($value) ); + var_dump( $value ); var_dump( gmstrftime($value, $timestamp) ); }; ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing gmstrftime() : usage variation *** --Preferred date and time representation-- -string(%d) "%s %d %s %d %d:%d:%d %s GMT" -string(31) "Fri 08 Aug 2008 08:08:08 AM GMT" +string(2) "%c" +string(24) "Fri Aug 8 08:08:08 2008" --Preferred date representation-- -string(%d) "%d/%d/%d" +string(2) "%x" string(10) "08/08/2008" --Preferred time representation-- -string(%d) "%d:%d:%d %s" -string(11) "08:08:08 AM" +string(2) "%X" +string(8) "08:08:08" ===DONE=== diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt index 4ce99339b6..bd672b417a 100644 --- a/ext/date/tests/strftime_variation22.phpt +++ b/ext/date/tests/strftime_variation22.phpt @@ -35,24 +35,24 @@ $inputs = array( foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); + var_dump( $value ); var_dump( strftime($value, $timestamp) ); } ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing strftime() : usage variation *** --Preferred date and time representation-- -string(%d) "%s %d %s %d %d:%d:%d %s %s" -string(31) "Fri 08 Aug 2008 08:08:08 AM IST" +string(2) "%c" +string(24) "Fri Aug 8 08:08:08 2008" --Preferred date representation-- -string(%d) "%d/%d/%d" +string(2) "%x" string(10) "08/08/2008" --Preferred time representation-- -string(%d) "%d:%d:%d %s" -string(11) "08:08:08 AM" +string(2) "%X" +string(8) "08:08:08" ===DONE=== -- 2.50.1