diff options
Diffstat (limited to 'ext/date')
197 files changed, 592 insertions, 28314 deletions
diff --git a/ext/date/config.w32 b/ext/date/config.w32 index d25b52df27..abf12dc732 100755..100644 --- a/ext/date/config.w32 +++ b/ext/date/config.w32 @@ -2,15 +2,12 @@ EXTENSION("date", "php_date.c", false, "/Iext/date/lib /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 /DHAVE_TIMELIB_CONFIG_H=1"); ADD_SOURCES("ext/date/lib", "astro.c timelib.c dow.c parse_date.c parse_tz.c tm2unixtime.c unixtime2tm.c parse_iso_intervals.c interval.c", "date"); -AC_DEFINE('HAVE_DATE', 1, 'Have date/time support'); ADD_FLAG('CFLAGS_DATE', "/wd4244"); var tl_config = FSO.CreateTextFile("ext/date/lib/timelib_config.h", true); tl_config.WriteLine("#include \"config.w32.h\""); tl_config.WriteLine("#include <php_stdint.h>"); -tl_config.WriteLine("#define TIMELIB_OMIT_STDINT 1"); -tl_config.WriteLine("#define HAVE_GETTIMEOFDAY 1"); tl_config.WriteLine("#include \"zend.h\""); tl_config.WriteLine("#define timelib_malloc emalloc"); tl_config.WriteLine("#define timelib_realloc erealloc"); diff --git a/ext/date/config0.m4 b/ext/date/config0.m4 index 6c9d614181..20e4164aaa 100644 --- a/ext/date/config0.m4 +++ b/ext/date/config0.m4 @@ -1,10 +1,5 @@ -dnl config.m4 for date extension - dnl Check for headers needed by timelib -AC_CHECK_HEADERS([ \ -strings.h \ -io.h -]) +AC_CHECK_HEADERS([io.h]) dnl Check for strtoll, atoll AC_CHECK_FUNCS(strtoll atoll) @@ -29,7 +24,6 @@ cat > $ext_builddir/lib/timelib_config.h <<EOF # include <php_config.h> #endif #include <php_stdint.h> -#define TIMELIB_OMIT_STDINT 1 #include "zend.h" diff --git a/ext/date/lib/timelib_config.h.win32 b/ext/date/lib/timelib_config.h.win32 deleted file mode 100755 index 379b3902fc..0000000000 --- a/ext/date/lib/timelib_config.h.win32 +++ /dev/null @@ -1 +0,0 @@ -# include "config.w32.h" diff --git a/ext/date/php_date.c b/ext/date/php_date.c index d0e14e9f4f..66812cbc22 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -425,12 +425,8 @@ static const zend_function_entry date_functions[] = { PHP_FE(mktime, arginfo_mktime) PHP_FE(gmmktime, arginfo_gmmktime) PHP_FE(checkdate, arginfo_checkdate) - -#ifdef HAVE_STRFTIME PHP_FE(strftime, arginfo_strftime) PHP_FE(gmstrftime, arginfo_gmstrftime) -#endif - PHP_FE(time, arginfo_time) PHP_FE(localtime, arginfo_localtime) PHP_FE(getdate, arginfo_getdate) @@ -493,7 +489,7 @@ static const zend_function_entry date_funcs_interface[] = { }; static const zend_function_entry date_funcs_date[] = { - PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_PUBLIC) PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateTime, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -516,7 +512,7 @@ static const zend_function_entry date_funcs_date[] = { }; static const zend_function_entry date_funcs_immutable[] = { - PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_PUBLIC) PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateTimeImmutable, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -539,7 +535,7 @@ static const zend_function_entry date_funcs_immutable[] = { }; static const zend_function_entry date_funcs_timezone[] = { - PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_PUBLIC) PHP_ME(DateTimeZone, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateTimeZone, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0) @@ -552,7 +548,7 @@ static const zend_function_entry date_funcs_timezone[] = { }; static const zend_function_entry date_funcs_interval[] = { - PHP_ME(DateInterval, __construct, arginfo_date_interval_construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DateInterval, __construct, arginfo_date_interval_construct, ZEND_ACC_PUBLIC) PHP_ME(DateInterval, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DateInterval, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME_MAPPING(format, date_interval_format, arginfo_date_method_interval_format, 0) @@ -561,7 +557,7 @@ static const zend_function_entry date_funcs_interval[] = { }; static const zend_function_entry date_funcs_period[] = { - PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) + PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_PUBLIC) PHP_ME(DatePeriod, __wakeup, NULL, ZEND_ACC_PUBLIC) PHP_ME(DatePeriod, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC) @@ -643,24 +639,6 @@ static zend_object_handlers date_object_handlers_timezone; static zend_object_handlers date_object_handlers_interval; static zend_object_handlers date_object_handlers_period; -#define DATE_SET_CONTEXT \ - zval *object; \ - object = getThis(); \ - -#define DATE_FETCH_OBJECT \ - php_date_obj *obj; \ - DATE_SET_CONTEXT; \ - if (object) { \ - if (zend_parse_parameters_none() == FAILURE) { \ - return; \ - } \ - } else { \ - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "O", &object, date_ce_date) == FAILURE) { \ - RETURN_FALSE; \ - } \ - } \ - obj = Z_PHPDATE_P(object); \ - #define DATE_CHECK_INITIALIZED(member, class_name) \ if (!(member)) { \ php_error_docref(NULL, E_WARNING, "The " #class_name " object has not been correctly initialized by its constructor"); \ @@ -684,21 +662,25 @@ static zend_object *date_object_clone_period(zval *this_ptr); static int date_object_compare_date(zval *d1, zval *d2); static HashTable *date_object_get_gc(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties(zval *object); +static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose); static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n); static HashTable *date_object_get_properties_interval(zval *object); static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n); static HashTable *date_object_get_properties_period(zval *object); -static HashTable *date_object_get_properties_timezone(zval *object); +static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose); static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n); static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp); static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv); -zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); -void date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot); +static int date_interval_compare_objects(zval *o1, zval *o2); +static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); +static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot); static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot); static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); -static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot); +static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot); +static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot); + +static int date_object_compare_timezone(zval *tz1, zval *tz2); /* {{{ Module struct */ zend_module_entry date_module_entry = { @@ -803,7 +785,7 @@ PHP_RSHUTDOWN_FUNCTION(date) * Wdy, DD Mon YY HH:MM:SS TIMEZONE * There is no hope of having a complete list of timezones. Universal * Time (GMT), the North American timezones (PST, PDT, MST, MDT, CST, - * CDT, EST, EDT) and the +/-hhmm offset specifed in RFC-822 should be supported. + * CDT, EST, EDT) and the +/-hhmm offset specified in RFC-822 should be supported. */ #define DATE_FORMAT_RFC1036 "D, d M y H:i:s O" @@ -1671,7 +1653,6 @@ PHP_FUNCTION(checkdate) } /* }}} */ -#ifdef HAVE_STRFTIME /* {{{ php_strftime - (gm)strftime helper */ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { @@ -1717,20 +1698,20 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) ta.tm_yday = timelib_day_of_year(ts->y, ts->m, ts->d); if (gmt) { ta.tm_isdst = 0; -#if HAVE_TM_GMTOFF +#if HAVE_STRUCT_TM_TM_GMTOFF ta.tm_gmtoff = 0; #endif -#if HAVE_TM_ZONE +#if HAVE_STRUCT_TM_TM_ZONE ta.tm_zone = "GMT"; #endif } else { offset = timelib_get_time_zone_info(timestamp, tzi); ta.tm_isdst = offset->is_dst; -#if HAVE_TM_GMTOFF +#if HAVE_STRUCT_TM_TM_GMTOFF ta.tm_gmtoff = offset->offset; #endif -#if HAVE_TM_ZONE +#if HAVE_STRUCT_TM_TM_ZONE ta.tm_zone = offset->abbr; #endif } @@ -1783,7 +1764,6 @@ PHP_FUNCTION(gmstrftime) php_strftime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ -#endif /* {{{ proto int time(void) Return current UNIX timestamp */ @@ -1793,7 +1773,7 @@ PHP_FUNCTION(time) return; } - RETURN_LONG((zend_long)php_time(NULL)); + RETURN_LONG((zend_long)php_time()); } /* }}} */ @@ -1801,7 +1781,7 @@ PHP_FUNCTION(time) Returns the results of the C system call localtime as an associative array if the associative_array argument is set to 1 other wise it is a regular array */ PHP_FUNCTION(localtime) { - zend_long timestamp = (zend_long)php_time(); + zend_long timestamp; zend_bool associative = 0; timelib_tzinfo *tzi; timelib_time *ts; @@ -1812,6 +1792,10 @@ PHP_FUNCTION(localtime) Z_PARAM_BOOL(associative) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + if (ZEND_NUM_ARGS() == 0) { + timestamp = (zend_long) php_time(); + } + tzi = get_timezone_info(); ts = timelib_time_ctor(); ts->tz_info = tzi; @@ -1850,7 +1834,7 @@ PHP_FUNCTION(localtime) Get date/time information */ PHP_FUNCTION(getdate) { - zend_long timestamp = (zend_long)php_time(); + zend_long timestamp; timelib_tzinfo *tzi; timelib_time *ts; @@ -1859,6 +1843,10 @@ PHP_FUNCTION(getdate) Z_PARAM_LONG(timestamp) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + if (ZEND_NUM_ARGS() == 0) { + timestamp = (zend_long) php_time(); + } + tzi = get_timezone_info(); ts = timelib_time_ctor(); ts->tz_info = tzi; @@ -2040,7 +2028,8 @@ zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval zend_iterator_init((zend_object_iterator*)iterator); - ZVAL_COPY(&iterator->intern.data, object); + Z_ADDREF_P(object); + ZVAL_OBJ(&iterator->intern.data, Z_OBJ_P(object)); iterator->intern.funcs = &date_period_it_funcs; iterator->object = Z_PHPPERIOD_P(object); ZVAL_UNDEF(&iterator->current); @@ -2069,7 +2058,11 @@ static int date_interval_has_property(zval *object, zval *member, int type, void int retval = 0; if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); + zend_string *str = zval_try_get_string_func(member); + if (UNEXPECTED(!str)) { + return 0; + } + ZVAL_STR(&tmp_member, str); member = &tmp_member; cache_slot = NULL; } @@ -2140,7 +2133,7 @@ static void date_register_classes(void) /* {{{ */ date_object_handlers_date.free_obj = date_object_free_storage_date; date_object_handlers_date.clone_obj = date_object_clone_date; date_object_handlers_date.compare_objects = date_object_compare_date; - date_object_handlers_date.get_properties = date_object_get_properties; + date_object_handlers_date.get_properties_for = date_object_get_properties_for; date_object_handlers_date.get_gc = date_object_get_gc; zend_class_implements(date_ce_date, 1, date_ce_interface); @@ -2150,7 +2143,7 @@ static void date_register_classes(void) /* {{{ */ memcpy(&date_object_handlers_immutable, &std_object_handlers, sizeof(zend_object_handlers)); date_object_handlers_immutable.clone_obj = date_object_clone_date; date_object_handlers_immutable.compare_objects = date_object_compare_date; - date_object_handlers_immutable.get_properties = date_object_get_properties; + date_object_handlers_immutable.get_properties_for = date_object_get_properties_for; date_object_handlers_immutable.get_gc = date_object_get_gc; zend_class_implements(date_ce_immutable, 1, date_ce_interface); @@ -2161,7 +2154,8 @@ static void date_register_classes(void) /* {{{ */ date_object_handlers_timezone.offset = XtOffsetOf(php_timezone_obj, std); date_object_handlers_timezone.free_obj = date_object_free_storage_timezone; date_object_handlers_timezone.clone_obj = date_object_clone_timezone; - date_object_handlers_timezone.get_properties = date_object_get_properties_timezone; + date_object_handlers_timezone.compare_objects = date_object_compare_timezone; + date_object_handlers_timezone.get_properties_for = date_object_get_properties_for_timezone; date_object_handlers_timezone.get_gc = date_object_get_gc_timezone; date_object_handlers_timezone.get_debug_info = date_object_get_debug_info_timezone; @@ -2196,6 +2190,7 @@ static void date_register_classes(void) /* {{{ */ date_object_handlers_interval.get_properties = date_object_get_properties_interval; date_object_handlers_interval.get_property_ptr_ptr = date_interval_get_property_ptr_ptr; date_object_handlers_interval.get_gc = date_object_get_gc_interval; + date_object_handlers_interval.compare_objects = date_interval_compare_objects; INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period); ce_period.create_object = date_object_new_period; @@ -2207,7 +2202,7 @@ static void date_register_classes(void) /* {{{ */ date_object_handlers_period.free_obj = date_object_free_storage_period; date_object_handlers_period.clone_obj = date_object_clone_period; date_object_handlers_period.get_properties = date_object_get_properties_period; - date_object_handlers_period.get_property_ptr_ptr = NULL; + date_object_handlers_period.get_property_ptr_ptr = date_period_get_property_ptr_ptr; date_object_handlers_period.get_gc = date_object_get_gc_period; date_object_handlers_period.read_property = date_period_read_property; date_object_handlers_period.write_property = date_period_write_property; @@ -2290,17 +2285,25 @@ static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties(zval *object) /* {{{ */ +static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */ { HashTable *props; zval zv; - php_date_obj *dateobj; + php_date_obj *dateobj; + switch (purpose) { + case ZEND_PROP_PURPOSE_DEBUG: + case ZEND_PROP_PURPOSE_SERIALIZE: + case ZEND_PROP_PURPOSE_VAR_EXPORT: + case ZEND_PROP_PURPOSE_JSON: + case ZEND_PROP_PURPOSE_ARRAY_CAST: + break; + default: + return zend_std_get_properties_for(object, purpose); + } dateobj = Z_PHPDATE_P(object); - - props = zend_std_get_properties(object); - + props = zend_array_dup(zend_std_get_properties(object)); if (!dateobj->time) { return props; } @@ -2380,6 +2383,34 @@ static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */ return &new_obj->std; } /* }}} */ +static int date_object_compare_timezone(zval *tz1, zval *tz2) /* {{{ */ +{ + php_timezone_obj *o1, *o2; + + o1 = Z_PHPTIMEZONE_P(tz1); + o2 = Z_PHPTIMEZONE_P(tz2); + + if (!o1->initialized || !o2->initialized) { + php_error_docref(NULL, E_WARNING, "Trying to compare uninitialized DateTimeZone objects"); + return 1; + } + + if (o1->type != o2->type) { + php_error_docref(NULL, E_WARNING, "Trying to compare different kinds of DateTimeZone objects"); + return 1; + } + + switch (o1->type) { + case TIMELIB_ZONETYPE_OFFSET: + return o1->tzi.utc_offset == o2->tzi.utc_offset ? 0 : 1; + case TIMELIB_ZONETYPE_ABBR: + return strcmp(o1->tzi.z.abbr, o2->tzi.z.abbr) ? 1 : 0; + case TIMELIB_ZONETYPE_ID: + return strcmp(o1->tzi.tz->name, o2->tzi.tz->name) ? 1 : 0; + EMPTY_SWITCH_DEFAULT_CASE(); + } +} /* }}} */ + static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv) { switch (tzobj->type) { @@ -2404,16 +2435,25 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv) } } -static HashTable *date_object_get_properties_timezone(zval *object) /* {{{ */ +static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose) /* {{{ */ { HashTable *props; zval zv; - php_timezone_obj *tzobj; - - tzobj = Z_PHPTIMEZONE_P(object); + php_timezone_obj *tzobj; - props = zend_std_get_properties(object); + switch (purpose) { + case ZEND_PROP_PURPOSE_DEBUG: + case ZEND_PROP_PURPOSE_SERIALIZE: + case ZEND_PROP_PURPOSE_VAR_EXPORT: + case ZEND_PROP_PURPOSE_JSON: + case ZEND_PROP_PURPOSE_ARRAY_CAST: + break; + default: + return zend_std_get_properties_for(object, purpose); + } + tzobj = Z_PHPTIMEZONE_P(object); + props = zend_array_dup(zend_std_get_properties(object)); if (!tzobj->initialized) { return props; } @@ -2485,12 +2525,10 @@ static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */ { HashTable *props; zval zv; - php_interval_obj *intervalobj; + php_interval_obj *intervalobj; intervalobj = Z_PHPINTERVAL_P(object); - props = zend_std_get_properties(object); - if (!intervalobj->initialized) { return props; } @@ -2848,7 +2886,7 @@ PHP_METHOD(DateTime, __construct) ZEND_PARSE_PARAMETERS_END(); zend_replace_error_handling(EH_THROW, NULL, &error_handling); - php_date_initialize(Z_PHPDATE_P(getThis()), time_str, time_str_len, NULL, timezone_object, 1); + php_date_initialize(Z_PHPDATE_P(ZEND_THIS), time_str, time_str_len, NULL, timezone_object, 1); zend_restore_error_handling(&error_handling); } /* }}} */ @@ -2870,7 +2908,7 @@ PHP_METHOD(DateTimeImmutable, __construct) ZEND_PARSE_PARAMETERS_END(); zend_replace_error_handling(EH_THROW, NULL, &error_handling); - php_date_initialize(Z_PHPDATE_P(getThis()), time_str, time_str_len, NULL, timezone_object, 1); + php_date_initialize(Z_PHPDATE_P(ZEND_THIS), time_str, time_str_len, NULL, timezone_object, 1); zend_restore_error_handling(&error_handling); } /* }}} */ @@ -3014,7 +3052,7 @@ PHP_METHOD(DateTimeImmutable, __set_state) */ PHP_METHOD(DateTime, __wakeup) { - zval *object = getThis(); + zval *object = ZEND_THIS; php_date_obj *dateobj; HashTable *myht; @@ -3279,7 +3317,7 @@ PHP_FUNCTION(date_modify) } Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3291,7 +3329,8 @@ PHP_METHOD(DateTimeImmutable, modify) char *modify; size_t modify_len; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &modify, &modify_len) == FAILURE) { RETURN_FALSE; } @@ -3335,7 +3374,7 @@ PHP_FUNCTION(date_add) php_date_add(object, interval, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3345,7 +3384,8 @@ PHP_METHOD(DateTimeImmutable, add) { zval *object, *interval, new_object; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_immutable, &interval, date_ce_interval) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) { RETURN_FALSE; } @@ -3391,7 +3431,7 @@ PHP_FUNCTION(date_sub) php_date_sub(object, interval, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3401,7 +3441,8 @@ PHP_METHOD(DateTimeImmutable, sub) { zval *object, *interval, new_object; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_immutable, &interval, date_ce_interval) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) { RETURN_FALSE; } @@ -3494,7 +3535,7 @@ PHP_FUNCTION(date_timezone_set) php_date_timezone_set(object, timezone_object, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3505,7 +3546,8 @@ PHP_METHOD(DateTimeImmutable, setTimezone) zval *object, new_object; zval *timezone_object; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_immutable, &timezone_object, date_ce_timezone) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &timezone_object, date_ce_timezone) == FAILURE) { RETURN_FALSE; } @@ -3580,7 +3622,7 @@ PHP_FUNCTION(date_time_set) php_date_time_set(object, h, i, s, ms, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3591,7 +3633,8 @@ PHP_METHOD(DateTimeImmutable, setTime) zval *object, new_object; zend_long h, i, s = 0, ms = 0; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|ll", &object, date_ce_immutable, &h, &i, &s, &ms) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|ll", &h, &i, &s, &ms) == FAILURE) { RETURN_FALSE; } @@ -3629,7 +3672,7 @@ PHP_FUNCTION(date_date_set) php_date_date_set(object, y, m, d, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3640,7 +3683,8 @@ PHP_METHOD(DateTimeImmutable, setDate) zval *object, new_object; zend_long y, m, d; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &y, &m, &d) == FAILURE) { RETURN_FALSE; } @@ -3682,7 +3726,7 @@ PHP_FUNCTION(date_isodate_set) php_date_isodate_set(object, y, w, d, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3693,7 +3737,8 @@ PHP_METHOD(DateTimeImmutable, setISODate) zval *object, new_object; zend_long y, w, d = 1; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l", &y, &w, &d) == FAILURE) { RETURN_FALSE; } @@ -3730,7 +3775,7 @@ PHP_FUNCTION(date_timestamp_set) php_date_timestamp_set(object, timestamp, return_value); Z_ADDREF_P(object); - ZVAL_COPY_VALUE(return_value, object); + ZVAL_OBJ(return_value, Z_OBJ_P(object)); } /* }}} */ @@ -3741,7 +3786,8 @@ PHP_METHOD(DateTimeImmutable, setTimestamp) zval *object, new_object; zend_long timestamp; - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, date_ce_immutable, ×tamp) == FAILURE) { + object = ZEND_THIS; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", ×tamp) == FAILURE) { RETURN_FALSE; } @@ -3867,7 +3913,7 @@ PHP_METHOD(DateTimeZone, __construct) ZEND_PARSE_PARAMETERS_END(); zend_replace_error_handling(EH_THROW, NULL, &error_handling); - tzobj = Z_PHPTIMEZONE_P(getThis()); + tzobj = Z_PHPTIMEZONE_P(ZEND_THIS); timezone_initialize(tzobj, ZSTR_VAL(tz), ZSTR_LEN(tz)); zend_restore_error_handling(&error_handling); } @@ -3922,7 +3968,7 @@ PHP_METHOD(DateTimeZone, __set_state) * */ PHP_METHOD(DateTimeZone, __wakeup) { - zval *object = getThis(); + zval *object = ZEND_THIS; php_timezone_obj *tzobj; HashTable *myht; @@ -3954,7 +4000,7 @@ PHP_FUNCTION(timezone_name_get) /* }}} */ /* {{{ proto string timezone_name_from_abbr(string abbr[, int gmtOffset[, int isdst]]) - Returns the timezone name from abbrevation + Returns the timezone name from abbreviation */ PHP_FUNCTION(timezone_name_from_abbr) { @@ -4155,8 +4201,16 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma return retval; } /* }}} */ +static int date_interval_compare_objects(zval *o1, zval *o2) { + /* There is no well defined way to compare intervals like P1M and P30D, which may compare + * smaller, equal or greater depending on the point in time at which the interval starts. As + * such, we treat DateInterval objects are non-comparable and emit a warning. */ + zend_error(E_WARNING, "Cannot compare DateInterval objects"); + return 1; +} + /* {{{ date_interval_read_property */ -zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) { php_interval_obj *obj; zval *retval; @@ -4165,7 +4219,11 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c double fvalue = -1; if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); + zend_string *str = zval_try_get_string_func(member); + if (UNEXPECTED(!str)) { + return &EG(uninitialized_zval); + } + ZVAL_STR(&tmp_member, str); member = &tmp_member; cache_slot = NULL; } @@ -4227,13 +4285,17 @@ zval *date_interval_read_property(zval *object, zval *member, int type, void **c /* }}} */ /* {{{ date_interval_write_property */ -void date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot) { php_interval_obj *obj; zval tmp_member; if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); + zend_string *str = zval_try_get_string_func(member); + if (UNEXPECTED(!str)) { + return value; + } + ZVAL_STR(&tmp_member, str); member = &tmp_member; cache_slot = NULL; } @@ -4241,17 +4303,17 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void obj = Z_PHPINTERVAL_P(object); if (!obj->initialized) { - zend_std_write_property(object, member, value, cache_slot); + value = zend_std_write_property(object, member, value, cache_slot); if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } - return; + return value; } #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ obj->diff->n = zval_get_long(value); \ - break; \ + break; \ } do { @@ -4267,12 +4329,14 @@ void date_interval_write_property(zval *object, zval *member, zval *value, void } SET_VALUE_FROM_STRUCT(invert, "invert"); /* didn't find any */ - zend_std_write_property(object, member, value, cache_slot); + value = zend_std_write_property(object, member, value, cache_slot); } while(0); if (member == &tmp_member) { zval_ptr_dtor_str(&tmp_member); } + + return value; } /* }}} */ @@ -4282,7 +4346,11 @@ static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int zval tmp_member, *ret; if (Z_TYPE_P(member) != IS_STRING) { - ZVAL_STR(&tmp_member, zval_get_string_func(member)); + zend_string *str = zval_try_get_string_func(member); + if (UNEXPECTED(!str)) { + return NULL; + } + ZVAL_STR(&tmp_member, str); member = &tmp_member; cache_slot = NULL; } @@ -4325,7 +4393,7 @@ PHP_METHOD(DateInterval, __construct) zend_replace_error_handling(EH_THROW, NULL, &error_handling); if (date_interval_initialize(&reltime, ZSTR_VAL(interval_string), ZSTR_LEN(interval_string)) == SUCCESS) { - php_interval_obj *diobj = Z_PHPINTERVAL_P(getThis()); + php_interval_obj *diobj = Z_PHPINTERVAL_P(ZEND_THIS); diobj->diff = reltime; diobj->initialized = 1; } @@ -4439,7 +4507,7 @@ PHP_METHOD(DateInterval, __set_state) */ PHP_METHOD(DateInterval, __wakeup) { - zval *object = getThis(); + zval *object = ZEND_THIS; php_interval_obj *intobj; HashTable *myht; @@ -4624,7 +4692,7 @@ PHP_METHOD(DatePeriod, __construct) } } - dpobj = Z_PHPPERIOD_P(getThis()); + dpobj = Z_PHPPERIOD_P(ZEND_THIS); dpobj->current = NULL; if (isostr) { @@ -4673,7 +4741,7 @@ PHP_METHOD(DatePeriod, __construct) dpobj->end = clone; } } - + if (dpobj->end == NULL && recurrences < 1) { php_error_docref(NULL, E_WARNING, "The recurrence count '%d' is invalid. Needs to be > 0", (int) recurrences); } @@ -4702,7 +4770,7 @@ PHP_METHOD(DatePeriod, getStartDate) return; } - dpobj = Z_PHPPERIOD_P(getThis()); + dpobj = Z_PHPPERIOD_P(ZEND_THIS); php_date_instantiate(dpobj->start_ce, return_value); dateobj = Z_PHPDATE_P(return_value); @@ -4729,7 +4797,7 @@ PHP_METHOD(DatePeriod, getEndDate) return; } - dpobj = Z_PHPPERIOD_P(getThis()); + dpobj = Z_PHPPERIOD_P(ZEND_THIS); if (!dpobj->end) { return; @@ -4760,7 +4828,7 @@ PHP_METHOD(DatePeriod, getDateInterval) return; } - dpobj = Z_PHPPERIOD_P(getThis()); + dpobj = Z_PHPPERIOD_P(ZEND_THIS); php_date_instantiate(date_ce_interval, return_value); diobj = Z_PHPINTERVAL_P(return_value); @@ -4774,16 +4842,16 @@ PHP_METHOD(DatePeriod, getDateInterval) */ PHP_METHOD(DatePeriod, getRecurrences) { - php_period_obj *dpobj; + php_period_obj *dpobj; if (zend_parse_parameters_none() == FAILURE) { - return; + return; } - dpobj = Z_PHPPERIOD_P(getThis()); + dpobj = Z_PHPPERIOD_P(ZEND_THIS); if (0 == dpobj->recurrences - dpobj->include_start_date) { - return; + return; } RETURN_LONG(dpobj->recurrences - dpobj->include_start_date); @@ -5163,9 +5231,7 @@ static HashTable *date_object_get_properties_period(zval *object) /* {{{ */ php_period_obj *period_obj; period_obj = Z_PHPPERIOD_P(object); - props = zend_std_get_properties(object); - if (!period_obj->start) { return props; } @@ -5327,7 +5393,7 @@ PHP_METHOD(DatePeriod, __set_state) */ PHP_METHOD(DatePeriod, __wakeup) { - zval *object = getThis(); + zval *object = ZEND_THIS; php_period_obj *period_obj; HashTable *myht; @@ -5379,25 +5445,31 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi /* }}} */ /* {{{ date_period_write_property */ -static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot) { zend_string *name = zval_get_string(member); if (date_period_is_magic_property(name)) { zend_throw_error(NULL, "Writing to DatePeriod->%s is unsupported", ZSTR_VAL(name)); zend_string_release(name); - return; + return value; } zend_string_release(name); - std_object_handlers.write_property(object, member, value, cache_slot); + return zend_std_write_property(object, member, value, cache_slot); } /* }}} */ -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: fdm=marker - * vim: noet sw=4 ts=4 - */ +/* {{{ date_period_get_property_ptr_ptr */ +static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) +{ + zend_string *name = zval_get_string(member); + if (date_period_is_magic_property(name)) { + zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name)); + zend_string_release(name); + return &EG(error_zval); + } + zend_string_release(name); + + return zend_std_get_property_ptr_ptr(object, member, type, cache_slot); +} +/* }}} */ diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 00e2c385f2..009be83a3f 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -37,12 +37,8 @@ PHP_FUNCTION(mktime); PHP_FUNCTION(gmmktime); PHP_FUNCTION(checkdate); - -#ifdef HAVE_STRFTIME PHP_FUNCTION(strftime); PHP_FUNCTION(gmstrftime); -#endif - PHP_FUNCTION(time); PHP_FUNCTION(localtime); PHP_FUNCTION(getdate); @@ -135,7 +131,6 @@ typedef struct _php_period_obj php_period_obj; struct _php_date_obj { timelib_time *time; - HashTable *props; zend_object std; }; @@ -153,7 +148,6 @@ struct _php_timezone_obj { timelib_sll utc_offset; /* TIMELIB_ZONETYPE_OFFSET */ timelib_abbr_info z; /* TIMELIB_ZONETYPE_ABBR */ } tzi; - HashTable *props; zend_object std; }; @@ -165,7 +159,6 @@ static inline php_timezone_obj *php_timezone_obj_from_obj(zend_object *obj) { struct _php_interval_obj { timelib_rel_time *diff; - HashTable *props; int initialized; zend_object std; }; @@ -210,10 +203,10 @@ PHPAPI time_t php_time(); PHPAPI zend_long php_parse_date(char *string, zend_long *now); PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt); PHPAPI int php_idate(char format, time_t ts, int localtime); -#if HAVE_STRFTIME + #define _php_strftime php_strftime + PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm); -#endif PHPAPI zend_string *php_format_date(char *format, size_t format_len, time_t ts, int localtime); /* Mechanism to set new TZ database */ diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt index ae8011eebd..4812d63de6 100644 --- a/ext/date/tests/009.phpt +++ b/ext/date/tests/009.phpt @@ -3,7 +3,6 @@ strftime() and gmstrftime() tests --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) == 'WIN') die('skip posix only test.'); -if (!function_exists('strftime')) die("skip, strftime not available"); ?> --FILE-- <?php diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt index 3da5b35c81..91c1b261ce 100644 --- a/ext/date/tests/009_win32.phpt +++ b/ext/date/tests/009_win32.phpt @@ -3,7 +3,6 @@ strftime() and gmstrftime() tests --SKIPIF-- <?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip only windows test.'); -if (!function_exists('strftime')) die("skip, strftime not available"); if (false === setlocale(LC_TIME, "en-us")) die("skip, couldn't set the locale to en-us"); ?> --FILE-- diff --git a/ext/date/tests/DateInterval_write_property_return.phpt b/ext/date/tests/DateInterval_write_property_return.phpt new file mode 100644 index 0000000000..9c2c5c9137 --- /dev/null +++ b/ext/date/tests/DateInterval_write_property_return.phpt @@ -0,0 +1,14 @@ +--TEST-- +Test that return value handling for DateInterval property writes do not corrupt RHS +--FILE-- +<?php + +$interval = new DateInterval('P2Y4DT6H8M'); +$f = 0.5; +var_dump($interval->f = $f); +var_dump($f); + +?> +--EXPECT-- +float(0.5) +float(0.5) diff --git a/ext/date/tests/DatePeriod_set_state.phpt b/ext/date/tests/DatePeriod_set_state.phpt new file mode 100644 index 0000000000..eaef2163cc --- /dev/null +++ b/ext/date/tests/DatePeriod_set_state.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test __set_state magic method for recreating a DatePeriod object +--CREDITS-- +Mark Baker mark@lange.demon.co.uk at the PHPNW2017 Conference for PHP Testfest 2017 +--FILE-- +<?php + +$datePeriodObject = new DatePeriod( + new DateTime('2017-10-06 23:30', new DateTimeZone('UTC')), + new DateInterval('PT1H30M'), + 24 +); + +$datePeriodState = var_export($datePeriodObject, true); + +eval("\$datePeriodObjectNew = {$datePeriodState};"); + +var_dump($datePeriodObjectNew); + +?> +--EXPECTF-- +object(DatePeriod)#%d (6) { + ["start"]=> + object(DateTime)#%d (3) { + ["date"]=> + string(26) "2017-10-06 23:30:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" + } + ["current"]=> + NULL + ["end"]=> + NULL + ["interval"]=> + object(DateInterval)#%d (16) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(1) + ["i"]=> + int(30) + ["s"]=> + int(0) + ["f"]=> + float(0) + ["weekday"]=> + int(0) + ["weekday_behavior"]=> + int(0) + ["first_last_day_of"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + bool(false) + ["special_type"]=> + int(0) + ["special_amount"]=> + int(0) + ["have_weekday_relative"]=> + int(0) + ["have_special_relative"]=> + int(0) + } + ["recurrences"]=> + int(25) + ["include_start_date"]=> + bool(true) +} diff --git a/ext/date/tests/DateTimeImmutable_set_state.phpt b/ext/date/tests/DateTimeImmutable_set_state.phpt new file mode 100644 index 0000000000..6ffbd87150 --- /dev/null +++ b/ext/date/tests/DateTimeImmutable_set_state.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test __set_state magic method for recreating a DateTimeImmutable object +--CREDITS-- +Mark Baker mark@lange.demon.co.uk at the PHPNW2017 Conference for PHP Testfest 2017 +--FILE-- +<?php + +$datettimeObject = new DateTimeImmutable('2017-10-06 23:30:00', new DateTimezone('UTC')); + +$datetimeState = var_export($datettimeObject, true); + +eval("\$datetimeObjectNew = {$datetimeState};"); + +var_dump($datetimeObjectNew); + +?> +--EXPECTF-- +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2017-10-06 23:30:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} diff --git a/ext/date/tests/DateTimeZone_compare_basic1.phpt b/ext/date/tests/DateTimeZone_compare_basic1.phpt index 790bb6cf7f..3ec6174fa8 100644 --- a/ext/date/tests/DateTimeZone_compare_basic1.phpt +++ b/ext/date/tests/DateTimeZone_compare_basic1.phpt @@ -1,54 +1,74 @@ --TEST-- -Test of compare object handler for DateTime objects +Test of compare object handler for DateTimeZone objects --FILE-- <?php -// NB: DateTimeZone class does not define a customized compare class handler so standard object handler will be used +$timezones = array( + ['+0200', '-0200'], + ['EST', 'PST'], + ['Europe/Amsterdam', 'Europe/Berlin'] +); -echo "Simple test for DateTimeZone compare object handler\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -class DateTimeZoneExt1 extends DateTimeZone { +foreach ($timezones as [$timezone1, $timezone2]) { + compare_timezones($timezone1, $timezone1); + compare_timezones($timezone1, $timezone2); } -class DateTimeZoneExt2 extends DateTimeZone{ - public $foo = "Hello"; - private $bar = 99; +var_dump(new DateTimeZone('Europe/Berlin') == new DateTimeZone('CET')); + +function compare_timezones($timezone1, $timezone2) +{ + $tz1 = new DateTimeZone($timezone1); + $tz2 = new DateTimeZone($timezone2); + echo "compare $timezone1 with $timezone2\n"; + echo "< "; + var_dump($tz1 < $tz2); + echo "= "; + var_dump($tz1 == $tz2); + echo "> "; + var_dump($tz1 > $tz2); } -class DateTimeZoneExt3 extends DateTimeZoneExt2 { +// Test comparison of uninitialized DateTimeZone objects. +class MyDateTimeZone extends DateTimeZone { + function __construct() { + // parent ctor not called + } } -$obj1 = new DateTimeZone("Europe/London"); -$obj2 = new DateTimeZoneExt1("Europe/London"); -$obj3 = new DateTimeZoneExt2("Europe/London"); -$obj4 = new DateTimeZoneExt3("Europe/London"); - -echo "\n-- All the following tests should compare equal --\n"; -var_dump($obj1 == $obj1); -echo "\n-- All the following tests should compare NOT equal --\n"; -var_dump($obj1 == $obj2); -var_dump($obj1 == $obj3); -var_dump($obj1 == $obj4); -var_dump($obj2 == $obj3); -var_dump($obj2 == $obj4); -var_dump($obj3 == $obj4); +$tz1 = new MyDateTimeZone(); +$tz2 = new MyDateTimeZone(); +var_dump($tz1 == $tz2); ?> -===DONE=== ---EXPECT-- -Simple test for DateTimeZone compare object handler +--EXPECTF-- +compare +0200 with +0200 +< bool(false) += bool(true) +> bool(false) +compare +0200 with -0200 +< bool(false) += bool(false) +> bool(false) +compare EST with EST +< bool(false) += bool(true) +> bool(false) +compare EST with PST +< bool(false) += bool(false) +> bool(false) +compare Europe/Amsterdam with Europe/Amsterdam +< bool(false) += bool(true) +> bool(false) +compare Europe/Amsterdam with Europe/Berlin +< bool(false) += bool(false) +> bool(false) --- All the following tests should compare equal -- -bool(true) - --- All the following tests should compare NOT equal -- -bool(false) -bool(false) -bool(false) -bool(false) +Warning: main(): Trying to compare different kinds of DateTimeZone objects in %s on line %d bool(false) + +Warning: main(): Trying to compare uninitialized DateTimeZone objects in %s on line %d bool(false) -===DONE=== diff --git a/ext/date/tests/DateTimeZone_construct_variation1.phpt b/ext/date/tests/DateTimeZone_construct_variation1.phpt deleted file mode 100644 index abc85bf0b8..0000000000 --- a/ext/date/tests/DateTimeZone_construct_variation1.phpt +++ /dev/null @@ -1,192 +0,0 @@ ---TEST-- -Test DateTime::__construct() function : usage variation - Passing unexpected values to first argument $timezone. ---FILE-- -<?php -/* Prototype : DateTimeZone::__construct ( string $timezone ) - * Description: Returns new DateTimeZone object - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing DateTime::__construct() : usage variation - unexpected values to first argument \$timezone***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - - // float data - 'float 10.5' => 10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -foreach($inputs as $variation =>$timezone) { - echo "\n-- $variation --\n"; - try { - var_dump( new DateTimezone($timezone) ); - } catch (Throwable $e) { - $msg = $e->getMessage(); - echo "FAILED: " . $msg . "\n"; - } - -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECT-- -*** Testing DateTime::__construct() : usage variation - unexpected values to first argument $timezone*** - --- int 0 -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0) - --- int 1 -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1) - --- int 12345 -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (12345) - --- float 10.5 -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (10.5) - --- float .5 -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (0.5) - --- empty array -- -FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given - --- int indexed array -- -FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given - --- associative array -- -FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given - --- nested arrays -- -FAILED: DateTimeZone::__construct() expects parameter 1 to be string, array given - --- uppercase NULL -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- lowercase null -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- lowercase true -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1) - --- lowercase false -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- uppercase TRUE -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (1) - --- uppercase FALSE -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- empty string DQ -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- empty string SQ -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- string DQ -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (string) - --- string SQ -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (string) - --- mixed case string -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (sTrInG) - --- heredoc -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (hello world) - --- instance of classWithToString -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone (Class A object) - --- instance of classWithoutToString -- -FAILED: DateTimeZone::__construct() expects parameter 1 to be string, object given - --- undefined var -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- unset var -- -FAILED: DateTimeZone::__construct(): Unknown or bad timezone () - --- resource -- -FAILED: DateTimeZone::__construct() expects parameter 1 to be string, resource given -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getLocation.phpt b/ext/date/tests/DateTimeZone_getLocation.phpt index 06d22820f1..0d9a43f5e7 100644 --- a/ext/date/tests/DateTimeZone_getLocation.phpt +++ b/ext/date/tests/DateTimeZone_getLocation.phpt @@ -1,20 +1,21 @@ --TEST-- -DateTimeZone::getLocation -- timezone_location_get — Returns location information for a timezone public array DateTimeZone::getLocation ( void ) ; +Test DateTimeZone::getLocation() --CREDITS-- marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br --FILE-- <?php -$arrayDate = DateTimeZone::listAbbreviations(); $countryCode = array("??"); $countryCodeTest = array("AU", "CA", "ET", "AF", "US", "KZ", "AM"); -foreach($arrayDate as $value){ - - if(NULL != $value[0]['timezone_id']){ +foreach (DateTimeZone::listAbbreviations() as $value) { + if (NULL != $value[0]['timezone_id']) { $timeZone = new DateTimeZone($value[0]['timezone_id']); $timeZoneArray = $timeZone->getLocation(); + if (false === $timeZoneArray) { + continue; + } - if((!in_array($timeZoneArray['country_code'], $countryCode)) && (NULL != $timeZoneArray['country_code']) && ("" != $timeZoneArray['country_code'])) { + if (!in_array($timeZoneArray['country_code'], $countryCode) && NULL != $timeZoneArray['country_code']) { array_push($countryCode, $timeZoneArray['country_code']); if(in_array($timeZoneArray['country_code'], $countryCodeTest)){ @@ -24,12 +25,6 @@ foreach($arrayDate as $value){ } } ?> ---CLEAN-- -<?php -unset($arrayDate); -unset($countryCode); -unset($countryCodeTest); -?> --EXPECTF-- Array ( diff --git a/ext/date/tests/DateTimeZone_getName_error.phpt b/ext/date/tests/DateTimeZone_getName_error.phpt deleted file mode 100644 index 23d0313b12..0000000000 --- a/ext/date/tests/DateTimeZone_getName_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -Test DateTimeZone::getName() function : error conditions ---FILE-- -<?php -/* Prototype : public string DateTimeZone::getName ( void ) - * Description: Returns the name of the timezone - * Source code: ext/date/php_date.c - * Alias to functions: timezone_name_get() - */ - -//Set the default time zone -date_default_timezone_set("GMT"); - -$tz = new DateTimeZone("Europe/London"); - -echo "*** Testing DateTimeZone::getName() : error conditions ***\n"; - -echo "\n-- Testing DateTimeZone::getName() function with more than expected no. of arguments --\n"; -$extra_arg = 99; -var_dump( $tz->getName($extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTimeZone::getName() : error conditions *** - --- Testing DateTimeZone::getName() function with more than expected no. of arguments -- - -Warning: DateTimeZone::getName() expects exactly 0 parameters, 1 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getOffset_error.phpt b/ext/date/tests/DateTimeZone_getOffset_error.phpt deleted file mode 100644 index c2e6e4eed7..0000000000 --- a/ext/date/tests/DateTimeZone_getOffset_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test DateTimeZone::getOffset() function : error conditions ---FILE-- -<?php -/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime ) - * Description: Returns the timezone offset from GMT - * Source code: ext/date/php_date.c - * Alias to functions: timezone_offset_get() - */ - -//Set the default time zone -date_default_timezone_set("GMT"); - -$tz = new DateTimeZone("Europe/London"); -$date = date_create("GMT"); - -echo "*** Testing DateTimeZone::getOffset() : error conditions ***\n"; - -echo "\n-- Testing DateTimeZone::getOffset() function with zero arguments --\n"; -var_dump( $tz->getOffset() ); - -echo "\n-- Testing DateTimeZone::getOffset() function with more than expected no. of arguments --\n"; -$extra_arg = 99; -var_dump( $tz->getOffset($date, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTimeZone::getOffset() : error conditions *** - --- Testing DateTimeZone::getOffset() function with zero arguments -- - -Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing DateTimeZone::getOffset() function with more than expected no. of arguments -- - -Warning: DateTimeZone::getOffset() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt deleted file mode 100644 index 3270566b5a..0000000000 --- a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -Test DateTimeZone::getOffset() function : usage variation - Passing unexpected values to first argument $datetime. ---FILE-- -<?php -/* Prototype : int DateTimeZone::getOffset ( DateTime $datetime ) - * Description: Returns the timezone offset from GMT - * Source code: ext/date/php_date.c - * Alias to functions: timezone_offset_get() - */ - -echo "*** Testing DateTimeZone::getOffset() : usage variation - unexpected values to first argument \$datetime***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$timezone = new DateTimezone("Europe/London"); - -foreach($inputs as $variation =>$datetime) { - echo "\n-- $variation --\n"; - var_dump( $timezone->getOffset($datetime) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTimeZone::getOffset() : usage variation - unexpected values to first argument $datetime*** - --- int 0 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- resource -- - -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getTransitions_error.phpt b/ext/date/tests/DateTimeZone_getTransitions_error.phpt deleted file mode 100644 index f50a77ddb9..0000000000 --- a/ext/date/tests/DateTimeZone_getTransitions_error.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Test DateTimeZone::getTransitions() function : error conditions ---FILE-- -<?php -/* Prototype : array DateTimeZone::getTransitions ([ int $timestamp_begin [, int $timestamp_end ]] ) - * Description: Returns all transitions for the timezone - * Source code: ext/date/php_date.c - * Alias to functions: timezone_transitions_get() - */ - -//Set the default time zone -date_default_timezone_set("GMT"); - -$tz = new DateTimeZone("Europe/London"); - -echo "*** Testing DateTimeZone::getTransitions() : error conditions ***\n"; - -echo "\n-- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments --\n"; -$timestamp_begin = mktime(0, 0, 0, 1, 1, 1972); -$timestamp_end = mktime(0, 0, 0, 1, 1, 1975); -$extra_arg = 99; - -var_dump( $tz->getTransitions($timestamp_begin, $timestamp_end, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTimeZone::getTransitions() : error conditions *** - --- Testing DateTimeZone::getTransitions() function with more than expected no. of arguments -- - -Warning: DateTimeZone::getTransitions() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTimeZone_set_state.phpt b/ext/date/tests/DateTimeZone_set_state.phpt new file mode 100644 index 0000000000..66c87c430f --- /dev/null +++ b/ext/date/tests/DateTimeZone_set_state.phpt @@ -0,0 +1,23 @@ +--TEST-- +Test __set_state magic method for recreating a DateTimeZone object +--CREDITS-- +Mark Baker mark@lange.demon.co.uk at the PHPNW2017 Conference for PHP Testfest 2017 +--FILE-- +<?php + +$datetimezoneObject = new DateTimezone('UTC'); + +$datetimezoneState = var_export($datetimezoneObject, true); + +eval("\$datetimezoneObjectNew = {$datetimezoneState};"); + +var_dump($datetimezoneObjectNew); + +?> +--EXPECTF-- +object(DateTimeZone)#%d (2) { + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} diff --git a/ext/date/tests/DateTime_clone_basic3.phpt b/ext/date/tests/DateTime_clone_basic3.phpt index 5019b6685c..ebda6a8428 100644 --- a/ext/date/tests/DateTime_clone_basic3.phpt +++ b/ext/date/tests/DateTime_clone_basic3.phpt @@ -41,40 +41,34 @@ object(DateTime)#%d (3) { -- Add some properties -- object(DateTime)#%d (5) { - ["date"]=> - string(26) "2009-02-03 12:34:41.000000" - ["timezone_type"]=> - int(2) - ["timezone"]=> - string(3) "GMT" ["property1"]=> int(99) ["property2"]=> string(5) "Hello" -} - --- clone it -- -object(DateTime)#%d (5) { ["date"]=> string(26) "2009-02-03 12:34:41.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "GMT" +} + +-- clone it -- +object(DateTime)#%d (5) { ["property1"]=> int(99) ["property2"]=> string(5) "Hello" -} - --- Add some more properties -- -object(DateTime)#%d (7) { ["date"]=> string(26) "2009-02-03 12:34:41.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "GMT" +} + +-- Add some more properties -- +object(DateTime)#%d (7) { ["property1"]=> int(99) ["property2"]=> @@ -83,16 +77,16 @@ object(DateTime)#%d (7) { bool(true) ["property4"]=> float(10.5) -} - --- clone it -- -object(DateTime)#%d (7) { ["date"]=> string(26) "2009-02-03 12:34:41.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "GMT" +} + +-- clone it -- +object(DateTime)#%d (7) { ["property1"]=> int(99) ["property2"]=> @@ -101,5 +95,11 @@ object(DateTime)#%d (7) { bool(true) ["property4"]=> float(10.5) + ["date"]=> + string(26) "2009-02-03 12:34:41.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "GMT" } ===DONE=== diff --git a/ext/date/tests/DateTime_construct_variation1.phpt b/ext/date/tests/DateTime_construct_variation1.phpt deleted file mode 100644 index 964d0ffc69..0000000000 --- a/ext/date/tests/DateTime_construct_variation1.phpt +++ /dev/null @@ -1,377 +0,0 @@ ---TEST-- -Test new DateTime() function : usage variation - Passing unexpected values to first argument $time. ---FILE-- -<?php -/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] ) - * Description: Returns new DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: date_create - */ - -echo "*** Testing new DateTime(): usage variation - unexpected values to first argument \$time***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$timezone = new DateTimeZone("Europe/London"); - -foreach($inputs as $variation =>$time) { - echo "\n-- $variation --\n"; - - try { - var_dump( new DateTime($time) ); - } catch (Throwable $e) { - $msg = $e->getMessage(); - echo "FAILED: " . $msg . "\n"; - } - - try { - var_dump( new DateTime($time, $timezone) ); - } catch (Throwable $e) { - $msg = $e->getMessage(); - echo "FAILED: " . $msg . "\n"; - } -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing new DateTime(): usage variation - unexpected values to first argument $time*** - --- int 0 -- -FAILED: DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (0) at position 0 (0): Unexpected character - --- int 1 -- -FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character - --- int 12345 -- -FAILED: DateTime::__construct(): Failed to parse time string (12345) at position 4 (5): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (12345) at position 4 (5): Unexpected character - --- int -12345 -- -FAILED: DateTime::__construct(): Failed to parse time string (-12345) at position 5 (5): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (-12345) at position 5 (5): Unexpected character - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -FAILED: DateTime::__construct(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- -FAILED: DateTime::__construct() expects parameter 1 to be string, array given -FAILED: DateTime::__construct() expects parameter 1 to be string, array given - --- int indexed array -- -FAILED: DateTime::__construct() expects parameter 1 to be string, array given -FAILED: DateTime::__construct() expects parameter 1 to be string, array given - --- associative array -- -FAILED: DateTime::__construct() expects parameter 1 to be string, array given -FAILED: DateTime::__construct() expects parameter 1 to be string, array given - --- nested arrays -- -FAILED: DateTime::__construct() expects parameter 1 to be string, array given -FAILED: DateTime::__construct() expects parameter 1 to be string, array given - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character -FAILED: DateTime::__construct(): Failed to parse time string (1) at position 0 (1): Unexpected character - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string SQ -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- string DQ -- -FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database -FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database - --- string SQ -- -FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database -FAILED: DateTime::__construct(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database - --- mixed case string -- -FAILED: DateTime::__construct(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database -FAILED: DateTime::__construct(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database - --- heredoc -- -FAILED: DateTime::__construct(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database -FAILED: DateTime::__construct(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database - --- instance of classWithToString -- -FAILED: DateTime::__construct(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database -FAILED: DateTime::__construct(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database - --- instance of classWithoutToString -- -FAILED: DateTime::__construct() expects parameter 1 to be string, object given -FAILED: DateTime::__construct() expects parameter 1 to be string, object given - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- -FAILED: DateTime::__construct() expects parameter 1 to be string, resource given -FAILED: DateTime::__construct() expects parameter 1 to be string, resource given -===DONE=== diff --git a/ext/date/tests/DateTime_construct_variation2.phpt b/ext/date/tests/DateTime_construct_variation2.phpt deleted file mode 100644 index 2e39f32715..0000000000 --- a/ext/date/tests/DateTime_construct_variation2.phpt +++ /dev/null @@ -1,231 +0,0 @@ ---TEST-- -Test new DateTime() function : usage variation - Passing unexpected values to second argument $timezone. ---FILE-- -<?php -/* Prototype : DateTime::__construct ([ string $time="now" [, DateTimeZone $timezone=NULL ]] ) - * Description: Returns new DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: date_create - */ - -echo "*** Testing new DateTime() : usage variation - unexpected values to second argument \$timezone***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$time = "2005-07-14 22:30:41"; - -foreach($inputs as $variation =>$timezone) { - echo "\n-- $variation --\n"; - - try { - var_dump( new DateTime($time, $timezone) ); - } catch (Throwable $e) { - $msg = $e->getMessage(); - echo "FAILED: " . $msg . "\n"; - } - -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing new DateTime() : usage variation - unexpected values to second argument $timezone*** - --- int 0 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, int given - --- int 1 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, int given - --- int 12345 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, int given - --- int -12345 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, int given - --- float 10.5 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, float given - --- float -10.5 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, float given - --- float .5 -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, float given - --- empty array -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given - --- int indexed array -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given - --- associative array -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given - --- nested arrays -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, array given - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, bool given - --- lowercase false -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, bool given - --- uppercase TRUE -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, bool given - --- uppercase FALSE -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, bool given - --- empty string DQ -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given - --- empty string SQ -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given - --- string DQ -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given - --- string SQ -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given - --- mixed case string -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given - --- heredoc -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, string given - --- instance of classWithToString -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object given - --- instance of classWithoutToString -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, object given - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- -FAILED: DateTime::__construct() expects parameter 2 to be DateTimeZone, resource given -===DONE=== diff --git a/ext/date/tests/DateTime_format_error.phpt b/ext/date/tests/DateTime_format_error.phpt deleted file mode 100644 index 0772bf8a09..0000000000 --- a/ext/date/tests/DateTime_format_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test DateTime::format() function : error conditions ---FILE-- -<?php -/* Prototype : public string DateTime::format ( string $format ) - * Description: Returns date formatted according to given format - * Source code: ext/date/php_date.c - * Alias to functions: date_format - */ - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -// Craete a date object -$date = new DateTime("2005-07-14 22:30:41"); - -echo "*** Testing DateTime::format() : error conditions ***\n"; - -echo "\n-- Testing date_date_formatcreate() function with zero arguments --\n"; -var_dump( $date->format() ); - -echo "\n-- Testing date_date_formatcreate() function with more than expected no. of arguments --\n"; -$format = "F j, Y, g:i a"; -$extra_arg = 10; -var_dump( $date->format($format, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::format() : error conditions *** - --- Testing date_date_formatcreate() function with zero arguments -- - -Warning: DateTime::format() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_date_formatcreate() function with more than expected no. of arguments -- - -Warning: DateTime::format() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_format_variation1.phpt b/ext/date/tests/DateTime_format_variation1.phpt deleted file mode 100644 index 68bbd56caa..0000000000 --- a/ext/date/tests/DateTime_format_variation1.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test DateTime::format() function : usage variation - Passing unexpected values to first argument $format. ---FILE-- -<?php -/* Prototype : public string DateTime::format ( string $format ) - * Description: Returns date formatted according to given format - * Source code: ext/date/php_date.c - * Alias to functions: date_format - */ - -echo "*** Testing DateTime::format() : usage variation - unexpected values to first argument \$format***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2005-07-14 22:30:41"); - -foreach($inputs as $variation =>$format) { - echo "\n-- $variation --\n"; - var_dump( $object->format($format) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::format() : usage variation - unexpected values to first argument $format*** - --- int 0 -- -string(1) "0" - --- int 1 -- -string(1) "1" - --- int 12345 -- -string(5) "12345" - --- int -12345 -- -string(6) "-12345" - --- float 10.5 -- -string(4) "10.5" - --- float -10.5 -- -string(5) "-10.5" - --- float .5 -- -string(3) "0.5" - --- empty array -- - -Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::format() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(0) "" - --- lowercase null -- -string(0) "" - --- lowercase true -- -string(1) "1" - --- lowercase false -- -string(0) "" - --- uppercase TRUE -- -string(1) "1" - --- uppercase FALSE -- -string(0) "" - --- empty string DQ -- -string(0) "" - --- empty string SQ -- -string(0) "" - --- string DQ -- -string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710" - --- string SQ -- -string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710" - --- mixed case string -- -string(40) "41BSTThu, 14 Jul 2005 22:30:41 +01001722" - --- heredoc -- -string(82) "10Europe/LondonThursdayThursday2005 42005Thu, 14 Jul 2005 22:30:41 +0100Thursday14" - --- instance of classWithToString -- -string(66) "CThursdaypm4141 PM 2005b14Europe/London2005-07-14T22:30:41+01:0031" - --- instance of classWithoutToString -- - -Warning: DateTime::format() expects parameter 1 to be string, object given in %s on line %d -bool(false) - --- undefined var -- -string(0) "" - --- unset var -- -string(0) "" - --- resource -- - -Warning: DateTime::format() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_getOffset_error.phpt b/ext/date/tests/DateTime_getOffset_error.phpt deleted file mode 100644 index 2cf65f1979..0000000000 --- a/ext/date/tests/DateTime_getOffset_error.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Test DateTime::getOffset() function : error conditions ---FILE-- -<?php - -/* Prototype : public int DateTime::getOffset ( void ) - * Description: Returns the daylight saving time offset - * Source code: ext/date/php_date.c - * Alias to functions: date_offset_get - */ - - //Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing DateTime::getOffset() : error conditions ***\n"; - -echo "\n-- Testing DateTime::getOffset() function with more than expected no. of arguments --\n"; -$datetime = new DateTime("2009-01-30 19:34:10"); -$extra_arg = 30; - -var_dump( $datetime->getOffset($extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::getOffset() : error conditions *** - --- Testing DateTime::getOffset() function with more than expected no. of arguments -- - -Warning: DateTime::getOffset() expects exactly 0 parameters, 1 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_modify_error.phpt b/ext/date/tests/DateTime_modify_error.phpt deleted file mode 100644 index 2562324fd7..0000000000 --- a/ext/date/tests/DateTime_modify_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test DateTime::modify() function : error conditions ---FILE-- -<?php -/* Prototype : public DateTime DateTime::modify ( string $modify ) - * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). - * Source code: ext/date/php_date.c - * Alias to functions: public date_modify() - */ - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing DateTime::modify() : error conditions ***\n"; - -// Create a date object -$object = new DateTime("2009-01-30 19:34:10"); - -echo "\n-- Testing DateTime::modify() function with less than expected no. of arguments --\n"; -var_dump( $object->modify() ); - -echo "\n-- Testing DateTime::modify() function with more than expected no. of arguments --\n"; -$modify = "+1 day"; -$extra_arg = 99; -var_dump( $object->modify($modify, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::modify() : error conditions *** - --- Testing DateTime::modify() function with less than expected no. of arguments -- - -Warning: DateTime::modify() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing DateTime::modify() function with more than expected no. of arguments -- - -Warning: DateTime::modify() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_modify_variation1.phpt b/ext/date/tests/DateTime_modify_variation1.phpt deleted file mode 100644 index d442243ead..0000000000 --- a/ext/date/tests/DateTime_modify_variation1.phpt +++ /dev/null @@ -1,262 +0,0 @@ ---TEST-- -Test DateTime::modify() function : usage variation - Passing unexpected values to first argument $modify. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::modify ( string $modify ) - * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). - * Source code: ext/date/php_date.c - * Alias to functions: public date_modify() - */ - -echo "*** Testing DateTime::modify() : usage variation - unexpected values to first argument \$modify***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-01-31 14:28:41"); - -foreach($inputs as $variation =>$format) { - echo "\n-- $variation --\n"; - var_dump( $object->modify($format) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::modify() : usage variation - unexpected values to first argument $modify*** - --- int 0 -- - -Warning: DateTime::modify(): Failed to parse time string (0) at position 0 (0): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- int 1 -- - -Warning: DateTime::modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- int 12345 -- - -Warning: DateTime::modify(): Failed to parse time string (12345) at position 4 (5): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- int -12345 -- - -Warning: DateTime::modify(): Failed to parse time string (-12345) at position 5 (5): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- float 10.5 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-31 10:05:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- - -Warning: DateTime::modify(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- float .5 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-31 00:05:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- int indexed array -- - -Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- associative array -- - -Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- nested arrays -- - -Warning: DateTime::modify() expects parameter 1 to be string, array given in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- uppercase NULL -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- lowercase null -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- lowercase true -- - -Warning: DateTime::modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- lowercase false -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- uppercase TRUE -- - -Warning: DateTime::modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- uppercase FALSE -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- empty string DQ -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- empty string SQ -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- string DQ -- - -Warning: DateTime::modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- string SQ -- - -Warning: DateTime::modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- mixed case string -- - -Warning: DateTime::modify(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- heredoc -- - -Warning: DateTime::modify(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::modify(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::modify() expects parameter 1 to be string, object given in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- undefined var -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- unset var -- - -Warning: DateTime::modify(): Failed to parse time string () at position 0 ( in %sDateTime_modify_variation1.php on line 99 -bool(false) - --- resource -- - -Warning: DateTime::modify() expects parameter 1 to be string, resource given in %sDateTime_modify_variation1.php on line 99 -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setDate_error.phpt b/ext/date/tests/DateTime_setDate_error.phpt deleted file mode 100644 index 25bbb3b2e8..0000000000 --- a/ext/date/tests/DateTime_setDate_error.phpt +++ /dev/null @@ -1,53 +0,0 @@ ---TEST-- -Test DateTime::setDate() function : error conditions ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: date_date_set() - */ - -date_default_timezone_set("Europe/London"); - -echo "*** Testing DateTime::setDate() : error conditions ***\n"; - -$datetime = new DateTime("2009-01-30 19:34:10"); - -echo "\n-- Testing DateTime::setDate() function with zero arguments --\n"; -var_dump( $datetime->setDate() ); - -echo "\n-- Testing DateTime::setDate() function with less than expected no. of arguments --\n"; -$year = 2009; -$month = 1; -$day = 30; -var_dump( $datetime->setDate($year) ); -var_dump( $datetime->setDate($year, $month) ); - -echo "\n-- Testing DateTime::setDate() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( $datetime->setDate($year, $month, $day, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setDate() : error conditions *** - --- Testing DateTime::setDate() function with zero arguments -- - -Warning: DateTime::setDate() expects exactly 3 parameters, 0 given in %s on line %d -bool(false) - --- Testing DateTime::setDate() function with less than expected no. of arguments -- - -Warning: DateTime::setDate() expects exactly 3 parameters, 1 given in %s on line %d -bool(false) - -Warning: DateTime::setDate() expects exactly 3 parameters, 2 given in %s on line %d -bool(false) - --- Testing DateTime::setDate() function with more than expected no. of arguments -- - -Warning: DateTime::setDate() expects exactly 3 parameters, 4 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setDate_variation1.phpt b/ext/date/tests/DateTime_setDate_variation1.phpt deleted file mode 100644 index a25bdee54f..0000000000 --- a/ext/date/tests/DateTime_setDate_variation1.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setDate() function : usage variation - Passing unexpected values to first argument $year. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: date_date_set - */ - -echo "*** Testing DateTime::setDate() : usage variation - unexpected values to first argument \$year***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-02-27 08:34:10"); -$day = 2; -$month = 7; - -foreach($inputs as $variation =>$year) { - echo "\n-- $variation --\n"; - var_dump( $object->setDate($year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setDate() : usage variation - unexpected values to first argument $year*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "12345-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(28) "-12345-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0010-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "-0010-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setDate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setDate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setDate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setDate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setDate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setDate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setDate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setDate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setDate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setDate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setDate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setDate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setDate() expects parameter 1 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setDate_variation2.phpt b/ext/date/tests/DateTime_setDate_variation2.phpt deleted file mode 100644 index b3fbf46f4f..0000000000 --- a/ext/date/tests/DateTime_setDate_variation2.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setDate() function : usage variation - Passing unexpected values to second argument $month. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: date_date_set - */ - -echo "*** Testing DateTime::setDate() : usage variation - unexpected values to second argument \$month***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-02-27 08:34:10"); -$day = 2; -$year = 1963; - -foreach($inputs as $variation =>$month) { - echo "\n-- $variation --\n"; - var_dump( $object->setDate($year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setDate() : usage variation - unexpected values to second argument $month*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2991-09-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0934-03-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-10-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-02-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setDate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setDate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setDate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setDate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setDate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setDate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setDate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setDate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setDate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setDate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setDate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setDate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setDate() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setDate_variation3.phpt b/ext/date/tests/DateTime_setDate_variation3.phpt deleted file mode 100644 index b1f7aab961..0000000000 --- a/ext/date/tests/DateTime_setDate_variation3.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setDate() function : usage variation - Passing unexpected values to third argument $day. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setDate ( int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: date_date_set - */ - -echo "*** Testing DateTime::setDate() : usage variation - unexpected values to third argument \$day***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-02-27 08:34:10"); -$month = 7; -$year = 1963; - -foreach($inputs as $variation =>$day) { - echo "\n-- $variation --\n"; - var_dump( $object->setDate($year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setDate() : usage variation - unexpected values to third argument $day*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1997-04-17 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1929-09-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-20 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setDate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setDate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setDate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setDate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setDate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setDate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setDate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setDate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setDate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setDate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setDate() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setDate() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setDate() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setISODate_error.phpt b/ext/date/tests/DateTime_setISODate_error.phpt deleted file mode 100644 index b228d9f30c..0000000000 --- a/ext/date/tests/DateTime_setISODate_error.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Test DateTime::setISODate () function : error conditions ---FILE-- -<?php - -/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: date_isodate_set - */ - - //Set the default time zone -date_default_timezone_set("Europe/London"); - -$datetime = new DateTime("2009-01-30 19:34:10"); - -echo "*** Testing DateTime::setISODate () : error conditions ***\n"; - -echo "\n-- Testing DateTime::setISODate() function with zero arguments --\n"; -var_dump( $datetime->setISODate() ); - -$year = 2009; -echo "\n-- Testing DateTime::setISODate() function with less than expected no. of arguments --\n"; -var_dump( $datetime->setISODate($year) ); - -echo "\n-- Testing date_isodate_set() function with more than expected no. of arguments --\n"; -$week = 30; -$day = 7; -$extra_arg = 30; -var_dump( $datetime->setISODate($year, $week, $day, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setISODate () : error conditions *** - --- Testing DateTime::setISODate() function with zero arguments -- - -Warning: DateTime::setISODate() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing DateTime::setISODate() function with less than expected no. of arguments -- - -Warning: DateTime::setISODate() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing date_isodate_set() function with more than expected no. of arguments -- - -Warning: DateTime::setISODate() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setISODate_variation1.phpt b/ext/date/tests/DateTime_setISODate_variation1.phpt deleted file mode 100644 index 4d2a32b1f7..0000000000 --- a/ext/date/tests/DateTime_setISODate_variation1.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setISODate() function : usage variation - Passing unexpected values to first argument $year. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: date_isodate_set - */ - -echo "*** Testing DateTime::setISODate() : usage variation - unexpected values to first argument \$year***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-02-27 08:34:10"); -$day = 2; -$month = 7; - -foreach($inputs as $variation =>$year) { - echo "\n-- $variation --\n"; - var_dump( $object->setISODate($year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setISODate() : usage variation - unexpected values to first argument $year*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "12345-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(28) "-12345-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0010-02-16 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "-0010-02-14 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setISODate() expects parameter 1 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setISODate_variation2.phpt b/ext/date/tests/DateTime_setISODate_variation2.phpt deleted file mode 100644 index 01c335991f..0000000000 --- a/ext/date/tests/DateTime_setISODate_variation2.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setISODate() function : usage variation - Passing unexpected values to second argument $week. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: date_isodate_set - */ - -echo "*** Testing DateTime::setISODate() : usage variation - unexpected values to second argument \$week***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$day = 2; -$year = 1963; - -foreach($inputs as $variation =>$month) { - echo "\n-- $variation --\n"; - var_dump( $object->setISODate($year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setISODate() : usage variation - unexpected values to second argument $week*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2199-07-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1726-05-21 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-03-05 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-10-16 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setISODate() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setISODate_variation3.phpt b/ext/date/tests/DateTime_setISODate_variation3.phpt deleted file mode 100644 index 3f0b43d7ff..0000000000 --- a/ext/date/tests/DateTime_setISODate_variation3.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setISODate() function : usage variation - Passing unexpected values to third argument $day. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setISODate ( int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: date_isodate_set - */ - -echo "*** Testing DateTime::setISODate() : usage variation - unexpected values to third argument \$day***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$year = 1963; -$month = 7; - -foreach($inputs as $variation =>$day) { - echo "\n-- $variation --\n"; - var_dump( $object->setISODate($year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setISODate() : usage variation - unexpected values to third argument $day*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1996-11-28 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1929-04-24 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-20 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-31 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setISODate() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setTime_error.phpt b/ext/date/tests/DateTime_setTime_error.phpt deleted file mode 100644 index 4d33cb11fa..0000000000 --- a/ext/date/tests/DateTime_setTime_error.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -Test DateTime::setTime() function : error conditions ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: date_time_set - */ - -date_default_timezone_set("Europe/London"); - -echo "*** Testing DateTime::setTime() : error conditions ***\n"; - -$datetime = date_create("2009-01-31 15:34:10"); - -echo "\n-- Testing DateTime::setTime() function with zero arguments --\n"; -var_dump( $datetime->setTime() ); - -echo "\n-- Testing DateTime::setTime() function with less than expected no. of arguments --\n"; -$hour = 18; -var_dump( $datetime->setTime($hour) ); - -echo "\n-- Testing DateTime::setTime() function with more than expected no. of arguments --\n"; -$min = 15; -$sec = 30; -$extra_arg = 10; -$microseconds = 123123; -var_dump( $datetime->setTime($hour, $min, $sec, $microseconds, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setTime() : error conditions *** - --- Testing DateTime::setTime() function with zero arguments -- - -Warning: DateTime::setTime() expects at least 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing DateTime::setTime() function with less than expected no. of arguments -- - -Warning: DateTime::setTime() expects at least 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing DateTime::setTime() function with more than expected no. of arguments -- - -Warning: DateTime::setTime() expects at most 4 parameters, 5 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setTime_variation1.phpt b/ext/date/tests/DateTime_setTime_variation1.phpt deleted file mode 100644 index dc067a48c3..0000000000 --- a/ext/date/tests/DateTime_setTime_variation1.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setTime() function : usage variation - Passing unexpected values to first argument $hour. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: date_time_set - */ - -echo "*** Testing DateTime::setTime() : usage variation - unexpected values to first argument \$hour***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-01-31 15:14:10"); -$minute = 13; -$sec = 45; - -foreach($inputs as $variation =>$hour) { - echo "\n-- $variation --\n"; - var_dump( $object->setTime($hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setTime() : usage variation - unexpected values to first argument $hour*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 01:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2010-06-29 09:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 15:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 14:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setTime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setTime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setTime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setTime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 01:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 01:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setTime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setTime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setTime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setTime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setTime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setTime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setTime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setTime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setTime() expects parameter 1 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setTime_variation2.phpt b/ext/date/tests/DateTime_setTime_variation2.phpt deleted file mode 100644 index f65966b014..0000000000 --- a/ext/date/tests/DateTime_setTime_variation2.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setTime() function : usage variation - Passing unexpected values to second argument $minute. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: date_time_set - */ - -echo "*** Testing DateTime::setTime() : usage variation - unexpected values to second argument \$minute***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-01-31 15:14:10"); -$hour = 10; -$sec = 45; - -foreach($inputs as $variation =>$minute) { - echo "\n-- $variation --\n"; - var_dump( $object->setTime($hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setTime() : usage variation - unexpected values to second argument $minute*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:01:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-02-08 23:45:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 20:15:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:10:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 09:50:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setTime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setTime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setTime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setTime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:01:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:01:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setTime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setTime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setTime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setTime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setTime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setTime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setTime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setTime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setTime() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setTime_variation3.phpt b/ext/date/tests/DateTime_setTime_variation3.phpt deleted file mode 100644 index a2cbff9f1b..0000000000 --- a/ext/date/tests/DateTime_setTime_variation3.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test DateTime::setTime() function : usage variation - Passing unexpected values to third argument $second. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: date_time_set - */ - -echo "*** Testing DateTime::setTime() : usage variation - unexpected values to third argument \$second***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-01-31 15:14:10"); -$hour = 10; -$minute = 13; - -foreach($inputs as $variation =>$sec) { - echo "\n-- $variation --\n"; - var_dump( $object->setTime($hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setTime() : usage variation - unexpected values to third argument $second*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:01.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 13:38:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 06:47:15.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:12:50.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: DateTime::setTime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setTime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setTime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setTime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:01.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:01.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: DateTime::setTime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setTime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setTime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setTime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setTime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setTime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setTime() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setTime() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: DateTime::setTime() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setTimezone_error.phpt b/ext/date/tests/DateTime_setTimezone_error.phpt deleted file mode 100644 index 2c6e105d63..0000000000 --- a/ext/date/tests/DateTime_setTimezone_error.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Test DateTime::setTimezone () function : error conditions ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setTimezone ( DateTimeZone $timezone ) - * Description: Sets the time zone for the DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: date_timezone_set - */ - -date_default_timezone_set("UTC"); - -echo "*** Testing DateTime::setTimezone () : error conditions ***\n"; - -$datetime = new DateTime("2009-01-30 17:57:32"); - -echo "\n-- Testing DateTime::setTimezone () function with zero arguments --\n"; -var_dump( $datetime->setTimezone() ); - -echo "\n-- Testing DateTime::setTimezone () function with more than expected no. of arguments --\n"; -$timezone = new DateTimezone("GMT"); -$extra_arg = 99; -var_dump( $datetime->setTimezone($timezone, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setTimezone () : error conditions *** - --- Testing DateTime::setTimezone () function with zero arguments -- - -Warning: DateTime::setTimezone() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing DateTime::setTimezone () function with more than expected no. of arguments -- - -Warning: DateTime::setTimezone() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_setTimezone_variation1.phpt b/ext/date/tests/DateTime_setTimezone_variation1.phpt deleted file mode 100644 index 6eace15116..0000000000 --- a/ext/date/tests/DateTime_setTimezone_variation1.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -Test DateTime::setTimezone() function : usage variation - Passing unexpected values to first argument $timezone. ---FILE-- -<?php -/* Prototype : public DateTime DateTime::setTimezone ( DateTimeZone $timezone ) - * Description: Sets the time zone for the DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: date_timezone_set - */ - -echo "*** Testing DateTime::setTimezone() : usage variation - unexpected values to first argument \$timezone***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTime("2009-01-30 17:57:32"); - -foreach($inputs as $variation =>$timezone) { - echo "\n-- $variation --\n"; - var_dump( $object->setTimezone($timezone) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing DateTime::setTimezone() : usage variation - unexpected values to first argument $timezone*** - --- int 0 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- resource -- - -Warning: DateTime::setTimezone() expects parameter 1 to be DateTimeZone, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/DateTime_set_state.phpt b/ext/date/tests/DateTime_set_state.phpt new file mode 100644 index 0000000000..cca8e3753d --- /dev/null +++ b/ext/date/tests/DateTime_set_state.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test __set_state magic method for recreating a DateTime object +--CREDITS-- +Mark Baker mark@lange.demon.co.uk at the PHPNW2017 Conference for PHP Testfest 2017 +--FILE-- +<?php + +$datettimeObject = new DateTime('2017-10-06 23:30:00', new DateTimezone('UTC')); + +$datetimeState = var_export($datettimeObject, true); + +eval("\$datetimeObjectNew = {$datetimeState};"); + +var_dump($datetimeObjectNew); + +?> +--EXPECTF-- +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2017-10-06 23:30:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} diff --git a/ext/date/tests/DateTime_verify.phpt b/ext/date/tests/DateTime_verify.phpt deleted file mode 100644 index 16d7ad3275..0000000000 --- a/ext/date/tests/DateTime_verify.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test DateTime class registration ---FILE-- -<?php - -echo "*** Verify DateTime class ***\n"; - -echo "Verify DateTime class registered OK\n"; -$class = new ReflectionClass('DateTime'); -var_dump($class); - -echo "..and get names of all its methods\n"; -$methods = $class->getMethods(); -var_dump($methods); - -echo "..and get names of all its class constants\n"; -$constants = $class->getConstants(); -var_dump($constants); - -echo "..and get __set_state arguments\n"; -$method = new ReflectionMethod('DateTime', '__set_state'); -var_dump($method->getParameters()); -var_dump($method->getParameters()[0]->isOptional()); - -?> -===DONE=== ---EXPECTF-- -*** Verify DateTime class *** -Verify DateTime class registered OK -object(ReflectionClass)#%d (1) { - ["name"]=> - string(8) "DateTime" -} -..and get names of all its methods -array(19) { - [0]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "__construct" - ["class"]=> - string(8) "DateTime" - } - [1]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(8) "__wakeup" - ["class"]=> - string(8) "DateTime" - } - [2]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "__set_state" - ["class"]=> - string(8) "DateTime" - } - [3]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(19) "createFromImmutable" - ["class"]=> - string(8) "DateTime" - } - [4]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(16) "createFromFormat" - ["class"]=> - string(8) "DateTime" - } - [5]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(13) "getLastErrors" - ["class"]=> - string(8) "DateTime" - } - [6]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(6) "format" - ["class"]=> - string(8) "DateTime" - } - [7]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(6) "modify" - ["class"]=> - string(8) "DateTime" - } - [8]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(3) "add" - ["class"]=> - string(8) "DateTime" - } - [9]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(3) "sub" - ["class"]=> - string(8) "DateTime" - } - [10]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "getTimezone" - ["class"]=> - string(8) "DateTime" - } - [11]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "setTimezone" - ["class"]=> - string(8) "DateTime" - } - [12]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(9) "getOffset" - ["class"]=> - string(8) "DateTime" - } - [13]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(7) "setTime" - ["class"]=> - string(8) "DateTime" - } - [14]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(7) "setDate" - ["class"]=> - string(8) "DateTime" - } - [15]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(10) "setISODate" - ["class"]=> - string(8) "DateTime" - } - [16]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(12) "setTimestamp" - ["class"]=> - string(8) "DateTime" - } - [17]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(12) "getTimestamp" - ["class"]=> - string(8) "DateTime" - } - [18]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(4) "diff" - ["class"]=> - string(8) "DateTime" - } -} -..and get names of all its class constants -array(13) { - ["ATOM"]=> - string(13) "Y-m-d\TH:i:sP" - ["COOKIE"]=> - string(16) "l, d-M-Y H:i:s T" - ["ISO8601"]=> - string(13) "Y-m-d\TH:i:sO" - ["RFC822"]=> - string(16) "D, d M y H:i:s O" - ["RFC850"]=> - string(16) "l, d-M-y H:i:s T" - ["RFC1036"]=> - string(16) "D, d M y H:i:s O" - ["RFC1123"]=> - string(16) "D, d M Y H:i:s O" - ["RFC7231"]=> - string(21) "D, d M Y H:i:s \G\M\T" - ["RFC2822"]=> - string(16) "D, d M Y H:i:s O" - ["RFC3339"]=> - string(13) "Y-m-d\TH:i:sP" - ["RFC3339_EXTENDED"]=> - string(15) "Y-m-d\TH:i:s.vP" - ["RSS"]=> - string(16) "D, d M Y H:i:s O" - ["W3C"]=> - string(13) "Y-m-d\TH:i:sP" -} -..and get __set_state arguments -array(1) { - [0]=> - object(ReflectionParameter)#%d (1) { - ["name"]=> - string(5) "array" - } -} -bool(false) -===DONE=== diff --git a/ext/date/tests/big_year.phpt b/ext/date/tests/big_year.phpt index 07440179ef..e1bc87fd54 100644 --- a/ext/date/tests/big_year.phpt +++ b/ext/date/tests/big_year.phpt @@ -1,7 +1,7 @@ --TEST-- Handling of large year values --SKIPIF-- -<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?> --FILE-- <?php date_default_timezone_set("America/Toronto"); diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt index 27d6ff1250..652cc67879 100644 --- a/ext/date/tests/bug26317.phpt +++ b/ext/date/tests/bug26317.phpt @@ -3,9 +3,11 @@ Bug #26317 (military timezone offset signedness) --INI-- date.timezone=GMT0 --SKIPIF-- +<?php if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { die("skip unable to change TZ environment variable\n"); } +?> --FILE-- <?php echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z")); diff --git a/ext/date/tests/bug26320.phpt b/ext/date/tests/bug26320.phpt index e742c39da5..48e901117c 100644 --- a/ext/date/tests/bug26320.phpt +++ b/ext/date/tests/bug26320.phpt @@ -3,9 +3,11 @@ Bug #26320 (strtotime handling of XML Schema/ISO 8601 format) --INI-- date.timezone=GMT0 --SKIPIF-- +<?php if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { die("skip unable to change TZ environment variable\n"); } +?> --FILE-- <?php echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42")); diff --git a/ext/date/tests/bug41523-64bit.phpt b/ext/date/tests/bug41523-64bit.phpt index 0c0e8076c3..ca01ee0f50 100644 --- a/ext/date/tests/bug41523-64bit.phpt +++ b/ext/date/tests/bug41523-64bit.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (64 bit) --SKIPIF-- -<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?> --FILE-- <?php date_default_timezone_set("UTC"); diff --git a/ext/date/tests/bug41523.phpt b/ext/date/tests/bug41523.phpt index 68fe1bd6a3..6df2006d57 100644 --- a/ext/date/tests/bug41523.phpt +++ b/ext/date/tests/bug41523.phpt @@ -1,7 +1,7 @@ --TEST-- Bug #41523 (strtotime('0000-00-00 00:00:00') is parsed as 1999-11-30) (32 bit) --SKIPIF-- -<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE == 8) die("skip 32-bit only"); ?> --FILE-- <?php date_default_timezone_set("UTC"); diff --git a/ext/date/tests/bug48187.phpt b/ext/date/tests/bug48187.phpt deleted file mode 100644 index 6dc0f8b56a..0000000000 --- a/ext/date/tests/bug48187.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #48187 (DateTime::diff() corrupting microtime() result) ---FILE-- -<?php -date_default_timezone_set('UTC'); - -// two arbitrary dates -$date1 = new DateTime('2005-07-23'); -$date2 = new DateTime('2006-02-14'); - -$begin_u = microtime(true); -$begin_t = time(); - -if (microtime(true) - $begin_u < 1) { - var_dump('microtime() difference less 1 second'); -} else { - var_dump('microtime() difference greater or equal 1 second'); -} - -if (time() - $begin_t < 1) { - var_dump('time() difference less 1 second'); -} else { - var_dump('time() difference greater or equal 1 second'); -} -?> ---EXPECT-- -string(36) "microtime() difference less 1 second" -string(31) "time() difference less 1 second" diff --git a/ext/date/tests/bug52113.phpt b/ext/date/tests/bug52113.phpt index dfc7d6112d..f6d0962625 100644 --- a/ext/date/tests/bug52113.phpt +++ b/ext/date/tests/bug52113.phpt @@ -32,8 +32,8 @@ $p = new DatePeriod($start, $diff_un, 2); var_dump($unser, $p); ?> ---EXPECT-- -object(DateInterval)#3 (16) { +--EXPECTF-- +object(DateInterval)#%d (16) { ["y"]=> int(0) ["m"]=> @@ -85,7 +85,7 @@ DateInterval::__set_state(array( 'special_amount' => 0, 'have_weekday_relative' => 0, 'have_special_relative' => 0, -))object(DateInterval)#5 (16) { +))object(DateInterval)#%d (16) { ["y"]=> int(0) ["m"]=> @@ -119,9 +119,9 @@ DateInterval::__set_state(array( ["have_special_relative"]=> int(0) } -object(DatePeriod)#6 (6) { +object(DatePeriod)#%d (6) { ["start"]=> - object(DateTime)#4 (3) { + object(DateTime)#%d (3) { ["date"]=> string(26) "2003-01-02 08:00:00.000000" ["timezone_type"]=> @@ -134,7 +134,7 @@ object(DatePeriod)#6 (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#7 (16) { + object(DateInterval)#%d (16) { ["y"]=> int(0) ["m"]=> @@ -173,7 +173,7 @@ object(DatePeriod)#6 (6) { ["include_start_date"]=> bool(true) } -object(DateInterval)#8 (16) { +object(DateInterval)#%d (16) { ["y"]=> int(7) ["m"]=> @@ -207,9 +207,9 @@ object(DateInterval)#8 (16) { ["have_special_relative"]=> int(0) } -object(DatePeriod)#9 (6) { +object(DatePeriod)#%d (6) { ["start"]=> - object(DateTime)#6 (3) { + object(DateTime)#%d (3) { ["date"]=> string(26) "2003-01-02 08:00:00.000000" ["timezone_type"]=> @@ -222,7 +222,7 @@ object(DatePeriod)#9 (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#7 (16) { + object(DateInterval)#%d (16) { ["y"]=> int(0) ["m"]=> diff --git a/ext/date/tests/bug65672.phpt b/ext/date/tests/bug65672.phpt index a84cff69ae..a01287d9b4 100644 --- a/ext/date/tests/bug65672.phpt +++ b/ext/date/tests/bug65672.phpt @@ -28,6 +28,9 @@ $period->dynamic2 = []; $period->dynamic2[] = "array"; var_dump($period->dynamic2); +$period->dynamic3[] = "array"; +var_dump($period->dynamic3); + ?> --EXPECT-- string(5) "stuff" @@ -42,3 +45,7 @@ array(1) { [0]=> string(5) "array" } +array(1) { + [0]=> + string(5) "array" +} diff --git a/ext/date/tests/bug70810.phpt b/ext/date/tests/bug70810.phpt new file mode 100644 index 0000000000..1918e56f90 --- /dev/null +++ b/ext/date/tests/bug70810.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #70810: DateInterval equals every other DateInterval +--FILE-- +<?php + +$i1 = new DateInterval('P1D'); +$i2 = new DateInterval('PT1H'); +var_dump($i1 == $i2); +var_dump($i1 < $i2); +var_dump($i1 > $i2); + +$i2 = new DateInterval('P1D'); +var_dump($i1 == $i2); +var_dump($i1 < $i2); +var_dump($i1 > $i2); + +?> +--EXPECTF-- +Warning: Cannot compare DateInterval objects in %s on line %d +bool(false) + +Warning: Cannot compare DateInterval objects in %s on line %d +bool(false) + +Warning: Cannot compare DateInterval objects in %s on line %d +bool(false) + +Warning: Cannot compare DateInterval objects in %s on line %d +bool(false) + +Warning: Cannot compare DateInterval objects in %s on line %d +bool(false) + +Warning: Cannot compare DateInterval objects in %s on line %d +bool(false) diff --git a/ext/date/tests/bug74639.phpt b/ext/date/tests/bug74639.phpt index 43eccc974d..7a9c31e530 100644 --- a/ext/date/tests/bug74639.phpt +++ b/ext/date/tests/bug74639.phpt @@ -19,10 +19,6 @@ if ($period->getEndDate() != $clonedPeriod->getEndDate()) { echo "failure\n"; } -if ($period->getDateInterval() != $clonedPeriod->getDateInterval()) { - echo "failure\n"; -} - if ($interval->format('Y-m-d H:i:s') != $clonedInterval->format('Y-m-d H:i:s')) { echo "failure\n"; } diff --git a/ext/date/tests/bug75232.phpt b/ext/date/tests/bug75232.phpt new file mode 100644 index 0000000000..9200f65e91 --- /dev/null +++ b/ext/date/tests/bug75232.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #75232: print_r of DateTime creating side-effect +--INI-- +date.timezone=UTC +--FILE-- +<?php + +$d1 = DateTime::createFromFormat("Ymd\THis\Z", '20170920T091600Z'); +echo $d1->date, "\n"; + +$d2 = DateTime::createFromFormat("Ymd\THis\Z", '20170920T091600Z'); +print_r($d2); +echo $d2->date, "\n"; + +?> +--EXPECTF-- +Notice: Undefined property: DateTime::$date in %s on line %d + +DateTime Object +( + [date] => 2017-09-20 09:16:00.000000 + [timezone_type] => 3 + [timezone] => UTC +) + +Notice: Undefined property: DateTime::$date in %s on line %d diff --git a/ext/date/tests/bug75851.phpt b/ext/date/tests/bug75851.phpt index 59bdb054ff..d447792b93 100644 --- a/ext/date/tests/bug75851.phpt +++ b/ext/date/tests/bug75851.phpt @@ -1,7 +1,7 @@ --TEST-- Test for bug #75851: Year component overflow with date formats "c", "o", "r" and "y" --SKIPIF-- -<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?> --INI-- date.timezone = UTC --FILE-- diff --git a/ext/date/tests/bug77097.phpt b/ext/date/tests/bug77097.phpt index effaad4900..080982d681 100644 --- a/ext/date/tests/bug77097.phpt +++ b/ext/date/tests/bug77097.phpt @@ -17,7 +17,7 @@ var_dump($diff->invert, $diff->s, $diff->f); $diff = $ago->diff($now, true); var_dump($diff->invert, $diff->s, $diff->f); ?> ---EXPECTF-- +--EXPECT-- int(1) int(0) float(0.781751) diff --git a/ext/date/tests/bug78383.phpt b/ext/date/tests/bug78383.phpt new file mode 100644 index 0000000000..dc1b702fa7 --- /dev/null +++ b/ext/date/tests/bug78383.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #78383: Casting a DateTime to array no longer returns its properties +--FILE-- +<?php + +var_dump((array) new DateTime('2000-01-01 UTC')); +var_dump((array) new DateTimeZone('Europe/Berlin')); + +?> +--EXPECT-- +array(3) { + ["date"]=> + string(26) "2000-01-01 00:00:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} +array(2) { + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/Berlin" +} diff --git a/ext/date/tests/checkdate_error.phpt b/ext/date/tests/checkdate_error.phpt deleted file mode 100644 index a96aa50f2c..0000000000 --- a/ext/date/tests/checkdate_error.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -Test checkdate() function : error conditions ---FILE-- -<?php -/* Prototype : bool checkdate ( int $month , int $day , int $year ) - * Description: Validate a Gregorian date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing checkdate() : error conditions ***\n"; - -//Set the default time zone -date_default_timezone_set("America/Chicago"); - -$arg_0 = 1; -$arg_1 = 1; -$arg_2 = 1; -$extra_arg = 1; - -echo "\n-- Testing checkdate() function with more than expected no. of arguments --\n"; -var_dump (checkdate($arg_0, $arg_1, $arg_2, $extra_arg)); - -echo "\n-- Testing checkdate() function with less than expected no. of arguments --\n"; -var_dump (checkdate()); -var_dump (checkdate($arg_0)); -var_dump (checkdate($arg_0, $arg_1)); - -?> -===DONE=== ---EXPECTF-- -*** Testing checkdate() : error conditions *** - --- Testing checkdate() function with more than expected no. of arguments -- - -Warning: checkdate() expects exactly 3 parameters, 4 given in %s on line %d -bool(false) - --- Testing checkdate() function with less than expected no. of arguments -- - -Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d -bool(false) - -Warning: checkdate() expects exactly 3 parameters, 1 given in %s on line %d -bool(false) - -Warning: checkdate() expects exactly 3 parameters, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/checkdate_variation1.phpt b/ext/date/tests/checkdate_variation1.phpt deleted file mode 100644 index 8913963de0..0000000000 --- a/ext/date/tests/checkdate_variation1.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -Test checkdate() function : usage variation - Passing unexpected values to first argument $month. ---FILE-- -<?php -/* Prototype : bool checkdate ( int $month , int $day , int $year ) - * Description: Checks the validity of the date formed by the arguments. - * A date is considered valid if each parameter is properly defined. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing checkdate() : usage variation - unexpected values to first argument \$month***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$day = 2; -$year = 1963; - -foreach($inputs as $variation =>$month) { - echo "\n-- $variation --\n"; - var_dump( checkdate($month, $day, $year) ); -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing checkdate() : usage variation - unexpected values to first argument $month*** - --- float 10.5 -- -bool(true) - --- float -10.5 -- -bool(false) - --- float .5 -- -bool(false) - --- empty array -- - -Warning: checkdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: checkdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: checkdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: checkdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -bool(false) - --- lowercase null -- -bool(false) - --- lowercase true -- -bool(true) - --- lowercase false -- -bool(false) - --- uppercase TRUE -- -bool(true) - --- uppercase FALSE -- -bool(false) - --- empty string DQ -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: checkdate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: checkdate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -bool(false) - --- unset var -- -bool(false) - --- resource -- - -Warning: checkdate() expects parameter 1 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/checkdate_variation2.phpt b/ext/date/tests/checkdate_variation2.phpt deleted file mode 100644 index 8f555314bd..0000000000 --- a/ext/date/tests/checkdate_variation2.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -Test checkdate() function : usage variation - Passing unexpected values to second argument $day. ---FILE-- -<?php -/* Prototype : bool checkdate ( int $month , int $day , int $year ) - * Description: Checks the validity of the date formed by the arguments. - * A date is considered valid if each parameter is properly defined. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing checkdate() : usage variation - unexpected values to second argument \$day***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$month = 7; -$year = 1963; - -foreach($inputs as $variation =>$day) { - echo "\n-- $variation --\n"; - var_dump( checkdate($month, $day, $year) ); -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing checkdate() : usage variation - unexpected values to second argument $day*** - --- float 10.5 -- -bool(true) - --- float -10.5 -- -bool(false) - --- float .5 -- -bool(false) - --- empty array -- - -Warning: checkdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: checkdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: checkdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: checkdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -bool(false) - --- lowercase null -- -bool(false) - --- lowercase true -- -bool(true) - --- lowercase false -- -bool(false) - --- uppercase TRUE -- -bool(true) - --- uppercase FALSE -- -bool(false) - --- empty string DQ -- - -Warning: checkdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: checkdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: checkdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: checkdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: checkdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: checkdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: checkdate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: checkdate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -bool(false) - --- unset var -- -bool(false) - --- resource -- - -Warning: checkdate() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/checkdate_variation3.phpt b/ext/date/tests/checkdate_variation3.phpt deleted file mode 100644 index 87b7fdac63..0000000000 --- a/ext/date/tests/checkdate_variation3.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -Test checkdate() function : usage variation - Passing unexpected values to third argument $year. ---FILE-- -<?php -/* Prototype : bool checkdate ( int $month , int $day , int $year ) - * Description: Checks the validity of the date formed by the arguments. - * A date is considered valid if each parameter is properly defined. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing checkdate() : usage variation - unexpected values to third argument \$year***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$day = 2; -$month = 7; - -foreach($inputs as $variation =>$year) { - echo "\n-- $variation --\n"; - var_dump( checkdate($month, $day, $year) ); -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing checkdate() : usage variation - unexpected values to third argument $year*** - --- float 10.5 -- -bool(true) - --- float -10.5 -- -bool(false) - --- float .5 -- -bool(false) - --- empty array -- - -Warning: checkdate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: checkdate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: checkdate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: checkdate() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -bool(false) - --- lowercase null -- -bool(false) - --- lowercase true -- -bool(true) - --- lowercase false -- -bool(false) - --- uppercase TRUE -- -bool(true) - --- uppercase FALSE -- -bool(false) - --- empty string DQ -- - -Warning: checkdate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: checkdate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: checkdate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: checkdate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: checkdate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: checkdate() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: checkdate() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: checkdate() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -bool(false) - --- unset var -- -bool(false) - --- resource -- - -Warning: checkdate() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_add_basic2.phpt b/ext/date/tests/date_add_basic2.phpt deleted file mode 100644 index a54c63658e..0000000000 --- a/ext/date/tests/date_add_basic2.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -date_add() return false with wrong params ---CREDITS-- -"Anna Filina" <afilina@phpquebec.org> -#PHPTestFest2009 2009-05-02 ---INI-- -date.timezone=UTC -display_errors=false ---FILE-- -<?php -var_dump(date_add()); // invalid parameters -?> ---EXPECT-- -bool(false) diff --git a/ext/date/tests/date_create_error.phpt b/ext/date/tests/date_create_error.phpt deleted file mode 100644 index fb468225fe..0000000000 --- a/ext/date/tests/date_create_error.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Test date_create() function : error conditions ---FILE-- -<?php -/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] ) - * Description: Returns new DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::__construct - */ - -echo "*** Testing date_create() : error conditions ***\n"; - -echo "\n-- Testing date_create() function with more than expected no. of arguments --\n"; -$time = "GMT"; -$timezone = timezone_open("GMT"); -$extra_arg = 99; -var_dump( date_create($time, $timezone, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_create() : error conditions *** - --- Testing date_create() function with more than expected no. of arguments -- - -Warning: date_create() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_create_from_format_basic.phpt b/ext/date/tests/date_create_from_format_basic.phpt deleted file mode 100644 index 823a4ccbeb..0000000000 --- a/ext/date/tests/date_create_from_format_basic.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -date_create_from_format() return false with wrong params ---CREDITS-- -"Anna Filina" <afilina@phpquebec.org> -#PHPTestFest2009 2009-05-02 ---INI-- -date.timezone=UTC -display_errors=false ---FILE-- -<?php -var_dump(date_create_from_format()); // invalid parameters -?> ---EXPECT-- -bool(false) diff --git a/ext/date/tests/date_create_variation1.phpt b/ext/date/tests/date_create_variation1.phpt deleted file mode 100644 index 8166ffa019..0000000000 --- a/ext/date/tests/date_create_variation1.phpt +++ /dev/null @@ -1,389 +0,0 @@ ---TEST-- -Test date_create() function : usage variation - Passing unexpected values to first argument $time. ---FILE-- -<?php -/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] ) - * Description: Returns new DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::__construct - */ - -echo "*** Testing date_create() : usage variation - unexpected values to first argument \$time***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$timezone = new DateTimeZone("Europe/London"); - -foreach($inputs as $variation =>$time) { - echo "\n-- $variation --\n"; - var_dump( date_create($time) ); - var_dump( date_create($time, $timezone) ); -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_create() : usage variation - unexpected values to first argument $time*** - --- int 0 -- -bool(false) -bool(false) - --- int 1 -- -bool(false) -bool(false) - --- int 12345 -- -bool(false) -bool(false) - --- int -12345 -- -bool(false) -bool(false) - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -bool(false) -bool(false) - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: date_create() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -bool(false) -bool(false) - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -bool(false) -bool(false) - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string SQ -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- string DQ -- -bool(false) -bool(false) - --- string SQ -- -bool(false) -bool(false) - --- mixed case string -- -bool(false) -bool(false) - --- heredoc -- -bool(false) -bool(false) - --- instance of classWithToString -- -bool(false) -bool(false) - --- instance of classWithoutToString -- - -Warning: date_create() expects parameter 1 to be string, object given in %s on line %d -bool(false) - -Warning: date_create() expects parameter 1 to be string, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} -object(DateTime)#%d (3) { - ["date"]=> - string(26) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_create() expects parameter 1 to be string, resource given in %s on line %d -bool(false) - -Warning: date_create() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_create_variation2.phpt b/ext/date/tests/date_create_variation2.phpt deleted file mode 100644 index 32495913b7..0000000000 --- a/ext/date/tests/date_create_variation2.phpt +++ /dev/null @@ -1,272 +0,0 @@ ---TEST-- -Test date_create() function : usage variation - Passing unexpected values to second argument $timezone. ---FILE-- -<?php -/* Prototype : DateTime date_create ([ string $time [, DateTimeZone $timezone ]] ) - * Description: Returns new DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::__construct - */ - -echo "*** Testing date_create() : usage variation - unexpected values to second argument \$timezone***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$time = "2005-07-14 22:30:41"; - -foreach($inputs as $variation =>$timezone) { - echo "\n-- $variation --\n"; - var_dump( date_create($time, $timezone) ); -}; - -// closing the resource -fclose( $file_handle); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_create() : usage variation - unexpected values to second argument $timezone*** - --- int 0 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2005-07-14 22:30:41.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_create() expects parameter 2 to be DateTimeZone, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_date_set_error.phpt b/ext/date/tests/date_date_set_error.phpt deleted file mode 100644 index 383249cd9a..0000000000 --- a/ext/date/tests/date_date_set_error.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Test date_date_set() function : error conditions ---FILE-- -<?php -/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setDate - */ - -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_date_set() : error conditions ***\n"; - -echo "\n-- Testing date_date_set() function with zero arguments --\n"; -var_dump( date_date_set() ); - -echo "\n-- Testing date_date_set() function with less than expected no. of arguments --\n"; -$datetime = date_create("2009-01-30 19:34:10"); -$year = 2009; -$month = 1; -$day = 30; -var_dump( date_date_set($datetime) ); -var_dump( date_date_set($datetime, $year) ); -var_dump( date_date_set($datetime, $year, $month) ); - -echo "\n-- Testing date_date_set() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( date_date_set($datetime, $year, $month, $day, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_date_set() : error conditions *** - --- Testing date_date_set() function with zero arguments -- - -Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d -bool(false) - --- Testing date_date_set() function with less than expected no. of arguments -- - -Warning: date_date_set() expects exactly 4 parameters, 1 given in %s on line %d -bool(false) - -Warning: date_date_set() expects exactly 4 parameters, 2 given in %s on line %d -bool(false) - -Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d -bool(false) - --- Testing date_date_set() function with more than expected no. of arguments -- - -Warning: date_date_set() expects exactly 4 parameters, 5 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_date_set_variation1.phpt b/ext/date/tests/date_date_set_variation1.phpt deleted file mode 100644 index cdfc56cfad..0000000000 --- a/ext/date/tests/date_date_set_variation1.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test date_date_set() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setDate - */ - -echo "*** Testing date_date_set() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$day = 2; -$month = 7; -$year = 1963; - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_date_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_date_set() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_date_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_date_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_date_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_date_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_date_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_date_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_date_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_date_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_date_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_date_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_date_set() expects parameter 1 to be DateTime, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_date_set_variation2.phpt b/ext/date/tests/date_date_set_variation2.phpt deleted file mode 100644 index 6522b7a7e8..0000000000 --- a/ext/date/tests/date_date_set_variation2.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_date_set() function : usage variation - Passing unexpected values to second argument $year. ---FILE-- -<?php -/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setDate - */ - -echo "*** Testing date_date_set() : usage variation - unexpected values to second argument \$year***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$day = 2; -$month = 7; - -foreach($inputs as $variation =>$year) { - echo "\n-- $variation --\n"; - var_dump( date_date_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_date_set() : usage variation - unexpected values to second argument $year*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "12345-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(28) "-12345-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0010-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "-0010-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_date_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_date_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_date_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_date_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-07-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_date_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_date_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_date_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_date_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_date_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_date_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_date_set() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_date_set() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(%d) "%s" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_date_set() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_date_set_variation3.phpt b/ext/date/tests/date_date_set_variation3.phpt deleted file mode 100644 index c63a339cc7..0000000000 --- a/ext/date/tests/date_date_set_variation3.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_date_set() function : usage variation - Passing unexpected values to third argument $month. ---FILE-- -<?php -/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setDate - */ - -echo "*** Testing date_date_set() : usage variation - unexpected values to third argument \$month***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$day = 2; -$year = 1963; - -foreach($inputs as $variation =>$month) { - echo "\n-- $variation --\n"; - var_dump( date_date_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_date_set() : usage variation - unexpected values to third argument $month*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2991-09-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0934-03-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-10-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-02-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_date_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_date_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_date_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_date_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_date_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_date_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_date_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_date_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_date_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_date_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_date_set() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_date_set() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-02 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_date_set() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_date_set_variation4.phpt b/ext/date/tests/date_date_set_variation4.phpt deleted file mode 100644 index de02a2a42c..0000000000 --- a/ext/date/tests/date_date_set_variation4.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_date_set() function : usage variation - Passing unexpected values to forth argument $day. ---FILE-- -<?php -/* Prototype : DateTime date_date_set ( DateTime $object , int $year , int $month , int $day ) - * Description: Resets the current date of the DateTime object to a different date. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setDate - */ - -echo "*** Testing date_date_set() : usage variation - unexpected values to forth argument \$day***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$month = 7; -$year = 1963; - -foreach($inputs as $variation =>$day) { - echo "\n-- $variation --\n"; - var_dump( date_date_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_date_set() : usage variation - unexpected values to forth argument $day*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1997-04-17 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1929-09-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-20 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_date_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_date_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_date_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_date_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-07-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_date_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_date_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_date_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_date_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_date_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_date_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_date_set() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_date_set() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-06-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_date_set() expects parameter 4 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_default_timezone_get-1-win32.phpt b/ext/date/tests/date_default_timezone_get-1-win32.phpt deleted file mode 100644 index 73003fb689..0000000000 --- a/ext/date/tests/date_default_timezone_get-1-win32.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -date_default_timezone_get() function [1] ---SKIPIF-- -<?php - if(substr(PHP_OS, 0, 3) != 'WIN') die("skip skip on non windows"); -?> ---INI-- -date.timezone= ---FILE-- -<?php - putenv('TZ='); - echo date_default_timezone_get(), "\n"; - echo date('e'), "\n"; - /* The behaviour on windows is to select an arbitrary timezone name from the current system settings. - This gives no chance to hardcode the timezone name, for instance for UTC+1 it could choose - from the multiple names like Europe/Berlin or Europe/Paris . For this reason the test is - parametrized so there is no hardcoded timezone data.*/ -?> ---EXPECT-- -UTC -UTC diff --git a/ext/date/tests/date_default_timezone_get_error.phpt b/ext/date/tests/date_default_timezone_get_error.phpt deleted file mode 100644 index bb9c2c4d95..0000000000 --- a/ext/date/tests/date_default_timezone_get_error.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test date_default_timezone_get() function : error conditions ---FILE-- -<?php -/* Prototype : string date_default_timezone_get ( void ) - * Description: Gets the default timezone used by all date/time functions in a script. - * Source code: ext/standard/data/php_date.c - */ - -date_default_timezone_set("UTC"); - -echo "*** Testing date_default_timezone_get() : error conditions ***\n"; - -echo "\n-- Testing date_create() function with more than expected no. of arguments --\n"; -$extra_arg = 99; -var_dump( date_default_timezone_get($extra_arg)); - -?> - -===Done=== ---EXPECTF-- -*** Testing date_default_timezone_get() : error conditions *** - --- Testing date_create() function with more than expected no. of arguments -- - -Warning: date_default_timezone_get() expects exactly 0 parameters, 1 given in %sdate_default_timezone_get_error.php on line %d -NULL - -===Done=== diff --git a/ext/date/tests/date_default_timezone_set_variation1.phpt b/ext/date/tests/date_default_timezone_set_variation1.phpt deleted file mode 100644 index ea6057b6ce..0000000000 --- a/ext/date/tests/date_default_timezone_set_variation1.phpt +++ /dev/null @@ -1,200 +0,0 @@ ---TEST-- -Test date_default_timezone_set() function : usage variations - Passing unexpected values for time_zone identifier ---FILE-- -<?php -/* Prototype : bool date_default_timezone_set ( string $timezone_identifier ) - * Description: Sets the default timezone used by all date/time functions in a script. - * Source code: ext/standard/data/php_date.c - */ - -echo "*** Testing date_default_timezone_set() : usage variations ***\n"; -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "abcxyz", - 'abcxyz', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behaviour of date_default_timezone_set() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(date_default_timezone_set($input)); - $iterator++; -}; -?> -===Done=== ---EXPECTF-- -*** Testing date_default_timezone_set() : usage variations *** - --- Iteration 1 -- - -Notice: date_default_timezone_set(): Timezone ID '0' is invalid in %s on line %d -bool(false) - --- Iteration 2 -- - -Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d -bool(false) - --- Iteration 3 -- - -Notice: date_default_timezone_set(): Timezone ID '12345' is invalid in %s on line %d -bool(false) - --- Iteration 4 -- - -Notice: date_default_timezone_set(): Timezone ID '-2345' is invalid in %s on line %d -bool(false) - --- Iteration 5 -- - -Notice: date_default_timezone_set(): Timezone ID '10.5' is invalid in %s on line %d -bool(false) - --- Iteration 6 -- - -Notice: date_default_timezone_set(): Timezone ID '-10.5' is invalid in %s on line %d -bool(false) - --- Iteration 7 -- - -Notice: date_default_timezone_set(): Timezone ID '123456789000' is invalid in %s on line %d -bool(false) - --- Iteration 8 -- - -Notice: date_default_timezone_set(): Timezone ID '1.23456789E-9' is invalid in %s on line %d -bool(false) - --- Iteration 9 -- - -Notice: date_default_timezone_set(): Timezone ID '0.5' is invalid in %s on line %d -bool(false) - --- Iteration 10 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 11 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 12 -- - -Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d -bool(false) - --- Iteration 13 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 14 -- - -Notice: date_default_timezone_set(): Timezone ID '1' is invalid in %s on line %d -bool(false) - --- Iteration 15 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 16 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 17 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 18 -- - -Warning: date_default_timezone_set() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- Iteration 19 -- - -Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d -bool(false) - --- Iteration 20 -- - -Notice: date_default_timezone_set(): Timezone ID 'abcxyz' is invalid in %s on line %d -bool(false) - --- Iteration 21 -- - -Notice: date_default_timezone_set(): Timezone ID 'abc -xyz' is invalid in %s on line %d -bool(false) - --- Iteration 22 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 23 -- - -Notice: date_default_timezone_set(): Timezone ID '' is invalid in %s on line %d -bool(false) - --- Iteration 24 -- - -Warning: date_default_timezone_set() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===Done=== diff --git a/ext/date/tests/date_error.phpt b/ext/date/tests/date_error.phpt deleted file mode 100644 index 167cbf0164..0000000000 --- a/ext/date/tests/date_error.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Test date() function : error conditions ---FILE-- -<?php -/* Prototype : string date ( string $format [, int $timestamp ] ) - * Description: Format a local time/date. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date() : error conditions ***\n"; - -//Set the default time zone -date_default_timezone_set("America/Chicago"); - -$format = "m.d.y"; -$timestamp = mktime(10, 44, 30, 2, 27, 2009); - -echo "\n-- Testing date function with no arguments --\n"; -var_dump (date()); - -echo "\n-- Testing date function with more than expected no. of arguments --\n"; -$extra_arg = true; -var_dump (checkdate($format, $timestamp, $extra_arg)); - -?> -===DONE=== ---EXPECTF-- -*** Testing date() : error conditions *** - --- Testing date function with no arguments -- - -Warning: date() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date function with more than expected no. of arguments -- - -Warning: checkdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_format_error.phpt b/ext/date/tests/date_format_error.phpt deleted file mode 100644 index 360420517d..0000000000 --- a/ext/date/tests/date_format_error.phpt +++ /dev/null @@ -1,67 +0,0 @@ ---TEST-- -Test date_format() function : error conditions ---FILE-- -<?php -/* Prototype : string date_format ( DateTime $object , string $format ) - * Description: Returns date formatted according to given format - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::format - */ - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_format() : error conditions ***\n"; - -echo "\n-- Testing date_create() function with zero arguments --\n"; -var_dump( date_format() ); - -$date = date_create("2005-07-14 22:30:41"); - -echo "\n-- Testing date_create() function with less than expected no. of arguments --\n"; -var_dump( date_format($date) ); - -echo "\n-- Testing date_create() function with more than expected no. of arguments --\n"; -$format = "F j, Y, g:i a"; -$extra_arg = 10; -var_dump( date_format($date, $format, $extra_arg) ); - -echo "\n-- Testing date_create() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_format($invalid_obj, $format) ); -$invalid_obj = 10; -var_dump( date_format($invalid_obj, $format) ); -$invalid_obj = null; -var_dump( date_format($invalid_obj, $format) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_format() : error conditions *** - --- Testing date_create() function with zero arguments -- - -Warning: date_format() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing date_create() function with less than expected no. of arguments -- - -Warning: date_format() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing date_create() function with more than expected no. of arguments -- - -Warning: date_format() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing date_create() function with an invalid values for $object argument -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, object given in %sp on line %d -bool(false) - -Warning: date_format() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - -Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_format_variation1.phpt b/ext/date/tests/date_format_variation1.phpt deleted file mode 100644 index a4add9854b..0000000000 --- a/ext/date/tests/date_format_variation1.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -Test date_format() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : string date_format ( DateTimeInterface $object , string $format ) - * Description: Returns date formatted according to given format - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeInterface::format - */ - -echo "*** Testing date_format() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$format = 'H:m:s \m \i\s\ \m\o\n\t\h'; - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_format($object, $format) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_format() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_format() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_format_variation2.phpt b/ext/date/tests/date_format_variation2.phpt deleted file mode 100644 index 136d3d4558..0000000000 --- a/ext/date/tests/date_format_variation2.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test date_format() function : usage variation - Passing unexpected values to second argument $format. ---FILE-- -<?php -/* Prototype : string date_format ( DateTime $object , string $format ) - * Description: Returns date formatted according to given format - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::format - */ - -echo "*** Testing date_format() : usage variation - unexpected values to second argument \$format***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2005-07-14 22:30:41"); - -foreach($inputs as $variation =>$format) { - echo "\n-- $variation --\n"; - var_dump( date_format($object, $format) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_format() : usage variation - unexpected values to second argument $format*** - --- int 0 -- -string(1) "0" - --- int 1 -- -string(1) "1" - --- int 12345 -- -string(5) "12345" - --- int -12345 -- -string(6) "-12345" - --- float 10.5 -- -string(4) "10.5" - --- float -10.5 -- -string(5) "-10.5" - --- float .5 -- -string(3) "0.5" - --- empty array -- - -Warning: date_format() expects parameter 2 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_format() expects parameter 2 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_format() expects parameter 2 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_format() expects parameter 2 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(0) "" - --- lowercase null -- -string(0) "" - --- lowercase true -- -string(1) "1" - --- lowercase false -- -string(0) "" - --- uppercase TRUE -- -string(1) "1" - --- uppercase FALSE -- -string(0) "" - --- empty string DQ -- -string(0) "" - --- empty string SQ -- -string(0) "" - --- string DQ -- -string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710" - --- string SQ -- -string(40) "4131Thu, 14 Jul 2005 22:30:41 +010030710" - --- mixed case string -- -string(40) "41BSTThu, 14 Jul 2005 22:30:41 +01001722" - --- heredoc -- -string(82) "10Europe/LondonThursdayThursday2005 42005Thu, 14 Jul 2005 22:30:41 +0100Thursday14" - --- instance of classWithToString -- -string(66) "CThursdaypm4141 PM 2005b14Europe/London2005-07-14T22:30:41+01:0031" - --- instance of classWithoutToString -- - -Warning: date_format() expects parameter 2 to be string, object given in %s on line %d -bool(false) - --- undefined var -- -string(0) "" - --- unset var -- -string(0) "" - --- resource -- - -Warning: date_format() expects parameter 2 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt deleted file mode 100644 index fa675fa2fe..0000000000 --- a/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt +++ /dev/null @@ -1,11 +0,0 @@ ---TEST-- -Test date_interval_create_from_date_string() function : wrong parameter (array) ---CREDITS-- -Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> ---FILE-- -<?php -$wrong_parameter = array(); -$i = date_interval_create_from_date_string($wrong_parameter); -?> ---EXPECTF-- -Warning: date_interval_create_from_date_string() expects parameter 1 to be string, array given in %s on line %d diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt deleted file mode 100644 index 89cea6abf3..0000000000 --- a/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt +++ /dev/null @@ -1,8 +0,0 @@ ---TEST-- -Test date_interval_create_from_date_string() function : with 2 parameters (wrong). ---FILE-- -<?php -$i = date_interval_create_from_date_string('1 year', 'wrong'); -?> ---EXPECTF-- -Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d diff --git a/ext/date/tests/date_isodate_set_error.phpt b/ext/date/tests/date_isodate_set_error.phpt deleted file mode 100644 index 2ad77f3c74..0000000000 --- a/ext/date/tests/date_isodate_set_error.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -Test date_isodate_set() function : error conditions ---FILE-- -<?php - -/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setISODate - */ - - //Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_isodate_set() : error conditions ***\n"; - -echo "\n-- Testing date_isodate_set() function with zero arguments --\n"; -var_dump( date_isodate_set() ); - -$datetime = date_create("2009-01-30 19:34:10"); -echo "\n-- Testing date_isodate_set() function with less than expected no. of arguments --\n"; -var_dump( date_isodate_set($datetime) ); - -echo "\n-- Testing date_isodate_set() function with more than expected no. of arguments --\n"; -$year = 2009; -$week = 30; -$day = 7; -$extra_arg = 30; -var_dump( date_isodate_set($datetime, $year, $week, $day, $extra_arg) ); - -echo "\n-- Testing date_isodate_set() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_isodate_set($invalid_obj, $year, $week, $day) ); -$invalid_obj = 10; -var_dump( date_isodate_set($invalid_obj, $year, $week, $day) ); -$invalid_obj = null; -var_dump( date_isodate_set($invalid_obj, $year, $week, $day) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_isodate_set() : error conditions *** - --- Testing date_isodate_set() function with zero arguments -- - -Warning: date_isodate_set() expects at least 3 parameters, 0 given in %s on line %d -bool(false) - --- Testing date_isodate_set() function with less than expected no. of arguments -- - -Warning: date_isodate_set() expects at least 3 parameters, 1 given in %s on line %d -bool(false) - --- Testing date_isodate_set() function with more than expected no. of arguments -- - -Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d -bool(false) - --- Testing date_isodate_set() function with an invalid values for $object argument -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - -Warning: date_isodate_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - -Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_isodate_set_variation1.phpt b/ext/date/tests/date_isodate_set_variation1.phpt deleted file mode 100644 index 42e94fe02f..0000000000 --- a/ext/date/tests/date_isodate_set_variation1.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test date_isodate_set() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setISODate - */ - -echo "*** Testing date_isodate_set() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$day = 2; -$month = 7; -$year = 1963; - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_isodate_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_isodate_set() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_isodate_set() expects parameter 1 to be DateTime, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_isodate_set_variation2.phpt b/ext/date/tests/date_isodate_set_variation2.phpt deleted file mode 100644 index adb4c5d34d..0000000000 --- a/ext/date/tests/date_isodate_set_variation2.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_isodate_set() function : usage variation - Passing unexpected values to second argument $year. ---FILE-- -<?php -/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setISODate - */ - -echo "*** Testing date_isodate_set() : usage variation - unexpected values to second argument \$year***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$day = 2; -$month = 7; - -foreach($inputs as $variation =>$year) { - echo "\n-- $variation --\n"; - var_dump( date_isodate_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_isodate_set() : usage variation - unexpected values to second argument $year*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "12345-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(28) "-12345-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0010-02-16 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(27) "-0010-02-14 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_isodate_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_isodate_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_isodate_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_isodate_set() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0001-02-13 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_isodate_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_isodate_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_isodate_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_isodate_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_isodate_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_isodate_set() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_isodate_set() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_isodate_set() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "0000-02-15 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_isodate_set() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_isodate_set_variation3.phpt b/ext/date/tests/date_isodate_set_variation3.phpt deleted file mode 100644 index 61e973efc4..0000000000 --- a/ext/date/tests/date_isodate_set_variation3.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_isodate_set() function : usage variation - Passing unexpected values to third argument $week. ---FILE-- -<?php -/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setISODate - */ - -echo "*** Testing date_isodate_set() : usage variation - unexpected values to third argument \$week***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$day = 2; -$year = 1963; - -foreach($inputs as $variation =>$month) { - echo "\n-- $variation --\n"; - var_dump( date_isodate_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_isodate_set() : usage variation - unexpected values to third argument $week*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2199-07-30 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1726-05-21 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-03-05 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-10-16 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_isodate_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_isodate_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_isodate_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_isodate_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-01 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_isodate_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_isodate_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_isodate_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_isodate_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_isodate_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_isodate_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_isodate_set() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_isodate_set() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1962-12-25 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_isodate_set() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_isodate_set_variation4.phpt b/ext/date/tests/date_isodate_set_variation4.phpt deleted file mode 100644 index 61de2be6cd..0000000000 --- a/ext/date/tests/date_isodate_set_variation4.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_isodate_set() function : usage variation - Passing unexpected values to forth argument $day. ---FILE-- -<?php -/* Prototype : DateTime date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] ) - * Description: Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setISODate - */ - -echo "*** Testing date_isodate_set() : usage variation - unexpected values to forth argument \$day***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-02-27 08:34:10"); -$year = 1963; -$month = 7; - -foreach($inputs as $variation =>$day) { - echo "\n-- $variation --\n"; - var_dump( date_isodate_set($object, $year, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_isodate_set() : usage variation - unexpected values to forth argument $day*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1996-11-28 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1929-04-24 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-20 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-01-31 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_isodate_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_isodate_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_isodate_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_isodate_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-11 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_isodate_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_isodate_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_isodate_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_isodate_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_isodate_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_isodate_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_isodate_set() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_isodate_set() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "1963-02-10 08:34:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_isodate_set() expects parameter 4 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_modify_error.phpt b/ext/date/tests/date_modify_error.phpt deleted file mode 100644 index 09e92f5a2c..0000000000 --- a/ext/date/tests/date_modify_error.phpt +++ /dev/null @@ -1,68 +0,0 @@ ---TEST-- -Test date_modify() function : error conditions ---FILE-- -<?php -/* Prototype : DateTime date_modify ( DateTime $object , string $modify ) - * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). - * Source code: ext/date/php_date.c - * Alias to functions: public DateTime DateTime::modify() - */ - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_modify() : error conditions ***\n"; - -echo "\n-- Testing date_modify() function with zero arguments --\n"; -var_dump( date_modify() ); - -// Create a date object -$datetime = date_create("2009-01-30 19:34:10"); - -echo "\n-- Testing date_modify() function with less than expected no. of arguments --\n"; -var_dump( date_modify($datetime) ); - -echo "\n-- Testing date_modify() function with more than expected no. of arguments --\n"; -$modify = "+1 day"; -$extra_arg = 99; -var_dump( date_modify($datetime, $modify, $extra_arg) ); - -echo "\n-- Testing date_modify() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_modify($invalid_obj, $modify) ); -$invalid_obj = 10; -var_dump( date_modify($invalid_obj, $modify) ); -$invalid_obj = null; -var_dump( date_modify($invalid_obj, $modify) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_modify() : error conditions *** - --- Testing date_modify() function with zero arguments -- - -Warning: date_modify() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing date_modify() function with less than expected no. of arguments -- - -Warning: date_modify() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing date_modify() function with more than expected no. of arguments -- - -Warning: date_modify() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing date_modify() function with an invalid values for $object argument -- - -Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - -Warning: date_modify() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - -Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_modify_variation1.phpt b/ext/date/tests/date_modify_variation1.phpt deleted file mode 100644 index 79de83b34c..0000000000 --- a/ext/date/tests/date_modify_variation1.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -Test date_modify() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : DateTime date_modify ( DateTime $object , string $modify ) - * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). - * Source code: ext/date/php_date.c - * Alias to functions: public DateTime DateTime::modify() - */ - -echo "*** Testing date_modify() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$format = "D, d M Y"; - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_modify($object, $format) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_modify() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_modify() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_modify() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_modify() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_modify() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_modify() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_modify() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_modify() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_modify() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_modify() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_modify() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_modify() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_modify() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_modify() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_modify() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_modify() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_modify() expects parameter 1 to be DateTime, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_modify_variation2.phpt b/ext/date/tests/date_modify_variation2.phpt deleted file mode 100644 index f2a87ce725..0000000000 --- a/ext/date/tests/date_modify_variation2.phpt +++ /dev/null @@ -1,262 +0,0 @@ ---TEST-- -Test date_modify() function : usage variation - Passing unexpected values to second argument $format. ---FILE-- -<?php -/* Prototype : DateTime date_modify ( DateTime $object , string $modify ) - * Description: Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime(). - * Source code: ext/date/php_date.c - * Alias to functions: public DateTime DateTime::modify() - */ - -echo "*** Testing date_modify() : usage variation - unexpected values to second argument \$format***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-01-31 14:28:41"); - -foreach($inputs as $variation =>$format) { - echo "\n-- $variation --\n"; - var_dump( date_modify($object, $format) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_modify() : usage variation - unexpected values to second argument $format*** - --- int 0 -- - -Warning: date_modify(): Failed to parse time string (0) at position 0 (0): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- int 1 -- - -Warning: date_modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- int 12345 -- - -Warning: date_modify(): Failed to parse time string (12345) at position 4 (5): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- int -12345 -- - -Warning: date_modify(): Failed to parse time string (-12345) at position 5 (5): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:05:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- - -Warning: date_modify(): Failed to parse time string (-10.5) at position 4 (5): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 00:05:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99 -bool(false) - --- int indexed array -- - -Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99 -bool(false) - --- associative array -- - -Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99 -bool(false) - --- nested arrays -- - -Warning: date_modify() expects parameter 2 to be string, array given in %sdate_modify_variation2.php on line 99 -bool(false) - --- uppercase NULL -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- lowercase null -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- lowercase true -- - -Warning: date_modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- lowercase false -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- uppercase TRUE -- - -Warning: date_modify(): Failed to parse time string (1) at position 0 (1): Unexpected character in %sdate_modify_variation2.php on line 99 -bool(false) - --- uppercase FALSE -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- empty string DQ -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- empty string SQ -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- string DQ -- - -Warning: date_modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99 -bool(false) - --- string SQ -- - -Warning: date_modify(): Failed to parse time string (string) at position 0 (s): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99 -bool(false) - --- mixed case string -- - -Warning: date_modify(): Failed to parse time string (sTrInG) at position 0 (s): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99 -bool(false) - --- heredoc -- - -Warning: date_modify(): Failed to parse time string (hello world) at position 0 (h): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99 -bool(false) - --- instance of classWithToString -- - -Warning: date_modify(): Failed to parse time string (Class A object) at position 0 (C): The timezone could not be found in the database in %sdate_modify_variation2.php on line 99 -bool(false) - --- instance of classWithoutToString -- - -Warning: date_modify() expects parameter 2 to be string, object given in %sdate_modify_variation2.php on line 99 -bool(false) - --- undefined var -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- unset var -- - -Warning: date_modify(): Failed to parse time string () at position 0 ( in %sdate_modify_variation2.php on line 99 -bool(false) - --- resource -- - -Warning: date_modify() expects parameter 2 to be string, resource given in %sdate_modify_variation2.php on line 99 -bool(false) -===DONE=== diff --git a/ext/date/tests/date_offset_get_error.phpt b/ext/date/tests/date_offset_get_error.phpt deleted file mode 100644 index 72a7df0e1f..0000000000 --- a/ext/date/tests/date_offset_get_error.phpt +++ /dev/null @@ -1,57 +0,0 @@ ---TEST-- -Test date_offset_get() function : error conditions ---FILE-- -<?php - -/* Prototype : int date_offset_get ( DateTimeInterface $object ) - * Description: Returns the daylight saving time offset - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeInterface::getOffset - */ - - //Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_offset_get() : error conditions ***\n"; - -echo "\n-- Testing date_offset_get() function with zero arguments --\n"; -var_dump( date_offset_get() ); - -echo "\n-- Testing date_offset_get() function with more than expected no. of arguments --\n"; -$datetime = date_create("2009-01-30 19:34:10"); -$extra_arg = 30; -var_dump( date_offset_get($datetime, $extra_arg) ); - -echo "\n-- Testing date_offset_get() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_offset_get($invalid_obj) ); -$invalid_obj = 10; -var_dump( date_offset_get($invalid_obj) ); -$invalid_obj = null; -var_dump( date_offset_get($invalid_obj) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_offset_get() : error conditions *** - --- Testing date_offset_get() function with zero arguments -- - -Warning: date_offset_get() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_offset_get() function with more than expected no. of arguments -- - -Warning: date_offset_get() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing date_offset_get() function with an invalid values for $object argument -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_offset_get_variation1.phpt b/ext/date/tests/date_offset_get_variation1.phpt deleted file mode 100644 index 6b4b9a682f..0000000000 --- a/ext/date/tests/date_offset_get_variation1.phpt +++ /dev/null @@ -1,250 +0,0 @@ ---TEST-- -Test date_offset_get() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : int date_offset_get ( DateTimeInterface $object ) - * Description: Returns the daylight saving time offset - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeInterface::getOffset - */ - -echo "*** Testing date_offset_get() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_offset_get($object) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_offset_get() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_parse_from_format_basic.phpt b/ext/date/tests/date_parse_from_format_basic.phpt deleted file mode 100644 index 717dfabe21..0000000000 --- a/ext/date/tests/date_parse_from_format_basic.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -date_parse_from_format() return false with wrong params ---CREDITS-- -"Anna Filina" <afilina@phpquebec.org> -#PHPTestFest2009 2009-05-02 ---INI-- -date.timezone=UTC -display_errors=false ---FILE-- -<?php -var_dump(date_parse_from_format()); // invalid parameters -?> ---EXPECT-- -bool(false) diff --git a/ext/date/tests/date_parse_variation1.phpt b/ext/date/tests/date_parse_variation1.phpt deleted file mode 100644 index d40a75f8aa..0000000000 --- a/ext/date/tests/date_parse_variation1.phpt +++ /dev/null @@ -1,274 +0,0 @@ ---TEST-- -Test date_parse() function : usage variation - Passing unexpected values to first argument $date. ---FILE-- -<?php -/* Prototype : array date_parse ( string $date ) - * Description: Returns associative array with detailed info about given date. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date_parse() : usage variation - unexpected values to first argument \$date***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -foreach($inputs as $variation =>$date) { - echo "\n-- $variation --\n"; - $result = date_parse($date); - if (is_array($result)) { - var_dump($result["errors"]); - } else { - var_dump($result); - } -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_parse() : usage variation - unexpected values to first argument $date*** - --- int 0 -- -array(1) { - [0]=> - string(20) "Unexpected character" -} - --- int 1 -- -array(1) { - [0]=> - string(20) "Unexpected character" -} - --- int 12345 -- -array(1) { - [4]=> - string(20) "Unexpected character" -} - --- int -12345 -- -array(1) { - [5]=> - string(20) "Unexpected character" -} - --- float 10.5 -- -array(0) { -} - --- float -10.5 -- -array(1) { - [4]=> - string(20) "Unexpected character" -} - --- float .5 -- -array(0) { -} - --- empty array -- - -Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_parse() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- lowercase null -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- lowercase true -- -array(1) { - [0]=> - string(20) "Unexpected character" -} - --- lowercase false -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- uppercase TRUE -- -array(1) { - [0]=> - string(20) "Unexpected character" -} - --- uppercase FALSE -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- empty string DQ -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- empty string SQ -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- string DQ -- -array(1) { - [0]=> - string(47) "The timezone could not be found in the database" -} - --- string SQ -- -array(1) { - [0]=> - string(47) "The timezone could not be found in the database" -} - --- mixed case string -- -array(1) { - [0]=> - string(47) "The timezone could not be found in the database" -} - --- heredoc -- -array(1) { - [0]=> - string(47) "The timezone could not be found in the database" -} - --- instance of classWithToString -- -array(2) { - [0]=> - string(47) "The timezone could not be found in the database" - [8]=> - string(29) "Double timezone specification" -} - --- instance of classWithoutToString -- - -Warning: date_parse() expects parameter 1 to be string, object given in %s on line %d -bool(false) - --- undefined var -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- unset var -- -array(1) { - [0]=> - string(12) "Empty string" -} - --- resource -- - -Warning: date_parse() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sun_info_error.phpt b/ext/date/tests/date_sun_info_error.phpt deleted file mode 100644 index 0b27757309..0000000000 --- a/ext/date/tests/date_sun_info_error.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -Test date_sun_info() function : error variations ---FILE-- -<?php -/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) - * Description: Returns an array with information about sunset/sunrise and twilight begin/end. - * Source code: ext/standard/data/php_date.c - */ - -echo "*** Testing date_sun_info() : usage variations ***\n"; - -$time = "2006-12-12"; -$latitude=31.7667; -$longitude=35.2333; - -echo "\n-- Testing date_sun_info() function with less than expected no. of arguments --\n"; -var_dump( date_sun_info() ); -var_dump( date_sun_info($time) ); -var_dump( date_sun_info($time, $latitude) ); - - -echo "\n-- Testing date_sun_info() function with more than expected no. of arguments --\n"; -$extra_arg = 99; -var_dump( date_create($time, $latitude, $longitude, $extra_arg) ); - -?> -===Done=== ---EXPECTF-- -*** Testing date_sun_info() : usage variations *** - --- Testing date_sun_info() function with less than expected no. of arguments -- - -Warning: date_sun_info() expects exactly 3 parameters, 0 given in %s on line %d -bool(false) - -Warning: date_sun_info() expects exactly 3 parameters, 1 given in %s on line %d -bool(false) - -Warning: date_sun_info() expects exactly 3 parameters, 2 given in %s on line %d -bool(false) - --- Testing date_sun_info() function with more than expected no. of arguments -- - -Warning: date_create() expects at most 2 parameters, 4 given in %s on line %d -bool(false) -===Done=== diff --git a/ext/date/tests/date_sun_info_variation1.phpt b/ext/date/tests/date_sun_info_variation1.phpt deleted file mode 100644 index 76ae077f73..0000000000 --- a/ext/date/tests/date_sun_info_variation1.phpt +++ /dev/null @@ -1,492 +0,0 @@ ---TEST-- -Test date_sun_info() function : error variations - Pass unexpected values for time argument ---FILE-- -<?php -/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) - * Description: Returns an array with information about sunset/sunrise and twilight begin/end. - * Source code: ext/standard/data/php_date.c - */ - -date_default_timezone_set("UTC"); - -echo "*** Testing date_sun_info() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e5, - 12.3456789000E-5, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "abcxyz", - 'abcxyz', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behaviour of date_sun_info() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(date_sun_info($input, 31.7667, 35.2333)); - $iterator++; -}; - -?> -===Done=== ---EXPECTF-- -*** Testing date_sun_info() : usage variations *** - --- Iteration 1 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 2 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 3 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 4 -- -array(9) { - ["sunrise"]=> - int(-69672) - ["sunset"]=> - int(-33281) - ["transit"]=> - int(-51476) - ["civil_twilight_begin"]=> - int(-71277) - ["civil_twilight_end"]=> - int(-31675) - ["nautical_twilight_begin"]=> - int(-73100) - ["nautical_twilight_end"]=> - int(-29852) - ["astronomical_twilight_begin"]=> - int(-74883) - ["astronomical_twilight_end"]=> - int(-28069) -} - --- Iteration 5 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 6 -- -array(9) { - ["sunrise"]=> - int(-69672) - ["sunset"]=> - int(-33281) - ["transit"]=> - int(-51476) - ["civil_twilight_begin"]=> - int(-71277) - ["civil_twilight_end"]=> - int(-31675) - ["nautical_twilight_begin"]=> - int(-73100) - ["nautical_twilight_end"]=> - int(-29852) - ["astronomical_twilight_begin"]=> - int(-74883) - ["astronomical_twilight_end"]=> - int(-28069) -} - --- Iteration 7 -- -array(9) { - ["sunrise"]=> - int(1226368) - ["sunset"]=> - int(1263442) - ["transit"]=> - int(1244905) - ["civil_twilight_begin"]=> - int(1224792) - ["civil_twilight_end"]=> - int(1265019) - ["nautical_twilight_begin"]=> - int(1222996) - ["nautical_twilight_end"]=> - int(1266815) - ["astronomical_twilight_begin"]=> - int(1221234) - ["astronomical_twilight_end"]=> - int(1268576) -} - --- Iteration 8 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 9 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 10 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 11 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 12 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 13 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 14 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 15 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 16 -- - -Warning: date_sun_info() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: date_sun_info() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- Iteration 18 -- - -Warning: date_sun_info() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- Iteration 19 -- - -Warning: date_sun_info() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- Iteration 20 -- - -Warning: date_sun_info() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- Iteration 21 -- - -Warning: date_sun_info() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- Iteration 22 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 23 -- -array(9) { - ["sunrise"]=> - int(16742) - ["sunset"]=> - int(53161) - ["transit"]=> - int(34951) - ["civil_twilight_begin"]=> - int(15138) - ["civil_twilight_end"]=> - int(54765) - ["nautical_twilight_begin"]=> - int(13316) - ["nautical_twilight_end"]=> - int(56587) - ["astronomical_twilight_begin"]=> - int(11534) - ["astronomical_twilight_end"]=> - int(58369) -} - --- Iteration 24 -- - -Warning: date_sun_info() expects parameter 1 to be int, resource given in %s on line %d -bool(false) -===Done=== diff --git a/ext/date/tests/date_sun_info_variation2.phpt b/ext/date/tests/date_sun_info_variation2.phpt deleted file mode 100644 index 42254d5586..0000000000 --- a/ext/date/tests/date_sun_info_variation2.phpt +++ /dev/null @@ -1,492 +0,0 @@ ---TEST-- -Test date_sun_info() function : error variations - Pass unexpected values for latitude argument ---FILE-- -<?php -/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) - * Description: Returns an array with information about sunset/sunrise and twilight begin/end. - * Source code: ext/standard/data/php_date.c - */ - -date_default_timezone_set("UTC"); - -echo "*** Testing date_sun_info() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "abcxyz", - 'abcxyz', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behaviour of date_sun_info() -$iterator = 1; -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(date_sun_info(strtotime("2006-12-12"), $input, 35.2333)); - $iterator++; -}; - -?> -===Done=== ---EXPECTF-- -*** Testing date_sun_info() : usage variations *** - --- Iteration 1 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 2 -- -array(9) { - ["sunrise"]=> - int(1165894240) - ["sunset"]=> - int(1165937681) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892898) - ["civil_twilight_end"]=> - int(1165939024) - ["nautical_twilight_begin"]=> - int(1165891330) - ["nautical_twilight_end"]=> - int(1165940591) - ["astronomical_twilight_begin"]=> - int(1165889758) - ["astronomical_twilight_end"]=> - int(1165942164) -} - --- Iteration 3 -- -array(9) { - ["sunrise"]=> - bool(true) - ["sunset"]=> - bool(true) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - bool(true) - ["civil_twilight_end"]=> - bool(true) - ["nautical_twilight_begin"]=> - int(1165883368) - ["nautical_twilight_end"]=> - int(1165948554) - ["astronomical_twilight_begin"]=> - int(1165890281) - ["astronomical_twilight_end"]=> - int(1165941641) -} - --- Iteration 4 -- -array(9) { - ["sunrise"]=> - int(1165894072) - ["sunset"]=> - int(1165937850) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165895418) - ["civil_twilight_end"]=> - int(1165936504) - ["nautical_twilight_begin"]=> - int(1165896984) - ["nautical_twilight_end"]=> - int(1165934938) - ["astronomical_twilight_begin"]=> - int(1165898549) - ["astronomical_twilight_end"]=> - int(1165933372) -} - --- Iteration 5 -- -array(9) { - ["sunrise"]=> - int(1165895221) - ["sunset"]=> - int(1165936701) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165893858) - ["civil_twilight_end"]=> - int(1165938064) - ["nautical_twilight_begin"]=> - int(1165892278) - ["nautical_twilight_end"]=> - int(1165939643) - ["astronomical_twilight_begin"]=> - int(1165890706) - ["astronomical_twilight_end"]=> - int(1165941215) -} - --- Iteration 6 -- -array(9) { - ["sunrise"]=> - int(1165893046) - ["sunset"]=> - int(1165938875) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165891669) - ["civil_twilight_end"]=> - int(1165940253) - ["nautical_twilight_begin"]=> - int(1165890044) - ["nautical_twilight_end"]=> - int(1165941878) - ["astronomical_twilight_begin"]=> - int(1165888392) - ["astronomical_twilight_end"]=> - int(1165943530) -} - --- Iteration 7 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 8 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 9 -- -array(9) { - ["sunrise"]=> - int(1165894189) - ["sunset"]=> - int(1165937733) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892846) - ["civil_twilight_end"]=> - int(1165939075) - ["nautical_twilight_begin"]=> - int(1165891278) - ["nautical_twilight_end"]=> - int(1165940643) - ["astronomical_twilight_begin"]=> - int(1165889704) - ["astronomical_twilight_end"]=> - int(1165942217) -} - --- Iteration 10 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 11 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 12 -- -array(9) { - ["sunrise"]=> - int(1165894240) - ["sunset"]=> - int(1165937681) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892898) - ["civil_twilight_end"]=> - int(1165939024) - ["nautical_twilight_begin"]=> - int(1165891330) - ["nautical_twilight_end"]=> - int(1165940591) - ["astronomical_twilight_begin"]=> - int(1165889758) - ["astronomical_twilight_end"]=> - int(1165942164) -} - --- Iteration 13 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 14 -- -array(9) { - ["sunrise"]=> - int(1165894240) - ["sunset"]=> - int(1165937681) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892898) - ["civil_twilight_end"]=> - int(1165939024) - ["nautical_twilight_begin"]=> - int(1165891330) - ["nautical_twilight_end"]=> - int(1165940591) - ["astronomical_twilight_begin"]=> - int(1165889758) - ["astronomical_twilight_end"]=> - int(1165942164) -} - --- Iteration 15 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 16 -- - -Warning: date_sun_info() expects parameter 2 to be float, string given in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: date_sun_info() expects parameter 2 to be float, string given in %s on line %d -bool(false) - --- Iteration 18 -- - -Warning: date_sun_info() expects parameter 2 to be float, array given in %s on line %d -bool(false) - --- Iteration 19 -- - -Warning: date_sun_info() expects parameter 2 to be float, string given in %s on line %d -bool(false) - --- Iteration 20 -- - -Warning: date_sun_info() expects parameter 2 to be float, string given in %s on line %d -bool(false) - --- Iteration 21 -- - -Warning: date_sun_info() expects parameter 2 to be float, string given in %s on line %d -bool(false) - --- Iteration 22 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 23 -- -array(9) { - ["sunrise"]=> - int(1165894138) - ["sunset"]=> - int(1165937784) - ["transit"]=> - int(1165915961) - ["civil_twilight_begin"]=> - int(1165892795) - ["civil_twilight_end"]=> - int(1165939127) - ["nautical_twilight_begin"]=> - int(1165891226) - ["nautical_twilight_end"]=> - int(1165940696) - ["astronomical_twilight_begin"]=> - int(1165889650) - ["astronomical_twilight_end"]=> - int(1165942271) -} - --- Iteration 24 -- - -Warning: date_sun_info() expects parameter 2 to be float, resource given in %s on line %d -bool(false) -===Done=== diff --git a/ext/date/tests/date_sun_info_variation3.phpt b/ext/date/tests/date_sun_info_variation3.phpt deleted file mode 100644 index 69396e4ee2..0000000000 --- a/ext/date/tests/date_sun_info_variation3.phpt +++ /dev/null @@ -1,493 +0,0 @@ ---TEST-- -Test date_sun_info() function : usage variations - Pass unexpected values for longitude argument ---FILE-- -<?php -/* Prototype : array date_sun_info ( int $time , float $latitude , float $longitude ) - * Description: Returns an array with information about sunset/sunrise and twilight begin/end. - * Source code: ext/standard/data/php_date.c - */ - -date_default_timezone_set("UTC"); - -echo "*** Testing date_sun_info() : usage variations ***\n"; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// heredoc string -$heredoc = <<<EOT -abc -xyz -EOT; - -// get a resource variable -$fp = fopen(__FILE__, "r"); - -$inputs = array( - // int data -/*1*/ 0, - 1, - 12345, - -2345, - - // float data -/*5*/ 10.5, - -10.5, - 12.3456789000e10, - 12.3456789000E-10, - .5, - - // null data -/*10*/ NULL, - null, - - // boolean data -/*12*/ true, - false, - TRUE, - FALSE, - - // empty data -/*16*/ "", - '', - array(), - - // string data -/*19*/ "abcxyz", - 'abcxyz', - $heredoc, - - // undefined data -/*22*/ @$undefined_var, - - // unset data -/*23*/ @$unset_var, - - // resource variable -/*24*/ $fp -); - -// loop through each element of $inputs to check the behaviour of date_sun_info() -$iterator = 1; - -foreach($inputs as $input) { - echo "\n-- Iteration $iterator --\n"; - var_dump(date_sun_info(strtotime("2006-12-12"), 31.7667, $input)); - $iterator++; -}; - -?> -===Done=== ---EXPECTF-- -*** Testing date_sun_info() : usage variations *** - --- Iteration 1 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 2 -- -array(9) { - ["sunrise"]=> - int(1165905981) - ["sunset"]=> - int(1165942378) - ["transit"]=> - int(1165924179) - ["civil_twilight_begin"]=> - int(1165904376) - ["civil_twilight_end"]=> - int(1165943983) - ["nautical_twilight_begin"]=> - int(1165902553) - ["nautical_twilight_end"]=> - int(1165945806) - ["astronomical_twilight_begin"]=> - int(1165900771) - ["astronomical_twilight_end"]=> - int(1165947588) -} - --- Iteration 3 -- -array(9) { - ["sunrise"]=> - int(1165879309) - ["sunset"]=> - int(1165917937) - ["transit"]=> - int(1165898623) - ["civil_twilight_begin"]=> - int(1165877787) - ["civil_twilight_end"]=> - int(1165919460) - ["nautical_twilight_begin"]=> - int(1165876041) - ["nautical_twilight_end"]=> - int(1165921205) - ["astronomical_twilight_begin"]=> - int(1165874319) - ["astronomical_twilight_end"]=> - int(1165922928) -} - --- Iteration 4 -- -array(9) { - ["sunrise"]=> - int(1165864467) - ["sunset"]=> - int(1165900749) - ["transit"]=> - int(1165882608) - ["civil_twilight_begin"]=> - int(1165862856) - ["civil_twilight_end"]=> - int(1165902359) - ["nautical_twilight_begin"]=> - int(1165861029) - ["nautical_twilight_end"]=> - int(1165904187) - ["astronomical_twilight_begin"]=> - int(1165859242) - ["astronomical_twilight_end"]=> - int(1165905973) -} - --- Iteration 5 -- -array(9) { - ["sunrise"]=> - int(1165903700) - ["sunset"]=> - int(1165940097) - ["transit"]=> - int(1165921899) - ["civil_twilight_begin"]=> - int(1165902095) - ["civil_twilight_end"]=> - int(1165941702) - ["nautical_twilight_begin"]=> - int(1165900272) - ["nautical_twilight_end"]=> - int(1165943525) - ["astronomical_twilight_begin"]=> - int(1165898490) - ["astronomical_twilight_end"]=> - int(1165945308) -} - --- Iteration 6 -- -array(9) { - ["sunrise"]=> - int(1165908743) - ["sunset"]=> - int(1165945138) - ["transit"]=> - int(1165926940) - ["civil_twilight_begin"]=> - int(1165907137) - ["civil_twilight_end"]=> - int(1165946743) - ["nautical_twilight_begin"]=> - int(1165905315) - ["nautical_twilight_end"]=> - int(1165948566) - ["astronomical_twilight_begin"]=> - int(1165903532) - ["astronomical_twilight_end"]=> - int(1165950349) -} - --- Iteration 7 -- -array(9) { - ["sunrise"]=> - int(1165920008) - ["sunset"]=> - int(1165970177) - ["transit"]=> - int(1165945092) - ["civil_twilight_begin"]=> - int(1165918353) - ["civil_twilight_end"]=> - int(1165971832) - ["nautical_twilight_begin"]=> - int(1165916371) - ["nautical_twilight_end"]=> - int(1165973814) - ["astronomical_twilight_begin"]=> - int(1165914258) - ["astronomical_twilight_end"]=> - int(1165975927) -} - --- Iteration 8 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 9 -- -array(9) { - ["sunrise"]=> - int(1165906101) - ["sunset"]=> - int(1165942498) - ["transit"]=> - int(1165924300) - ["civil_twilight_begin"]=> - int(1165904496) - ["civil_twilight_end"]=> - int(1165944103) - ["nautical_twilight_begin"]=> - int(1165902673) - ["nautical_twilight_end"]=> - int(1165945926) - ["astronomical_twilight_begin"]=> - int(1165900891) - ["astronomical_twilight_end"]=> - int(1165947708) -} - --- Iteration 10 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 11 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 12 -- -array(9) { - ["sunrise"]=> - int(1165905981) - ["sunset"]=> - int(1165942378) - ["transit"]=> - int(1165924179) - ["civil_twilight_begin"]=> - int(1165904376) - ["civil_twilight_end"]=> - int(1165943983) - ["nautical_twilight_begin"]=> - int(1165902553) - ["nautical_twilight_end"]=> - int(1165945806) - ["astronomical_twilight_begin"]=> - int(1165900771) - ["astronomical_twilight_end"]=> - int(1165947588) -} - --- Iteration 13 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 14 -- -array(9) { - ["sunrise"]=> - int(1165905981) - ["sunset"]=> - int(1165942378) - ["transit"]=> - int(1165924179) - ["civil_twilight_begin"]=> - int(1165904376) - ["civil_twilight_end"]=> - int(1165943983) - ["nautical_twilight_begin"]=> - int(1165902553) - ["nautical_twilight_end"]=> - int(1165945806) - ["astronomical_twilight_begin"]=> - int(1165900771) - ["astronomical_twilight_end"]=> - int(1165947588) -} - --- Iteration 15 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 16 -- - -Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d -bool(false) - --- Iteration 17 -- - -Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d -bool(false) - --- Iteration 18 -- - -Warning: date_sun_info() expects parameter 3 to be float, array given in %s on line %d -bool(false) - --- Iteration 19 -- - -Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d -bool(false) - --- Iteration 20 -- - -Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d -bool(false) - --- Iteration 21 -- - -Warning: date_sun_info() expects parameter 3 to be float, string given in %s on line %d -bool(false) - --- Iteration 22 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 23 -- -array(9) { - ["sunrise"]=> - int(1165906221) - ["sunset"]=> - int(1165942618) - ["transit"]=> - int(1165924420) - ["civil_twilight_begin"]=> - int(1165904616) - ["civil_twilight_end"]=> - int(1165944223) - ["nautical_twilight_begin"]=> - int(1165902793) - ["nautical_twilight_end"]=> - int(1165946046) - ["astronomical_twilight_begin"]=> - int(1165901011) - ["astronomical_twilight_end"]=> - int(1165947828) -} - --- Iteration 24 -- - -Warning: date_sun_info() expects parameter 3 to be float, resource given in %s on line %d -bool(false) -===Done=== diff --git a/ext/date/tests/date_sunrise_error.phpt b/ext/date/tests/date_sunrise_error.phpt deleted file mode 100644 index d420bfa293..0000000000 --- a/ext/date/tests/date_sunrise_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test date_sunrise() function : error conditions ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date_sunrise() : error conditions ***\n"; - -//Initialise the variables -$time = time(); -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; -$extra_arg = 10; - -// Zero arguments -echo "\n-- Testing date_sunrise() function with Zero arguments --\n"; -var_dump( date_sunrise() ); - -//Test date_sunrise with one more than the expected number of arguments -echo "\n-- Testing date_sunrise() function with more than expected no. of arguments --\n"; -var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : error conditions *** - --- Testing date_sunrise() function with Zero arguments -- - -Warning: date_sunrise() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_sunrise() function with more than expected no. of arguments -- - -Warning: date_sunrise() expects at most 6 parameters, 7 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation1.phpt b/ext/date/tests/date_sunrise_variation1.phpt deleted file mode 100644 index 7bb7be0c28..0000000000 --- a/ext/date/tests/date_sunrise_variation1.phpt +++ /dev/null @@ -1,316 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing unexpected values to first argument time. ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -//Initialise the variables -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; -$format = SUNFUNCS_RET_STRING; -date_default_timezone_set("Asia/Calcutta"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for time - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunrise($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunrise($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunrise($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - ---int 0-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---int 1-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---int 12345-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---int -12345-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---float 10.5-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---float -10.5-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---float .5-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---empty array-- - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---lowercase null-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---lowercase true-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---lowercase false-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---uppercase TRUE-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---uppercase FALSE-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---empty string DQ-- - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunrise() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunrise() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "08:56" -float(8.943%d) -int(28596) - ---unset var-- -string(5) "08:56" -float(8.943%d) -int(28596) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation2.phpt b/ext/date/tests/date_sunrise_variation2.phpt deleted file mode 100644 index 27a5272b4b..0000000000 --- a/ext/date/tests/date_sunrise_variation2.phpt +++ /dev/null @@ -1,213 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing unexpected values to second argument format. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for format - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunrise($time, $value, $latitude, $longitude, $zenith, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - ---float 10.5-- - -Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d -bool(false) - ---float -10.5-- - -Warning: date_sunrise(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d -bool(false) - ---float 12.3456789000e10-- - -Warning: date_sunrise() expects parameter 2 to be int, float given in %s on line %d -bool(false) - ---float -12.3456789000e10-- - -Warning: date_sunrise() expects parameter 2 to be int, float given in %s on line %d -bool(false) - ---float .5-- -int(1218174468) - ---empty array-- - -Warning: date_sunrise() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunrise() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunrise() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunrise() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1218174468) - ---lowercase null-- -int(1218174468) - ---lowercase true-- -string(5) "06:47" - ---lowercase false-- -int(1218174468) - ---uppercase TRUE-- -string(5) "06:47" - ---uppercase FALSE-- -int(1218174468) - ---empty string DQ-- - -Warning: date_sunrise() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunrise() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunrise() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunrise() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunrise() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunrise() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunrise() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunrise() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1218174468) - ---unset var-- -int(1218174468) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation3.phpt b/ext/date/tests/date_sunrise_variation3.phpt deleted file mode 100644 index 32287db243..0000000000 --- a/ext/date/tests/date_sunrise_variation3.phpt +++ /dev/null @@ -1,294 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing unexpected values to third argument latitude. ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$longitude = -9; -$zenith = 90; -$gmt_offset = -5.5; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for latitude - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $value, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude, $zenith, $gmt_offset) ); -}; -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - ---int 0-- -string(5) "01:10" -float(1.174%d) -int(1218177629) - ---int 1-- -string(5) "01:09" -float(1.155%d) -int(1218177560) - ---int 12345-- -bool(false) -bool(false) -bool(false) - ---int -12345-- -bool(false) -bool(false) -bool(false) - ---empty array-- - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "01:10" -float(1.174%d) -int(1218177629) - ---lowercase null-- -string(5) "01:10" -float(1.174%d) -int(1218177629) - ---lowercase true-- -string(5) "01:09" -float(1.155%d) -int(1218177560) - ---lowercase false-- -string(5) "01:10" -float(1.174%d) -int(1218177629) - ---uppercase TRUE-- -string(5) "01:09" -float(1.155%d) -int(1218177560) - ---uppercase FALSE-- -string(5) "01:10" -float(1.174%d) -int(1218177629) - ---empty string DQ-- - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunrise() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunrise() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 3 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "01:10" -float(1.174%d) -int(1218177629) - ---unset var-- -string(5) "01:10" -float(1.174%d) -int(1218177629) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation4.phpt b/ext/date/tests/date_sunrise_variation4.phpt deleted file mode 100644 index 00fb15837b..0000000000 --- a/ext/date/tests/date_sunrise_variation4.phpt +++ /dev/null @@ -1,296 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing unexpected values to fourth argument longitude. ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -//Initialise the variables -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$latitude = 38.4; -$zenith = 90; -$gmt_offset = 0; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for longitude - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - ---int 0-- -string(5) "05:11" -float(5.196%d) -int(1218172307) - ---int 1-- -string(5) "05:07" -float(5.129%d) -int(1218172067) - ---int 12345-- -string(5) "21:45" -float(21.757%d) -int(1218145525) - ---int -12345-- -string(5) "12:41" -float(12.694%d) -int(1218199301) - ---empty array-- - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "05:11" -float(5.196%d) -int(1218172307) - ---lowercase null-- -string(5) "05:11" -float(5.196%d) -int(1218172307) - ---lowercase true-- -string(5) "05:07" -float(5.129%d) -int(1218172067) - ---lowercase false-- -string(5) "05:11" -float(5.196%d) -int(1218172307) - ---uppercase TRUE-- -string(5) "05:07" -float(5.129%d) -int(1218172067) - ---uppercase FALSE-- -string(5) "05:11" -float(5.196%d) -int(1218172307) - ---empty string DQ-- - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunrise() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunrise() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 4 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "05:11" -float(5.196%d) -int(1218172307) - ---unset var-- -string(5) "05:11" -float(5.196%d) -int(1218172307) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation5.phpt b/ext/date/tests/date_sunrise_variation5.phpt deleted file mode 100644 index 7e44590a7d..0000000000 --- a/ext/date/tests/date_sunrise_variation5.phpt +++ /dev/null @@ -1,296 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing unexpected values to fifth argument zenith ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$latitude = 38.4; -$longitude = -9; -$gmt_offset = 5.5; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for zenith - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $value, $gmt_offset) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $value, $gmt_offset) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $value, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - ---int 0-- -bool(false) -bool(false) -bool(false) - ---int 1-- -bool(false) -bool(false) -bool(false) - ---int 12345-- -string(5) "09:50" -float(9.849%d) -int(1218169259) - ---int -12345-- -string(5) "09:54" -float(9.904%d) -int(1218169455) - ---empty array-- - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -bool(false) -bool(false) -bool(false) - ---lowercase null-- -bool(false) -bool(false) -bool(false) - ---lowercase true-- -bool(false) -bool(false) -bool(false) - ---lowercase false-- -bool(false) -bool(false) -bool(false) - ---uppercase TRUE-- -bool(false) -bool(false) -bool(false) - ---uppercase FALSE-- -bool(false) -bool(false) -bool(false) - ---empty string DQ-- - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunrise() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunrise() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 5 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -bool(false) -bool(false) -bool(false) - ---unset var-- -bool(false) -bool(false) -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation6.phpt b/ext/date/tests/date_sunrise_variation6.phpt deleted file mode 100644 index 0a9e776a61..0000000000 --- a/ext/date/tests/date_sunrise_variation6.phpt +++ /dev/null @@ -1,295 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing unexpected values to sixth argument gmt_offset. ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$latitude = 38.4; -$longitude = -9; -$zenith = 90; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for gmt_offset - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - ---int 0-- -string(5) "05:47" -float(5.796%d) -int(1218174468) - ---int 1-- -string(5) "06:47" -float(6.796%d) -int(1218174468) - ---int 12345-- -string(5) "14:47" -float(14.796%d) -int(1218174468) - ---int -12345-- -string(5) "12:47" -float(12.796%d) -int(1218174468) - ---empty array-- - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "05:47" -float(5.796%d) -int(1218174468) - ---lowercase null-- -string(5) "05:47" -float(5.796%d) -int(1218174468) - ---lowercase true-- -string(5) "06:47" -float(6.796%d) -int(1218174468) - ---lowercase false-- -string(5) "05:47" -float(5.796%d) -int(1218174468) - ---uppercase TRUE-- -string(5) "06:47" -float(6.796%d) -int(1218174468) - ---uppercase FALSE-- -string(5) "05:47" -float(5.796%d) -int(1218174468) - ---empty string DQ-- - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunrise() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunrise() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 6 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "05:47" -float(5.796%d) -int(1218174468) - ---unset var-- -string(5) "05:47" -float(5.796%d) -int(1218174468) -===DONE=== diff --git a/ext/date/tests/date_sunset_error.phpt b/ext/date/tests/date_sunset_error.phpt deleted file mode 100644 index 92d8879c4e..0000000000 --- a/ext/date/tests/date_sunset_error.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -Test date_sunset() function : error conditions ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : error conditions ***\n"; - -//Initialise the variables -$time = time(); -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; -$extra_arg = 10; - -// Zero arguments -echo "\n-- Testing date_sunset() function with Zero arguments --\n"; -var_dump( date_sunset() ); - -//Test date_sunset with one more than the expected number of arguments -echo "\n-- Testing date_sunset() function with more than expected no. of arguments --\n"; -var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); -var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); -var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset, $extra_arg) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : error conditions *** - --- Testing date_sunset() function with Zero arguments -- - -Warning: date_sunset() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_sunset() function with more than expected no. of arguments -- - -Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d -bool(false) - -Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d -bool(false) - -Warning: date_sunset() expects at most 6 parameters, 7 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation1.phpt b/ext/date/tests/date_sunset_variation1.phpt deleted file mode 100644 index e128d1c404..0000000000 --- a/ext/date/tests/date_sunset_variation1.phpt +++ /dev/null @@ -1,316 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing unexpected values to first argument time. ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -//Initialise the variables -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; -date_default_timezone_set("Asia/Calcutta"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for time - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunset($value, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunset($value, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunset($value, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - ---int 0-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---int 1-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---int 12345-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---int -12345-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---float 10.5-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---float -10.5-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---float .5-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---empty array-- - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---lowercase null-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---lowercase true-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---lowercase false-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---uppercase TRUE-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---uppercase FALSE-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---empty string DQ-- - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunset() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunset() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "18:22" -float(18.373%d) -int(62545) - ---unset var-- -string(5) "18:22" -float(18.373%d) -int(62545) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation2.phpt b/ext/date/tests/date_sunset_variation2.phpt deleted file mode 100644 index 51ad39570e..0000000000 --- a/ext/date/tests/date_sunset_variation2.phpt +++ /dev/null @@ -1,213 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing unexpected values to second argument format. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$latitude = 22.34; -$longitude = 88.21; -$zenith = 90; -$gmt_offset = 5.5; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for format - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunset($time, $value, $latitude, $longitude, $zenith, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - ---float 10.5-- - -Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d -bool(false) - ---float -10.5-- - -Warning: date_sunset(): Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE in %s on line %d -bool(false) - ---float 12.3456789000e10-- - -Warning: date_sunset() expects parameter 2 to be int, float given in %s on line %d -bool(false) - ---float -12.3456789000e10-- - -Warning: date_sunset() expects parameter 2 to be int, float given in %s on line %d -bool(false) - ---float .5-- -int(1218199264) - ---empty array-- - -Warning: date_sunset() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunset() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunset() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunset() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1218199264) - ---lowercase null-- -int(1218199264) - ---lowercase true-- -string(5) "18:11" - ---lowercase false-- -int(1218199264) - ---uppercase TRUE-- -string(5) "18:11" - ---uppercase FALSE-- -int(1218199264) - ---empty string DQ-- - -Warning: date_sunset() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunset() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunset() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunset() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunset() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunset() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunset() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunset() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1218199264) - ---unset var-- -int(1218199264) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation3.phpt b/ext/date/tests/date_sunset_variation3.phpt deleted file mode 100644 index ca91e639d0..0000000000 --- a/ext/date/tests/date_sunset_variation3.phpt +++ /dev/null @@ -1,297 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing unexpected values to third argument latitude. ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$longitude = 88.21; -$zenith = 90; -$gmt_offset = 5.5; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for latitude - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $value, $longitude, $zenith, $gmt_offset) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $value, $longitude, $zenith, $gmt_offset) ); - -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - ---int 0-- -string(5) "17:43" -float(17.731%d) -int(1218197632) - ---int 1-- -string(5) "17:45" -float(17.750%d) -int(1218197701) - ---int 12345-- -bool(false) -bool(false) -bool(false) - ---int -12345-- -string(5) "17:35" -float(17.598%d) -int(1218197155) - ---empty array-- - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "17:43" -float(17.731%d) -int(1218197632) - ---lowercase null-- -string(5) "17:43" -float(17.731%d) -int(1218197632) - ---lowercase true-- -string(5) "17:45" -float(17.750%d) -int(1218197701) - ---lowercase false-- -string(5) "17:43" -float(17.731%d) -int(1218197632) - ---uppercase TRUE-- -string(5) "17:45" -float(17.750%d) -int(1218197701) - ---uppercase FALSE-- -string(5) "17:43" -float(17.731%d) -int(1218197632) - ---empty string DQ-- - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunset() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunset() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 3 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "17:43" -float(17.731%d) -int(1218197632) - ---unset var-- -string(5) "17:43" -float(17.731%d) -int(1218197632) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation4.phpt b/ext/date/tests/date_sunset_variation4.phpt deleted file mode 100644 index 75fc64cc92..0000000000 --- a/ext/date/tests/date_sunset_variation4.phpt +++ /dev/null @@ -1,296 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing unexpected values to fourth argument longitude. ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$latitude = 22.34; -$zenith = 90; -$gmt_offset = 5.5; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for longitude - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $value, $zenith, $gmt_offset) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $value, $zenith, $gmt_offset) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $value, $zenith, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - ---int 0-- -string(5) "00:03" -float(0.062%d) -int(1218220425) - ---int 1-- -string(5) "23:59" -float(23.995%d) -int(1218220185) - ---int 12345-- -string(5) "17:15" -float(17.259%d) -int(1218195932) - ---int -12345-- -string(5) "12:19" -float(12.319%d) -int(1218178151) - ---empty array-- - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "00:03" -float(0.062%d) -int(1218220425) - ---lowercase null-- -string(5) "00:03" -float(0.062%d) -int(1218220425) - ---lowercase true-- -string(5) "23:59" -float(23.995%d) -int(1218220185) - ---lowercase false-- -string(5) "00:03" -float(0.062%d) -int(1218220425) - ---uppercase TRUE-- -string(5) "23:59" -float(23.995%d) -int(1218220185) - ---uppercase FALSE-- -string(5) "00:03" -float(0.062%d) -int(1218220425) - ---empty string DQ-- - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunset() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunset() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 4 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "00:03" -float(0.062%d) -int(1218220425) - ---unset var-- -string(5) "00:03" -float(0.062%d) -int(1218220425) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation5.phpt b/ext/date/tests/date_sunset_variation5.phpt deleted file mode 100644 index 54ea07a8c4..0000000000 --- a/ext/date/tests/date_sunset_variation5.phpt +++ /dev/null @@ -1,296 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing unexpected values to fifth argument zenith. ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$longitude = 88.21; -$latitude = 22.34; -$gmt_offset = 5.5; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for zenith - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $value, $gmt_offset) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $value, $gmt_offset) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $value, $gmt_offset) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - ---int 0-- -bool(false) -bool(false) -bool(false) - ---int 1-- -bool(false) -bool(false) -bool(false) - ---int 12345-- -string(5) "19:20" -float(19.343%d) -int(1218203437) - ---int -12345-- -bool(false) -bool(false) -bool(false) - ---empty array-- - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -bool(false) -bool(false) -bool(false) - ---lowercase null-- -bool(false) -bool(false) -bool(false) - ---lowercase true-- -bool(false) -bool(false) -bool(false) - ---lowercase false-- -bool(false) -bool(false) -bool(false) - ---uppercase TRUE-- -bool(false) -bool(false) -bool(false) - ---uppercase FALSE-- -bool(false) -bool(false) -bool(false) - ---empty string DQ-- - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunset() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunset() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 5 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -bool(false) -bool(false) -bool(false) - ---unset var-- -bool(false) -bool(false) -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation6.phpt b/ext/date/tests/date_sunset_variation6.phpt deleted file mode 100644 index 933f634036..0000000000 --- a/ext/date/tests/date_sunset_variation6.phpt +++ /dev/null @@ -1,296 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing unexpected values to sixth argument gmt_offset. ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$time = mktime(8, 8, 8, 8, 8, 2008); -$longitude = 88.21; -$latitude = 22.34; -$zenith = 90; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for gmt_offset - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $value) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $value) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - ---int 0-- -string(5) "12:41" -float(12.684%d) -int(1218199264) - ---int 1-- -string(5) "13:41" -float(13.684%d) -int(1218199264) - ---int 12345-- -string(5) "21:41" -float(21.684%d) -int(1218199264) - ---int -12345-- -string(5) "19:41" -float(19.684%d) -int(1218199264) - ---empty array-- - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(5) "12:41" -float(12.684%d) -int(1218199264) - ---lowercase null-- -string(5) "12:41" -float(12.684%d) -int(1218199264) - ---lowercase true-- -string(5) "13:41" -float(13.684%d) -int(1218199264) - ---lowercase false-- -string(5) "12:41" -float(12.684%d) -int(1218199264) - ---uppercase TRUE-- -string(5) "13:41" -float(13.684%d) -int(1218199264) - ---uppercase FALSE-- -string(5) "12:41" -float(12.684%d) -int(1218199264) - ---empty string DQ-- - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: date_sunset() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: date_sunset() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, object given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 6 to be float, object given in %s on line %d -bool(false) - ---undefined var-- -string(5) "12:41" -float(12.684%d) -int(1218199264) - ---unset var-- -string(5) "12:41" -float(12.684%d) -int(1218199264) -===DONE=== diff --git a/ext/date/tests/date_time_immutable001.phpt b/ext/date/tests/date_time_immutable001.phpt new file mode 100644 index 0000000000..14eb2a986c --- /dev/null +++ b/ext/date/tests/date_time_immutable001.phpt @@ -0,0 +1,10 @@ +--TEST-- +DateTimeImmutable - invalid arguments +--CREDITS-- +Mark Niebergall mbniebergall@gmail.com UPHPU TestFest 2017 +--FILE-- +<?php +var_dump(date_create_immutable('Invalid')); +?> +--EXPECT-- +bool(false) diff --git a/ext/date/tests/date_time_set_error.phpt b/ext/date/tests/date_time_set_error.phpt deleted file mode 100644 index 8c869ce657..0000000000 --- a/ext/date/tests/date_time_set_error.phpt +++ /dev/null @@ -1,71 +0,0 @@ ---TEST-- -Test date_time_set() function : error conditions ---FILE-- -<?php -/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTime - */ - -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_time_set() : error conditions ***\n"; - -echo "\n-- Testing date_time_set() function with zero arguments --\n"; -var_dump( date_time_set() ); - -echo "\n-- Testing date_time_set() function with less than expected no. of arguments --\n"; -$datetime = date_create("2009-01-31 15:34:10"); -$hour = 18; -var_dump( date_time_set($datetime) ); -var_dump( date_time_set($datetime, $hour) ); - -echo "\n-- Testing date_time_set() function with more than expected no. of arguments --\n"; -$min = 15; -$sec = 30; -$microseconds = 123123; -$extra_arg = 10; -var_dump( date_time_set($datetime, $hour, $min, $sec, $microseconds, $extra_arg) ); - -echo "\n-- Testing date_time_set() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_time_set($invalid_obj, $hour, $min, $sec) ); -$invalid_obj = 10; -var_dump( date_time_set($invalid_obj, $hour, $min, $sec) ); -$invalid_obj = null; -var_dump( date_time_set($invalid_obj, $hour, $min, $sec) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_time_set() : error conditions *** - --- Testing date_time_set() function with zero arguments -- - -Warning: date_time_set() expects at least 3 parameters, 0 given in %s on line %d -bool(false) - --- Testing date_time_set() function with less than expected no. of arguments -- - -Warning: date_time_set() expects at least 3 parameters, 1 given in %s on line %d -bool(false) - -Warning: date_time_set() expects at least 3 parameters, 2 given in %s on line %d -bool(false) - --- Testing date_time_set() function with more than expected no. of arguments -- - -Warning: date_time_set() expects at most 5 parameters, 6 given in %s on line %d -bool(false) - --- Testing date_time_set() function with an invalid values for $object argument -- - -Warning: date_time_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - -Warning: date_time_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - -Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_time_set_variation1.phpt b/ext/date/tests/date_time_set_variation1.phpt deleted file mode 100644 index d3999207e9..0000000000 --- a/ext/date/tests/date_time_set_variation1.phpt +++ /dev/null @@ -1,254 +0,0 @@ ---TEST-- -Test date_time_set() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTime - */ - -echo "*** Testing date_time_set() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; -$minute = 13; -$sec = 45; - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_time_set($object, $hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_time_set() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_time_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_time_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_time_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_time_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_time_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_time_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_time_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_time_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_time_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_time_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_time_set() expects parameter 1 to be DateTime, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_time_set_variation2.phpt b/ext/date/tests/date_time_set_variation2.phpt deleted file mode 100644 index 6892a1b747..0000000000 --- a/ext/date/tests/date_time_set_variation2.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_time_set() function : usage variation - Passing unexpected values to second argument $hour. ---FILE-- -<?php -/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTime - */ - -echo "*** Testing date_time_set() : usage variation - unexpected values to second argument \$hour***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-01-31 15:14:10"); -$minute = 13; -$sec = 45; - -foreach($inputs as $variation =>$hour) { - echo "\n-- $variation --\n"; - var_dump( date_time_set($object, $hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_time_set() : usage variation - unexpected values to second argument $hour*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 01:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2010-06-29 09:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 15:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 14:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_time_set() expects parameter 2 to be int, array given in %s -bool(false) - --- int indexed array -- - -Warning: date_time_set() expects parameter 2 to be int, array given in %s -bool(false) - --- associative array -- - -Warning: date_time_set() expects parameter 2 to be int, array given in %s -bool(false) - --- nested arrays -- - -Warning: date_time_set() expects parameter 2 to be int, array given in %s -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 01:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 01:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_time_set() expects parameter 2 to be int, string given in %s -bool(false) - --- empty string SQ -- - -Warning: date_time_set() expects parameter 2 to be int, string given in %s -bool(false) - --- string DQ -- - -Warning: date_time_set() expects parameter 2 to be int, string given in %s -bool(false) - --- string SQ -- - -Warning: date_time_set() expects parameter 2 to be int, string given in %s -bool(false) - --- mixed case string -- - -Warning: date_time_set() expects parameter 2 to be int, string given in %s -bool(false) - --- heredoc -- - -Warning: date_time_set() expects parameter 2 to be int, string given in %s -bool(false) - --- instance of classWithToString -- - -Warning: date_time_set() expects parameter 2 to be int, object given in %s -bool(false) - --- instance of classWithoutToString -- - -Warning: date_time_set() expects parameter 2 to be int, object given in %s -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-29 00:13:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_time_set() expects parameter 2 to be int, resource given in %s -bool(false) -===DONE=== diff --git a/ext/date/tests/date_time_set_variation3.phpt b/ext/date/tests/date_time_set_variation3.phpt deleted file mode 100644 index 0d1315d8e3..0000000000 --- a/ext/date/tests/date_time_set_variation3.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_time_set() function : usage variation - Passing unexpected values to third argument $minute. ---FILE-- -<?php -/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTime - */ - -echo "*** Testing date_time_set() : usage variation - unexpected values to third argument \$minute***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-01-31 15:14:10"); -$hour = 10; -$sec = 45; - -foreach($inputs as $variation =>$minute) { - echo "\n-- $variation --\n"; - var_dump( date_time_set($object, $hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_time_set() : usage variation - unexpected values to third argument $minute*** - --- int 0 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-31 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-31 10:01:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-02-08 23:45:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-30 20:15:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-30 10:10:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-30 09:50:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#3 (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_time_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_time_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_time_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_time_set() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:01:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:01:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_time_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_time_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_time_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_time_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_time_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_time_set() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_time_set() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_time_set() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-30 10:00:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_time_set() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_time_set_variation4.phpt b/ext/date/tests/date_time_set_variation4.phpt deleted file mode 100644 index 8f8fdd7de6..0000000000 --- a/ext/date/tests/date_time_set_variation4.phpt +++ /dev/null @@ -1,329 +0,0 @@ ---TEST-- -Test date_time_set() function : usage variation - Passing unexpected values to forth argument $sec. ---FILE-- -<?php -/* Prototype : DateTime date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) - * Description: Resets the current time of the DateTime object to a different time. - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTime - */ - -echo "*** Testing date_time_set() : usage variation - unexpected values to forth argument \$sec***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-01-31 15:14:10"); -$hour = 10; -$minute = 13; - -foreach($inputs as $variation =>$sec) { - echo "\n-- $variation --\n"; - var_dump( date_time_set($object, $hour, $minute, $sec) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_time_set() : usage variation - unexpected values to forth argument $sec*** - --- int 0 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 1 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:01.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int 12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 13:38:45.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- int -12345 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 06:47:15.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float 10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:10.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float -10.5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:12:50.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- float .5 -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty array -- - -Warning: date_time_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_time_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_time_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_time_set() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase null -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase true -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:01.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- lowercase false -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase TRUE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:01.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- uppercase FALSE -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- empty string DQ -- - -Warning: date_time_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_time_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_time_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_time_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_time_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_time_set() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_time_set() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_time_set() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- unset var -- -object(DateTime)#%d (3) { - ["date"]=> - string(26) "2009-01-31 10:13:00.000000" - ["timezone_type"]=> - int(3) - ["timezone"]=> - string(13) "Europe/London" -} - --- resource -- - -Warning: date_time_set() expects parameter 4 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_timestamp_get.phpt b/ext/date/tests/date_timestamp_get.phpt index d42b1a5385..2aade6db60 100644 --- a/ext/date/tests/date_timestamp_get.phpt +++ b/ext/date/tests/date_timestamp_get.phpt @@ -1,20 +1,24 @@ --TEST-- -DateTime: Test correct setup and correct DateTime parameter to date_timestamp_get() +Test the basics to function date_timestamp_get(). --CREDITS-- -Havard Eide <nucleuz@gmail.com> -#PHPTestFest2009 Norway 2009-06-09 \o/ ---INI-- -date.timezone=UTC +Carlos Alexandre Pires de Carvalho Junior <calexandrepcjr [at] gmail [dot] com> +Daiane Alves <daiane [at] lt [dot] coop [dot] br> +Ednaldo Neimeg Marques <neimeg [at] gmail [dot] com> +Henrique Ramos <henrique [at] habilissimo [dot] com [dot] br> +Larissa Mourullo <larismourullo [at] gmail [dot] com> +Vinicius Dias <carlosv775 [at] gmail [dot] com> +VirgÃlio de Carvalho Pontes <vigiliocpontes [at] outlook [dot] com> +Vitor Mattos <vitor [at] php [dot] rio> --FILE-- <?php -$tz = date_timestamp_get(new DateTime()); -var_dump(is_int($tz)); -echo "\n\n"; -$tz = date_timestamp_get(time()); +$beginDtObj = date_create('1970-01-01T00:00:00UTC'); +$beginTimestamp = date_timestamp_get($beginDtObj); +var_dump($beginTimestamp); + +// Test the DateTime feature alias in function date_timestamp_get(). +$dateTimeTz = (new DateTime('1970-01-01T00:00:00UTC'))->getTimeStamp(); +var_dump($dateTimeTz === $beginTimestamp); ?> ---EXPECTF-- +--EXPECT-- +int(0) bool(true) - - - -Warning: date_timestamp_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d diff --git a/ext/date/tests/date_timestamp_set_nullparam.phpt b/ext/date/tests/date_timestamp_set_nullparam.phpt deleted file mode 100644 index 27b105c998..0000000000 --- a/ext/date/tests/date_timestamp_set_nullparam.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Test the function date_timestamp_set() with first null parameter. ---CREDITS-- -Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> ---INI-- -date.timezone = UTC; -date_default_timezone_set("America/Sao_Paulo"); ---FILE-- -<?php -$dftz021 = date_default_timezone_get(); //UTC - -$dtms021 = date_create(); - -date_timestamp_set(null, 1234567890); -?> ---EXPECTF-- -Warning: date_timestamp_set() expects parameter 1 to be DateTime, null given in %s on line %d diff --git a/ext/date/tests/date_timestamp_set_wrongparam_001.phpt b/ext/date/tests/date_timestamp_set_wrongparam_001.phpt deleted file mode 100644 index a7af0572f3..0000000000 --- a/ext/date/tests/date_timestamp_set_wrongparam_001.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Check the function date_timestamp_set() with first parameter wrong (array). ---CREDITS-- -Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> ---INI-- -date.timezone = UTC; -date_default_timezone_set("America/Sao_Paulo"); ---FILE-- -<?php -$dftz021 = date_default_timezone_get(); //UTC - -$dtms021 = array(); - -date_timestamp_set($dtms021, 123456789); -?> ---EXPECTF-- -Warning: date_timestamp_set() expects parameter 1 to be DateTime, array given in %s on line %d diff --git a/ext/date/tests/date_timestamp_set_wrongparam_002.phpt b/ext/date/tests/date_timestamp_set_wrongparam_002.phpt deleted file mode 100644 index 8fe38ff539..0000000000 --- a/ext/date/tests/date_timestamp_set_wrongparam_002.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Check the function date_timestamp_set() with first parameter wrong (integer). ---CREDITS-- -Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> ---INI-- -date.timezone = UTC; -date_default_timezone_set("America/Sao_Paulo"); ---FILE-- -<?php -$dftz021 = date_default_timezone_get(); //UTC - -date_timestamp_set(987654321, 123456789); -?> ---EXPECTF-- -Warning: date_timestamp_set() expects parameter 1 to be DateTime, int given in %s on line %d diff --git a/ext/date/tests/date_timestamp_set_wrongparam_003.phpt b/ext/date/tests/date_timestamp_set_wrongparam_003.phpt deleted file mode 100644 index bd2a71172a..0000000000 --- a/ext/date/tests/date_timestamp_set_wrongparam_003.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -Check the function date_timestamp_set() with second parameter wrong (array). ---CREDITS-- -Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> ---INI-- -date.timezone = UTC; -date_default_timezone_set("America/Sao_Paulo"); ---FILE-- -<?php -$dftz021 = date_default_timezone_get(); //UTC - -$dtms021 = new DateTime(); - -$wrong_parameter = array(); - -date_timestamp_set($dtms021, $wrong_parameter); -?> ---EXPECTF-- -Warning: date_timestamp_set() expects parameter 2 to be int, array given in %s on line %d diff --git a/ext/date/tests/date_timestamp_set_wrongparam_004.phpt b/ext/date/tests/date_timestamp_set_wrongparam_004.phpt deleted file mode 100644 index 3a6d304561..0000000000 --- a/ext/date/tests/date_timestamp_set_wrongparam_004.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -Check the function date_timestamp_set() with 3 parameters. ---CREDITS-- -Rodrigo Prado de Jesus <royopa [at] gmail [dot] com> ---INI-- -date.timezone = UTC; -date_default_timezone_set("America/Sao_Paulo"); ---FILE-- -<?php -$dftz021 = date_default_timezone_get(); //UTC - -$dtms021 = new DateTime(); - -date_timestamp_set($dtms021, 123456789, 'error'); -?> ---EXPECTF-- -Warning: date_timestamp_set() expects exactly 2 parameters, 3 given in %s on line %d diff --git a/ext/date/tests/date_timezone_get_error.phpt b/ext/date/tests/date_timezone_get_error.phpt deleted file mode 100644 index 46255dc580..0000000000 --- a/ext/date/tests/date_timezone_get_error.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Test date_timezone_get() function : error conditions ---FILE-- -<?php -/* Prototype : DateTimeZone date_timezone_get ( DateTimeInterface $object ) - * Description: Return time zone relative to given DateTimeInterface - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeInterface::getTimezone - */ - -// Set timezone -date_default_timezone_set("Europe/London"); - -echo "*** Testing date_timezone_get() : error conditions ***\n"; - -echo "\n-- Testing date_timezone_get() function with zero arguments --\n"; -var_dump( date_timezone_get() ); - -echo "\n-- Testing date_timezone_get() function with more than expected no. of arguments --\n"; -$datetime = date_create("2009-01-30 17:57:32"); -$extra_arg = 99; -var_dump( date_timezone_get($datetime, $extra_arg) ); - -echo "\n-- Testing date_timezone_get() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_timezone_get($invalid_obj) ); -$invalid_obj = 10; -var_dump( date_timezone_get($invalid_obj) ); -$invalid_obj = null; -var_dump( date_timezone_get($invalid_obj) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_timezone_get() : error conditions *** - --- Testing date_timezone_get() function with zero arguments -- - -Warning: date_timezone_get() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_timezone_get() function with more than expected no. of arguments -- - -Warning: date_timezone_get() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing date_timezone_get() function with an invalid values for $object argument -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_timezone_get_variation1.phpt b/ext/date/tests/date_timezone_get_variation1.phpt deleted file mode 100644 index a9e995fa78..0000000000 --- a/ext/date/tests/date_timezone_get_variation1.phpt +++ /dev/null @@ -1,250 +0,0 @@ ---TEST-- -Test date_timezone_get() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : DateTimeZone date_timezone_get ( DateTimeInterface $object ) - * Description: Return time zone relative to given DateTimeInterface - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeInterface::getTimezone - */ - -echo "*** Testing date_timezone_get() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_timezone_get($object) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_timezone_get() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_timezone_set_error.phpt b/ext/date/tests/date_timezone_set_error.phpt deleted file mode 100644 index 0bed83cfaa..0000000000 --- a/ext/date/tests/date_timezone_set_error.phpt +++ /dev/null @@ -1,64 +0,0 @@ ---TEST-- -Test date_timezone_set() function : error conditions ---FILE-- -<?php -/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone ) - * Description: Sets the time zone for the DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTimezone - */ - -date_default_timezone_set("UTC"); - -echo "*** Testing date_timezone_set() : error conditions ***\n"; - -echo "\n-- Testing date_timezone_set() function with zero arguments --\n"; -var_dump( date_timezone_set() ); - -echo "\n-- Testing date_timezone_set() function with less than expected no. of arguments --\n"; -$datetime = date_create("2009-01-30 17:57:32"); -var_dump( date_timezone_set($datetime) ); - -echo "\n-- Testing date_timezone_set() function with more than expected no. of arguments --\n"; -$timezone = timezone_open("GMT"); -$extra_arg = 99; -var_dump( date_timezone_set($datetime, $timezone, $extra_arg) ); - -echo "\n-- Testing date_timezone_set() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( date_timezone_set($invalid_obj, $timezone) ); -$invalid_obj = 10; -var_dump( date_timezone_set($invalid_obj, $timezone) ); -$invalid_obj = null; -var_dump( date_timezone_set($invalid_obj, $timezone) ); -?> -===DONE=== ---EXPECTF-- -*** Testing date_timezone_set() : error conditions *** - --- Testing date_timezone_set() function with zero arguments -- - -Warning: date_timezone_set() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing date_timezone_set() function with less than expected no. of arguments -- - -Warning: date_timezone_set() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing date_timezone_set() function with more than expected no. of arguments -- - -Warning: date_timezone_set() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - --- Testing date_timezone_set() function with an invalid values for $object argument -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - -Warning: date_timezone_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - -Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_timezone_set_variation1.phpt b/ext/date/tests/date_timezone_set_variation1.phpt deleted file mode 100644 index 549993b532..0000000000 --- a/ext/date/tests/date_timezone_set_variation1.phpt +++ /dev/null @@ -1,253 +0,0 @@ ---TEST-- -Test date_timezone_set() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone ) - * Description: Sets the time zone for the DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTimezone - */ - -echo "*** Testing date_timezone_set() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$timezone = timezone_open("America/Los_Angeles"); - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( date_timezone_set($object, $timezone) ); -}; - - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_timezone_set() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_timezone_set() expects parameter 1 to be DateTime, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_timezone_set_variation2.phpt b/ext/date/tests/date_timezone_set_variation2.phpt deleted file mode 100644 index 2c17c255b0..0000000000 --- a/ext/date/tests/date_timezone_set_variation2.phpt +++ /dev/null @@ -1,252 +0,0 @@ ---TEST-- -Test date_timezone_set() function : usage variation - Passing unexpected values to second argument $timezone. ---FILE-- -<?php -/* Prototype : DateTime date_timezone_set ( DateTime $object , DateTimeZone $timezone ) - * Description: Sets the time zone for the DateTime object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::setTimezone - */ - -echo "*** Testing date_timezone_set() : usage variation - unexpected values to second argument \$timezone***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = date_create("2009-01-30 17:57:32"); - -foreach($inputs as $variation =>$timezone) { - echo "\n-- $variation --\n"; - var_dump( date_timezone_set($object, $timezone) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_timezone_set() : usage variation - unexpected values to second argument $timezone*** - --- int 0 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, null given in %s on line %d -bool(false) - --- resource -- - -Warning: date_timezone_set() expects parameter 2 to be DateTimeZone, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_variation1.phpt b/ext/date/tests/date_variation1.phpt deleted file mode 100644 index 533d0d3d7c..0000000000 --- a/ext/date/tests/date_variation1.phpt +++ /dev/null @@ -1,207 +0,0 @@ ---TEST-- -Test date() function : usage variation - Passing unexpected values to first argument $format. ---FILE-- -<?php -/* Prototype : string date ( string $format [, int $timestamp ] ) - * Description: Format a local time/date. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date() : usage variation - unexpected values to first argument \$format***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$timestamp = mktime(10, 44, 30, 2, 27, 2009); - -foreach($inputs as $variation =>$format) { - echo "\n-- $variation --\n"; - var_dump( date($format, $timestamp) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date() : usage variation - unexpected values to first argument $format*** - --- int 0 -- -string(1) "0" - --- int 1 -- -string(1) "1" - --- int 12345 -- -string(5) "12345" - --- int -12345 -- -string(6) "-12345" - --- float 10.5 -- -string(4) "10.5" - --- float -10.5 -- -string(5) "-10.5" - --- float .5 -- -string(3) "0.5" - --- empty array -- - -Warning: date() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(0) "" - --- lowercase null -- -string(0) "" - --- lowercase true -- -string(1) "1" - --- lowercase false -- -string(0) "" - --- uppercase TRUE -- -string(1) "1" - --- uppercase FALSE -- -string(0) "" - --- empty string DQ -- -string(0) "" - --- empty string SQ -- -string(0) "" - --- string DQ -- -string(40) "3028Fri, 27 Feb 2009 10:44:30 +000044210" - --- string SQ -- -string(40) "3028Fri, 27 Feb 2009 10:44:30 +000044210" - --- mixed case string -- -string(40) "30GMTFri, 27 Feb 2009 10:44:30 +00000210" - --- heredoc -- -string(76) "10Europe/LondonFridayFriday2009 52009Fri, 27 Feb 2009 10:44:30 +0000Friday27" - --- instance of classWithToString -- -string(64) "CFridayam3030 AM 2009b27Europe/London2009-02-27T10:44:30+00:0028" - --- instance of classWithoutToString -- - -Warning: date() expects parameter 1 to be string, object given in %s on line %d -bool(false) - --- undefined var -- -string(0) "" - --- unset var -- -string(0) "" - --- resource -- - -Warning: date() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_variation2.phpt b/ext/date/tests/date_variation2.phpt deleted file mode 100644 index 77dc822396..0000000000 --- a/ext/date/tests/date_variation2.phpt +++ /dev/null @@ -1,221 +0,0 @@ ---TEST-- -Test date() function : usage variation - Passing unexpected values to second argument $timestamp. ---FILE-- -<?php -/* Prototype : string date ( string $format [, int $timestamp ] ) - * Description: Format a local time/date. - * Source code: ext/date/php_date.c - */ - -echo "*** Testing date() : usage variation - unexpected values to second argument \$timestamp***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$format = "F j, Y, g:i a"; - -foreach($inputs as $variation =>$timestamp) { - echo "\n-- $variation --\n"; - var_dump( date($format, $timestamp) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date() : usage variation - unexpected values to second argument $timestamp*** - --- int 0 -- -string(24) "January 1, 1970, 1:00 am" - --- int 1 -- -string(24) "January 1, 1970, 1:00 am" - --- int 12345 -- -string(24) "January 1, 1970, 4:25 am" - --- int -12345 -- -string(26) "December 31, 1969, 9:34 pm" - --- float 10.5 -- -string(24) "January 1, 1970, 1:00 am" - --- float -10.5 -- -string(25) "January 1, 1970, 12:59 am" - --- float .5 -- -string(24) "January 1, 1970, 1:00 am" - --- empty array -- - -Warning: date() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: date() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: date() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: date() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(24) "January 1, 1970, 1:00 am" - --- lowercase null -- -string(24) "January 1, 1970, 1:00 am" - --- lowercase true -- -string(24) "January 1, 1970, 1:00 am" - --- lowercase false -- -string(24) "January 1, 1970, 1:00 am" - --- uppercase TRUE -- -string(24) "January 1, 1970, 1:00 am" - --- uppercase FALSE -- -string(24) "January 1, 1970, 1:00 am" - --- empty string DQ -- - -Warning: date() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: date() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: date() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: date() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: date() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: date() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: date() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: date() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -string(24) "January 1, 1970, 1:00 am" - --- unset var -- -string(24) "January 1, 1970, 1:00 am" - --- resource -- - -Warning: date() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/getdate_error.phpt b/ext/date/tests/getdate_error.phpt deleted file mode 100644 index e6704b032b..0000000000 --- a/ext/date/tests/getdate_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -Test getdate() function : error conditions ---FILE-- -<?php -/* Prototype : array getdate([int timestamp]) - * Description: Get date/time information - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing getdate() : error conditions ***\n"; - -//Set the default time zone -date_default_timezone_set("America/Chicago"); - -//Test getdate with one more than the expected number of arguments -echo "\n-- Testing getdate() function with more than expected no. of arguments --\n"; -$timestamp = 10; -$extra_arg = 10; -var_dump( getdate($timestamp, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing getdate() : error conditions *** - --- Testing getdate() function with more than expected no. of arguments -- - -Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/getdate_variation1.phpt b/ext/date/tests/getdate_variation1.phpt deleted file mode 100644 index 87b43e14d6..0000000000 --- a/ext/date/tests/getdate_variation1.phpt +++ /dev/null @@ -1,443 +0,0 @@ ---TEST-- -Test getdate() function : usage variation - Passing unexpected values to first argument timestamp. ---FILE-- -<?php -/* Prototype : array getdate([int timestamp]) - * Description: Get date/time information - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing getdate() : usage variation ***\n"; - -//Set the default time zone -date_default_timezone_set("Asia/Calcutta"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for timestamp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( getdate($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing getdate() : usage variation *** - ---float 10.5-- -array(11) { - ["seconds"]=> - int(10) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(10) -} - ---float -10.5-- -array(11) { - ["seconds"]=> - int(50) - ["minutes"]=> - int(29) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(-10) -} - ---float .5-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} - ---empty array-- - -Warning: getdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: getdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: getdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: getdate() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} - ---lowercase null-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} - ---lowercase true-- -array(11) { - ["seconds"]=> - int(1) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(1) -} - ---lowercase false-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} - ---uppercase TRUE-- -array(11) { - ["seconds"]=> - int(1) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(1) -} - ---uppercase FALSE-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} - ---empty string DQ-- - -Warning: getdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: getdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: getdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: getdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: getdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: getdate() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: getdate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: getdate() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} - ---unset var-- -array(11) { - ["seconds"]=> - int(0) - ["minutes"]=> - int(30) - ["hours"]=> - int(5) - ["mday"]=> - int(1) - ["wday"]=> - int(4) - ["mon"]=> - int(1) - ["year"]=> - int(1970) - ["yday"]=> - int(0) - ["weekday"]=> - string(8) "Thursday" - ["month"]=> - string(7) "January" - [0]=> - int(0) -} -===DONE=== diff --git a/ext/date/tests/gettimeofday_error.phpt b/ext/date/tests/gettimeofday_error.phpt deleted file mode 100644 index f18b54f9cd..0000000000 --- a/ext/date/tests/gettimeofday_error.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Test gettimeofday() function : error conditions ---FILE-- -<?php -/* Prototype : array gettimeofday([bool get_as_float]) - * Description: Returns the current time as array - * Source code: ext/standard/microtime.c - * Alias to functions: - */ - -echo "*** Testing gettimeofday() : error conditions ***\n"; - - -//Test gettimeofday with one more than the expected number of arguments -echo "\n-- Testing gettimeofday() function with more than expected no. of arguments --\n"; -$get_as_float = true; -$extra_arg = 10; -var_dump( gettimeofday($get_as_float, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing gettimeofday() : error conditions *** - --- Testing gettimeofday() function with more than expected no. of arguments -- - -Warning: gettimeofday() expects at most 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/date/tests/gettimeofday_variation1.phpt b/ext/date/tests/gettimeofday_variation1.phpt deleted file mode 100644 index c4f91aab0b..0000000000 --- a/ext/date/tests/gettimeofday_variation1.phpt +++ /dev/null @@ -1,284 +0,0 @@ ---TEST-- -Test gettimeofday() function : usage variation - Passing unexpected values to get_as_float argument ---FILE-- -<?php -/* Prototype : array gettimeofday([bool get_as_float]) - * Description: Returns the current time as array - * Source code: ext/standard/microtime.c - * Alias to functions: - */ - -echo "*** Testing gettimeofday() : usage variation ***\n"; - -date_default_timezone_set("Asia/Calcutta"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for get_as_float - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gettimeofday($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gettimeofday() : usage variation *** - ---int 0-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---int 1-- -float(%f) - ---int 12345-- -float(%f) - ---int -12345-- -float(%f) - ---float 10.5-- -float(%f) - ---float -10.5-- -float(%f) - ---float 12.3456789000e10-- -float(%f) - ---float -12.3456789000e10-- -float(%f) - ---float .5-- -float(%f) - ---empty array-- - -Warning: gettimeofday() expects parameter 1 to be bool, array given in %s on line %d -NULL - ---int indexed array-- - -Warning: gettimeofday() expects parameter 1 to be bool, array given in %s on line %d -NULL - ---associative array-- - -Warning: gettimeofday() expects parameter 1 to be bool, array given in %s on line %d -NULL - ---nested arrays-- - -Warning: gettimeofday() expects parameter 1 to be bool, array given in %s on line %d -NULL - ---uppercase NULL-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---lowercase null-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---lowercase true-- -float(%f) - ---lowercase false-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---uppercase TRUE-- -float(%f) - ---uppercase FALSE-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---empty string DQ-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---empty string SQ-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---string DQ-- -float(%f) - ---string SQ-- -float(%f) - ---mixed case string-- -float(%f) - ---heredoc-- -float(%f) - ---instance of classWithToString-- - -Warning: gettimeofday() expects parameter 1 to be bool, object given in %s on line %d -NULL - ---instance of classWithoutToString-- - -Warning: gettimeofday() expects parameter 1 to be bool, object given in %s on line %d -NULL - ---undefined var-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} - ---unset var-- -array(4) { - ["sec"]=> - int(%d) - ["usec"]=> - int(%d) - ["minuteswest"]=> - int(-330) - ["dsttime"]=> - int(0) -} -===DONE=== diff --git a/ext/date/tests/gmdate_error.phpt b/ext/date/tests/gmdate_error.phpt deleted file mode 100644 index 210c9d134b..0000000000 --- a/ext/date/tests/gmdate_error.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test gmdate() function : error conditions ---FILE-- -<?php -/* Prototype : string gmdate(string format [, long timestamp]) - * Description: Format a GMT date/time - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmdate() : error conditions ***\n"; - -// Initialise all required variables -date_default_timezone_set('UTC'); -$format = DATE_ISO8601; -$timestamp = mktime(8, 8, 8, 8, 8, 2008); - -// Zero arguments -echo "\n-- Testing gmdate() function with Zero arguments --\n"; -var_dump( gmdate() ); - -//Test gmdate with one more than the expected number of arguments -echo "\n-- Testing gmdate() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( gmdate($format, $timestamp, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing gmdate() : error conditions *** - --- Testing gmdate() function with Zero arguments -- - -Warning: gmdate() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing gmdate() function with more than expected no. of arguments -- - -Warning: gmdate() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gmdate_variation1.phpt b/ext/date/tests/gmdate_variation1.phpt deleted file mode 100644 index 88fb91d5fe..0000000000 --- a/ext/date/tests/gmdate_variation1.phpt +++ /dev/null @@ -1,221 +0,0 @@ ---TEST-- -Test gmdate() function : usage variation - Passing unexpected values to format argument . ---FILE-- -<?php -/* Prototype : string gmdate(string format [, long timestamp]) - * Description: Format a GMT date/time - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmdate() : usage variation ***\n"; - -// Initialise all required variables -date_default_timezone_set('UTC'); -$timestamp = mktime(8, 8, 8, 8, 8, 2008); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for format - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmdate($value, $timestamp) ); - var_dump( gmdate($value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmdate() : usage variation *** - ---int 0-- -string(1) "0" -string(1) "0" - ---int 1-- -string(1) "1" -string(1) "1" - ---int 12345-- -string(5) "12345" -string(5) "12345" - ---int -12345-- -string(6) "-12345" -string(6) "-12345" - ---float 10.5-- -string(4) "10.5" -string(4) "10.5" - ---float -10.5-- -string(5) "-10.5" -string(5) "-10.5" - ---float 12.3456789000e10-- -string(12) "123456789000" -string(12) "123456789000" - ---float -12.3456789000e10-- -string(13) "-123456789000" -string(13) "-123456789000" - ---float .5-- -string(3) "0.5" -string(3) "0.5" - ---empty array-- - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmdate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(0) "" -string(0) "" - ---lowercase null-- -string(0) "" -string(0) "" - ---lowercase true-- -string(1) "1" -string(1) "1" - ---lowercase false-- -string(0) "" -string(0) "" - ---uppercase TRUE-- -string(1) "1" -string(1) "1" - ---uppercase FALSE-- -string(0) "" -string(0) "" - ---empty string DQ-- -string(0) "" -string(0) "" - ---empty string SQ-- -string(0) "" -string(0) "" - ---instance of classWithToString-- -string(53) "CFridayam0808 AM 2008b8UTC2008-08-08T08:08:08+00:0031" -string(%d) "%s" - ---instance of classWithoutToString-- - -Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d -bool(false) - -Warning: gmdate() expects parameter 1 to be string, object given in %s on line %d -bool(false) - ---undefined var-- -string(0) "" -string(0) "" - ---unset var-- -string(0) "" -string(0) "" -===DONE=== diff --git a/ext/date/tests/gmdate_variation2.phpt b/ext/date/tests/gmdate_variation2.phpt deleted file mode 100644 index 0d522e5bf2..0000000000 --- a/ext/date/tests/gmdate_variation2.phpt +++ /dev/null @@ -1,210 +0,0 @@ ---TEST-- -Test gmdate() function : usage variation - Passing unexpected values to timestamp argument. ---FILE-- -<?php -/* Prototype : string gmdate(string format [, long timestamp]) - * Description: Format a GMT date/time - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmdate() : usage variation ***\n"; - - -// Initialise all required variables -date_default_timezone_set('UTC'); -$format = DATE_ISO8601; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for timestamp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmdate($format, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmdate() : usage variation *** - ---int 0-- -string(24) "1970-01-01T00:00:00+0000" - ---int 1-- -string(24) "1970-01-01T00:00:01+0000" - ---int 12345-- -string(24) "1970-01-01T03:25:45+0000" - ---int -12345-- -string(24) "1969-12-31T20:34:15+0000" - ---float 10.5-- -string(24) "1970-01-01T00:00:10+0000" - ---float -10.5-- -string(24) "1969-12-31T23:59:50+0000" - ---float .5-- -string(24) "1970-01-01T00:00:00+0000" - ---empty array-- - -Warning: gmdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmdate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(24) "1970-01-01T00:00:00+0000" - ---lowercase null-- -string(24) "1970-01-01T00:00:00+0000" - ---lowercase true-- -string(24) "1970-01-01T00:00:01+0000" - ---lowercase false-- -string(24) "1970-01-01T00:00:00+0000" - ---uppercase TRUE-- -string(24) "1970-01-01T00:00:01+0000" - ---uppercase FALSE-- -string(24) "1970-01-01T00:00:00+0000" - ---empty string DQ-- - -Warning: gmdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmdate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmdate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmdate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -string(24) "1970-01-01T00:00:00+0000" - ---unset var-- -string(24) "1970-01-01T00:00:00+0000" -===DONE=== diff --git a/ext/date/tests/gmmktime_error.phpt b/ext/date/tests/gmmktime_error.phpt deleted file mode 100644 index fb6dc85c3b..0000000000 --- a/ext/date/tests/gmmktime_error.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Test gmmktime() function : error conditions ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : error conditions ***\n"; - -//Test gmmktime with one more than the expected number of arguments -echo "\n-- Testing gmmktime() function with more than expected no. of arguments --\n"; -$hour = 8; -$min = 8; -$sec = 8; -$mon = 8; -$day = 8; -$year = 2008; -$extra_arg = 10; - -var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year, $extra_arg) ); -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : error conditions *** - --- Testing gmmktime() function with more than expected no. of arguments -- - -Warning: gmmktime() expects at most 6 parameters, 7 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation1.phpt b/ext/date/tests/gmmktime_variation1.phpt deleted file mode 100644 index 95150e174b..0000000000 --- a/ext/date/tests/gmmktime_variation1.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -Test gmmktime() function : usage variation - Passing unexpected values to first argument hour. ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$min = 8; -$sec = 8; -$mon = 8; -$day = 8; -$year = 2008; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for hour - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : usage variation *** - ---float 10.5-- -int(1218190088) - ---float -10.5-- -int(1218118088) - ---float .5-- -int(1218154088) - ---empty array-- - -Warning: gmmktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmmktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmmktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmmktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1218154088) - ---lowercase null-- -int(1218154088) - ---lowercase true-- -int(1218157688) - ---lowercase false-- -int(1218154088) - ---uppercase TRUE-- -int(1218157688) - ---uppercase FALSE-- -int(1218154088) - ---empty string DQ-- - -Warning: gmmktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmmktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmmktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmmktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmmktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmmktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmmktime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmmktime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1218154088) - ---unset var-- -int(1218154088) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation2.phpt b/ext/date/tests/gmmktime_variation2.phpt deleted file mode 100644 index 2022a08a5b..0000000000 --- a/ext/date/tests/gmmktime_variation2.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -Test gmmktime() function : usage variation - Passing unexpected values to second argument minute. ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$hour = 8; -$sec = 8; -$mon = 8; -$day = 8; -$year = 2008; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for min - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : usage variation *** - ---float 10.5-- -int(1218183008) - ---float -10.5-- -int(1218181808) - ---float .5-- -int(1218182408) - ---empty array-- - -Warning: gmmktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmmktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmmktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmmktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1218182408) - ---lowercase null-- -int(1218182408) - ---lowercase true-- -int(1218182468) - ---lowercase false-- -int(1218182408) - ---uppercase TRUE-- -int(1218182468) - ---uppercase FALSE-- -int(1218182408) - ---empty string DQ-- - -Warning: gmmktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmmktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmmktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmmktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmmktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmmktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmmktime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmmktime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1218182408) - ---unset var-- -int(1218182408) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation3.phpt b/ext/date/tests/gmmktime_variation3.phpt deleted file mode 100644 index 409c08ab8a..0000000000 --- a/ext/date/tests/gmmktime_variation3.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -Test gmmktime() function : usage variation - Passing unexpected values to third argument seconds. ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$hour = 8; -$min = 8; -$mon = 8; -$day = 8; -$year = 2008; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for sec - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : usage variation *** - ---float 10.5-- -int(1218182890) - ---float -10.5-- -int(1218182870) - ---float .5-- -int(1218182880) - ---empty array-- - -Warning: gmmktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmmktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmmktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmmktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1218182880) - ---lowercase null-- -int(1218182880) - ---lowercase true-- -int(1218182881) - ---lowercase false-- -int(1218182880) - ---uppercase TRUE-- -int(1218182881) - ---uppercase FALSE-- -int(1218182880) - ---empty string DQ-- - -Warning: gmmktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmmktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmmktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmmktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmmktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmmktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmmktime() expects parameter 3 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmmktime() expects parameter 3 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1218182880) - ---unset var-- -int(1218182880) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation4.phpt b/ext/date/tests/gmmktime_variation4.phpt deleted file mode 100644 index fb51916e34..0000000000 --- a/ext/date/tests/gmmktime_variation4.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -Test gmmktime() function : usage variation - Passing unexpected values to fourth argument month. ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$hour = 8; -$min = 8; -$sec = 8; -$day = 8; -$year = 2008; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for mon - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : usage variation *** - ---float 10.5-- -int(1223453288) - ---float -10.5-- -int(1170922088) - ---float .5-- -int(1197101288) - ---empty array-- - -Warning: gmmktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmmktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmmktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmmktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1197101288) - ---lowercase null-- -int(1197101288) - ---lowercase true-- -int(1199779688) - ---lowercase false-- -int(1197101288) - ---uppercase TRUE-- -int(1199779688) - ---uppercase FALSE-- -int(1197101288) - ---empty string DQ-- - -Warning: gmmktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmmktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmmktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmmktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmmktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmmktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmmktime() expects parameter 4 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmmktime() expects parameter 4 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1197101288) - ---unset var-- -int(1197101288) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation5.phpt b/ext/date/tests/gmmktime_variation5.phpt deleted file mode 100644 index 1ebf1377b3..0000000000 --- a/ext/date/tests/gmmktime_variation5.phpt +++ /dev/null @@ -1,194 +0,0 @@ ---TEST-- -Test gmmktime() function : usage variation - Passing unexpected values to fifth argument day. ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$hour = 8; -$min = 8; -$sec = 8; -$mon = 8; -$year = 2008; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for day - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmmktime($hour, $min, $sec, $mon, $value, $year) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : usage variation *** - ---float 10.5-- -int(1218355688) - ---float -10.5-- -int(1216627688) - ---float .5-- -int(1217491688) - ---empty array-- - -Warning: gmmktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmmktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmmktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmmktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1217491688) - ---lowercase null-- -int(1217491688) - ---lowercase true-- -int(1217578088) - ---lowercase false-- -int(1217491688) - ---uppercase TRUE-- -int(1217578088) - ---uppercase FALSE-- -int(1217491688) - ---empty string DQ-- - -Warning: gmmktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmmktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmmktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmmktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmmktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmmktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmmktime() expects parameter 5 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmmktime() expects parameter 5 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1217491688) - ---unset var-- -int(1217491688) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation6.phpt b/ext/date/tests/gmmktime_variation6.phpt deleted file mode 100644 index e5e80282cb..0000000000 --- a/ext/date/tests/gmmktime_variation6.phpt +++ /dev/null @@ -1,190 +0,0 @@ ---TEST-- -Test gmmktime() function : usage variation - Passing unexpected values to sixth argument year. ---FILE-- -<?php -/* Prototype : int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) - * Description: Get UNIX timestamp for a GMT date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmmktime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$hour = 8; -$min = 8; -$sec = 8; -$mon = 8; -$day = 8; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for year - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmmktime($hour, $min, $sec, $mon, $day, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmmktime() : usage variation *** - ---float 10.5-- -int(1281254888) - ---float .5-- -int(965722088) - ---empty array-- - -Warning: gmmktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmmktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmmktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmmktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(965722088) - ---lowercase null-- -int(965722088) - ---lowercase true-- -int(997258088) - ---lowercase false-- -int(965722088) - ---uppercase TRUE-- -int(997258088) - ---uppercase FALSE-- -int(965722088) - ---empty string DQ-- - -Warning: gmmktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmmktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmmktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmmktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmmktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmmktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmmktime() expects parameter 6 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmmktime() expects parameter 6 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(965722088) - ---unset var-- -int(965722088) -===DONE=== diff --git a/ext/date/tests/gmstrftime_error.phpt b/ext/date/tests/gmstrftime_error.phpt deleted file mode 100644 index 3e6050c140..0000000000 --- a/ext/date/tests/gmstrftime_error.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -Test gmstrftime() function : error conditions ---FILE-- -<?php -/* Prototype : string gmstrftime(string format [, int timestamp]) - * Description: Format a GMT/UCT time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmstrftime() : error conditions ***\n"; - -// Zero arguments -echo "\n-- Testing gmstrftime() function with Zero arguments --\n"; -var_dump( gmstrftime() ); - -//Test gmstrftime with one more than the expected number of arguments -echo "\n-- Testing gmstrftime() function with more than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); -$extra_arg = 10; -var_dump( gmstrftime($format, $timestamp, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing gmstrftime() : error conditions *** - --- Testing gmstrftime() function with Zero arguments -- - -Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing gmstrftime() function with more than expected no. of arguments -- - -Warning: gmstrftime() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation1.phpt b/ext/date/tests/gmstrftime_variation1.phpt deleted file mode 100644 index c8dcbe08e5..0000000000 --- a/ext/date/tests/gmstrftime_variation1.phpt +++ /dev/null @@ -1,220 +0,0 @@ ---TEST-- -Test gmstrftime() function : usage variation - Passing unexpected values to first argument 'format'. ---FILE-- -<?php -/* Prototype : string gmstrftime(string format [, int timestamp]) - * Description: Format a GMT/UCT time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmstrftime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for format - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmstrftime($value) ); - var_dump( gmstrftime($value, $timestamp) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmstrftime() : usage variation *** - ---int 0-- -string(1) "0" -string(1) "0" - ---int 1-- -string(1) "1" -string(1) "1" - ---int 12345-- -string(5) "12345" -string(5) "12345" - ---int -12345-- -string(6) "-12345" -string(6) "-12345" - ---float 10.5-- -string(4) "10.5" -string(4) "10.5" - ---float -10.5-- -string(5) "-10.5" -string(5) "-10.5" - ---float 12.3456789000e10-- -string(12) "123456789000" -string(12) "123456789000" - ---float -12.3456789000e10-- -string(13) "-123456789000" -string(13) "-123456789000" - ---float .5-- -string(3) "0.5" -string(3) "0.5" - ---empty array-- - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: gmstrftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---uppercase NULL-- -bool(false) -bool(false) - ---lowercase null-- -bool(false) -bool(false) - ---lowercase true-- -string(1) "1" -string(1) "1" - ---lowercase false-- -bool(false) -bool(false) - ---uppercase TRUE-- -string(1) "1" -string(1) "1" - ---uppercase FALSE-- -bool(false) -bool(false) - ---empty string DQ-- -bool(false) -bool(false) - ---empty string SQ-- -bool(false) -bool(false) - ---instance of classWithToString-- -string(14) "Class A object" -string(14) "Class A object" - ---instance of classWithoutToString-- - -Warning: gmstrftime() expects parameter 1 to be string, object given in %s on line %d -bool(false) - -Warning: gmstrftime() expects parameter 1 to be string, object given in %s on line %d -bool(false) - ---undefined var-- -bool(false) -bool(false) - ---unset var-- -bool(false) -bool(false) -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation11.phpt b/ext/date/tests/gmstrftime_variation11.phpt index bb37757c7a..f64c3ea1e2 100644 --- a/ext/date/tests/gmstrftime_variation11.phpt +++ b/ext/date/tests/gmstrftime_variation11.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking month related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/gmstrftime_variation13.phpt b/ext/date/tests/gmstrftime_variation13.phpt index c8c77c8055..9a7a9b3c4b 100644 --- a/ext/date/tests/gmstrftime_variation13.phpt +++ b/ext/date/tests/gmstrftime_variation13.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking date related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/gmstrftime_variation15.phpt b/ext/date/tests/gmstrftime_variation15.phpt index 157eaa8fec..ac91c66a9e 100644 --- a/ext/date/tests/gmstrftime_variation15.phpt +++ b/ext/date/tests/gmstrftime_variation15.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking time related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/gmstrftime_variation17.phpt b/ext/date/tests/gmstrftime_variation17.phpt index d4d82efd10..9abdb76e0c 100644 --- a/ext/date/tests/gmstrftime_variation17.phpt +++ b/ext/date/tests/gmstrftime_variation17.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking day related formats which was not supported on Windows before vc14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/gmstrftime_variation19.phpt b/ext/date/tests/gmstrftime_variation19.phpt index 3000860bb9..983911fa48 100644 --- a/ext/date/tests/gmstrftime_variation19.phpt +++ b/ext/date/tests/gmstrftime_variation19.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking newline and tab formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/gmstrftime_variation2.phpt b/ext/date/tests/gmstrftime_variation2.phpt deleted file mode 100644 index 89dc158661..0000000000 --- a/ext/date/tests/gmstrftime_variation2.phpt +++ /dev/null @@ -1,210 +0,0 @@ ---TEST-- -Test gmstrftime() function : usage variation - Passing unexpected values to second argument 'timestamp'. ---SKIPIF-- -<?php -if(PHP_INT_SIZE != 4 ) { - die("skip Test is not valid for 64-bit"); -} -?> ---FILE-- -<?php -/* Prototype : string gmstrftime(string format [, int timestamp]) - * Description: Format a GMT/UCT time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing gmstrftime() : usage variation ***\n"; - -date_default_timezone_set("Asia/Calcutta"); - -// Initialise function arguments not being substituted (if any) -$format = '%b %d %Y %H:%M:%S'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for timestamp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( gmstrftime($format, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing gmstrftime() : usage variation *** - ---float 10.5-- -string(20) "Jan 01 1970 00:00:10" - ---float -10.5-- -string(20) "Dec 31 1969 23:59:50" - ---float 12.3456789000e10-- - -Warning: gmstrftime() expects parameter 2 to be int, float given in %s on line %d -bool(false) - ---float -12.3456789000e10-- - -Warning: gmstrftime() expects parameter 2 to be int, float given in %s on line %d -bool(false) - ---float .5-- -string(20) "Jan 01 1970 00:00:00" - ---empty array-- - -Warning: gmstrftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: gmstrftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: gmstrftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: gmstrftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(20) "Jan 01 1970 00:00:00" - ---lowercase null-- -string(20) "Jan 01 1970 00:00:00" - ---lowercase true-- -string(20) "Jan 01 1970 00:00:01" - ---lowercase false-- -string(20) "Jan 01 1970 00:00:00" - ---uppercase TRUE-- -string(20) "Jan 01 1970 00:00:01" - ---uppercase FALSE-- -string(20) "Jan 01 1970 00:00:00" - ---empty string DQ-- - -Warning: gmstrftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: gmstrftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: gmstrftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: gmstrftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: gmstrftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: gmstrftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: gmstrftime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: gmstrftime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -string(20) "Jan 01 1970 00:00:00" - ---unset var-- -string(20) "Jan 01 1970 00:00:00" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation21.phpt b/ext/date/tests/gmstrftime_variation21.phpt index a427090942..8ff050fc9a 100644 --- a/ext/date/tests/gmstrftime_variation21.phpt +++ b/ext/date/tests/gmstrftime_variation21.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking Preferred date and time representation on Windows. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/gmstrftime_variation9.phpt b/ext/date/tests/gmstrftime_variation9.phpt index ec69404cfc..560ea2db47 100644 --- a/ext/date/tests/gmstrftime_variation9.phpt +++ b/ext/date/tests/gmstrftime_variation9.phpt @@ -1,11 +1,5 @@ --TEST-- Test gmstrftime() function : usage variation - Checking week related formats which was not supported on Windows before vc14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is only valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string gmstrftime(string format [, int timestamp]) diff --git a/ext/date/tests/idate_error.phpt b/ext/date/tests/idate_error.phpt deleted file mode 100644 index ff277ecd6a..0000000000 --- a/ext/date/tests/idate_error.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Test idate() function : error conditions ---FILE-- -<?php -/* Prototype : int idate(string format [, int timestamp]) - * Description: Format a local time/date as integer - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing idate() : error conditions ***\n"; - -echo "\n-- Testing idate() function with Zero arguments --\n"; -var_dump( idate() ); - -echo "\n-- Testing idate() function with more than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); -$extra_arg = 10; -var_dump( idate($format, $timestamp, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing idate() : error conditions *** - --- Testing idate() function with Zero arguments -- - -Warning: idate() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing idate() function with more than expected no. of arguments -- - -Warning: idate() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/idate_variation1.phpt b/ext/date/tests/idate_variation1.phpt deleted file mode 100644 index 8727b8133a..0000000000 --- a/ext/date/tests/idate_variation1.phpt +++ /dev/null @@ -1,301 +0,0 @@ ---TEST-- -Test idate() function : usage variation - Passing unexpected values to first argument 'format'. ---FILE-- -<?php -/* Prototype : int idate(string format [, int timestamp]) - * Description: Format a local time/date as integer - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing idate() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -date_default_timezone_set("Asia/Calcutta"); -$timestamp = mktime(8, 8, 8, 8, 8, 2008); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for format - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( idate($value) ); - var_dump( idate($value, $timestamp) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing idate() : usage variation *** - ---int 0-- - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - ---int 1-- - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - ---int 12345-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---int -12345-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---float 10.5-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---float -10.5-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---float 12.3456789000e10-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---float -12.3456789000e10-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---float .5-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---empty array-- - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: idate() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---uppercase NULL-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---lowercase null-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---lowercase true-- - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - ---lowercase false-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---uppercase TRUE-- - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - -Warning: idate(): Unrecognized date format token. in %s on line %d -bool(false) - ---uppercase FALSE-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---empty string DQ-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: idate() expects parameter 1 to be string, object given in %s on line %d -bool(false) - -Warning: idate() expects parameter 1 to be string, object given in %s on line %d -bool(false) - ---undefined var-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - ---unset var-- - -Warning: idate(): idate format is one char in %s on line %d -bool(false) - -Warning: idate(): idate format is one char in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/idate_variation2.phpt b/ext/date/tests/idate_variation2.phpt deleted file mode 100644 index 5d6cc6b13f..0000000000 --- a/ext/date/tests/idate_variation2.phpt +++ /dev/null @@ -1,191 +0,0 @@ ---TEST-- -Test idate() function : usage variation - Passing unexpected values to second optional argument 'timestamp'. ---FILE-- -<?php -/* Prototype : int idate(string format [, int timestamp]) - * Description: Format a local time/date as integer - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing idate() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$format = 'Y'; -date_default_timezone_set("Asia/Calcutta"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for timestamp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( idate($format, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing idate() : usage variation *** - ---float 10.5-- -int(1970) - ---float -10.5-- -int(1970) - ---float .5-- -int(1970) - ---empty array-- - -Warning: idate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: idate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: idate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: idate() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -int(1970) - ---lowercase null-- -int(1970) - ---lowercase true-- -int(1970) - ---lowercase false-- -int(1970) - ---uppercase TRUE-- -int(1970) - ---uppercase FALSE-- -int(1970) - ---empty string DQ-- - -Warning: idate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: idate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: idate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: idate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: idate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: idate() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: idate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: idate() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -int(1970) - ---unset var-- -int(1970) -===DONE=== diff --git a/ext/date/tests/localtime_error.phpt b/ext/date/tests/localtime_error.phpt deleted file mode 100644 index 4c9dee85f7..0000000000 --- a/ext/date/tests/localtime_error.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Test localtime() function : error conditions ---FILE-- -<?php -/* Prototype : array localtime([int timestamp [, bool associative_array]]) - * Description: Returns the results of the C system call localtime as an associative array - * if the associative_array argument is set to 1 other wise it is a regular array - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing localtime() : error conditions ***\n"; - -echo "\n-- Testing localtime() function with more than expected no. of arguments --\n"; -$timestamp = gmmktime(8, 8, 8, 8, 8, 2008); -$assoc = true; -$extra_arg = 10; -var_dump( localtime($timestamp, $assoc, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing localtime() : error conditions *** - --- Testing localtime() function with more than expected no. of arguments -- - -Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/localtime_variation1.phpt b/ext/date/tests/localtime_variation1.phpt deleted file mode 100644 index 6dbff620d3..0000000000 --- a/ext/date/tests/localtime_variation1.phpt +++ /dev/null @@ -1,658 +0,0 @@ ---TEST-- -Test localtime() function : usage variation - Passing unexpected values to first argument 'timestamp'. ---FILE-- -<?php -/* Prototype : array localtime([int timestamp [, bool associative_array]]) - * Description: Returns the results of the C system call localtime as an associative array - * if the associative_array argument is set to 1 other wise it is a regular array - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing localtime() : usage variation ***\n"; - -date_default_timezone_set("UTC"); -// Initialise function arguments not being substituted (if any) -$is_associative = true; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for timestamp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( localtime($value) ); - var_dump( localtime($value, $is_associative) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing localtime() : usage variation *** - ---float 10.5-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---float -10.5-- -array(9) { - [0]=> - int(50) - [1]=> - int(59) - [2]=> - int(23) - [3]=> - int(31) - [4]=> - int(11) - [5]=> - int(69) - [6]=> - int(3) - [7]=> - int(364) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(50) - ["tm_min"]=> - int(59) - ["tm_hour"]=> - int(23) - ["tm_mday"]=> - int(31) - ["tm_mon"]=> - int(11) - ["tm_year"]=> - int(69) - ["tm_wday"]=> - int(3) - ["tm_yday"]=> - int(364) - ["tm_isdst"]=> - int(0) -} - ---float .5-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---empty array-- - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---lowercase null-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---lowercase true-- -array(9) { - [0]=> - int(1) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(1) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---lowercase false-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---uppercase TRUE-- -array(9) { - [0]=> - int(1) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(1) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---uppercase FALSE-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---empty string DQ-- - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: localtime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: localtime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---unset var-- -array(9) { - [0]=> - int(0) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -array(9) { - ["tm_sec"]=> - int(0) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} -===DONE=== diff --git a/ext/date/tests/localtime_variation2.phpt b/ext/date/tests/localtime_variation2.phpt deleted file mode 100644 index 315d956fcd..0000000000 --- a/ext/date/tests/localtime_variation2.phpt +++ /dev/null @@ -1,643 +0,0 @@ ---TEST-- -Test localtime() function : usage variation - Passing unexpected values to second argument 'associative_array'. ---FILE-- -<?php -/* Prototype : array localtime([int timestamp [, bool associative_array]]) - * Description: Returns the results of the C system call localtime as an associative array - * if the associative_array argument is set to 1 other wise it is a regular array - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing localtime() : usage variation ***\n"; - -date_default_timezone_set("UTC"); -// Initialise function arguments not being substituted (if any) -$timestamp = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -2345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for associative_array - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( localtime($timestamp, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing localtime() : usage variation *** - ---int 0-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---int 1-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---int 12345-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---int -12345-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---float 10.5-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---float -10.5-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---float 12.3456789000e10-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---float -12.3456789000e10-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---float .5-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---empty array-- - -Warning: localtime() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: localtime() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: localtime() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: localtime() expects parameter 2 to be bool, array given in %s on line %d -bool(false) - ---uppercase NULL-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---lowercase null-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---lowercase true-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---lowercase false-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---uppercase TRUE-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---uppercase FALSE-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---empty string DQ-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---empty string SQ-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---string DQ-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---string SQ-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---mixed case string-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---heredoc-- -array(9) { - ["tm_sec"]=> - int(10) - ["tm_min"]=> - int(0) - ["tm_hour"]=> - int(0) - ["tm_mday"]=> - int(1) - ["tm_mon"]=> - int(0) - ["tm_year"]=> - int(70) - ["tm_wday"]=> - int(4) - ["tm_yday"]=> - int(0) - ["tm_isdst"]=> - int(0) -} - ---instance of classWithToString-- - -Warning: localtime() expects parameter 2 to be bool, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: localtime() expects parameter 2 to be bool, object given in %s on line %d -bool(false) - ---undefined var-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} - ---unset var-- -array(9) { - [0]=> - int(10) - [1]=> - int(0) - [2]=> - int(0) - [3]=> - int(1) - [4]=> - int(0) - [5]=> - int(70) - [6]=> - int(4) - [7]=> - int(0) - [8]=> - int(0) -} -===DONE=== diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt index cbb441f13c..f415cbf2d6 100644 --- a/ext/date/tests/mktime-3-64bit.phpt +++ b/ext/date/tests/mktime-3-64bit.phpt @@ -1,7 +1,7 @@ --TEST-- mktime() [3] (64-bit) --SKIPIF-- -<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?> +<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?> --INI-- error_reporting=2047 --FILE-- diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt index ce1a203a20..cc16083965 100644 --- a/ext/date/tests/mktime-3.phpt +++ b/ext/date/tests/mktime-3.phpt @@ -1,7 +1,7 @@ --TEST-- mktime() [3] (32-bit) --SKIPIF-- -<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?> +<?php if (PHP_INT_SIZE == 8) die("skip 32-bit only"); ?> --INI-- error_reporting=2047 --FILE-- diff --git a/ext/date/tests/mktime_variation1.phpt b/ext/date/tests/mktime_variation1.phpt deleted file mode 100644 index da4dd1836a..0000000000 --- a/ext/date/tests/mktime_variation1.phpt +++ /dev/null @@ -1,224 +0,0 @@ ---TEST-- -Test mktime() function : usage variation - Passing unexpected values to first argument $hour. ---FILE-- -<?php -/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] ) - * Description: Get Unix timestamp for a date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing mktime() : usage variation - unexpected values to first argument \$hour***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; -$minute = 30; -$sec = 45; -$month = 7; -$day = 2; -$year = 1963; -$is_dst = 0; - -foreach($inputs as $variation =>$hour) { - echo "\n-- $variation --\n"; - var_dump( mktime($hour) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing mktime() : usage variation - unexpected values to first argument $hour*** - --- int 0 -- -int(%i) - --- int 12345 -- -int(%i) - --- int -12345 -- -int(%i) - --- float 10.5 -- -int(%i) - --- float -10.5 -- -int(%i) - --- float .5 -- -int(%i) - --- empty array -- - -Warning: mktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: mktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: mktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: mktime() expects parameter 1 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -int(%i) - --- lowercase null -- -int(%i) - --- lowercase true -- -int(%i) - --- lowercase false -- -int(%i) - --- uppercase TRUE -- -int(%i) - --- uppercase FALSE -- -int(%i) - --- empty string DQ -- - -Warning: mktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: mktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: mktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: mktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: mktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: mktime() expects parameter 1 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: mktime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: mktime() expects parameter 1 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -int(%i) - --- unset var -- -int(%i) - --- resource -- - -Warning: mktime() expects parameter 1 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/mktime_variation2.phpt b/ext/date/tests/mktime_variation2.phpt deleted file mode 100644 index dafb7a0aa0..0000000000 --- a/ext/date/tests/mktime_variation2.phpt +++ /dev/null @@ -1,218 +0,0 @@ ---TEST-- -Test mktime() function : usage variation - Passing unexpected values to second argument $minute. ---FILE-- -<?php -/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] ) - * Description: Get Unix timestamp for a date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing mktime() : usage variation - unexpected values to second argument \$minute***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; - -foreach($inputs as $variation =>$minute) { - echo "\n-- $variation --\n"; - var_dump( mktime($hour, $minute) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing mktime() : usage variation - unexpected values to second argument $minute*** - --- int 0 -- -int(%i) - --- int 12345 -- -int(%i) - --- int -12345 -- -int(%i) - --- float 10.5 -- -int(%i) - --- float -10.5 -- -int(%i) - --- float .5 -- -int(%i) - --- empty array -- - -Warning: mktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: mktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: mktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: mktime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -int(%i) - --- lowercase null -- -int(%i) - --- lowercase true -- -int(%i) - --- lowercase false -- -int(%i) - --- uppercase TRUE -- -int(%i) - --- uppercase FALSE -- -int(%i) - --- empty string DQ -- - -Warning: mktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: mktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: mktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: mktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: mktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: mktime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: mktime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: mktime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -int(%i) - --- unset var -- -int(%i) - --- resource -- - -Warning: mktime() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/mktime_variation3.phpt b/ext/date/tests/mktime_variation3.phpt deleted file mode 100644 index e610a13b3c..0000000000 --- a/ext/date/tests/mktime_variation3.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test mktime() function : usage variation - Passing unexpected values to third argument $second. ---FILE-- -<?php -/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] ) - * Description: Get Unix timestamp for a date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing mktime() : usage variation - unexpected values to third argument \$second***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; -$minute = 30; - -foreach($inputs as $variation =>$second) { - echo "\n-- $variation --\n"; - var_dump( mktime($hour, $minute, $second) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing mktime() : usage variation - unexpected values to third argument $second*** - --- int 0 -- -int(%i) - --- int 12345 -- -int(%i) - --- int -12345 -- -int(%i) - --- float 10.5 -- -int(%i) - --- float -10.5 -- -int(%i) - --- float .5 -- -int(%i) - --- empty array -- - -Warning: mktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: mktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: mktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: mktime() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -int(%i) - --- lowercase null -- -int(%i) - --- lowercase true -- -int(%i) - --- lowercase false -- -int(%i) - --- uppercase TRUE -- -int(%i) - --- uppercase FALSE -- -int(%i) - --- empty string DQ -- - -Warning: mktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: mktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: mktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: mktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: mktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: mktime() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: mktime() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: mktime() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -int(%i) - --- unset var -- -int(%i) - --- resource -- - -Warning: mktime() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/mktime_variation4.phpt b/ext/date/tests/mktime_variation4.phpt deleted file mode 100644 index 5cd39dd0ec..0000000000 --- a/ext/date/tests/mktime_variation4.phpt +++ /dev/null @@ -1,220 +0,0 @@ ---TEST-- -Test mktime() function : usage variation - Passing unexpected values to forth argument $month. ---FILE-- -<?php -/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] ) - * Description: Get Unix timestamp for a date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing mktime() : usage variation - unexpected values to forth argument \$month***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; -$minute = 30; -$second = 45; - -foreach($inputs as $variation =>$month) { - echo "\n-- $variation --\n"; - var_dump( mktime($hour, $minute, $second, $month) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing mktime() : usage variation - unexpected values to forth argument $month*** - --- int 0 -- -int(%i) - --- int 12345 -- -%rint\(-?[1-9][0-9]*\)|bool\(false\)%r - --- int -12345 -- -%rint\(-?[1-9][0-9]*\)|bool\(false\)%r - --- float 10.5 -- -int(%i) - --- float -10.5 -- -int(%i) - --- float .5 -- -int(%i) - --- empty array -- - -Warning: mktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: mktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: mktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: mktime() expects parameter 4 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -int(%i) - --- lowercase null -- -int(%i) - --- lowercase true -- -int(%i) - --- lowercase false -- -int(%i) - --- uppercase TRUE -- -int(%i) - --- uppercase FALSE -- -int(%i) - --- empty string DQ -- - -Warning: mktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: mktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: mktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: mktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: mktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: mktime() expects parameter 4 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: mktime() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: mktime() expects parameter 4 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -int(%i) - --- unset var -- -int(%i) - --- resource -- - -Warning: mktime() expects parameter 4 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/mktime_variation5.phpt b/ext/date/tests/mktime_variation5.phpt deleted file mode 100644 index 526d74d896..0000000000 --- a/ext/date/tests/mktime_variation5.phpt +++ /dev/null @@ -1,221 +0,0 @@ ---TEST-- -Test mktime() function : usage variation - Passing unexpected values to fifth argument $day. ---FILE-- -<?php -/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] ) - * Description: Get Unix timestamp for a date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing mktime() : usage variation - unexpected values to fifth argument \$day***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; -$minute = 30; -$second = 45; -$month = 7; - -foreach($inputs as $variation =>$day) { - echo "\n-- $variation --\n"; - var_dump( mktime($hour, $minute, $second, $month, $day) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing mktime() : usage variation - unexpected values to fifth argument $day*** - --- int 0 -- -int(%i) - --- int 12345 -- -%rint\(-?[1-9][0-9]*\)|bool\(false\)%r - --- int -12345 -- -int(%i) - --- float 10.5 -- -int(%i) - --- float -10.5 -- -int(%i) - --- float .5 -- -int(%i) - --- empty array -- - -Warning: mktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: mktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: mktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: mktime() expects parameter 5 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -int(%i) - --- lowercase null -- -int(%i) - --- lowercase true -- -int(%i) - --- lowercase false -- -int(%i) - --- uppercase TRUE -- -int(%i) - --- uppercase FALSE -- -int(%i) - --- empty string DQ -- - -Warning: mktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: mktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: mktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: mktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: mktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: mktime() expects parameter 5 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: mktime() expects parameter 5 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: mktime() expects parameter 5 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -int(%i) - --- unset var -- -int(%i) - --- resource -- - -Warning: mktime() expects parameter 5 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/mktime_variation6.phpt b/ext/date/tests/mktime_variation6.phpt deleted file mode 100644 index 82f42634a1..0000000000 --- a/ext/date/tests/mktime_variation6.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test mktime() function : usage variation - Passing unexpected values to sixth argument $year. ---FILE-- -<?php -/* Prototype : int mktime ([ int $hour= date("H") [, int $minute= date("i") [, int $second= date("s") [, int $month= date("n") [, int $day= date("j") [, int $year= date("Y") [, int $is_dst= -1 ]]]]]]] ) - * Description: Get Unix timestamp for a date - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing mktime() : usage variation - unexpected values to sixth argument \$year***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$hour = 10; -$minute = 30; -$second = 45; -$month = 7; -$day = 2; - -foreach($inputs as $variation =>$year) { - echo "\n-- $variation --\n"; - var_dump( mktime($hour, $minute, $second, $month, $day, $year) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing mktime() : usage variation - unexpected values to sixth argument $year*** - --- int 0 -- -int(%i) - --- int 12345 -- -%rint\(-?[1-9][0-9]*\)|bool\(false\)%r - --- int -12345 -- -%rint\(-?[1-9][0-9]*\)|bool\(false\)%r - --- float 10.5 -- -int(%i) - --- float -10.5 -- -%rint\(-?[1-9][0-9]*\)|bool\(false\)%r - --- float .5 -- -int(%i) - --- empty array -- - -Warning: mktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: mktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: mktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: mktime() expects parameter 6 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -int(%i) - --- lowercase null -- -int(%i) - --- lowercase true -- -int(%i) - --- lowercase false -- -int(%i) - --- uppercase TRUE -- -int(%i) - --- uppercase FALSE -- -int(%i) - --- empty string DQ -- - -Warning: mktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: mktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: mktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: mktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: mktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: mktime() expects parameter 6 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: mktime() expects parameter 6 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: mktime() expects parameter 6 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -int(%i) - --- unset var -- -int(%i) - --- resource -- - -Warning: mktime() expects parameter 6 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/strftime_error.phpt b/ext/date/tests/strftime_error.phpt deleted file mode 100644 index fe51d23466..0000000000 --- a/ext/date/tests/strftime_error.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -Test strftime() function : error conditions ---FILE-- -<?php -/* Prototype : string strftime(string format [, int timestamp]) - * Description: Format a local time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing strftime() : error conditions ***\n"; - -date_default_timezone_set("Asia/Calcutta"); -//Test strftime with one more than the expected number of arguments -echo "\n-- Testing strftime() function with more than expected no. of arguments --\n"; -$format = '%b %d %Y %H:%M:%S'; -$timestamp = mktime(8, 8, 8, 8, 8, 2008); -$extra_arg = 10; -var_dump( strftime($format, $timestamp, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing strftime() : error conditions *** - --- Testing strftime() function with more than expected no. of arguments -- - -Warning: strftime() expects at most 2 parameters, 3 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/strftime_variation1.phpt b/ext/date/tests/strftime_variation1.phpt deleted file mode 100644 index c75661dcb4..0000000000 --- a/ext/date/tests/strftime_variation1.phpt +++ /dev/null @@ -1,222 +0,0 @@ ---TEST-- -Test strftime() function : usage variation - Passing unexpected values to first argument 'format'. ---FILE-- -<?php -/* Prototype : string strftime(string format [, int timestamp]) - * Description: Format a local time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing strftime() : usage variation ***\n"; - -date_default_timezone_set("Asia/Calcutta"); - -// Initialise function arguments not being substituted (if any) -$timestamp = 10; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float 12.3456789000e10' => 12.3456789000e10, - 'float -12.3456789000e10' => -12.3456789000e10, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for format - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing strftime() : usage variation *** - ---int 0-- -string(1) "0" -string(1) "0" - ---int 1-- -string(1) "1" -string(1) "1" - ---int 12345-- -string(5) "12345" -string(5) "12345" - ---int -12345-- -string(6) "-12345" -string(6) "-12345" - ---float 10.5-- -string(4) "10.5" -string(4) "10.5" - ---float -10.5-- -string(5) "-10.5" -string(5) "-10.5" - ---float 12.3456789000e10-- -string(12) "123456789000" -string(12) "123456789000" - ---float -12.3456789000e10-- -string(13) "-123456789000" -string(13) "-123456789000" - ---float .5-- -string(3) "0.5" -string(3) "0.5" - ---empty array-- - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - -Warning: strftime() expects parameter 1 to be string, array given in %s on line %d -bool(false) - ---uppercase NULL-- -bool(false) -bool(false) - ---lowercase null-- -bool(false) -bool(false) - ---lowercase true-- -string(1) "1" -string(1) "1" - ---lowercase false-- -bool(false) -bool(false) - ---uppercase TRUE-- -string(1) "1" -string(1) "1" - ---uppercase FALSE-- -bool(false) -bool(false) - ---empty string DQ-- -bool(false) -bool(false) - ---empty string SQ-- -bool(false) -bool(false) - ---instance of classWithToString-- -string(14) "Class A object" -string(14) "Class A object" - ---instance of classWithoutToString-- - -Warning: strftime() expects parameter 1 to be string, object given in %s on line %d -bool(false) - -Warning: strftime() expects parameter 1 to be string, object given in %s on line %d -bool(false) - ---undefined var-- -bool(false) -bool(false) - ---unset var-- -bool(false) -bool(false) -===DONE=== diff --git a/ext/date/tests/strftime_variation11.phpt b/ext/date/tests/strftime_variation11.phpt index 55eb7226b8..737f7c96de 100644 --- a/ext/date/tests/strftime_variation11.phpt +++ b/ext/date/tests/strftime_variation11.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking month related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt index 887a14e7e7..cce13fbc3b 100644 --- a/ext/date/tests/strftime_variation13.phpt +++ b/ext/date/tests/strftime_variation13.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking date related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt index 41be0bfeaf..f6e8fedf0b 100644 --- a/ext/date/tests/strftime_variation15.phpt +++ b/ext/date/tests/strftime_variation15.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking time related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strftime_variation17.phpt b/ext/date/tests/strftime_variation17.phpt index 05ff3a0c8a..04e1cadab0 100644 --- a/ext/date/tests/strftime_variation17.phpt +++ b/ext/date/tests/strftime_variation17.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking day related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt index 37e6c85eb9..125a47c789 100644 --- a/ext/date/tests/strftime_variation19.phpt +++ b/ext/date/tests/strftime_variation19.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking newline and tab formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strftime_variation2.phpt b/ext/date/tests/strftime_variation2.phpt deleted file mode 100644 index 3b54896370..0000000000 --- a/ext/date/tests/strftime_variation2.phpt +++ /dev/null @@ -1,191 +0,0 @@ ---TEST-- -Test strftime() function : usage variation - Passing unexpected values to second argument 'timestamp'. ---FILE-- -<?php -/* Prototype : string strftime(string format [, int timestamp]) - * Description: Format a local time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing strftime() : usage variation ***\n"; - -date_default_timezone_set("Asia/Calcutta"); -// Initialise all required variables -$format = '%b %d %Y %H:%M:%S'; - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -//array of values to iterate over -$inputs = array( - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, -); - -// loop through each element of the array for timestamp - -foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( strftime($format, $value) ); -}; - -?> -===DONE=== ---EXPECTF-- -*** Testing strftime() : usage variation *** - ---float 10.5-- -string(20) "Jan 01 1970 05:30:10" - ---float -10.5-- -string(20) "Jan 01 1970 05:29:50" - ---float .5-- -string(20) "Jan 01 1970 05:30:00" - ---empty array-- - -Warning: strftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---int indexed array-- - -Warning: strftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---associative array-- - -Warning: strftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---nested arrays-- - -Warning: strftime() expects parameter 2 to be int, array given in %s on line %d -bool(false) - ---uppercase NULL-- -string(20) "Jan 01 1970 05:30:00" - ---lowercase null-- -string(20) "Jan 01 1970 05:30:00" - ---lowercase true-- -string(20) "Jan 01 1970 05:30:01" - ---lowercase false-- -string(20) "Jan 01 1970 05:30:00" - ---uppercase TRUE-- -string(20) "Jan 01 1970 05:30:01" - ---uppercase FALSE-- -string(20) "Jan 01 1970 05:30:00" - ---empty string DQ-- - -Warning: strftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---empty string SQ-- - -Warning: strftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string DQ-- - -Warning: strftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---string SQ-- - -Warning: strftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---mixed case string-- - -Warning: strftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---heredoc-- - -Warning: strftime() expects parameter 2 to be int, string given in %s on line %d -bool(false) - ---instance of classWithToString-- - -Warning: strftime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---instance of classWithoutToString-- - -Warning: strftime() expects parameter 2 to be int, object given in %s on line %d -bool(false) - ---undefined var-- -string(20) "Jan 01 1970 05:30:00" - ---unset var-- -string(20) "Jan 01 1970 05:30:00" -===DONE=== diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt index 0eb0bea02b..730716c392 100644 --- a/ext/date/tests/strftime_variation21.phpt +++ b/ext/date/tests/strftime_variation21.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking Preferred date and time representation on Windows. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt index d9898e0294..49363ec27b 100644 --- a/ext/date/tests/strftime_variation9.phpt +++ b/ext/date/tests/strftime_variation9.phpt @@ -1,11 +1,5 @@ --TEST-- Test strftime() function : usage variation - Checking week related formats which was not supported on Windows before VC14. ---SKIPIF-- -<?php -if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { - die("skip Test is valid for Windows"); -} -?> --FILE-- <?php /* Prototype : string strftime(string format [, int timestamp]) diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt index c511d626e9..356e485949 100644 --- a/ext/date/tests/strtotime-mysql-64bit.phpt +++ b/ext/date/tests/strtotime-mysql-64bit.phpt @@ -1,7 +1,7 @@ --TEST-- strtotime() and mysql timestamps (64 bit) --SKIPIF-- -<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?> --FILE-- <?php date_default_timezone_set('UTC'); diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt index e5935bb165..5b0192880b 100644 --- a/ext/date/tests/strtotime-mysql.phpt +++ b/ext/date/tests/strtotime-mysql.phpt @@ -1,7 +1,7 @@ --TEST-- strtotime() and mysql timestamps (32 bit) --SKIPIF-- -<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE == 8) die("skip 32-bit only"); ?> --FILE-- <?php date_default_timezone_set('UTC'); diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt index 3a47659f86..52c4edd63b 100644 --- a/ext/date/tests/strtotime3-64bit.phpt +++ b/ext/date/tests/strtotime3-64bit.phpt @@ -1,7 +1,7 @@ --TEST-- strtotime() function (64 bit) --SKIPIF-- -<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE != 8) die("skip 64-bit only"); ?> --FILE-- <?php date_default_timezone_set('Europe/Lisbon'); diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt index 6aa5640f64..97161f9dfe 100644 --- a/ext/date/tests/strtotime3.phpt +++ b/ext/date/tests/strtotime3.phpt @@ -1,7 +1,7 @@ --TEST-- strtotime() function (32 bit) --SKIPIF-- -<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK"; ?> +<?php if (PHP_INT_SIZE == 8) die("skip 32-bit only"); ?> --FILE-- <?php date_default_timezone_set('Europe/Lisbon'); diff --git a/ext/date/tests/strtotime_basic.phpt b/ext/date/tests/strtotime_basic.phpt index 0afd6d2bc1..55c145722d 100644 --- a/ext/date/tests/strtotime_basic.phpt +++ b/ext/date/tests/strtotime_basic.phpt @@ -35,7 +35,7 @@ var_dump(date('Y-m-d', strtotime('second Monday December 2008'))); */ var_dump(date('Y-m-d', strtotime('third Monday December 2008'))); ?> ---EXPECTF-- +--EXPECT-- string(10) "2008-12-01" string(10) "2008-12-08" string(10) "2008-12-15" diff --git a/ext/date/tests/strtotime_variation_scottish.phpt b/ext/date/tests/strtotime_variation_scottish.phpt index 0cd642cc82..740583a78e 100644 --- a/ext/date/tests/strtotime_variation_scottish.phpt +++ b/ext/date/tests/strtotime_variation_scottish.phpt @@ -8,7 +8,7 @@ Checking whisky time var_dump(date('H:i:s', strtotime('back of 19'))); var_dump(date('H:i:s', strtotime('front of 19'))); ?> ---EXPECTF-- +--EXPECT-- string(8) "07:15:00" string(8) "06:45:00" string(8) "19:15:00" diff --git a/ext/date/tests/time_error.phpt b/ext/date/tests/time_error.phpt deleted file mode 100644 index 30ba99d12c..0000000000 --- a/ext/date/tests/time_error.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -Test wrong number of arguments for time() ---FILE-- -<?php -/* - * proto int time(void) - * Function is implemented in ext/date/php_date.c -*/ - -// Extra arguments are ignored -$extra_arg = 1; -echo "\nToo many arguments\n"; -var_dump (time($extra_arg)); -?> -===DONE=== ---EXPECTF-- -Too many arguments - -Warning: time() expects exactly 0 parameters, 1 given in %stime_error.php on line %d -NULL -===DONE=== diff --git a/ext/date/tests/timezone_name_from_abbr_error.phpt b/ext/date/tests/timezone_name_from_abbr_error.phpt deleted file mode 100644 index a6989b6c90..0000000000 --- a/ext/date/tests/timezone_name_from_abbr_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test timezone_name_from_abbr() function : error conditions ---FILE-- -<?php -/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] ) - * Description: Returns the timezone name from abbrevation - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -echo "*** Testing timezone_name_from_abbr() : error conditions ***\n"; - -echo "\n-- Testing timezone_name_from_abbr() function with Zero arguments --\n"; -var_dump( timezone_name_from_abbr() ); - -echo "\n-- Testing timezone_name_from_abbr() function with more than expected no. of arguments --\n"; -$abbr = 10; -$gmtOffset = 30; -$isdst = 45; -$extra_arg = 10; -var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_name_from_abbr() : error conditions *** - --- Testing timezone_name_from_abbr() function with Zero arguments -- - -Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing timezone_name_from_abbr() function with more than expected no. of arguments -- - -Warning: timezone_name_from_abbr() expects at most 3 parameters, 4 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_name_from_abbr_variation1.phpt b/ext/date/tests/timezone_name_from_abbr_variation1.phpt deleted file mode 100644 index f2702fe2c9..0000000000 --- a/ext/date/tests/timezone_name_from_abbr_variation1.phpt +++ /dev/null @@ -1,205 +0,0 @@ ---TEST-- -Test timezone_name_from_abbr() function : usage variation - Passing unexpected values to first argument $abbr. ---FILE-- -<?php -/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] ) - * Description: Returns the timezone name from abbrevation - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing timezone_name_from_abbr() : usage variation - unexpected values to first argument \$abbr***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$gmtOffset= 3600; -$isdst = 1; - -foreach($inputs as $variation =>$abbr) { - echo "\n-- $variation --\n"; - var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_name_from_abbr() : usage variation - unexpected values to first argument $abbr*** - --- int 0 -- -string(13) "Europe/London" - --- int 12345 -- -string(13) "Europe/London" - --- int -12345 -- -string(13) "Europe/London" - --- float 10.5 -- -string(13) "Europe/London" - --- float -10.5 -- -string(13) "Europe/London" - --- float .5 -- -string(13) "Europe/London" - --- empty array -- - -Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: timezone_name_from_abbr() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(13) "Europe/London" - --- lowercase null -- -string(13) "Europe/London" - --- lowercase true -- -string(13) "Europe/London" - --- lowercase false -- -string(13) "Europe/London" - --- uppercase TRUE -- -string(13) "Europe/London" - --- uppercase FALSE -- -string(13) "Europe/London" - --- empty string DQ -- -string(13) "Europe/London" - --- empty string SQ -- -string(13) "Europe/London" - --- string DQ -- -string(13) "Europe/London" - --- string SQ -- -string(13) "Europe/London" - --- mixed case string -- -string(13) "Europe/London" - --- heredoc -- -string(13) "Europe/London" - --- instance of classWithToString -- -string(13) "Europe/London" - --- instance of classWithoutToString -- - -Warning: timezone_name_from_abbr() expects parameter 1 to be string, object given in %s on line %d -bool(false) - --- undefined var -- -string(13) "Europe/London" - --- unset var -- -string(13) "Europe/London" - --- resource -- - -Warning: timezone_name_from_abbr() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_name_from_abbr_variation2.phpt b/ext/date/tests/timezone_name_from_abbr_variation2.phpt deleted file mode 100644 index 952dc0008a..0000000000 --- a/ext/date/tests/timezone_name_from_abbr_variation2.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test timezone_name_from_abbr() function : usage variation - Passing unexpected values to second argument $gmtOffset. ---FILE-- -<?php -/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] ) - * Description: Returns the timezone name from abbrevation - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing timezone_name_from_abbr() : usage variation - unexpected values to second argument \$gmtOffset***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$abbr= "GMT"; -$isdst = 1; - -foreach($inputs as $variation =>$gmtOffset) { - echo "\n-- $variation --\n"; - var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_name_from_abbr() : usage variation - unexpected values to second argument $gmtOffset*** - --- int 0 -- -string(3) "UTC" - --- int 12345 -- -string(3) "UTC" - --- int -12345 -- -string(3) "UTC" - --- float 10.5 -- -string(3) "UTC" - --- float -10.5 -- -string(3) "UTC" - --- float .5 -- -string(3) "UTC" - --- empty array -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(3) "UTC" - --- lowercase null -- -string(3) "UTC" - --- lowercase true -- -string(3) "UTC" - --- lowercase false -- -string(3) "UTC" - --- uppercase TRUE -- -string(3) "UTC" - --- uppercase FALSE -- -string(3) "UTC" - --- empty string DQ -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -string(3) "UTC" - --- unset var -- -string(3) "UTC" - --- resource -- - -Warning: timezone_name_from_abbr() expects parameter 2 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_name_from_abbr_variation3.phpt b/ext/date/tests/timezone_name_from_abbr_variation3.phpt deleted file mode 100644 index 901ff8cbf7..0000000000 --- a/ext/date/tests/timezone_name_from_abbr_variation3.phpt +++ /dev/null @@ -1,219 +0,0 @@ ---TEST-- -Test timezone_name_from_abbr() function : usage variation - Passing unexpected values to third argument $isdst. ---FILE-- -<?php -/* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] ) - * Description: Returns the timezone name from abbrevation - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing timezone_name_from_abbr() : usage variation - unexpected values to third argument \$isdst***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$abbr= "GMT"; -$gmtOffset = 3600; - -foreach($inputs as $variation =>$isdst) { - echo "\n-- $variation --\n"; - var_dump( timezone_name_from_abbr($abbr, $gmtOffset, $isdst) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_name_from_abbr() : usage variation - unexpected values to third argument $isdst*** - --- int 0 -- -string(3) "UTC" - --- int 12345 -- -string(3) "UTC" - --- int -12345 -- -string(3) "UTC" - --- float 10.5 -- -string(3) "UTC" - --- float -10.5 -- -string(3) "UTC" - --- float .5 -- -string(3) "UTC" - --- empty array -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, array given in %s on line %d -bool(false) - --- uppercase NULL -- -string(3) "UTC" - --- lowercase null -- -string(3) "UTC" - --- lowercase true -- -string(3) "UTC" - --- lowercase false -- -string(3) "UTC" - --- uppercase TRUE -- -string(3) "UTC" - --- uppercase FALSE -- -string(3) "UTC" - --- empty string DQ -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, object given in %s on line %d -bool(false) - --- undefined var -- -string(3) "UTC" - --- unset var -- -string(3) "UTC" - --- resource -- - -Warning: timezone_name_from_abbr() expects parameter 3 to be int, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_name_get_error.phpt b/ext/date/tests/timezone_name_get_error.phpt deleted file mode 100644 index e413017be4..0000000000 --- a/ext/date/tests/timezone_name_get_error.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -Test timezone_name_get() function : error conditions ---FILE-- -<?php -/* Prototype : string timezone_name_get ( DateTime $object ) - * Description: Returns the name of the timezone - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getName() - */ - -// Set timezone -date_default_timezone_set("Europe/London"); - -echo "*** Testing timezone_name_get() : error conditions ***\n"; - -echo "\n-- Testing timezone_name_get() function with zero arguments --\n"; -var_dump( timezone_name_get() ); - -echo "\n-- Testing date_timezone_set() function with more than expected no. of arguments --\n"; -$datetime = date_create("2009-01-30 17:57:32"); -$extra_arg = 99; -var_dump( timezone_name_get($datetime, $extra_arg) ); - -echo "\n-- Testing timezone_name_get() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( timezone_name_get($invalid_obj) ); -$invalid_obj = 10; -var_dump( timezone_name_get($invalid_obj) ); -$invalid_obj = null; -var_dump( timezone_name_get($invalid_obj) ); -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_name_get() : error conditions *** - --- Testing timezone_name_get() function with zero arguments -- - -Warning: timezone_name_get() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_timezone_set() function with more than expected no. of arguments -- - -Warning: timezone_name_get() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - --- Testing timezone_name_get() function with an invalid values for $object argument -- - -Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) - -Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - -Warning: timezone_name_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt index 2aff20ac2d..413755ac72 100644 --- a/ext/date/tests/timezone_offset_get_error.phpt +++ b/ext/date/tests/timezone_offset_get_error.phpt @@ -13,14 +13,6 @@ date_default_timezone_set("GMT"); $tz = timezone_open("Europe/London"); $date = date_create("GMT"); -set_error_handler('err'); - -function err($errno, $errstr) { - if ($errno === E_RECOVERABLE_ERROR) { - var_dump($errstr); - } -} - echo "*** Testing timezone_offset_get() : error conditions ***\n"; echo "\n-- Testing timezone_offset_get() function with zero arguments --\n"; @@ -99,12 +91,18 @@ try { *** Testing timezone_offset_get() : error conditions *** -- Testing timezone_offset_get() function with zero arguments -- + +Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d bool(false) -- Testing timezone_offset_get() function with less than expected no. of arguments -- + +Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d bool(false) -- Testing timezone_offset_get() function with more than expected no. of arguments -- + +Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d bool(false) -- Testing timezone_offset_get() function with an invalid values for $object argument -- diff --git a/ext/date/tests/timezone_offset_get_variation1.phpt b/ext/date/tests/timezone_offset_get_variation1.phpt deleted file mode 100644 index 9c076f54cc..0000000000 --- a/ext/date/tests/timezone_offset_get_variation1.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test timezone_offset_get() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime ) - * Description: Returns the timezone offset from GMT - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getOffset() - */ - -echo "*** Testing timezone_offset_get() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -set_error_handler('handler'); - -function handler($errno, $errstr) { - if ($errno === E_RECOVERABLE_ERROR) { - echo $errstr . "\n"; - } -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$datetime = new DateTime("2009-01-31 15:14:10"); - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - try { - var_dump( timezone_offset_get($object, $datetime) ); - } catch (Error $ex) { - echo $ex->getMessage()."\n"; - } -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECT-- -*** Testing timezone_offset_get() : usage variation - unexpected values to first argument $object*** - --- int 0 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given - --- int 1 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given - --- int 12345 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given - --- int -12345 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given - --- float 10.5 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, float given - --- float -10.5 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, float given - --- float .5 -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, float given - --- empty array -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given - --- int indexed array -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given - --- associative array -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given - --- nested arrays -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given - --- uppercase NULL -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given - --- lowercase null -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given - --- lowercase true -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, bool given - --- lowercase false -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, bool given - --- uppercase TRUE -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, bool given - --- uppercase FALSE -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, bool given - --- empty string DQ -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given - --- empty string SQ -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given - --- string DQ -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given - --- string SQ -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given - --- mixed case string -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given - --- heredoc -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given - --- instance of classWithToString -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of classWithToString given - --- instance of classWithoutToString -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of classWithoutToString given - --- undefined var -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given - --- unset var -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given - --- resource -- -Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, resource given -===DONE=== diff --git a/ext/date/tests/timezone_offset_get_variation2.phpt b/ext/date/tests/timezone_offset_get_variation2.phpt deleted file mode 100644 index 6a764405e6..0000000000 --- a/ext/date/tests/timezone_offset_get_variation2.phpt +++ /dev/null @@ -1,208 +0,0 @@ ---TEST-- -Test timezone_offset_get() function : usage variation - Passing unexpected values to second argument $datetime. ---FILE-- -<?php -/* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime ) - * Description: Returns the timezone offset from GMT - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getOffset() - */ - -echo "*** Testing timezone_offset_get() : usage variation - unexpected values to second argument \$datetime***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -set_error_handler('handler'); - -function handler($errno, $errstr) { - if ($errno === E_RECOVERABLE_ERROR) { - echo $errstr . "\n"; - } -} - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$object = new DateTimezone("Europe/London"); - -foreach($inputs as $variation =>$datetime) { - echo "\n-- $variation --\n"; - try { - var_dump( timezone_offset_get($object, $datetime) ); - } catch (Error $ex) { - echo $ex->getMessage()."\n"; - } -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECT-- -*** Testing timezone_offset_get() : usage variation - unexpected values to second argument $datetime*** - --- int 0 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given - --- int 1 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given - --- int 12345 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given - --- int -12345 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given - --- float 10.5 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, float given - --- float -10.5 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, float given - --- float .5 -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, float given - --- empty array -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given - --- int indexed array -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given - --- associative array -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given - --- nested arrays -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given - --- uppercase NULL -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given - --- lowercase null -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given - --- lowercase true -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, bool given - --- lowercase false -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, bool given - --- uppercase TRUE -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, bool given - --- uppercase FALSE -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, bool given - --- empty string DQ -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given - --- empty string SQ -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given - --- string DQ -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given - --- string SQ -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given - --- mixed case string -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given - --- heredoc -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given - --- instance of classWithToString -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of classWithToString given - --- instance of classWithoutToString -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of classWithoutToString given - --- undefined var -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given - --- unset var -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given - --- resource -- -Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, resource given -===DONE=== diff --git a/ext/date/tests/timezone_open_error.phpt b/ext/date/tests/timezone_open_error.phpt deleted file mode 100644 index a2a6473b76..0000000000 --- a/ext/date/tests/timezone_open_error.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Test timezone_open() function : error conditions ---FILE-- -<?php -/* Prototype : DateTimeZone timezone_open ( string $timezone ) - * Description: Returns new DateTimeZone object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::__construct() - */ - -echo "*** Testing timezone_open() : error conditions ***\n"; - -echo "\n-- Testing timezone_open() function with zero arguments --\n"; -var_dump( timezone_open() ); - -echo "\n-- Testing timezone_open() function with more than expected no. of arguments --\n"; -$time = "GMT"; -$extra_arg = 99; -var_dump( timezone_open($time, $extra_arg) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_open() : error conditions *** - --- Testing timezone_open() function with zero arguments -- - -Warning: timezone_open() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing timezone_open() function with more than expected no. of arguments -- - -Warning: timezone_open() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_open_variation1.phpt b/ext/date/tests/timezone_open_variation1.phpt deleted file mode 100644 index d9afa4700d..0000000000 --- a/ext/date/tests/timezone_open_variation1.phpt +++ /dev/null @@ -1,239 +0,0 @@ ---TEST-- -Test timezone_open function : usage variation - Passing unexpected values to first argument $timezone. ---FILE-- -<?php -/* Prototype : DateTimeZone timezone_open ( string $timezone ) - * Description: Returns new DateTimeZone object - * Source code: ext/date/php_date.c - * Alias to functions: DateTime::__construct() - */ - -echo "*** Testing timezone_open() : usage variation - unexpected values to first argument \$timezone***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - - // float data - 'float 10.5' => 10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -foreach($inputs as $variation =>$timezone) { - echo "\n-- $variation --\n"; - var_dump( timezone_open($timezone) ); - -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_open() : usage variation - unexpected values to first argument $timezone*** - --- int 0 -- - -Warning: timezone_open(): Unknown or bad timezone (0) in %s on line %d -bool(false) - --- int 1 -- - -Warning: timezone_open(): Unknown or bad timezone (1) in %s on line %d -bool(false) - --- int 12345 -- - -Warning: timezone_open(): Unknown or bad timezone (12345) in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: timezone_open(): Unknown or bad timezone (10.5) in %s on line %d -bool(false) - --- float .5 -- - -Warning: timezone_open(): Unknown or bad timezone (0.5) in %s on line %d -bool(false) - --- empty array -- - -Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: timezone_open() expects parameter 1 to be string, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- lowercase null -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- lowercase true -- - -Warning: timezone_open(): Unknown or bad timezone (1) in %s on line %d -bool(false) - --- lowercase false -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: timezone_open(): Unknown or bad timezone (1) in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- string DQ -- - -Warning: timezone_open(): Unknown or bad timezone (string) in %s on line %d -bool(false) - --- string SQ -- - -Warning: timezone_open(): Unknown or bad timezone (string) in %s on line %d -bool(false) - --- mixed case string -- - -Warning: timezone_open(): Unknown or bad timezone (sTrInG) in %s on line %d -bool(false) - --- heredoc -- - -Warning: timezone_open(): Unknown or bad timezone (hello world) in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: timezone_open(): Unknown or bad timezone (Class A object) in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: timezone_open() expects parameter 1 to be string, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- unset var -- - -Warning: timezone_open(): Unknown or bad timezone () in %s on line %d -bool(false) - --- resource -- - -Warning: timezone_open() expects parameter 1 to be string, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_transitions_get_error.phpt b/ext/date/tests/timezone_transitions_get_error.phpt deleted file mode 100644 index 316fe40f3c..0000000000 --- a/ext/date/tests/timezone_transitions_get_error.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -Test timezone_transitions_get() function : error conditions ---FILE-- -<?php -/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] ) - * Description: Returns all transitions for the timezone - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getTransitions() - */ - -//Set the default time zone -date_default_timezone_set("GMT"); -$tz = timezone_open("Europe/London"); - -echo "*** Testing timezone_transitions_get() : error conditions ***\n"; - -echo "\n-- Testing timezone_transitions_get() function with zero arguments --\n"; -var_dump( timezone_transitions_get() ); - -echo "\n-- Testing timezone_transitions_get() function with more than expected no. of arguments --\n"; -$timestamp_begin = mktime(0, 0, 0, 1, 1, 1972); -$timestamp_end = mktime(0, 0, 0, 1, 1, 1975); -$extra_arg = 99; -var_dump( timezone_transitions_get($tz, $timestamp_begin, $timestamp_end, $extra_arg) ); - -echo "\n-- Testing timezone_transitions_get() function with an invalid values for \$object argument --\n"; -$invalid_obj = new stdClass(); -var_dump( timezone_transitions_get($invalid_obj) ); -$invalid_obj = 10; -var_dump( timezone_transitions_get($invalid_obj) ); -$invalid_obj = null; -var_dump( timezone_transitions_get($invalid_obj) ); -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_transitions_get() : error conditions *** - --- Testing timezone_transitions_get() function with zero arguments -- - -Warning: timezone_transitions_get() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing timezone_transitions_get() function with more than expected no. of arguments -- - -Warning: timezone_transitions_get() expects at most 3 parameters, 4 given in %s on line %d -bool(false) - --- Testing timezone_transitions_get() function with an invalid values for $object argument -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_transitions_get_variation1.phpt b/ext/date/tests/timezone_transitions_get_variation1.phpt deleted file mode 100644 index 615b02692a..0000000000 --- a/ext/date/tests/timezone_transitions_get_variation1.phpt +++ /dev/null @@ -1,250 +0,0 @@ ---TEST-- -Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $object. ---FILE-- -<?php -/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] ) - * Description: Returns all transitions for the timezone - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getTransitions() - */ - -echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$object***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -foreach($inputs as $variation =>$object) { - echo "\n-- $variation --\n"; - var_dump( timezone_transitions_get($object) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $object*** - --- int 0 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 1 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int 12345 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- int -12345 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, int given in %s on line %d -bool(false) - --- float 10.5 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float -10.5 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, float given in %s on line %d -bool(false) - --- float .5 -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, float given in %s on line %d -bool(false) - --- empty array -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- int indexed array -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- associative array -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- nested arrays -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d -bool(false) - --- uppercase NULL -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- lowercase null -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- lowercase true -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- lowercase false -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase TRUE -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- uppercase FALSE -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, bool given in %s on line %d -bool(false) - --- empty string DQ -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- empty string SQ -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string DQ -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- string SQ -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- mixed case string -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- heredoc -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d -bool(false) - --- instance of classWithToString -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) - --- instance of classWithoutToString -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) - --- undefined var -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- unset var -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d -bool(false) - --- resource -- - -Warning: timezone_transitions_get() expects parameter 1 to be DateTimeZone, resource given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_transitions_get_variation2.phpt b/ext/date/tests/timezone_transitions_get_variation2.phpt deleted file mode 100644 index a3d6db912f..0000000000 --- a/ext/date/tests/timezone_transitions_get_variation2.phpt +++ /dev/null @@ -1,279 +0,0 @@ ---TEST-- -Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $timestamp_begin. ---FILE-- -<?php -/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] ) - * Description: Returns all transitions for the timezone - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getTransitions() - */ - -echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$timestamp_begin ***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$tz = timezone_open("Europe/London"); -$timestamp_end = mktime(0, 0, 0, 1, 1, 1975); - -foreach($inputs as $variation =>$timestamp_begin) { - echo "\n-- $variation --\n"; - $tran = timezone_transitions_get($tz, $timestamp_begin, $timestamp_end); - var_dump( gettype($tran) ); - var_dump( count($tran) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $timestamp_begin *** - --- int 0 -- -string(5) "array" -int(8) - --- int 1 -- -string(5) "array" -int(8) - --- int 12345 -- -string(5) "array" -int(8) - --- int -12345 -- -string(5) "array" -int(8) - --- float 10.5 -- -string(5) "array" -int(8) - --- float -10.5 -- -string(5) "array" -int(8) - --- float .5 -- -string(5) "array" -int(8) - --- empty array -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- int indexed array -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- associative array -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- nested arrays -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- uppercase NULL -- -string(5) "array" -int(8) - --- lowercase null -- -string(5) "array" -int(8) - --- lowercase true -- -string(5) "array" -int(8) - --- lowercase false -- -string(5) "array" -int(8) - --- uppercase TRUE -- -string(5) "array" -int(8) - --- uppercase FALSE -- -string(5) "array" -int(8) - --- empty string DQ -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- empty string SQ -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- string DQ -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- string SQ -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- mixed case string -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- heredoc -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- instance of classWithToString -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, object given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- instance of classWithoutToString -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, object given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- undefined var -- -string(5) "array" -int(8) - --- unset var -- -string(5) "array" -int(8) - --- resource -- - -Warning: timezone_transitions_get() expects parameter 2 to be int, resource given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) -===DONE=== diff --git a/ext/date/tests/timezone_transitions_get_variation3.phpt b/ext/date/tests/timezone_transitions_get_variation3.phpt deleted file mode 100644 index 5d793acdfc..0000000000 --- a/ext/date/tests/timezone_transitions_get_variation3.phpt +++ /dev/null @@ -1,279 +0,0 @@ ---TEST-- -Test timezone_transitions_get() function : usage variation - Passing unexpected values to first argument $timestamp_env. ---FILE-- -<?php -/* Prototype : array timezone_transitions_get ( DateTimeZone $object, [ int $timestamp_begin [, int $timestamp_end ]] ) - * Description: Returns all transitions for the timezone - * Source code: ext/date/php_date.c - * Alias to functions: DateTimeZone::getTransitions() - */ - -echo "*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument \$timestamp_end ***\n"; - -//Set the default time zone -date_default_timezone_set("Europe/London"); - -//get an unset variable -$unset_var = 10; -unset ($unset_var); - -// define some classes -class classWithToString -{ - public function __toString() { - return "Class A object"; - } -} - -class classWithoutToString -{ -} - -// heredoc string -$heredoc = <<<EOT -hello world -EOT; - -// add arrays -$index_array = array (1, 2, 3); -$assoc_array = array ('one' => 1, 'two' => 2); - -// resource -$file_handle = fopen(__FILE__, 'r'); - -//array of values to iterate over -$inputs = array( - - // int data - 'int 0' => 0, - 'int 1' => 1, - 'int 12345' => 12345, - 'int -12345' => -12345, - - // float data - 'float 10.5' => 10.5, - 'float -10.5' => -10.5, - 'float .5' => .5, - - // array data - 'empty array' => array(), - 'int indexed array' => $index_array, - 'associative array' => $assoc_array, - 'nested arrays' => array('foo', $index_array, $assoc_array), - - // null data - 'uppercase NULL' => NULL, - 'lowercase null' => null, - - // boolean data - 'lowercase true' => true, - 'lowercase false' =>false, - 'uppercase TRUE' =>TRUE, - 'uppercase FALSE' =>FALSE, - - // empty data - 'empty string DQ' => "", - 'empty string SQ' => '', - - // string data - 'string DQ' => "string", - 'string SQ' => 'string', - 'mixed case string' => "sTrInG", - 'heredoc' => $heredoc, - - // object data - 'instance of classWithToString' => new classWithToString(), - 'instance of classWithoutToString' => new classWithoutToString(), - - // undefined data - 'undefined var' => @$undefined_var, - - // unset data - 'unset var' => @$unset_var, - - // resource - 'resource' => $file_handle -); - -$tz = timezone_open("Europe/London"); -$timestamp_begin = mktime(0, 0, 0, 1, 1, 1975); - -foreach($inputs as $variation =>$timestamp_end) { - echo "\n-- $variation --\n"; - $tran = timezone_transitions_get($tz, $timestamp_begin, $timestamp_end); - var_dump( gettype($tran) ); - var_dump( count($tran) ); -}; - -// closing the resource -fclose( $file_handle ); - -?> -===DONE=== ---EXPECTF-- -*** Testing timezone_transitions_get() : usage variation - unexpected values to first argument $timestamp_end *** - --- int 0 -- -string(5) "array" -int(1) - --- int 1 -- -string(5) "array" -int(1) - --- int 12345 -- -string(5) "array" -int(1) - --- int -12345 -- -string(5) "array" -int(1) - --- float 10.5 -- -string(5) "array" -int(1) - --- float -10.5 -- -string(5) "array" -int(1) - --- float .5 -- -string(5) "array" -int(1) - --- empty array -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- int indexed array -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- associative array -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- nested arrays -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, array given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- uppercase NULL -- -string(5) "array" -int(1) - --- lowercase null -- -string(5) "array" -int(1) - --- lowercase true -- -string(5) "array" -int(1) - --- lowercase false -- -string(5) "array" -int(1) - --- uppercase TRUE -- -string(5) "array" -int(1) - --- uppercase FALSE -- -string(5) "array" -int(1) - --- empty string DQ -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- empty string SQ -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- string DQ -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- string SQ -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- mixed case string -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- heredoc -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, string given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- instance of classWithToString -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, object given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- instance of classWithoutToString -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, object given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) - --- undefined var -- -string(5) "array" -int(1) - --- unset var -- -string(5) "array" -int(1) - --- resource -- - -Warning: timezone_transitions_get() expects parameter 3 to be int, resource given in %s on line %d -string(7) "boolean" - -Warning: count(): Parameter must be an array or an object that implements Countable in %s on line %d -int(1) -===DONE=== |