source: branches/version-2_5-dev/data/module/Compat/tests/function/idate.phpt @ 20119

Revision 20119, 1.6 KB checked in by nanasess, 13 years ago (diff)

module 以下は svn:keywords を除外

  • Property svn:eol-style set to LF
Line 
1--TEST--
2Function -- idate
3--SKIPIF--
4<?php if (function_exists('idate')) { echo 'skip'; } ?>
5--FILE--
6<?php
7require_once 'PHP/Compat.php';
8PHP_Compat::loadFunction('idate');
9
10$tests = array(
11    'B',    // OK
12    'd',    // ...
13    'h',
14    'H',
15    'i',
16    'I',
17    'L',
18    'm',
19    's',
20    't',
21    'U',
22    'w',
23    'W',
24    'y',
25    'Y',
26    'z',    // ...
27    'Z',    // OK
28
29    'foo',  // NOK
30    '',     // NOK
31    '!',    // NOK
32    '\\'    // NOK
33);
34
35function ehandler($no, $str)
36{
37    echo '(Warning) ';
38}
39set_error_handler('ehandler');
40
41foreach ($tests as $v) {
42    echo 'testing: ';
43    var_dump($v);
44    echo "\nresult:  ";
45    $res = idate($v);
46    if (!$res) {
47        var_dump($res);
48    } else {
49        echo "> 0\n";
50    }
51    echo "\n\n";
52}
53
54restore_error_handler();
55?>
56--EXPECT--
57testing: string(1) "B"
58
59result:  > 0
60
61
62testing: string(1) "d"
63
64result:  > 0
65
66
67testing: string(1) "h"
68
69result:  > 0
70
71
72testing: string(1) "H"
73
74result:  > 0
75
76
77testing: string(1) "i"
78
79result:  > 0
80
81
82testing: string(1) "I"
83
84result:  int(0)
85
86
87testing: string(1) "L"
88
89result:  int(0)
90
91
92testing: string(1) "m"
93
94result:  > 0
95
96
97testing: string(1) "s"
98
99result:  > 0
100
101
102testing: string(1) "t"
103
104result:  > 0
105
106
107testing: string(1) "U"
108
109result:  > 0
110
111
112testing: string(1) "w"
113
114result:  > 0
115
116
117testing: string(1) "W"
118
119result:  > 0
120
121
122testing: string(1) "y"
123
124result:  > 0
125
126
127testing: string(1) "Y"
128
129result:  > 0
130
131
132testing: string(1) "z"
133
134result:  > 0
135
136
137testing: string(1) "Z"
138
139result:  int(0)
140
141
142testing: string(3) "foo"
143
144result:  (Warning) bool(false)
145
146
147testing: string(0) ""
148
149result:  (Warning) bool(false)
150
151
152testing: string(1) "!"
153
154result:  int(0)
155
156
157testing: string(1) "\"
158
159result:  int(0)
Note: See TracBrowser for help on using the repository browser.