source: branches/dev/html/test/adachi/LLReader/Lib/XML/Feed/tests/convertedtests/rss.php @ 14612

Revision 14612, 61.8 KB checked in by adati, 17 years ago (diff)
Line 
1<?php
2
3require_once 'XML_Feed_Parser_TestCase.php';
4
5class rss_TestCase extends XML_Feed_Parser_Converted_TestCase {
6
7    function test_channel_author_1 () {
8        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_author.xml');
9        try {
10            $feed = new XML_Feed_Parser($content);
11        } catch (XML_Feed_Parser_Exception $e) {
12            $this->assertTrue(false);
13            return;
14        }
15        $this->assertEquals('Example editor (me@example.com)', $feed->author);
16    }
17
18    function test_channel_author_map_author_detail_email_1 () {
19        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_author_map_author_detail_email.xml');
20        try {
21            $feed = new XML_Feed_Parser($content);
22        } catch (XML_Feed_Parser_Exception $e) {
23            $this->assertTrue(false);
24            return;
25        }
26        $this->assertEquals('me@example.com', $feed->author(0, 'email'));
27    }
28
29    function test_channel_author_map_author_detail_email_2_1 () {
30        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_author_map_author_detail_email_2.xml');
31        try {
32            $feed = new XML_Feed_Parser($content);
33        } catch (XML_Feed_Parser_Exception $e) {
34            $this->assertTrue(false);
35            return;
36        }
37        $this->assertEquals('me+spam@example.com', $feed->author(0, 'email'));
38    }
39
40    function test_channel_author_map_author_detail_email_3_1 () {
41        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_author_map_author_detail_email_3.xml');
42        try {
43            $feed = new XML_Feed_Parser($content);
44        } catch (XML_Feed_Parser_Exception $e) {
45            $this->assertTrue(false);
46            return;
47        }
48        $this->assertEquals('me@example.com', $feed->author(0, 'email'));
49    }
50
51    function test_channel_author_map_author_detail_name_1 () {
52        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_author_map_author_detail_name.xml');
53        try {
54            $feed = new XML_Feed_Parser($content);
55        } catch (XML_Feed_Parser_Exception $e) {
56            $this->assertTrue(false);
57            return;
58        }
59        $this->assertEquals('Example editor', $feed->author(0, 'name'));
60    }
61
62    function test_channel_author_map_author_detail_name_2_1 () {
63        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_author_map_author_detail_name_2.xml');
64        try {
65            $feed = new XML_Feed_Parser($content);
66        } catch (XML_Feed_Parser_Exception $e) {
67            $this->assertTrue(false);
68            return;
69        }
70        $this->assertEquals('Example editor', $feed->author(0, 'name'));
71    }
72
73    function test_channel_category_1 () {
74        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_category.xml');
75        try {
76            $feed = new XML_Feed_Parser($content);
77        } catch (XML_Feed_Parser_Exception $e) {
78            $this->assertTrue(false);
79            return;
80        }
81        $this->assertEquals('Example category', $feed->category);
82    }
83
84    function test_channel_category_domain_1 () {
85        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_category_domain.xml');
86        try {
87            $feed = new XML_Feed_Parser($content);
88        } catch (XML_Feed_Parser_Exception $e) {
89            $this->assertTrue(false);
90            return;
91        }
92        $this->assertEquals('http://www.example.com/', $feed->categories[0][0]);
93    }
94
95    function test_channel_category_multiple_1 () {
96        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_category_multiple.xml');
97        try {
98            $feed = new XML_Feed_Parser($content);
99        } catch (XML_Feed_Parser_Exception $e) {
100            $this->assertTrue(false);
101            return;
102        }
103        $this->assertEquals('http://www.example.com/2', $feed->categories[1][0]);
104    }
105
106    function test_channel_category_multiple_2_1 () {
107        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_category_multiple_2.xml');
108        try {
109            $feed = new XML_Feed_Parser($content);
110        } catch (XML_Feed_Parser_Exception $e) {
111            $this->assertTrue(false);
112            return;
113        }
114        $this->assertEquals('Example category 2', $feed->categories[1][1]);
115    }
116
117    function test_channel_cloud_domain_1 () {
118        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_cloud_domain.xml');
119        try {
120            $feed = new XML_Feed_Parser($content);
121        } catch (XML_Feed_Parser_Exception $e) {
122            $this->assertTrue(false);
123            return;
124        }
125        $this->assertEquals('rpc.sys.com', $feed->cloud(0, 'domain'));
126    }
127
128    function test_channel_cloud_path_1 () {
129        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_cloud_path.xml');
130        try {
131            $feed = new XML_Feed_Parser($content);
132        } catch (XML_Feed_Parser_Exception $e) {
133            $this->assertTrue(false);
134            return;
135        }
136        $this->assertEquals('/RPC2', $feed->cloud(0, 'path'));
137    }
138
139    function test_channel_cloud_port_1 () {
140        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_cloud_port.xml');
141        try {
142            $feed = new XML_Feed_Parser($content);
143        } catch (XML_Feed_Parser_Exception $e) {
144            $this->assertTrue(false);
145            return;
146        }
147        $this->assertEquals('80', $feed->cloud(0, 'port'));
148    }
149
150    function test_channel_cloud_protocol_1 () {
151        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_cloud_protocol.xml');
152        try {
153            $feed = new XML_Feed_Parser($content);
154        } catch (XML_Feed_Parser_Exception $e) {
155            $this->assertTrue(false);
156            return;
157        }
158        $this->assertEquals('xml-rpc', $feed->cloud(0, 'protocol'));
159    }
160
161    function test_channel_cloud_registerProcedure_1 () {
162        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_cloud_registerProcedure.xml');
163        try {
164            $feed = new XML_Feed_Parser($content);
165        } catch (XML_Feed_Parser_Exception $e) {
166            $this->assertTrue(false);
167            return;
168        }
169        $this->assertEquals('myCloud.rssPleaseNotify', $feed->cloud(0, 'registerprocedure'));
170    }
171
172    function test_channel_copyright_1 () {
173        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_copyright.xml');
174        try {
175            $feed = new XML_Feed_Parser($content);
176        } catch (XML_Feed_Parser_Exception $e) {
177            $this->assertTrue(false);
178            return;
179        }
180        $this->assertEquals('Example copyright', $feed->copyright);
181    }
182
183    function test_channel_dc_author_1 () {
184        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_author.xml');
185        try {
186            $feed = new XML_Feed_Parser($content);
187        } catch (XML_Feed_Parser_Exception $e) {
188            $this->assertTrue(false);
189            return;
190        }
191        $this->assertEquals('Example editor', $feed->author);
192    }
193
194    function test_channel_dc_author_map_author_detail_email_1 () {
195        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_author_map_author_detail_email.xml');
196        try {
197            $feed = new XML_Feed_Parser($content);
198        } catch (XML_Feed_Parser_Exception $e) {
199            $this->assertTrue(false);
200            return;
201        }
202        $this->assertEquals('me@example.com', $feed->author(0, 'email'));
203    }
204
205    function test_channel_dc_author_map_author_detail_name_1 () {
206        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_author_map_author_detail_name.xml');
207        try {
208            $feed = new XML_Feed_Parser($content);
209        } catch (XML_Feed_Parser_Exception $e) {
210            $this->assertTrue(false);
211            return;
212        }
213        $this->assertEquals('Example editor', $feed->author(0, 'name'));
214    }
215
216    function test_channel_dc_contributor_1 () {
217        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_contributor.xml');
218        try {
219            $feed = new XML_Feed_Parser($content);
220        } catch (XML_Feed_Parser_Exception $e) {
221            $this->assertTrue(false);
222            return;
223        }
224        $this->assertEquals('Example contributor', $feed->contributors(0, 'name'));
225    }
226
227    function test_channel_dc_creator_1 () {
228        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_creator.xml');
229        try {
230            $feed = new XML_Feed_Parser($content);
231        } catch (XML_Feed_Parser_Exception $e) {
232            $this->assertTrue(false);
233            return;
234        }
235        $this->assertEquals('Example editor', $feed->author);
236    }
237
238    function test_channel_dc_creator_map_author_detail_email_1 () {
239        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_creator_map_author_detail_email.xml');
240        try {
241            $feed = new XML_Feed_Parser($content);
242        } catch (XML_Feed_Parser_Exception $e) {
243            $this->assertTrue(false);
244            return;
245        }
246        $this->assertEquals('me@example.com', $feed->author(0, 'email'));
247    }
248
249    function test_channel_dc_creator_map_author_detail_name_1 () {
250        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_creator_map_author_detail_name.xml');
251        try {
252            $feed = new XML_Feed_Parser($content);
253        } catch (XML_Feed_Parser_Exception $e) {
254            $this->assertTrue(false);
255            return;
256        }
257        $this->assertEquals('Example editor', $feed->author(0, 'name'));
258    }
259
260    function test_channel_dc_publisher_1 () {
261        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_publisher.xml');
262        try {
263            $feed = new XML_Feed_Parser($content);
264        } catch (XML_Feed_Parser_Exception $e) {
265            $this->assertTrue(false);
266            return;
267        }
268        $this->assertEquals('Example editor', $feed->publisher);
269    }
270
271    function test_channel_dc_publisher_email_1 () {
272        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_publisher_email.xml');
273        try {
274            $feed = new XML_Feed_Parser($content);
275        } catch (XML_Feed_Parser_Exception $e) {
276            $this->assertTrue(false);
277            return;
278        }
279        $this->assertEquals('me@example.com', $feed->publisher(0, 'email'));
280    }
281
282    function test_channel_dc_publisher_name_1 () {
283        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_publisher_name.xml');
284        try {
285            $feed = new XML_Feed_Parser($content);
286        } catch (XML_Feed_Parser_Exception $e) {
287            $this->assertTrue(false);
288            return;
289        }
290        $this->assertEquals('Example editor', $feed->publisher(0, 'name'));
291    }
292
293    function test_channel_dc_rights_1 () {
294        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_rights.xml');
295        try {
296            $feed = new XML_Feed_Parser($content);
297        } catch (XML_Feed_Parser_Exception $e) {
298            $this->assertTrue(false);
299            return;
300        }
301        $this->assertEquals('Example copyright', $feed->copyright);
302    }
303
304    function test_channel_dc_subject_1 () {
305        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_subject.xml');
306        try {
307            $feed = new XML_Feed_Parser($content);
308        } catch (XML_Feed_Parser_Exception $e) {
309            $this->assertTrue(false);
310            return;
311        }
312        $this->assertEquals('Example category', $feed->category);
313    }
314
315    function test_channel_dc_subject_2_1 () {
316        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_subject_2.xml');
317        try {
318            $feed = new XML_Feed_Parser($content);
319        } catch (XML_Feed_Parser_Exception $e) {
320            $this->assertTrue(false);
321            return;
322        }
323        $this->assertEquals('Example category', $feed->categories[0][1]);
324    }
325
326    function test_channel_dc_subject_multiple_1 () {
327        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_subject_multiple.xml');
328        try {
329            $feed = new XML_Feed_Parser($content);
330        } catch (XML_Feed_Parser_Exception $e) {
331            $this->assertTrue(false);
332            return;
333        }
334        $this->assertEquals('Example category 2', $feed->categories[1][1]);
335    }
336
337    function test_channel_dc_title_1 () {
338        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_dc_title.xml');
339        try {
340            $feed = new XML_Feed_Parser($content);
341        } catch (XML_Feed_Parser_Exception $e) {
342            $this->assertTrue(false);
343            return;
344        }
345        $this->assertEquals('Example title', $feed->title);
346    }
347
348    function test_channel_description_1 () {
349        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_description.xml');
350        try {
351            $feed = new XML_Feed_Parser($content);
352        } catch (XML_Feed_Parser_Exception $e) {
353            $this->assertTrue(false);
354            return;
355        }
356        $this->assertEquals('Example description', $feed->description);
357    }
358
359    function test_channel_description_escaped_markup_1 () {
360        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_description_escaped_markup.xml');
361        try {
362            $feed = new XML_Feed_Parser($content);
363        } catch (XML_Feed_Parser_Exception $e) {
364            $this->assertTrue(false);
365            return;
366        }
367        $this->assertEquals('<p>Example description</p>', $feed->description);
368    }
369
370    function test_channel_description_map_tagline_1 () {
371        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_description_map_tagline.xml');
372        try {
373            $feed = new XML_Feed_Parser($content);
374        } catch (XML_Feed_Parser_Exception $e) {
375            $this->assertTrue(false);
376            return;
377        }
378        $this->assertEquals('Example description', $feed->tagline);
379    }
380
381    function test_channel_description_naked_markup_1 () {
382        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_description_naked_markup.xml');
383        try {
384            $feed = new XML_Feed_Parser($content);
385        } catch (XML_Feed_Parser_Exception $e) {
386            $this->assertTrue(false);
387            return;
388        }
389        $this->assertEquals('<p>Example description</p>', $feed->description);
390    }
391
392    function test_channel_description_shorttag_1 () {
393        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_description_shorttag.xml');
394        try {
395            $feed = new XML_Feed_Parser($content);
396        } catch (XML_Feed_Parser_Exception $e) {
397            $this->assertTrue(false);
398            return;
399        }
400        $this->assertEquals('', $feed->description);
401    }
402
403    function test_channel_description_shorttag_2 () {
404        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_description_shorttag.xml');
405        try {
406            $feed = new XML_Feed_Parser($content);
407        } catch (XML_Feed_Parser_Exception $e) {
408            $this->assertTrue(false);
409            return;
410        }
411        $this->assertEquals('http://example.com/', $feed->link);
412    }
413
414    function test_channel_docs_1 () {
415        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_docs.xml');
416        try {
417            $feed = new XML_Feed_Parser($content);
418        } catch (XML_Feed_Parser_Exception $e) {
419            $this->assertTrue(false);
420            return;
421        }
422        $this->assertEquals('http://www.example.com/', $feed->docs);
423    }
424
425    function test_channel_generator_1 () {
426        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_generator.xml');
427        try {
428            $feed = new XML_Feed_Parser($content);
429        } catch (XML_Feed_Parser_Exception $e) {
430            $this->assertTrue(false);
431            return;
432        }
433        $this->assertEquals('Example generator', $feed->generator);
434    }
435
436    function test_channel_image_description_1 () {
437        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_description.xml');
438        try {
439            $feed = new XML_Feed_Parser($content);
440        } catch (XML_Feed_Parser_Exception $e) {
441            $this->assertTrue(false);
442            return;
443        }
444        $this->assertEquals('Available in Netscape RSS 0.91', $feed->image(0, 'description'));
445    }
446
447    function test_channel_image_height_1 () {
448        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_height.xml');
449        try {
450            $feed = new XML_Feed_Parser($content);
451        } catch (XML_Feed_Parser_Exception $e) {
452            $this->assertTrue(false);
453            return;
454        }
455        $this->assertEquals(15, $feed->image(0, 'height'));
456    }
457
458    function test_channel_image_link_1 () {
459        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_link.xml');
460        try {
461            $feed = new XML_Feed_Parser($content);
462        } catch (XML_Feed_Parser_Exception $e) {
463            $this->assertTrue(false);
464            return;
465        }
466        $this->assertEquals('http://example.org/link', $feed->image(0, 'link'));
467    }
468
469    function test_channel_image_link_conflict_1 () {
470        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_link_conflict.xml');
471        try {
472            $feed = new XML_Feed_Parser($content);
473        } catch (XML_Feed_Parser_Exception $e) {
474            $this->assertTrue(false);
475            return;
476        }
477        $this->assertEquals('http://channel.example.com/', $feed->link);
478    }
479
480    function test_channel_image_title_1 () {
481        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_title.xml');
482        try {
483            $feed = new XML_Feed_Parser($content);
484        } catch (XML_Feed_Parser_Exception $e) {
485            $this->assertTrue(false);
486            return;
487        }
488        $this->assertEquals('Sample image', $feed->image(0, 'title'));
489    }
490
491    function test_channel_image_title_conflict_1 () {
492        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_title_conflict.xml');
493        try {
494            $feed = new XML_Feed_Parser($content);
495        } catch (XML_Feed_Parser_Exception $e) {
496            $this->assertTrue(false);
497            return;
498        }
499        $this->assertEquals('Real title', $feed->title);
500    }
501
502    function test_channel_image_url_1 () {
503        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_url.xml');
504        try {
505            $feed = new XML_Feed_Parser($content);
506        } catch (XML_Feed_Parser_Exception $e) {
507            $this->assertTrue(false);
508            return;
509        }
510        $this->assertEquals('http://example.org/url', $feed->image(0, 'url'));
511    }
512
513    function test_channel_image_width_1 () {
514        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_image_width.xml');
515        try {
516            $feed = new XML_Feed_Parser($content);
517        } catch (XML_Feed_Parser_Exception $e) {
518            $this->assertTrue(false);
519            return;
520        }
521        $this->assertEquals(80, $feed->image(0, 'width'));
522    }
523
524    function test_channel_link_1 () {
525        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_link.xml');
526        try {
527            $feed = new XML_Feed_Parser($content);
528        } catch (XML_Feed_Parser_Exception $e) {
529            $this->assertTrue(false);
530            return;
531        }
532        $this->assertEquals('http://example.com/', $feed->link);
533    }
534
535    function test_channel_managingEditor_1 () {
536        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_managingEditor.xml');
537        try {
538            $feed = new XML_Feed_Parser($content);
539        } catch (XML_Feed_Parser_Exception $e) {
540            $this->assertTrue(false);
541            return;
542        }
543        $this->assertEquals('Example editor', $feed->author);
544    }
545
546    function test_channel_managingEditor_map_author_detail_email_1 () {
547        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_managingEditor_map_author_detail_email.xml');
548        try {
549            $feed = new XML_Feed_Parser($content);
550        } catch (XML_Feed_Parser_Exception $e) {
551            $this->assertTrue(false);
552            return;
553        }
554        $this->assertEquals('me@example.com', $feed->author(0, 'email'));
555    }
556
557    function test_channel_managingEditor_map_author_detail_name_1 () {
558        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_managingEditor_map_author_detail_name.xml');
559        try {
560            $feed = new XML_Feed_Parser($content);
561        } catch (XML_Feed_Parser_Exception $e) {
562            $this->assertTrue(false);
563            return;
564        }
565        $this->assertEquals('Example editor', $feed->author(0, 'name'));
566    }
567
568    function test_channel_textInput_description_1 () {
569        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_description.xml');
570        try {
571            $feed = new XML_Feed_Parser($content);
572        } catch (XML_Feed_Parser_Exception $e) {
573            $this->assertTrue(false);
574            return;
575        }
576        $this->assertEquals('textInput description', $feed->textinput(0, 'description'));
577    }
578
579    function test_channel_textInput_description_conflict_1 () {
580        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_description_conflict.xml');
581        try {
582            $feed = new XML_Feed_Parser($content);
583        } catch (XML_Feed_Parser_Exception $e) {
584            $this->assertTrue(false);
585            return;
586        }
587        $this->assertEquals('Real description', $feed->description);
588    }
589
590    function test_channel_textInput_link_1 () {
591        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_link.xml');
592        try {
593            $feed = new XML_Feed_Parser($content);
594        } catch (XML_Feed_Parser_Exception $e) {
595            $this->assertTrue(false);
596            return;
597        }
598        $this->assertEquals('http://textinput.example.com/', $feed->textinput(0, 'link'));
599    }
600
601    function test_channel_textInput_link_conflict_1 () {
602        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_link_conflict.xml');
603        try {
604            $feed = new XML_Feed_Parser($content);
605        } catch (XML_Feed_Parser_Exception $e) {
606            $this->assertTrue(false);
607            return;
608        }
609        $this->assertEquals('http://channel.example.com/', $feed->link);
610    }
611
612    function test_channel_textInput_name_1 () {
613        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_name.xml');
614        try {
615            $feed = new XML_Feed_Parser($content);
616        } catch (XML_Feed_Parser_Exception $e) {
617            $this->assertTrue(false);
618            return;
619        }
620        $this->assertEquals('textinput name', $feed->textinput(0, 'name'));
621    }
622
623    function test_channel_textInput_title_1 () {
624        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_title.xml');
625        try {
626            $feed = new XML_Feed_Parser($content);
627        } catch (XML_Feed_Parser_Exception $e) {
628            $this->assertTrue(false);
629            return;
630        }
631        $this->assertEquals('textInput title', $feed->textinput(0, 'title'));
632    }
633
634    function test_channel_textInput_title_conflict_1 () {
635        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_textInput_title_conflict.xml');
636        try {
637            $feed = new XML_Feed_Parser($content);
638        } catch (XML_Feed_Parser_Exception $e) {
639            $this->assertTrue(false);
640            return;
641        }
642        $this->assertEquals('Real title', $feed->title);
643    }
644
645    function test_channel_title_1 () {
646        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_title.xml');
647        try {
648            $feed = new XML_Feed_Parser($content);
649        } catch (XML_Feed_Parser_Exception $e) {
650            $this->assertTrue(false);
651            return;
652        }
653        $this->assertEquals('Example feed', $feed->title);
654    }
655
656    function test_channel_title_apos_1 () {
657        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_title_apos.xml');
658        try {
659            $feed = new XML_Feed_Parser($content);
660        } catch (XML_Feed_Parser_Exception $e) {
661            $this->assertTrue(false);
662            return;
663        }
664        $this->assertEquals(u"Mark's title", $feed->title);
665    }
666
667    function test_channel_title_gt_1 () {
668        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_title_gt.xml');
669        try {
670            $feed = new XML_Feed_Parser($content);
671        } catch (XML_Feed_Parser_Exception $e) {
672            $this->assertTrue(false);
673            return;
674        }
675        $this->assertEquals('2 > 1', $feed->title);
676    }
677
678    function test_channel_title_lt_1 () {
679        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_title_lt.xml');
680        try {
681            $feed = new XML_Feed_Parser($content);
682        } catch (XML_Feed_Parser_Exception $e) {
683            $this->assertTrue(false);
684            return;
685        }
686        $this->assertEquals('1 < 2', $feed->title);
687    }
688
689    function test_channel_ttl_1 () {
690        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_ttl.xml');
691        try {
692            $feed = new XML_Feed_Parser($content);
693        } catch (XML_Feed_Parser_Exception $e) {
694            $this->assertTrue(false);
695            return;
696        }
697        $this->assertEquals('60', $feed->ttl);
698    }
699
700    function test_channel_webMaster_1 () {
701        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_webMaster.xml');
702        try {
703            $feed = new XML_Feed_Parser($content);
704        } catch (XML_Feed_Parser_Exception $e) {
705            $this->assertTrue(false);
706            return;
707        }
708        $this->assertEquals('Example editor', $feed->publisher);
709    }
710
711    function test_channel_webMaster_email_1 () {
712        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_webMaster_email.xml');
713        try {
714            $feed = new XML_Feed_Parser($content);
715        } catch (XML_Feed_Parser_Exception $e) {
716            $this->assertTrue(false);
717            return;
718        }
719        $this->assertEquals('me@example.com', $feed->publisher(0, 'email'));
720    }
721
722    function test_channel_webMaster_name_1 () {
723        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/channel_webMaster_name.xml');
724        try {
725            $feed = new XML_Feed_Parser($content);
726        } catch (XML_Feed_Parser_Exception $e) {
727            $this->assertTrue(false);
728            return;
729        }
730        $this->assertEquals('Example editor', $feed->publisher(0, 'name'));
731    }
732
733    function test_item_author_1 () {
734        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_author.xml');
735        try {
736            $feed = new XML_Feed_Parser($content);
737        } catch (XML_Feed_Parser_Exception $e) {
738            $this->assertTrue(false);
739            return;
740        }
741        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->author);
742    }
743
744    function test_item_author_map_author_detail_email_1 () {
745        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_author_map_author_detail_email.xml');
746        try {
747            $feed = new XML_Feed_Parser($content);
748        } catch (XML_Feed_Parser_Exception $e) {
749            $this->assertTrue(false);
750            return;
751        }
752        $this->assertEquals('me@example.com', $feed->getEntryByOffset(0)->author(0, 'email'));
753    }
754
755    function test_item_author_map_author_detail_name_1 () {
756        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_author_map_author_detail_name.xml');
757        try {
758            $feed = new XML_Feed_Parser($content);
759        } catch (XML_Feed_Parser_Exception $e) {
760            $this->assertTrue(false);
761            return;
762        }
763        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->author(0, 'name'));
764    }
765
766    function test_item_category_1 () {
767        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_category.xml');
768        try {
769            $feed = new XML_Feed_Parser($content);
770        } catch (XML_Feed_Parser_Exception $e) {
771            $this->assertTrue(false);
772            return;
773        }
774        $this->assertEquals('Example category', $feed->getEntryByOffset(0)->category);
775    }
776
777    function test_item_category_domain_1 () {
778        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_category_domain.xml');
779        try {
780            $feed = new XML_Feed_Parser($content);
781        } catch (XML_Feed_Parser_Exception $e) {
782            $this->assertTrue(false);
783            return;
784        }
785        $this->assertEquals('http://www.example.com/', $feed->getEntryByOffset(0)->categories[0][0]);
786    }
787
788    function test_item_category_multiple_1 () {
789        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_category_multiple.xml');
790        try {
791            $feed = new XML_Feed_Parser($content);
792        } catch (XML_Feed_Parser_Exception $e) {
793            $this->assertTrue(false);
794            return;
795        }
796        $this->assertEquals('http://www.example.com/2', $feed->getEntryByOffset(0)->categories[1][0]);
797    }
798
799    function test_item_category_multiple_2_1 () {
800        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_category_multiple_2.xml');
801        try {
802            $feed = new XML_Feed_Parser($content);
803        } catch (XML_Feed_Parser_Exception $e) {
804            $this->assertTrue(false);
805            return;
806        }
807        $this->assertEquals('Example category 2', $feed->getEntryByOffset(0)->categories[1][1]);
808    }
809
810    function test_item_comments_1 () {
811        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_comments.xml');
812        try {
813            $feed = new XML_Feed_Parser($content);
814        } catch (XML_Feed_Parser_Exception $e) {
815            $this->assertTrue(false);
816            return;
817        }
818        $this->assertEquals('http://example.com/', $feed->getEntryByOffset(0)->comments);
819    }
820
821    function test_item_content_encoded_1 () {
822        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_content_encoded.xml');
823        try {
824            $feed = new XML_Feed_Parser($content);
825        } catch (XML_Feed_Parser_Exception $e) {
826            $this->assertTrue(false);
827            return;
828        }
829        $this->assertEquals('<p>Example content</p>', $feed->getEntryByOffset(0)->content(0, 'value'));
830    }
831
832    function test_item_content_encoded_mode_0 () {
833        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_content_encoded_mode.xml');
834        try {
835            $feed = new XML_Feed_Parser($content);
836        } catch (XML_Feed_Parser_Exception $e) {
837            $this->assertTrue(false);
838            return;
839        }
840        $this->assertEquals(, 1);
841    }
842
843    function test_item_content_encoded_type_1 () {
844        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_content_encoded_type.xml');
845        try {
846            $feed = new XML_Feed_Parser($content);
847        } catch (XML_Feed_Parser_Exception $e) {
848            $this->assertTrue(false);
849            return;
850        }
851        $this->assertEquals('text/html', $feed->getEntryByOffset(0)->content(0, 'type'));
852    }
853
854    function test_item_dc_author_1 () {
855        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_author.xml');
856        try {
857            $feed = new XML_Feed_Parser($content);
858        } catch (XML_Feed_Parser_Exception $e) {
859            $this->assertTrue(false);
860            return;
861        }
862        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->author);
863    }
864
865    function test_item_dc_author_map_author_detail_email_1 () {
866        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_author_map_author_detail_email.xml');
867        try {
868            $feed = new XML_Feed_Parser($content);
869        } catch (XML_Feed_Parser_Exception $e) {
870            $this->assertTrue(false);
871            return;
872        }
873        $this->assertEquals('me@example.com', $feed->getEntryByOffset(0)->author(0, 'email'));
874    }
875
876    function test_item_dc_author_map_author_detail_name_1 () {
877        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_author_map_author_detail_name.xml');
878        try {
879            $feed = new XML_Feed_Parser($content);
880        } catch (XML_Feed_Parser_Exception $e) {
881            $this->assertTrue(false);
882            return;
883        }
884        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->author(0, 'name'));
885    }
886
887    function test_item_dc_contributor_1 () {
888        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_contributor.xml');
889        try {
890            $feed = new XML_Feed_Parser($content);
891        } catch (XML_Feed_Parser_Exception $e) {
892            $this->assertTrue(false);
893            return;
894        }
895        $this->assertEquals('Example contributor', $feed->getEntryByOffset(0)->contributors(0, 'name'));
896    }
897
898    function test_item_dc_creator_1 () {
899        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_creator.xml');
900        try {
901            $feed = new XML_Feed_Parser($content);
902        } catch (XML_Feed_Parser_Exception $e) {
903            $this->assertTrue(false);
904            return;
905        }
906        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->author);
907    }
908
909    function test_item_dc_creator_map_author_detail_email_1 () {
910        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_creator_map_author_detail_email.xml');
911        try {
912            $feed = new XML_Feed_Parser($content);
913        } catch (XML_Feed_Parser_Exception $e) {
914            $this->assertTrue(false);
915            return;
916        }
917        $this->assertEquals('me@example.com', $feed->getEntryByOffset(0)->author(0, 'email'));
918    }
919
920    function test_item_dc_creator_map_author_detail_name_1 () {
921        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_creator_map_author_detail_name.xml');
922        try {
923            $feed = new XML_Feed_Parser($content);
924        } catch (XML_Feed_Parser_Exception $e) {
925            $this->assertTrue(false);
926            return;
927        }
928        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->author(0, 'name'));
929    }
930
931    function test_item_dc_publisher_1 () {
932        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_publisher.xml');
933        try {
934            $feed = new XML_Feed_Parser($content);
935        } catch (XML_Feed_Parser_Exception $e) {
936            $this->assertTrue(false);
937            return;
938        }
939        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->publisher);
940    }
941
942    function test_item_dc_publisher_email_1 () {
943        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_publisher_email.xml');
944        try {
945            $feed = new XML_Feed_Parser($content);
946        } catch (XML_Feed_Parser_Exception $e) {
947            $this->assertTrue(false);
948            return;
949        }
950        $this->assertEquals('me@example.com', $feed->getEntryByOffset(0)->publisher(0, 'email'));
951    }
952
953    function test_item_dc_publisher_name_1 () {
954        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_publisher_name.xml');
955        try {
956            $feed = new XML_Feed_Parser($content);
957        } catch (XML_Feed_Parser_Exception $e) {
958            $this->assertTrue(false);
959            return;
960        }
961        $this->assertEquals('Example editor', $feed->getEntryByOffset(0)->publisher(0, 'name'));
962    }
963
964    function test_item_dc_rights_1 () {
965        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_rights.xml');
966        try {
967            $feed = new XML_Feed_Parser($content);
968        } catch (XML_Feed_Parser_Exception $e) {
969            $this->assertTrue(false);
970            return;
971        }
972        $this->assertEquals('Example copyright', $feed->getEntryByOffset(0)->copyright);
973    }
974
975    function test_item_dc_subject_1 () {
976        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_subject.xml');
977        try {
978            $feed = new XML_Feed_Parser($content);
979        } catch (XML_Feed_Parser_Exception $e) {
980            $this->assertTrue(false);
981            return;
982        }
983        $this->assertEquals('Example category', $feed->getEntryByOffset(0)->category);
984    }
985
986    function test_item_dc_subject_2_1 () {
987        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_subject_2.xml');
988        try {
989            $feed = new XML_Feed_Parser($content);
990        } catch (XML_Feed_Parser_Exception $e) {
991            $this->assertTrue(false);
992            return;
993        }
994        $this->assertEquals('Example category', $feed->getEntryByOffset(0)->categories[0][1]);
995    }
996
997    function test_item_dc_subject_multiple_1 () {
998        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_subject_multiple.xml');
999        try {
1000            $feed = new XML_Feed_Parser($content);
1001        } catch (XML_Feed_Parser_Exception $e) {
1002            $this->assertTrue(false);
1003            return;
1004        }
1005        $this->assertEquals('Example category 2', $feed->getEntryByOffset(0)->categories[1][1]);
1006    }
1007
1008    function test_item_dc_title_1 () {
1009        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_dc_title.xml');
1010        try {
1011            $feed = new XML_Feed_Parser($content);
1012        } catch (XML_Feed_Parser_Exception $e) {
1013            $this->assertTrue(false);
1014            return;
1015        }
1016        $this->assertEquals('Example title', $feed->getEntryByOffset(0)->title);
1017    }
1018
1019    function test_item_description_1 () {
1020        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description.xml');
1021        try {
1022            $feed = new XML_Feed_Parser($content);
1023        } catch (XML_Feed_Parser_Exception $e) {
1024            $this->assertTrue(false);
1025            return;
1026        }
1027        $this->assertEquals('Example description', $feed->getEntryByOffset(0)->description);
1028    }
1029
1030    function test_item_description_and_summary_1 () {
1031        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_and_summary.xml');
1032        try {
1033            $feed = new XML_Feed_Parser($content);
1034        } catch (XML_Feed_Parser_Exception $e) {
1035            $this->assertTrue(false);
1036            return;
1037        }
1038        $this->assertEquals('Example description', $feed->getEntryByOffset(0)->description);
1039    }
1040
1041    function test_item_description_and_summary_2 () {
1042        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_and_summary.xml');
1043        try {
1044            $feed = new XML_Feed_Parser($content);
1045        } catch (XML_Feed_Parser_Exception $e) {
1046            $this->assertTrue(false);
1047            return;
1048        }
1049        $this->assertEquals('Example summary', $feed->getEntryByOffset(0)->content(0, 'value'));
1050    }
1051
1052    function test_item_description_br_1 () {
1053        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_br.xml');
1054        try {
1055            $feed = new XML_Feed_Parser($content);
1056        } catch (XML_Feed_Parser_Exception $e) {
1057            $this->assertTrue(false);
1058            return;
1059        }
1060        $this->assertEquals('article title<br /><br /> article byline<br /><br />text of article', $feed->getEntryByOffset(0)->description);
1061    }
1062
1063    function test_item_description_escaped_markup_1 () {
1064        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_escaped_markup.xml');
1065        try {
1066            $feed = new XML_Feed_Parser($content);
1067        } catch (XML_Feed_Parser_Exception $e) {
1068            $this->assertTrue(false);
1069            return;
1070        }
1071        $this->assertEquals('<p>Example description</p>', $feed->getEntryByOffset(0)->description);
1072    }
1073
1074    function test_item_description_map_summary_1 () {
1075        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_map_summary.xml');
1076        try {
1077            $feed = new XML_Feed_Parser($content);
1078        } catch (XML_Feed_Parser_Exception $e) {
1079            $this->assertTrue(false);
1080            return;
1081        }
1082        $this->assertEquals('Example description', $feed->getEntryByOffset(0)->summary);
1083    }
1084
1085    function test_item_description_naked_markup_1 () {
1086        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_naked_markup.xml');
1087        try {
1088            $feed = new XML_Feed_Parser($content);
1089        } catch (XML_Feed_Parser_Exception $e) {
1090            $this->assertTrue(false);
1091            return;
1092        }
1093        $this->assertEquals('<p>Example description</p>', $feed->getEntryByOffset(0)->description);
1094    }
1095
1096    function test_item_description_not_a_doctype_1 () {
1097        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_description_not_a_doctype.xml');
1098        try {
1099            $feed = new XML_Feed_Parser($content);
1100        } catch (XML_Feed_Parser_Exception $e) {
1101            $this->assertTrue(false);
1102            return;
1103        }
1104        $this->assertEquals("""&lt;!' <a href="foo">""", $feed->getEntryByOffset(0)->description);
1105    }
1106
1107    function test_item_enclosure_length_1 () {
1108        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_enclosure_length.xml');
1109        try {
1110            $feed = new XML_Feed_Parser($content);
1111        } catch (XML_Feed_Parser_Exception $e) {
1112            $this->assertTrue(false);
1113            return;
1114        }
1115        $this->assertEquals('100000', $feed->getEntryByOffset(0)->enclosures(0, 'length'));
1116    }
1117
1118    function test_item_enclosure_multiple_1 () {
1119        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_enclosure_multiple.xml');
1120        try {
1121            $feed = new XML_Feed_Parser($content);
1122        } catch (XML_Feed_Parser_Exception $e) {
1123            $this->assertTrue(false);
1124            return;
1125        }
1126        $this->assertEquals(array('href' => 'http://example.com/2', 'length' => '200000', 'type' => 'image/gif'), $feed->getEntryByOffset(0)->enclosures[1]);
1127    }
1128
1129    function test_item_enclosure_type_1 () {
1130        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_enclosure_type.xml');
1131        try {
1132            $feed = new XML_Feed_Parser($content);
1133        } catch (XML_Feed_Parser_Exception $e) {
1134            $this->assertTrue(false);
1135            return;
1136        }
1137        $this->assertEquals('image/jpeg', $feed->getEntryByOffset(0)->enclosures(0, 'type'));
1138    }
1139
1140    function test_item_enclosure_url_1 () {
1141        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_enclosure_url.xml');
1142        try {
1143            $feed = new XML_Feed_Parser($content);
1144        } catch (XML_Feed_Parser_Exception $e) {
1145            $this->assertTrue(false);
1146            return;
1147        }
1148        $this->assertEquals('http://example.com/', $feed->getEntryByOffset(0)->enclosures(0, 'url'));
1149    }
1150
1151    function test_item_fullitem_1 () {
1152        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_fullitem.xml');
1153        try {
1154            $feed = new XML_Feed_Parser($content);
1155        } catch (XML_Feed_Parser_Exception $e) {
1156            $this->assertTrue(false);
1157            return;
1158        }
1159        $this->assertEquals('<p>Example content</p>', $feed->getEntryByOffset(0)->content(0, 'value'));
1160    }
1161
1162    function test_item_fullitem_mode_0 () {
1163        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_fullitem_mode.xml');
1164        try {
1165            $feed = new XML_Feed_Parser($content);
1166        } catch (XML_Feed_Parser_Exception $e) {
1167            $this->assertTrue(false);
1168            return;
1169        }
1170        $this->assertEquals(, 1);
1171    }
1172
1173    function test_item_fullitem_type_1 () {
1174        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_fullitem_type.xml');
1175        try {
1176            $feed = new XML_Feed_Parser($content);
1177        } catch (XML_Feed_Parser_Exception $e) {
1178            $this->assertTrue(false);
1179            return;
1180        }
1181        $this->assertEquals('text/html', $feed->getEntryByOffset(0)->content(0, 'type'));
1182    }
1183
1184    function test_item_guid_1 () {
1185        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid.xml');
1186        try {
1187            $feed = new XML_Feed_Parser($content);
1188        } catch (XML_Feed_Parser_Exception $e) {
1189            $this->assertTrue(false);
1190            return;
1191        }
1192        $this->assertEquals('http://guid.example.com/', $feed->getEntryByOffset(0)->guid);
1193    }
1194
1195    function test_item_guid_conflict_link_1 () {
1196        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_conflict_link.xml');
1197        try {
1198            $feed = new XML_Feed_Parser($content);
1199        } catch (XML_Feed_Parser_Exception $e) {
1200            $this->assertTrue(false);
1201            return;
1202        }
1203        $this->assertEquals('http://link.example.com/', $feed->getEntryByOffset(0)->link);
1204    }
1205
1206    function test_item_guid_guidislink_1 () {
1207        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_guidislink.xml');
1208        try {
1209            $feed = new XML_Feed_Parser($content);
1210        } catch (XML_Feed_Parser_Exception $e) {
1211            $this->assertTrue(false);
1212            return;
1213        }
1214        $this->assertEquals(, $feed->getEntryByOffset(0)->guidislink);
1215    }
1216
1217    function test_item_guid_isPermaLink_conflict_link_1 () {
1218        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_isPermaLink_conflict_link.xml');
1219        try {
1220            $feed = new XML_Feed_Parser($content);
1221        } catch (XML_Feed_Parser_Exception $e) {
1222            $this->assertTrue(false);
1223            return;
1224        }
1225        $this->assertEquals('http://link.example.com/', $feed->getEntryByOffset(0)->link);
1226    }
1227
1228    function test_item_guid_isPermaLink_conflict_link_not_guidislink_1 () {
1229        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_isPermaLink_conflict_link_not_guidislink.xml');
1230        try {
1231            $feed = new XML_Feed_Parser($content);
1232        } catch (XML_Feed_Parser_Exception $e) {
1233            $this->assertTrue(false);
1234            return;
1235        }
1236        $this->assertEquals(, ! $feed->getEntryByOffset(0)->guidislink);
1237    }
1238
1239    function test_item_guid_isPermaLink_guidislink_1 () {
1240        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_isPermaLink_guidislink.xml');
1241        try {
1242            $feed = new XML_Feed_Parser($content);
1243        } catch (XML_Feed_Parser_Exception $e) {
1244            $this->assertTrue(false);
1245            return;
1246        }
1247        $this->assertEquals(, $feed->getEntryByOffset(0)->guidislink);
1248    }
1249
1250    function test_item_guid_isPermaLink_map_link_1 () {
1251        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_isPermaLink_map_link.xml');
1252        try {
1253            $feed = new XML_Feed_Parser($content);
1254        } catch (XML_Feed_Parser_Exception $e) {
1255            $this->assertTrue(false);
1256            return;
1257        }
1258        $this->assertEquals('http://guid.example.com/', $feed->getEntryByOffset(0)->link);
1259    }
1260
1261    function test_item_guid_map_link_1 () {
1262        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_map_link.xml');
1263        try {
1264            $feed = new XML_Feed_Parser($content);
1265        } catch (XML_Feed_Parser_Exception $e) {
1266            $this->assertTrue(false);
1267            return;
1268        }
1269        $this->assertEquals('http://guid.example.com/', $feed->getEntryByOffset(0)->link);
1270    }
1271
1272    function test_item_guid_not_permalink_1 () {
1273        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_not_permalink.xml');
1274        try {
1275            $feed = new XML_Feed_Parser($content);
1276        } catch (XML_Feed_Parser_Exception $e) {
1277            $this->assertTrue(false);
1278            return;
1279        }
1280        $this->assertEquals(, ! $feed->getEntryByOffset(0).has_key(->));
1281    }
1282
1283    function test_item_guid_not_permalink_conflict_link_1 () {
1284        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_not_permalink_conflict_link.xml');
1285        try {
1286            $feed = new XML_Feed_Parser($content);
1287        } catch (XML_Feed_Parser_Exception $e) {
1288            $this->assertTrue(false);
1289            return;
1290        }
1291        $this->assertEquals('http://link.example.com/', $feed->getEntryByOffset(0)->link);
1292    }
1293
1294    function test_item_guid_not_permalink_not_guidislink_1 () {
1295        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_not_permalink_not_guidislink.xml');
1296        try {
1297            $feed = new XML_Feed_Parser($content);
1298        } catch (XML_Feed_Parser_Exception $e) {
1299            $this->assertTrue(false);
1300            return;
1301        }
1302        $this->assertEquals(, ! $feed->getEntryByOffset(0)->guidislink);
1303    }
1304
1305    function test_item_guid_not_permalink_not_guidislink_2_1 () {
1306        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_guid_not_permalink_not_guidislink_2.xml');
1307        try {
1308            $feed = new XML_Feed_Parser($content);
1309        } catch (XML_Feed_Parser_Exception $e) {
1310            $this->assertTrue(false);
1311            return;
1312        }
1313        $this->assertEquals(, ! $feed->getEntryByOffset(0)->guidislink);
1314    }
1315
1316    function test_item_link_1 () {
1317        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_link.xml');
1318        try {
1319            $feed = new XML_Feed_Parser($content);
1320        } catch (XML_Feed_Parser_Exception $e) {
1321            $this->assertTrue(false);
1322            return;
1323        }
1324        $this->assertEquals('http://example.com/', $feed->getEntryByOffset(0)->link);
1325    }
1326
1327    function test_item_source_0 () {
1328        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_source.xml');
1329        try {
1330            $feed = new XML_Feed_Parser($content);
1331        } catch (XML_Feed_Parser_Exception $e) {
1332            $this->assertTrue(false);
1333            return;
1334        }
1335        $this->assertEquals(, 1);
1336    }
1337
1338    function test_item_source_url_0 () {
1339        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_source_url.xml');
1340        try {
1341            $feed = new XML_Feed_Parser($content);
1342        } catch (XML_Feed_Parser_Exception $e) {
1343            $this->assertTrue(false);
1344            return;
1345        }
1346        $this->assertEquals(, 1);
1347    }
1348
1349    function test_item_summary_and_description_1 () {
1350        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_summary_and_description.xml');
1351        try {
1352            $feed = new XML_Feed_Parser($content);
1353        } catch (XML_Feed_Parser_Exception $e) {
1354            $this->assertTrue(false);
1355            return;
1356        }
1357        $this->assertEquals('Example summary', $feed->getEntryByOffset(0)->summary);
1358    }
1359
1360    function test_item_summary_and_description_2 () {
1361        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_summary_and_description.xml');
1362        try {
1363            $feed = new XML_Feed_Parser($content);
1364        } catch (XML_Feed_Parser_Exception $e) {
1365            $this->assertTrue(false);
1366            return;
1367        }
1368        $this->assertEquals('Example description', $feed->getEntryByOffset(0)->content(0, 'value'));
1369    }
1370
1371    function test_item_title_1 () {
1372        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_title.xml');
1373        try {
1374            $feed = new XML_Feed_Parser($content);
1375        } catch (XML_Feed_Parser_Exception $e) {
1376            $this->assertTrue(false);
1377            return;
1378        }
1379        $this->assertEquals('Item 1 title', $feed->getEntryByOffset(0)->title);
1380    }
1381
1382    function test_item_xhtml_body_1 () {
1383        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_xhtml_body.xml');
1384        try {
1385            $feed = new XML_Feed_Parser($content);
1386        } catch (XML_Feed_Parser_Exception $e) {
1387            $this->assertTrue(false);
1388            return;
1389        }
1390        $this->assertEquals('<p>Example content</p>', $feed->getEntryByOffset(0)->content(0, 'value'));
1391    }
1392
1393    function test_item_xhtml_body_mode_0 () {
1394        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_xhtml_body_mode.xml');
1395        try {
1396            $feed = new XML_Feed_Parser($content);
1397        } catch (XML_Feed_Parser_Exception $e) {
1398            $this->assertTrue(false);
1399            return;
1400        }
1401        $this->assertEquals(, 1);
1402    }
1403
1404    function test_item_xhtml_body_type_1 () {
1405        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/item_xhtml_body_type.xml');
1406        try {
1407            $feed = new XML_Feed_Parser($content);
1408        } catch (XML_Feed_Parser_Exception $e) {
1409            $this->assertTrue(false);
1410            return;
1411        }
1412        $this->assertEquals('application/xhtml+xml', $feed->getEntryByOffset(0)->content(0, 'type'));
1413    }
1414
1415    function test_rss_namespace_1_1 () {
1416        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_namespace_1.xml');
1417        try {
1418            $feed = new XML_Feed_Parser($content);
1419        } catch (XML_Feed_Parser_Exception $e) {
1420            $this->assertTrue(false);
1421            return;
1422        }
1423        $this->assertEquals('Example description', $feed->description);
1424    }
1425
1426    function test_rss_namespace_2_1 () {
1427        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_namespace_2.xml');
1428        try {
1429            $feed = new XML_Feed_Parser($content);
1430        } catch (XML_Feed_Parser_Exception $e) {
1431            $this->assertTrue(false);
1432            return;
1433        }
1434        $this->assertEquals('Example description', $feed->description);
1435    }
1436
1437    function test_rss_namespace_3_1 () {
1438        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_namespace_3.xml');
1439        try {
1440            $feed = new XML_Feed_Parser($content);
1441        } catch (XML_Feed_Parser_Exception $e) {
1442            $this->assertTrue(false);
1443            return;
1444        }
1445        $this->assertEquals('Example description', $feed->description);
1446    }
1447
1448    function test_rss_namespace_4_1 () {
1449        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_namespace_4.xml');
1450        try {
1451            $feed = new XML_Feed_Parser($content);
1452        } catch (XML_Feed_Parser_Exception $e) {
1453            $this->assertTrue(false);
1454            return;
1455        }
1456        $this->assertEquals('Example description', $feed->description);
1457    }
1458
1459    function test_rss_version_090_1 () {
1460        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_090.xml');
1461        try {
1462            $feed = new XML_Feed_Parser($content);
1463        } catch (XML_Feed_Parser_Exception $e) {
1464            $this->assertTrue(false);
1465            return;
1466        }
1467        $this->assertEquals('rss090', $feed->version());
1468    }
1469
1470    function test_rss_version_091_netscape_1 () {
1471        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_091_netscape.xml');
1472        try {
1473            $feed = new XML_Feed_Parser($content);
1474        } catch (XML_Feed_Parser_Exception $e) {
1475            $this->assertTrue(false);
1476            return;
1477        }
1478        $this->assertEquals('rss091n', $feed->version());
1479    }
1480
1481    function test_rss_version_091_userland_1 () {
1482        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_091_userland.xml');
1483        try {
1484            $feed = new XML_Feed_Parser($content);
1485        } catch (XML_Feed_Parser_Exception $e) {
1486            $this->assertTrue(false);
1487            return;
1488        }
1489        $this->assertEquals('rss091', $feed->version());
1490    }
1491
1492    function test_rss_version_092_1 () {
1493        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_092.xml');
1494        try {
1495            $feed = new XML_Feed_Parser($content);
1496        } catch (XML_Feed_Parser_Exception $e) {
1497            $this->assertTrue(false);
1498            return;
1499        }
1500        $this->assertEquals('rss092', $feed->version());
1501    }
1502
1503    function test_rss_version_093_1 () {
1504        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_093.xml');
1505        try {
1506            $feed = new XML_Feed_Parser($content);
1507        } catch (XML_Feed_Parser_Exception $e) {
1508            $this->assertTrue(false);
1509            return;
1510        }
1511        $this->assertEquals('rss093', $feed->version());
1512    }
1513
1514    function test_rss_version_094_1 () {
1515        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_094.xml');
1516        try {
1517            $feed = new XML_Feed_Parser($content);
1518        } catch (XML_Feed_Parser_Exception $e) {
1519            $this->assertTrue(false);
1520            return;
1521        }
1522        $this->assertEquals('rss094', $feed->version());
1523    }
1524
1525    function test_rss_version_20_1 () {
1526        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_20.xml');
1527        try {
1528            $feed = new XML_Feed_Parser($content);
1529        } catch (XML_Feed_Parser_Exception $e) {
1530            $this->assertTrue(false);
1531            return;
1532        }
1533        $this->assertEquals('rss20', $feed->version());
1534    }
1535
1536    function test_rss_version_201_1 () {
1537        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_201.xml');
1538        try {
1539            $feed = new XML_Feed_Parser($content);
1540        } catch (XML_Feed_Parser_Exception $e) {
1541            $this->assertTrue(false);
1542            return;
1543        }
1544        $this->assertEquals('rss20', $feed->version());
1545    }
1546
1547    function test_rss_version_21_1 () {
1548        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_21.xml');
1549        try {
1550            $feed = new XML_Feed_Parser($content);
1551        } catch (XML_Feed_Parser_Exception $e) {
1552            $this->assertTrue(false);
1553            return;
1554        }
1555        $this->assertEquals('rss20', $feed->version());
1556    }
1557
1558    function test_rss_version_missing_1 () {
1559        $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/rss/rss_version_missing.xml');
1560        try {
1561            $feed = new XML_Feed_Parser($content);
1562        } catch (XML_Feed_Parser_Exception $e) {
1563            $this->assertTrue(false);
1564            return;
1565        }
1566        $this->assertEquals('rss', $feed->version());
1567    }
1568}
1569
1570$suite = new PHPUnit_TestSuite('rss_TestCase');
1571$result = PHPUnit::run($suite, '123');
1572echo $result->toString();
1573
1574?>
Note: See TracBrowser for help on using the repository browser.