diff --git a/ext/date/tests/microtime_basic.phpt b/ext/date/tests/microtime_basic.phpt new file mode 100644 index 00000000000..0546b917a20 --- /dev/null +++ b/ext/date/tests/microtime_basic.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test return type and value for expected input microtime() +--FILE-- + +===DONE=== +--EXPECTF-- +unicode(%d) "%s %s" +float(%s) +unicode(%d) "%s %s" +===DONE=== diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt new file mode 100644 index 00000000000..efb5adf4171 --- /dev/null +++ b/ext/date/tests/microtime_error.phpt @@ -0,0 +1,71 @@ +--TEST-- +Test wrong number of arguments for microtime() +--FILE-- +'v', array(0)), + new stdClass, + 1); +foreach ($bad_args as $bad_arg) { + echo "\n--> bad arg: "; + var_dump($bad_arg); + var_dump(microtime($bad_arg)); +} + +?> +===DONE=== +--EXPECTF-- +-- Too many arguments -- + +Warning: microtime() expects at most 1 parameter, 2 given in %s on line %d +NULL + +-- Bad Arg types -- + +--> bad arg: NULL +unicode(%d) "%s" + +--> bad arg: float(1.5) +float(%f) + +--> bad arg: unicode(5) "hello" +float(%f) + +--> bad arg: array(2) { + [u"k"]=> + unicode(1) "v" + [0]=> + array(1) { + [0]=> + int(0) + } +} + +Warning: microtime() expects parameter 1 to be boolean, array given in %s on line %d +NULL + +--> bad arg: object(stdClass)#1 (0) { +} + +Warning: microtime() expects parameter 1 to be boolean, object given in %s on line %d +NULL + +--> bad arg: int(1) +float(%f) +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/time_basic.phpt b/ext/date/tests/time_basic.phpt new file mode 100644 index 00000000000..116c0a4175e --- /dev/null +++ b/ext/date/tests/time_basic.phpt @@ -0,0 +1,16 @@ +--TEST-- +Test return type and value for expected input time() +--FILE-- + +===DONE=== +--EXPECTF-- +int(%d) +===DONE=== \ No newline at end of file diff --git a/ext/date/tests/time_error.phpt b/ext/date/tests/time_error.phpt new file mode 100644 index 00000000000..1ab88270ddb --- /dev/null +++ b/ext/date/tests/time_error.phpt @@ -0,0 +1,20 @@ +--TEST-- +Test wrong number of arguments for time() +--FILE-- + +===DONE=== +--EXPECTF-- + +-- Too many arguments -- +int(%d) +===DONE=== \ No newline at end of file