Annotation of embedaddon/php/ext/date/tests/gmdate_variation13.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test gmdate() function : usage variation - Passing predefined constants to format argument.
3: --FILE--
4: <?php
5: /* Prototype : string gmdate(string format [, long timestamp])
6: * Description: Format a GMT date/time
7: * Source code: ext/date/php_date.c
8: */
9:
10: echo "*** Testing gmdate() : usage variation ***\n";
11:
12: // Initialise all required variables
13: date_default_timezone_set('UTC');
14: $timestamp = mktime(8, 8, 8, 8, 8, 2008);
15:
16: //array of values to iterate over
17: $inputs = array(
18: // Predefined Date constants
19: 'DATE_ATOM Constant' => DATE_ATOM,
20: 'DATE_COOKIE Constant' => DATE_COOKIE,
21: 'DATE_RFC822 Constant' => DATE_RFC822,
22: 'DATE_RFC850 Constant' => DATE_RFC850,
23: 'DATE_RFC1036 Constant' => DATE_RFC1036,
24: 'DATE_RFC1123 Constant' => DATE_RFC1123,
25: 'DATE_RFC2822 Constant' => DATE_RFC2822,
26: 'DATE_RFC3339 Constant' => DATE_RFC3339,
27: 'DATE_RSS Constant' => DATE_RSS,
28: 'DATE_W3C Constant' => DATE_W3C,
29: );
30:
31: // loop through each element of the array for format
32: foreach($inputs as $key =>$value) {
33: echo "\n--$key--\n";
34: var_dump( gmdate($value, $timestamp) );
35: var_dump( gmdate($value) );
36: };
37:
38: ?>
39: ===DONE===
40: --EXPECTF--
41: *** Testing gmdate() : usage variation ***
42:
43: --DATE_ATOM Constant--
44: string(25) "2008-08-08T08:08:08+00:00"
45: string(%d) "%s"
46:
47: --DATE_COOKIE Constant--
48: string(30) "Friday, 08-Aug-08 08:08:08 GMT"
49: string(%d) "%s"
50:
51: --DATE_RFC822 Constant--
52: string(29) "Fri, 08 Aug 08 08:08:08 +0000"
53: string(%d) "%s"
54:
55: --DATE_RFC850 Constant--
56: string(30) "Friday, 08-Aug-08 08:08:08 GMT"
57: string(%d) "%s"
58:
59: --DATE_RFC1036 Constant--
60: string(29) "Fri, 08 Aug 08 08:08:08 +0000"
61: string(%d) "%s"
62:
63: --DATE_RFC1123 Constant--
64: string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
65: string(%d) "%s"
66:
67: --DATE_RFC2822 Constant--
68: string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
69: string(%d) "%s"
70:
71: --DATE_RFC3339 Constant--
72: string(25) "2008-08-08T08:08:08+00:00"
73: string(%d) "%s"
74:
75: --DATE_RSS Constant--
76: string(31) "Fri, 08 Aug 2008 08:08:08 +0000"
77: string(%d) "%s"
78:
79: --DATE_W3C Constant--
80: string(25) "2008-08-08T08:08:08+00:00"
81: string(%d) "%s"
82: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>