1 | <?php |
---|
2 | |
---|
3 | require_once 'XML_Feed_Parser_TestCase.php'; |
---|
4 | |
---|
5 | class cdf_TestCase extends XML_Feed_Parser_Converted_TestCase { |
---|
6 | |
---|
7 | function test_channel_abstract_map_description_1 () { |
---|
8 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/channel_abstract_map_description.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 description', $feed->description); |
---|
16 | } |
---|
17 | |
---|
18 | function test_channel_abstract_map_tagline_1 () { |
---|
19 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/channel_abstract_map_tagline.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('Example description', $feed->tagline); |
---|
27 | } |
---|
28 | |
---|
29 | function test_channel_href_map_link_1 () { |
---|
30 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/channel_href_map_link.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('http://www.example.org/', $feed->link); |
---|
38 | } |
---|
39 | |
---|
40 | function test_channel_href_map_links_1 () { |
---|
41 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/channel_href_map_links.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('http://www.example.org/', $feed->links(0, 'href')); |
---|
49 | } |
---|
50 | |
---|
51 | function test_channel_title_1 () { |
---|
52 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/channel_title.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 feed', $feed->title); |
---|
60 | } |
---|
61 | |
---|
62 | function test_item_abstract_map_description_1 () { |
---|
63 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/item_abstract_map_description.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 description', $feed->getEntryByOffset(0)->description); |
---|
71 | } |
---|
72 | |
---|
73 | function test_item_abstract_map_summary_1 () { |
---|
74 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/item_abstract_map_summary.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 description', $feed->getEntryByOffset(0)->summary); |
---|
82 | } |
---|
83 | |
---|
84 | function test_item_href_map_link_1 () { |
---|
85 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/item_href_map_link.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.org/', $feed->getEntryByOffset(0)->link); |
---|
93 | } |
---|
94 | |
---|
95 | function test_item_href_map_links_1 () { |
---|
96 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/item_href_map_links.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.org/', $feed->getEntryByOffset(0)->links(0, 'href')); |
---|
104 | } |
---|
105 | |
---|
106 | function test_item_title_1 () { |
---|
107 | $content = file_get_contents($this->fp_test_dir . DIRECTORY_SEPARATOR . 'wellformed/cdf/item_title.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 item', $feed->getEntryByOffset(0)->title); |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | $suite = new PHPUnit_TestSuite('cdf_TestCase'); |
---|
119 | $result = PHPUnit::run($suite, '123'); |
---|
120 | echo $result->toString(); |
---|
121 | |
---|
122 | ?> |
---|