Annotation of embedaddon/php/ext/date/tests/gmstrftime_variation22.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test gmstrftime() function : usage variation - Checking Preferred date and time representation other than on Windows.
3: --SKIPIF--
4: <?php
5: if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
6: die("skip Test is not valid for Windows");
7: }
8: if (!setlocale(LC_TIME, "POSIX")) {
9: die("skip Locale POSIX is required to run this test");
10: }
11: ?>
12: --FILE--
13: <?php
14: /* Prototype : string gmstrftime(string format [, int timestamp])
15: * Description: Format a GMT/UCT time/date according to locale settings
16: * Source code: ext/date/php_date.c
17: * Alias to functions:
18: */
19:
20: echo "*** Testing gmstrftime() : usage variation ***\n";
21:
22: // Initialise function arguments not being substituted (if any)
23: $timestamp = gmmktime(8, 8, 8, 8, 8, 2008);
24: setlocale(LC_TIME, "POSIX");
25: putenv("LC_TIME=POSIX");
26: date_default_timezone_set("Asia/Calcutta");
27:
28: //array of values to iterate over
29: $inputs = array(
30: 'Preferred date and time representation' => "%c",
31: 'Preferred date representation' => "%x",
32: 'Preferred time representation' => "%X",
33: );
34:
35: // loop through each element of the array for timestamp
36:
37: foreach($inputs as $key =>$value) {
38: echo "\n--$key--\n";
39: var_dump( $value );
40: var_dump( gmstrftime($value, $timestamp) );
41: };
42:
43: ?>
44: ===DONE===
45: --EXPECT--
46: *** Testing gmstrftime() : usage variation ***
47:
48: --Preferred date and time representation--
49: string(2) "%c"
50: string(24) "Fri Aug 8 08:08:08 2008"
51:
52: --Preferred date representation--
53: string(2) "%x"
54: string(8) "08/08/08"
55:
56: --Preferred time representation--
57: string(2) "%X"
58: string(8) "08:08:08"
59: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>