1 |
41cc1b08
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
require_once dirname(__FILE__) . '/bootstrap.php';
|
44 |
|
|
|
45 |
|
|
class IRITest extends PHPUnit_Framework_TestCase
|
46 |
|
|
{
|
47 |
|
|
public static function rfc3986_tests()
|
48 |
|
|
{
|
49 |
|
|
return array(
|
50 |
|
|
|
51 |
|
|
array('g:h', 'g:h'),
|
52 |
|
|
array('g', 'http://a/b/c/g'),
|
53 |
|
|
array('./g', 'http://a/b/c/g'),
|
54 |
|
|
array('g/', 'http://a/b/c/g/'),
|
55 |
|
|
array('/g', 'http://a/g'),
|
56 |
|
|
array('//g', 'http://g/'),
|
57 |
|
|
array('?y', 'http://a/b/c/d;p?y'),
|
58 |
|
|
array('g?y', 'http://a/b/c/g?y'),
|
59 |
|
|
array('#s', 'http://a/b/c/d;p?q#s'),
|
60 |
|
|
array('g#s', 'http://a/b/c/g#s'),
|
61 |
|
|
array('g?y#s', 'http://a/b/c/g?y#s'),
|
62 |
|
|
array(';x', 'http://a/b/c/;x'),
|
63 |
|
|
array('g;x', 'http://a/b/c/g;x'),
|
64 |
|
|
array('g;x?y#s', 'http://a/b/c/g;x?y#s'),
|
65 |
|
|
array('', 'http://a/b/c/d;p?q'),
|
66 |
|
|
array('.', 'http://a/b/c/'),
|
67 |
|
|
array('./', 'http://a/b/c/'),
|
68 |
|
|
array('..', 'http://a/b/'),
|
69 |
|
|
array('../', 'http://a/b/'),
|
70 |
|
|
array('../g', 'http://a/b/g'),
|
71 |
|
|
array('../..', 'http://a/'),
|
72 |
|
|
array('../../', 'http://a/'),
|
73 |
|
|
array('../../g', 'http://a/g'),
|
74 |
|
|
|
75 |
|
|
array('../../../g', 'http://a/g'),
|
76 |
|
|
array('../../../../g', 'http://a/g'),
|
77 |
|
|
array('/./g', 'http://a/g'),
|
78 |
|
|
array('/../g', 'http://a/g'),
|
79 |
|
|
array('g.', 'http://a/b/c/g.'),
|
80 |
|
|
array('.g', 'http://a/b/c/.g'),
|
81 |
|
|
array('g..', 'http://a/b/c/g..'),
|
82 |
|
|
array('..g', 'http://a/b/c/..g'),
|
83 |
|
|
array('./../g', 'http://a/b/g'),
|
84 |
|
|
array('./g/.', 'http://a/b/c/g/'),
|
85 |
|
|
array('g/./h', 'http://a/b/c/g/h'),
|
86 |
|
|
array('g/../h', 'http://a/b/c/h'),
|
87 |
|
|
array('g;x=1/./y', 'http://a/b/c/g;x=1/y'),
|
88 |
|
|
array('g;x=1/../y', 'http://a/b/c/y'),
|
89 |
|
|
array('g?y/./x', 'http://a/b/c/g?y/./x'),
|
90 |
|
|
array('g?y/../x', 'http://a/b/c/g?y/../x'),
|
91 |
|
|
array('g#s/./x', 'http://a/b/c/g#s/./x'),
|
92 |
|
|
array('g#s/../x', 'http://a/b/c/g#s/../x'),
|
93 |
|
|
array('http:g', 'http:g'),
|
94 |
|
|
);
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
public function testStringRFC3986($relative, $expected)
|
101 |
|
|
{
|
102 |
|
|
$base = new SimplePie_IRI('http://a/b/c/d;p?q');
|
103 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative)->get_iri());
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
public function testObjectRFC3986($relative, $expected)
|
110 |
|
|
{
|
111 |
|
|
$base = new SimplePie_IRI('http://a/b/c/d;p?q');
|
112 |
|
|
$expected = new SimplePie_IRI($expected);
|
113 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative));
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
public function testBothStringRFC3986($relative, $expected)
|
120 |
|
|
{
|
121 |
|
|
$base = 'http://a/b/c/d;p?q';
|
122 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative)->get_iri());
|
123 |
|
|
$this->assertEquals($expected, (string) SimplePie_IRI::absolutize($base, $relative));
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
public static function sp_tests()
|
127 |
|
|
{
|
128 |
|
|
return array(
|
129 |
|
|
array('http://a/b/c/d', 'f%0o', 'http://a/b/c/f%250o'),
|
130 |
|
|
array('http://a/b/', 'c', 'http://a/b/c'),
|
131 |
|
|
array('http://a/', 'b', 'http://a/b'),
|
132 |
|
|
array('http://a/', '/b', 'http://a/b'),
|
133 |
|
|
array('http://a/b', 'c', 'http://a/c'),
|
134 |
|
|
array('http://a/b/', "c\x0Ad", 'http://a/b/c%0Ad'),
|
135 |
|
|
array('http://a/b/', "c\x0A\x0B", 'http://a/b/c%0A%0B'),
|
136 |
|
|
array('http://a/b/c', '//0', 'http://0/'),
|
137 |
|
|
array('http://a/b/c', '0', 'http://a/b/0'),
|
138 |
|
|
array('http://a/b/c', '?0', 'http://a/b/c?0'),
|
139 |
|
|
array('http://a/b/c', '#0', 'http://a/b/c#0'),
|
140 |
|
|
array('http://0/b/c', 'd', 'http://0/b/d'),
|
141 |
|
|
array('http://a/b/c?0', 'd', 'http://a/b/d'),
|
142 |
|
|
array('http://a/b/c#0', 'd', 'http://a/b/d'),
|
143 |
|
|
array('http://example.com', '//example.net', 'http://example.net/'),
|
144 |
|
|
array('http:g', 'a', 'http:a'),
|
145 |
|
|
);
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
public function testStringSP($base, $relative, $expected)
|
152 |
|
|
{
|
153 |
|
|
$base = new SimplePie_IRI($base);
|
154 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative)->get_iri());
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
public function testObjectSP($base, $relative, $expected)
|
161 |
|
|
{
|
162 |
|
|
$base = new SimplePie_IRI($base);
|
163 |
|
|
$expected = new SimplePie_IRI($expected);
|
164 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative));
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
public static function query_tests()
|
168 |
|
|
{
|
169 |
|
|
return array(
|
170 |
|
|
array('a=b&c=d', 'http://example.com/?a=b&c=d'),
|
171 |
|
|
array('a=b%26c=d', 'http://example.com/?a=b%26c=d'),
|
172 |
|
|
array('url=http%3A%2F%2Fexample.com%3Fa%3Db', 'http://example.com/?url=http%3A%2F%2Fexample.com%3Fa%3Db'),
|
173 |
|
|
array('url=http%3A%2F%2Fexample.com%3Fa%3Db%26c%3Dd', 'http://example.com/?url=http%3A%2F%2Fexample.com%3Fa%3Db%26c%3Dd'),
|
174 |
|
|
);
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
public function testStringQuery($query, $expected)
|
181 |
|
|
{
|
182 |
|
|
$base = new SimplePie_IRI('http://example.com/');
|
183 |
|
|
$base->set_query($query);
|
184 |
|
|
$this->assertEquals($expected, $base->get_iri());
|
185 |
|
|
}
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
|
190 |
|
|
public function testObjectQuery($query, $expected)
|
191 |
|
|
{
|
192 |
|
|
$base = new SimplePie_IRI('http://example.com/');
|
193 |
|
|
$base->set_query($query);
|
194 |
|
|
$expected = new SimplePie_IRI($expected);
|
195 |
|
|
$this->assertEquals($expected, $base);
|
196 |
|
|
}
|
197 |
|
|
|
198 |
|
|
public static function absolutize_tests()
|
199 |
|
|
{
|
200 |
|
|
return array(
|
201 |
|
|
array('http://example.com/', 'foo/111:bar', 'http://example.com/foo/111:bar'),
|
202 |
|
|
array('http://example.com/#foo', '', 'http://example.com/'),
|
203 |
|
|
);
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
public function testAbsolutizeString($base, $relative, $expected)
|
210 |
|
|
{
|
211 |
|
|
$base = new SimplePie_IRI($base);
|
212 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative)->get_iri());
|
213 |
|
|
}
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
public function testAbsolutizeObject($base, $relative, $expected)
|
219 |
|
|
{
|
220 |
|
|
$base = new SimplePie_IRI($base);
|
221 |
|
|
$expected = new SimplePie_IRI($expected);
|
222 |
|
|
$this->assertEquals($expected, SimplePie_IRI::absolutize($base, $relative));
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
public static function normalization_tests()
|
226 |
|
|
{
|
227 |
|
|
return array(
|
228 |
|
|
array('example://a/b/c/%7Bfoo%7D', 'example://a/b/c/%7Bfoo%7D'),
|
229 |
|
|
array('eXAMPLE://a/./b/../b/%63/%7bfoo%7d', 'example://a/b/c/%7Bfoo%7D'),
|
230 |
|
|
array('example://%61/', 'example://a/'),
|
231 |
|
|
array('example://%41/', 'example://a/'),
|
232 |
|
|
array('example://A/', 'example://a/'),
|
233 |
|
|
array('example://a/', 'example://a/'),
|
234 |
|
|
array('example://%25A/', 'example://%25a/'),
|
235 |
|
|
array('HTTP://EXAMPLE.com/', 'http://example.com/'),
|
236 |
|
|
array('http://example.com/', 'http://example.com/'),
|
237 |
|
|
array('http://example.com:', 'http://example.com/'),
|
238 |
|
|
array('http://example.com:80', 'http://example.com/'),
|
239 |
|
|
array('http://@example.com', 'http://@example.com/'),
|
240 |
|
|
array('http://', 'http://'),
|
241 |
|
|
array('http://example.com?', 'http://example.com/?'),
|
242 |
|
|
array('http://example.com#', 'http://example.com/#'),
|
243 |
|
|
array('https://example.com/', 'https://example.com/'),
|
244 |
|
|
array('https://example.com:', 'https://example.com/'),
|
245 |
|
|
array('https://@example.com', 'https://@example.com/'),
|
246 |
|
|
array('https://example.com?', 'https://example.com/?'),
|
247 |
|
|
array('https://example.com#', 'https://example.com/#'),
|
248 |
|
|
array('file://localhost/foobar', 'file:/foobar'),
|
249 |
|
|
array('http://[0:0:0:0:0:0:0:1]', 'http://[::1]/'),
|
250 |
|
|
array('http://[2001:db8:85a3:0000:0000:8a2e:370:7334]', 'http://[2001:db8:85a3::8a2e:370:7334]/'),
|
251 |
|
|
array('http://[0:0:0:0:0:ffff:c0a8:a01]', 'http://[::ffff:c0a8:a01]/'),
|
252 |
|
|
array('http://[ffff:0:0:0:0:0:0:0]', 'http://[ffff::]/'),
|
253 |
|
|
array('http://[::ffff:192.0.2.128]', 'http://[::ffff:192.0.2.128]/'),
|
254 |
|
|
array('http://[invalid]', 'http:'),
|
255 |
|
|
array('http://[0:0:0:0:0:0:0:1]:', 'http://[::1]/'),
|
256 |
|
|
array('http://[0:0:0:0:0:0:0:1]:80', 'http://[::1]/'),
|
257 |
|
|
array('http://[0:0:0:0:0:0:0:1]:1234', 'http://[::1]:1234/'),
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
array('http://Aa@example.com', 'http://Aa@example.com/'),
|
263 |
|
|
array('http://example.com?Aa', 'http://example.com/?Aa'),
|
264 |
|
|
array('http://example.com/Aa', 'http://example.com/Aa'),
|
265 |
|
|
array('http://example.com#Aa', 'http://example.com/#Aa'),
|
266 |
|
|
array('http://[0:0:0:0:0:0:0:0]', 'http://[::]/'),
|
267 |
|
|
array('http:.', 'http:'),
|
268 |
|
|
array('http:..', 'http:'),
|
269 |
|
|
array('http:./', 'http:'),
|
270 |
|
|
array('http:../', 'http:'),
|
271 |
|
|
array('http://example.com/%3A', 'http://example.com/%3A'),
|
272 |
|
|
array('http://example.com/:', 'http://example.com/:'),
|
273 |
|
|
array('http://example.com/%C2', 'http://example.com/%C2'),
|
274 |
|
|
array('http://example.com/%C2a', 'http://example.com/%C2a'),
|
275 |
|
|
array('http://example.com/%C2%00', 'http://example.com/%C2%00'),
|
276 |
|
|
array('http://example.com/%C3%A9', 'http://example.com/é'),
|
277 |
|
|
array('http://example.com/%C3%A9%00', 'http://example.com/é%00'),
|
278 |
|
|
array('http://example.com/%C3%A9cole', 'http://example.com/école'),
|
279 |
|
|
array('http://example.com/%FF', 'http://example.com/%FF'),
|
280 |
|
|
array("http://example.com/\xF3\xB0\x80\x80", 'http://example.com/%F3%B0%80%80'),
|
281 |
|
|
array("http://example.com/\xF3\xB0\x80\x80%00", 'http://example.com/%F3%B0%80%80%00'),
|
282 |
|
|
array("http://example.com/\xF3\xB0\x80\x80a", 'http://example.com/%F3%B0%80%80a'),
|
283 |
|
|
array("http://example.com?\xF3\xB0\x80\x80", "http://example.com/?\xF3\xB0\x80\x80"),
|
284 |
|
|
array("http://example.com?\xF3\xB0\x80\x80%00", "http://example.com/?\xF3\xB0\x80\x80%00"),
|
285 |
|
|
array("http://example.com?\xF3\xB0\x80\x80a", "http://example.com/?\xF3\xB0\x80\x80a"),
|
286 |
|
|
array("http://example.com/\xEE\x80\x80", 'http://example.com/%EE%80%80'),
|
287 |
|
|
array("http://example.com/\xEE\x80\x80%00", 'http://example.com/%EE%80%80%00'),
|
288 |
|
|
array("http://example.com/\xEE\x80\x80a", 'http://example.com/%EE%80%80a'),
|
289 |
|
|
array("http://example.com?\xEE\x80\x80", "http://example.com/?\xEE\x80\x80"),
|
290 |
|
|
array("http://example.com?\xEE\x80\x80%00", "http://example.com/?\xEE\x80\x80%00"),
|
291 |
|
|
array("http://example.com?\xEE\x80\x80a", "http://example.com/?\xEE\x80\x80a"),
|
292 |
|
|
array("http://example.com/\xC2", 'http://example.com/%C2'),
|
293 |
|
|
array("http://example.com/\xC2a", 'http://example.com/%C2a'),
|
294 |
|
|
array("http://example.com/\xC2\x00", 'http://example.com/%C2%00'),
|
295 |
|
|
array("http://example.com/\xC3\xA9", 'http://example.com/é'),
|
296 |
|
|
array("http://example.com/\xC3\xA9\x00", 'http://example.com/é%00'),
|
297 |
|
|
array("http://example.com/\xC3\xA9cole", 'http://example.com/école'),
|
298 |
|
|
array("http://example.com/\xFF", 'http://example.com/%FF'),
|
299 |
|
|
array("http://example.com/\xFF%00", 'http://example.com/%FF%00'),
|
300 |
|
|
array("http://example.com/\xFFa", 'http://example.com/%FFa'),
|
301 |
|
|
array('http://example.com/%61', 'http://example.com/a'),
|
302 |
|
|
array('http://example.com?%26', 'http://example.com/?%26'),
|
303 |
|
|
array('http://example.com?%61', 'http://example.com/?a'),
|
304 |
|
|
array('///', '///'),
|
305 |
|
|
);
|
306 |
|
|
}
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
public function testStringNormalization($input, $output)
|
312 |
|
|
{
|
313 |
|
|
$input = new SimplePie_IRI($input);
|
314 |
|
|
$this->assertEquals($output, $input->get_iri());
|
315 |
|
|
}
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
public function testObjectNormalization($input, $output)
|
321 |
|
|
{
|
322 |
|
|
$input = new SimplePie_IRI($input);
|
323 |
|
|
$output = new SimplePie_IRI($output);
|
324 |
|
|
$this->assertEquals($output, $input);
|
325 |
|
|
}
|
326 |
|
|
|
327 |
|
|
public static function uri_tests() {
|
328 |
|
|
return array(
|
329 |
|
|
array('http://example.com/%C3%A9cole', 'http://example.com/%C3%A9cole'),
|
330 |
|
|
array('http://example.com/école', 'http://example.com/%C3%A9cole'),
|
331 |
|
|
array("http://example.com/\xC3\xA9cole", 'http://example.com/%C3%A9cole'),
|
332 |
|
|
);
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
public function testURIConversion($input, $output)
|
339 |
|
|
{
|
340 |
|
|
$input = new SimplePie_IRI($input);
|
341 |
|
|
$this->assertEquals($output, $input->get_uri());
|
342 |
|
|
}
|
343 |
|
|
|
344 |
|
|
public static function equivalence_tests()
|
345 |
|
|
{
|
346 |
|
|
return array(
|
347 |
|
|
array('http://É.com', 'http://%C3%89.com'),
|
348 |
|
|
);
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
|
|
public function testObjectEquivalence($input, $output)
|
355 |
|
|
{
|
356 |
|
|
$input = new SimplePie_IRI($input);
|
357 |
|
|
$output = new SimplePie_IRI($output);
|
358 |
|
|
$this->assertEquals($output, $input);
|
359 |
|
|
}
|
360 |
|
|
|
361 |
|
|
public static function not_equivalence_tests()
|
362 |
|
|
{
|
363 |
|
|
return array(
|
364 |
|
|
array('http://example.com/foo/bar', 'http://example.com/foo%2Fbar'),
|
365 |
|
|
);
|
366 |
|
|
}
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
public function testObjectNotEquivalence($input, $output)
|
372 |
|
|
{
|
373 |
|
|
$input = new SimplePie_IRI($input);
|
374 |
|
|
$output = new SimplePie_IRI($output);
|
375 |
|
|
$this->assertNotEquals($output, $input);
|
376 |
|
|
}
|
377 |
|
|
|
378 |
|
|
public function testInvalidAbsolutizeBase()
|
379 |
|
|
{
|
380 |
|
|
$this->assertFalse(SimplePie_IRI::absolutize('://not a URL', '../'));
|
381 |
|
|
}
|
382 |
|
|
|
383 |
|
|
public function testInvalidAbsolutizeRelative()
|
384 |
|
|
{
|
385 |
|
|
$this->assertFalse(SimplePie_IRI::absolutize('http://example.com/', 'http://example.com//not a URL'));
|
386 |
|
|
}
|
387 |
|
|
|
388 |
|
|
public function testFullGamut()
|
389 |
|
|
{
|
390 |
|
|
$iri = new SimplePie_IRI();
|
391 |
|
|
$iri->scheme = 'http';
|
392 |
|
|
$iri->userinfo = 'user:password';
|
393 |
|
|
$iri->host = 'example.com';
|
394 |
|
|
$iri->path = '/test/';
|
395 |
|
|
$iri->fragment = 'test';
|
396 |
|
|
|
397 |
|
|
$this->assertEquals('http', $iri->scheme);
|
398 |
|
|
$this->assertEquals('user:password', $iri->userinfo);
|
399 |
|
|
$this->assertEquals('example.com', $iri->host);
|
400 |
|
|
$this->assertEquals(80, $iri->port);
|
401 |
|
|
$this->assertEquals('/test/', $iri->path);
|
402 |
|
|
$this->assertEquals('test', $iri->fragment);
|
403 |
|
|
}
|
404 |
|
|
|
405 |
|
|
public function testReadAliased()
|
406 |
|
|
{
|
407 |
|
|
$iri = new SimplePie_IRI();
|
408 |
|
|
$iri->scheme = 'http';
|
409 |
|
|
$iri->userinfo = 'user:password';
|
410 |
|
|
$iri->host = 'example.com';
|
411 |
|
|
$iri->path = '/test/';
|
412 |
|
|
$iri->fragment = 'test';
|
413 |
|
|
|
414 |
|
|
$this->assertEquals('http', $iri->ischeme);
|
415 |
|
|
$this->assertEquals('user:password', $iri->iuserinfo);
|
416 |
|
|
$this->assertEquals('example.com', $iri->ihost);
|
417 |
|
|
$this->assertEquals(80, $iri->iport);
|
418 |
|
|
$this->assertEquals('/test/', $iri->ipath);
|
419 |
|
|
$this->assertEquals('test', $iri->ifragment);
|
420 |
|
|
}
|
421 |
|
|
|
422 |
|
|
public function testWriteAliased()
|
423 |
|
|
{
|
424 |
|
|
$iri = new SimplePie_IRI();
|
425 |
|
|
$iri->scheme = 'http';
|
426 |
|
|
$iri->iuserinfo = 'user:password';
|
427 |
|
|
$iri->ihost = 'example.com';
|
428 |
|
|
$iri->ipath = '/test/';
|
429 |
|
|
$iri->ifragment = 'test';
|
430 |
|
|
|
431 |
|
|
$this->assertEquals('http', $iri->scheme);
|
432 |
|
|
$this->assertEquals('user:password', $iri->userinfo);
|
433 |
|
|
$this->assertEquals('example.com', $iri->host);
|
434 |
|
|
$this->assertEquals(80, $iri->port);
|
435 |
|
|
$this->assertEquals('/test/', $iri->path);
|
436 |
|
|
$this->assertEquals('test', $iri->fragment);
|
437 |
|
|
}
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
public function testNonexistantProperty()
|
443 |
|
|
{
|
444 |
|
|
$iri = new SimplePie_IRI();
|
445 |
|
|
$this->assertFalse(isset($iri->nonexistant_prop));
|
446 |
|
|
$should_fail = $iri->nonexistant_prop;
|
447 |
|
|
}
|
448 |
|
|
|
449 |
|
|
public function testBlankHost()
|
450 |
|
|
{
|
451 |
|
|
$iri = new SimplePie_IRI('http://example.com/a/?b=c#d');
|
452 |
|
|
$iri->host = null;
|
453 |
|
|
|
454 |
|
|
$this->assertEquals(null, $iri->host);
|
455 |
|
|
$this->assertEquals('http:/a/?b=c#d', (string) $iri);
|
456 |
|
|
}
|
457 |
|
|
|
458 |
|
|
public function testBadPort()
|
459 |
|
|
{
|
460 |
|
|
$iri = new SimplePie_IRI();
|
461 |
|
|
$iri->port = 'example';
|
462 |
|
|
|
463 |
|
|
$this->assertEquals(null, $iri->port);
|
464 |
|
|
}
|
465 |
|
|
}
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
?> |