diff --git a/.travis.yml b/.travis.yml index 545f818b4..834e788b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: java jdk: - openjdk11 - oraclejdk9 - - oraclejdk8 + #- oraclejdk8 services: - mongodb diff --git a/exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/DateFunctions.java b/exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/DateFunctions.java index 7d366939a..adf327d1b 100644 --- a/exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/DateFunctions.java +++ b/exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/DateFunctions.java @@ -7,8 +7,12 @@ import java.time.LocalDateTime; import java.time.Year; import java.time.ZoneId; +import java.time.ZoneOffset; import java.time.ZonedDateTime; +import java.time.format.TextStyle; +import java.time.temporal.IsoFields; import java.util.Date; +import java.util.Locale; import java.util.Map; import java.util.TimeZone; @@ -115,7 +119,7 @@ public static Memory date_default_timezone_get(Environment env, TraceInfo traceI public static Memory mktime(Environment env, TraceInfo traceInfo, int hour, int minute, int second, int month, int day, int year) { - return __mktime(zoneId(date_default_timezone_get(env, traceInfo)), hour, minute, second, + return __mktime(zoneId(env, traceInfo), hour, minute, second, month, day, year); } @@ -144,6 +148,10 @@ private static ZoneId zoneId(Memory memory) { return ZoneIdFactory.of(memory.toString()); } + private static ZoneId zoneId(Environment env, TraceInfo traceInfo) { + return zoneId(date_default_timezone_get(env, traceInfo)); + } + public static Memory mktime(Environment env, TraceInfo traceInfo, int hour, int minute, int second, int month, int day) { return mktime(env, traceInfo, hour, minute, second, month, day, Year.now().getValue()); @@ -219,7 +227,7 @@ public static Memory gmmktime(Environment env, TraceInfo traceInfo) { } public static Memory localtime(Environment env, TraceInfo traceInfo, long time, boolean isAssociative) { - ZoneId zone = zoneId(date_default_timezone_get(env, traceInfo)); + ZoneId zone = zoneId(env, traceInfo); Instant instant = Instant.ofEpochSecond(time); ZonedDateTime dateTime = instant.atZone(zone); @@ -262,6 +270,228 @@ public static Memory time() { return LongMemory.valueOf(epochSeconds()); } + public static Memory strftime(Environment env, TraceInfo traceInfo, String format) { + return strftime(env, traceInfo, format, epochSeconds()); + } + + public static Memory strftime(Environment env, TraceInfo traceInfo, String format, long time) { + if (format.isEmpty()) + return Memory.FALSE; + + StringBuilder buff = strftimeImpl(zonedDateTime(env, traceInfo, time), env.getLocale(), format, new StringBuilder()); + + return StringMemory.valueOf(buff.toString()); + } + + private static StringBuilder strftimeImpl(ZonedDateTime date, Locale l, String format, StringBuilder buff) { + for (int i = 0, n = format.length(); i < n; i++) { + char c = format.charAt(i); + + if (c == '%' && ++i < n) { + c = format.charAt(i); + + switch (c) { + // Days + case 'a': { + buff.append(date.getDayOfWeek().getDisplayName(TextStyle.SHORT, l)); + break; + } + case 'A': { + buff.append(date.getDayOfWeek().getDisplayName(TextStyle.FULL, l)); + break; + } + case 'd': { + buff.append(String.format(l, TWO_DIGIT_INT, date.getDayOfMonth())); + break; + } + case 'e': { + int dayOfMonth = date.getDayOfMonth(); + if (dayOfMonth < 10) + buff.append(' '); + + buff.append(dayOfMonth); + break; + } + case 'j': { + buff.append(String.format(l, "%03d", date.getDayOfYear())); + break; + } + case 'u': + case 'w': { + buff.append(date.getDayOfWeek().getValue()); + break; + } + // Week + case 'W': + case 'U': { + int week = date.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR); + buff.append(--week); + break; + } + case 'V': { + buff.append(String.format(l, TWO_DIGIT_INT, date.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR))); + break; + } + // Month + case 'h': + case 'b': { + buff.append(date.getMonth().getDisplayName(TextStyle.SHORT, l)); + break; + } + case 'B': { + buff.append(date.getMonth().getDisplayName(TextStyle.FULL, l)); + break; + } + case 'm': { + buff.append(String.format(l, TWO_DIGIT_INT, date.getMonth().getValue())); + break; + } + // Year + case 'C': { + buff.append(date.getYear() / 100); + break; + } + case 'y': + case 'g': { + buff.append(String.format(l, TWO_DIGIT_INT, date.getYear() % 100)); + break; + } + case 'G': + case 'Y': { + buff.append(String.format(l, "%04d", date.getYear())); + break; + } + // Time + case 'H': { + buff.append(String.format(l, TWO_DIGIT_INT, date.getHour())); + break; + } + case 'k': { + buff.append(String.format(l, "% 4d", date.getHour())); + break; + } + case 'I': { + int hRem = date.getHour() % 12; + buff.append(String.format(l, TWO_DIGIT_INT, hRem > 0 ? hRem : 12)); + break; + } + case 'L': { + int hRem = date.getHour() % 12; + buff.append(String.format(l, "% 2d", hRem > 0 ? hRem : 12)); + break; + } + case 'M': { + buff.append(String.format(l, TWO_DIGIT_INT, date.getMinute())); + break; + } + case 'p': { + buff.append(date.getHour() >= 12 ? "PM" : "AM"); + break; + } + case 'P': { + buff.append(date.getHour() >= 12 ? "pm" : "am"); + break; + } + case 'r': { + strftimeImpl(date, l, "%I:%M:%S %p", buff); + break; + } + case 'R': { + strftimeImpl(date, l, "%H:%M", buff); + break; + } + case 'S': { + buff.append(String.format(l, TWO_DIGIT_INT, date.getSecond())); + break; + } + case 'X': + case 'T': { + strftimeImpl(date, l, "%H:%M:%S", buff); + break; + } + case 'z': { + long hours = Duration.ofSeconds(date.getOffset().getTotalSeconds()).toHours(); + String offset = ((hours < 0) ? "-" : "+") + String.format(l, "%02d00", Math.abs(hours)); + buff.append(offset); + break; + } + case 'Z': { + ZoneId zone = date.getZone(); + if (zone instanceof ZoneOffset) { + buff.append("GMT"); + strftimeImpl(date, l, "%z", buff); + } else { + String str = ZoneIdFactory.aliasFor(date); + if (str == null) { + long hours = Duration.ofSeconds(date.getOffset().getTotalSeconds()).toHours(); + buff.append(hours < 0 ? '-' : '+') + .append(String.format(l, TWO_DIGIT_INT, Math.abs(hours))); + } else { + buff.append(str); + } + } + break; + } + // Timestamps + case 'c': { + strftimeImpl(date, l, "%a %b %e %H:%M:%S %Y", buff); + break; + } + case 'x': + case 'D': { + strftimeImpl(date, l, "%m/%d/%y", buff); + break; + } + case 'F': { + strftimeImpl(date, l, "%Y-%m-%d", buff); + break; + } + case 's': { + buff.append(date.toEpochSecond()); + break; + } + case 'n': { + buff.append('\n'); + break; + } + case 't': { + buff.append('\t'); + break; + } + case '%': { + buff.append(c); + break; + } + default: { + buff.append('%').append(c); + break; + } + } + } else { + buff.append(c); + } + } + + return buff; + } + + public static Memory gmstrftime(Environment env, TraceInfo traceInfo, String format, long time) { + if (format.isEmpty()) + return Memory.FALSE; + + StringBuilder buff = strftimeImpl(Instant.ofEpochSecond(time).atZone(ZONE_GMT), env.getLocale(), format, new StringBuilder()); + + return StringMemory.valueOf(buff.toString()); + } + + public static Memory gmstrftime(Environment env, TraceInfo traceInfo, String format) { + return gmstrftime(env, traceInfo, format, epochSeconds()); + } + + private static ZonedDateTime zonedDateTime(Environment env, TraceInfo traceInfo, long time) { + return Instant.ofEpochSecond(time).atZone(zoneId(env, traceInfo)); + } + private static long epochSeconds() { return System.currentTimeMillis() / 1000; } diff --git a/exts/jphp-zend-ext/src/main/tests/org/develnext/jphp/zend/ext/standard/DateFunctionsTest.java b/exts/jphp-zend-ext/src/main/tests/org/develnext/jphp/zend/ext/standard/DateFunctionsTest.java index 03b219fcd..ece072c89 100644 --- a/exts/jphp-zend-ext/src/main/tests/org/develnext/jphp/zend/ext/standard/DateFunctionsTest.java +++ b/exts/jphp-zend-ext/src/main/tests/org/develnext/jphp/zend/ext/standard/DateFunctionsTest.java @@ -42,4 +42,54 @@ public void testMkTime() { public void testTime() { check("ext/date/time_basic.phpt"); } + + @Test + public void testStrftime() { + check("ext/date/strftime/strftime_basic.phpt"); + check("ext/date/strftime/strftime_variation3.phpt"); + check("ext/date/strftime/strftime_variation4.phpt"); + check("ext/date/strftime/strftime_variation5.phpt"); + check("ext/date/strftime/strftime_variation6.phpt"); + check("ext/date/strftime/strftime_variation7.phpt"); + check("ext/date/strftime/strftime_variation8.phpt"); + check("ext/date/strftime/strftime_variation9.phpt"); + check("ext/date/strftime/strftime_variation10.phpt"); + check("ext/date/strftime/strftime_variation11.phpt"); + check("ext/date/strftime/strftime_variation12.phpt"); + check("ext/date/strftime/strftime_variation13.phpt"); + check("ext/date/strftime/strftime_variation14.phpt"); + check("ext/date/strftime/strftime_variation15.phpt"); + check("ext/date/strftime/strftime_variation16.phpt"); + check("ext/date/strftime/strftime_variation17.phpt"); + check("ext/date/strftime/strftime_variation18.phpt"); + check("ext/date/strftime/strftime_variation19.phpt"); + check("ext/date/strftime/strftime_variation20.phpt"); + check("ext/date/strftime/strftime_variation21.phpt"); + check("ext/date/strftime/strftime_variation22.phpt"); + } + + @Test + public void testGmStrftime() { + check("ext/date/strftime/gmstrftime_basic.phpt"); + check("ext/date/strftime/gmstrftime_variation3.phpt"); + check("ext/date/strftime/gmstrftime_variation4.phpt"); + check("ext/date/strftime/gmstrftime_variation5.phpt"); + check("ext/date/strftime/gmstrftime_variation6.phpt"); + check("ext/date/strftime/gmstrftime_variation7.phpt"); + check("ext/date/strftime/gmstrftime_variation8.phpt"); + check("ext/date/strftime/gmstrftime_variation9.phpt"); + check("ext/date/strftime/gmstrftime_variation10.phpt"); + check("ext/date/strftime/gmstrftime_variation11.phpt"); + check("ext/date/strftime/gmstrftime_variation12.phpt"); + check("ext/date/strftime/gmstrftime_variation13.phpt"); + check("ext/date/strftime/gmstrftime_variation14.phpt"); + check("ext/date/strftime/gmstrftime_variation15.phpt"); + check("ext/date/strftime/gmstrftime_variation16.phpt"); + check("ext/date/strftime/gmstrftime_variation17.phpt"); + check("ext/date/strftime/gmstrftime_variation18.phpt"); + check("ext/date/strftime/gmstrftime_variation19.phpt"); + check("ext/date/strftime/gmstrftime_variation20.phpt"); + check("ext/date/strftime/gmstrftime_variation21.phpt"); + check("ext/date/strftime/gmstrftime_variation22.phpt"); + } } \ No newline at end of file diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_basic.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_basic.phpt new file mode 100644 index 000000000..0486fe477 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_basic.phpt @@ -0,0 +1,29 @@ +--TEST-- +Test gmstrftime() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : basic functionality *** +string(20) "Aug 08 2008 08:08:08" +string(%d) "%s %02d %d %02d:%02d:%02d" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation10.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation10.phpt new file mode 100644 index 000000000..5631042ae --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation10.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking week related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%V", + 'Weekday as decimal' => "%u", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--The ISO 8601:1988 week number-- +string(%d) "%d" +string(2) "32" + +--Weekday as decimal-- +string(%d) "%d" +string(1) "5" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation11.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation11.phpt new file mode 100644 index 000000000..fa827c134 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation11.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking month related formats which was not supported on Windows before VC14. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** +%s +string(3) "Aug" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation12.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation12.phpt new file mode 100644 index 000000000..83e76618f --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation12.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking month related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** +%s +string(3) "Aug" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation13.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation13.phpt new file mode 100644 index 000000000..40b0e0383 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation13.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking date related formats which was not supported on Windows before VC14. +--FILE-- + "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Century number-- +string(2) "%d" +string(2) "20" + +--Month Date Year-- +string(%d) "%02d/%02d/%02d" +string(8) "08/08/08" + +--Year with century-- +string(%d) "%d" +string(4) "2008" + +--Year without century-- +string(2) "%02d" +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation14.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation14.phpt new file mode 100644 index 000000000..fc9945c59 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation14.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking date related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Century number-- +string(%d) "%d" +string(2) "20" + +--Month Date Year-- +string(%d) "%02d/%02d/%02d" +string(8) "08/08/08" + +--Year with century-- +string(%d) "%d" +string(4) "2008" + +--Year without century-- +string(%d) "%02d" +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation15.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation15.phpt new file mode 100644 index 000000000..2878692bc --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation15.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking time related formats which was not supported on Windows before VC14. +--FILE-- + "%r", + 'Time in 24 hour notation' => "%R", + 'Current time H:M:S format' => "%T", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Time in a.m/p.m notation-- +string(%d) "%02d:%02d:%02d %c%c" +string(11) "08:08:08 AM" + +--Time in 24 hour notation-- +string(%d) "%02d:%02d" +string(5) "08:08" + +--Current time H:M:S format-- +string(%d) "%02d:%02d:%02d" +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation16.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation16.phpt new file mode 100644 index 000000000..0c1d85702 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation16.phpt @@ -0,0 +1,54 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking time related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%r", + 'Time in 24 hour notation' => "%R", + 'Current time H:M:S format' => "%T", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Time in a.m/p.m notation-- +string(%d) "%02d:%02d:%02d %c%c" +string(11) "02:08:08 PM" + +--Time in 24 hour notation-- +string(%d) "%02d:%02d" +string(5) "14:08" + +--Current time H:M:S format-- +string(%d) "%02d:%02d:%02d" +string(8) "14:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation17.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation17.phpt new file mode 100644 index 000000000..39acfd314 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation17.phpt @@ -0,0 +1,31 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking day related formats which was not supported on Windows before vc14. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +-- Testing gmstrftime() function with Day of the month as decimal single digit format -- +%s +string(2) " 8" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation18.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation18.phpt new file mode 100644 index 000000000..818834625 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation18.phpt @@ -0,0 +1,37 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking day related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +-- Testing gmstrftime() function with Day of the month as decimal single digit format -- +%s +string(2) " 8" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation19.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation19.phpt new file mode 100644 index 000000000..8b7309b44 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation19.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking newline and tab formats which was not supported on Windows before VC14. +--FILE-- + "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECT-- +*** Testing gmstrftime() : usage variation *** + +--Newline character-- +string(1) " +" +string(1) " +" + +--Tab character-- +string(1) " " +string(1) " " +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation20.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation20.phpt new file mode 100644 index 000000000..135520e37 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation20.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing gmstrftime\(\) : usage variation \*\*\* + +--Newline character-- +string\(1\) " +" +string\(1\) " +" + +--Tab character-- +string\(1\) "\s" +string\(1\) "\s" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation21.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation21.phpt new file mode 100644 index 000000000..559aa6759 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation21.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking Preferred date and time representation on Windows. +--FILE-- + "%c", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Preferred date and time representation-- +string(%d) "%s %s %d %02d:%02d:%02d %d" +string(24) "Fri Aug 8 08:08:08 2008" + +--Preferred date representation-- +string(%d) "%02d/%02d/%02d" +string(8) "08/08/08" + +--Preferred time representation-- +string(%d) "%02d:%02d:%02d" +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation22.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation22.phpt new file mode 100644 index 000000000..d6e9be872 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation22.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking Preferred date and time representation other than on Windows. +--SKIPIF-- + +--FILE-- + "%c", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( $value ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECT-- +*** Testing gmstrftime() : usage variation *** + +--Preferred date and time representation-- +string(2) "%c" +string(24) "Fri Aug 8 08:08:08 2008" + +--Preferred date representation-- +string(2) "%x" +string(8) "08/08/08" + +--Preferred time representation-- +string(2) "%X" +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation3.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation3.phpt new file mode 100644 index 000000000..f640862af --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation3.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing week related format strings to format argument. +--FILE-- + "%a", + 'Full weekday name' => "%A", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( gmstrftime($value) ); + echo PHP_EOL; + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Abbreviated weekday name-- +%s +string(3) "Fri" + +--Full weekday name-- +%s +string(6) "Friday" + +--Week number of the year-- +%d +string(2) "31" + +--Week number of the year in decimal number-- +%d +string(2) "31" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation4.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation4.phpt new file mode 100644 index 000000000..be7c26820 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation4.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing month related format strings to format argument. +--FILE-- + "%b", + 'Full month name' => "%B", + 'Month as decimal' => "%m", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( gmstrftime($value) ); + echo PHP_EOL; + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Abbreviated month name-- +%s +string(3) "Aug" + +--Full month name-- +%s +string(6) "August" + +--Month as decimal-- +%02d +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation5.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation5.phpt new file mode 100644 index 000000000..8fb8c490e --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation5.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing date related format strings to format argument. +--FILE-- + "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( gmstrftime($value) ); + echo PHP_EOL; + print_r( gmstrftime($value, $timestamp) ); + echo PHP_EOL; +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Year as decimal number without a century-- +%d +08 + +--Year as decimal number including the century-- +%d +2008 + +--Time zone offset-- +%s +%s +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation6.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation6.phpt new file mode 100644 index 000000000..77c0953ac --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation6.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing time related format strings to format argument. +--FILE-- + "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( gmstrftime($value) ); + echo PHP_EOL; + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Hour as decimal by 24-hour format-- +%02d +string(2) "08" + +--Hour as decimal by 12-hour format-- +%02d +string(2) "08" + +--Minute as decimal number-- +%02d +string(2) "08" + +--AM/PM format for a time-- +%s +string(2) "AM" + +--Second as decimal number-- +%02d +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation7.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation7.phpt new file mode 100644 index 000000000..8ac2f774b --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation7.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing day related format strings to format argument. +--FILE-- + "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--Day of the month as a decimal number-- +string(%d) "%02d" +string(2) "08" + +--Day of the year as a decimal number-- +string(%d) "%d" +string(3) "221" + +--Day of the week as a decimal number-- +string(%d) "%d" +string(1) "5" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation8.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation8.phpt new file mode 100644 index 000000000..2e79d13d9 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation8.phpt @@ -0,0 +1,38 @@ +--TEST-- +Test gmstrftime() function : usage variation - Passing literal related strings to format argument. +--FILE-- + "%%", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECT-- +*** Testing gmstrftime() : usage variation *** + +--A literal % character-- +string(1) "%" +string(1) "%" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation9.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation9.phpt new file mode 100644 index 000000000..f7d52b7bd --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/gmstrftime_variation9.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test gmstrftime() function : usage variation - Checking week related formats which was not supported on Windows before vc14. +--FILE-- + "%V", + 'Weekday as decimal' => "%u", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( gmstrftime($value) ); + var_dump( gmstrftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing gmstrftime() : usage variation *** + +--The ISO 8601:1988 week number-- +string(%d) "%d" +string(2) "32" + +--Weekday as decimal-- +string(1) "%d" +string(1) "5" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_basic.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_basic.phpt new file mode 100644 index 000000000..8af4f31a2 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test strftime() function : basic functionality +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : basic functionality *** +string(20) "Aug 08 2008 08:08:08" +string(%d) "%s %02d %d %02d:%02d:%02d" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation10.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation10.phpt new file mode 100644 index 000000000..0a0fc65f4 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation10.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test strftime() function : usage variation - Checking week related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%V", + 'Weekday as decimal' => "%u", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--The ISO 8601:1988 week number-- +string(%d) "%d" +string(2) "32" + +--Weekday as decimal-- +string(%d) "%d" +string(1) "5" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation11.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation11.phpt new file mode 100644 index 000000000..b76ec83ab --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation11.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test strftime() function : usage variation - Checking month related formats which was not supported on Windows before VC14. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** +%s +string(3) "Aug" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation12.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation12.phpt new file mode 100644 index 000000000..3bbb0e15e --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation12.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test strftime() function : usage variation - Checking month related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** +%s +string(3) "Aug" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation13.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation13.phpt new file mode 100644 index 000000000..9e39e1e8a --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation13.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test strftime() function : usage variation - Checking date related formats which was not supported on Windows before VC14. +--FILE-- + "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Century number-- +string(2) "20" +string(2) "20" + +--Month Date Year-- +string(%d) "%02d/%02d/%02d" +string(8) "08/08/08" + +--Year with century-- +string(4) "%d" +string(4) "2008" + +--Year without century-- +string(2) "%02d" +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation14.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation14.phpt new file mode 100644 index 000000000..2a58ed69b --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation14.phpt @@ -0,0 +1,59 @@ +--TEST-- +Test strftime() function : usage variation - Checking date related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Century number-- +string(%d) "%d" +string(2) "20" + +--Month Date Year-- +string(%d) "%02d/%02d/%02d" +string(8) "08/08/08" + +--Year with century-- +string(%d) "%d" +string(4) "2008" + +--Year without century-- +string(%d) "%02d" +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation15.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation15.phpt new file mode 100644 index 000000000..477554f13 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation15.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test strftime() function : usage variation - Checking time related formats which was not supported on Windows before VC14. +--FILE-- + "%r", + 'Time in 24 hour notation' => "%R", + 'Current time H:M:S format' => "%T", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Time in a.m/p.m notation-- +%02d:%02d:%02d %s +string(11) "08:08:08 AM" + +--Time in 24 hour notation-- +%02d:%02d +string(5) "08:08" + +--Current time H:M:S format-- +%02d:%02d:%02d +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation16.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation16.phpt new file mode 100644 index 000000000..91daed943 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation16.phpt @@ -0,0 +1,55 @@ +--TEST-- +Test strftime() function : usage variation - Checking time related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%r", + 'Time in 24 hour notation' => "%R", + 'Current time H:M:S format' => "%T", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Time in a.m/p.m notation-- +%02d:%02d:%02d %s +string(11) "08:08:08 AM" + +--Time in 24 hour notation-- +%02d:%02d +string(5) "08:08" + +--Current time H:M:S format-- +%02d:%02d:%02d +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation17.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation17.phpt new file mode 100644 index 000000000..c41f5e130 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation17.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test strftime() function : usage variation - Checking day related formats which was not supported on Windows before VC14. +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with Day of the month as decimal single digit format -- +%s +string(2) " 8" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation18.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation18.phpt new file mode 100644 index 000000000..c8338f312 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation18.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test strftime() function : usage variation - Checking day related formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with Day of the month as decimal single digit format -- +%s +string(2) " 8" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation19.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation19.phpt new file mode 100644 index 000000000..37239b74b --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation19.phpt @@ -0,0 +1,45 @@ +--TEST-- +Test strftime() function : usage variation - Checking newline and tab formats which was not supported on Windows before VC14. +--FILE-- + "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECT-- +*** Testing strftime() : usage variation *** + +--Newline character-- +string(1) " +" +string(1) " +" + +--Tab character-- +string(1) " " +string(1) " " +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation20.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation20.phpt new file mode 100644 index 000000000..f0e88bcc9 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation20.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test strftime() function : usage variation - Checking newline and tab formats which are supported other than on Windows. +--SKIPIF-- + +--FILE-- + "%n", + 'Tab character' => "%t" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTREGEX-- +\*\*\* Testing strftime\(\) : usage variation \*\*\* + +--Newline character-- +string\(1\) " +" +string\(1\) " +" + +--Tab character-- +string\(1\) "\s" +string\(1\) "\s" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation21.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation21.phpt new file mode 100644 index 000000000..045b9a6e0 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation21.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test strftime() function : usage variation - Checking Preferred date and time representation on Windows. +--FILE-- + "%c", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Preferred date and time representation-- +string(%d) "%s %s %d %02d:%02d:%02d %d" +string(24) "Fri Aug 8 08:08:08 2008" + +--Preferred date representation-- +string(%d) "%02d/%02d/%02d" +string(8) "08/08/08" + +--Preferred time representation-- +string(%d) "%02d:%02d:%02d" +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation22.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation22.phpt new file mode 100644 index 000000000..49d258c63 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation22.phpt @@ -0,0 +1,58 @@ +--TEST-- +Test strftime() function : usage variation - Checking Preferred date and time representation other than on Windows. +--SKIPIF-- + +--FILE-- + "%c", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( $value ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECT-- +*** Testing strftime() : usage variation *** + +--Preferred date and time representation-- +string(2) "%c" +string(24) "Fri Aug 8 08:08:08 2008" + +--Preferred date representation-- +string(2) "%x" +string(8) "08/08/08" + +--Preferred time representation-- +string(2) "%X" +string(8) "08:08:08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation3.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation3.phpt new file mode 100644 index 000000000..0e50851f7 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation3.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test strftime() function : usage variation - Passing week related format strings to format argument. +--FILE-- + "%a", + 'Full weekday name' => "%A", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", +); +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Abbreviated weekday name-- +%s +string(3) "Fri" + +--Full weekday name-- +%s +string(6) "Friday" + +--Week number of the year-- +%d +string(2) "31" + +--Week number of the year in decimal number-- +%d +string(2) "31" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation4.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation4.phpt new file mode 100644 index 000000000..079a8876c --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation4.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test strftime() function : usage variation - Passing month related format strings to format argument. +--FILE-- + "%b", + 'Full month name' => "%B", + 'Month as decimal' => "%m", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Abbreviated month name-- +%s +string(3) "Aug" + +--Full month name-- +%s +string(6) "August" + +--Month as decimal-- +%s +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation5.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation5.phpt new file mode 100644 index 000000000..93674b624 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation5.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test strftime() function : usage variation - Passing date related format strings to format argument. +--FILE-- + "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + print_r( strftime($value, $timestamp) ); + echo PHP_EOL; +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Year as decimal number without a century-- +%s +08 + +--Year as decimal number including the century-- +%s +2008 + +--Time zone offset-- +%s +%s +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation6.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation6.phpt new file mode 100644 index 000000000..8cd79a9a4 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation6.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test strftime() function : usage variation - Passing time related format strings to format argument. +--FILE-- + "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Hour as decimal by 24-hour format-- +%s +string(2) "18" + +--Hour as decimal by 12-hour format-- +%s +string(2) "06" + +--Minute as decimal number-- +%s +string(2) "08" + +--AM/PM format for a time-- +%s +string(2) "PM" + +--Second as decimal number-- +%s +string(2) "08" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation7.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation7.phpt new file mode 100644 index 000000000..76618bd65 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation7.phpt @@ -0,0 +1,50 @@ +--TEST-- +Test strftime() function : usage variation - Passing day related format strings to format argument. +--FILE-- + "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + print_r( strftime($value) ); + echo PHP_EOL; + var_dump( strftime($value, $timestamp) ); +}; + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--Day of the month as a decimal number-- +%s +string(2) "08" + +--Day of the year as a decimal number-- +%s +string(3) "221" + +--Day of the week as a decimal number-- +%s +string(1) "5" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation8.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation8.phpt new file mode 100644 index 000000000..35dcc4839 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation8.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test strftime() function : usage variation - Passing literal related strings to format argument. +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing strftime() : usage variation *** + +-- Testing strftime() function with a literal % character to format -- +string(1) "%" +string(1) "%" +===DONE=== diff --git a/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation9.phpt b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation9.phpt new file mode 100644 index 000000000..700b84277 --- /dev/null +++ b/exts/jphp-zend-ext/src/main/tests/resources/ext/date/strftime/strftime_variation9.phpt @@ -0,0 +1,43 @@ +--TEST-- +Test strftime() function : usage variation - Checking week related formats which was not supported on Windows before VC14. +--FILE-- + "%V", + 'Weekday as decimal' => "%u", +); + +// loop through each element of the array for timestamp + +foreach($inputs as $key =>$value) { + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); +} + +?> +===DONE=== +--EXPECTF-- +*** Testing strftime() : usage variation *** + +--The ISO 8601:1988 week number-- +string(2) "%d" +string(2) "32" + +--Weekday as decimal-- +string(1) "%d" +string(1) "5" +===DONE===