1 | <?php |
---|
2 | |
---|
3 | require_once 'XML_Feed_Parser_TestCase.php'; |
---|
4 | |
---|
5 | /** |
---|
6 | * This test is to make sure that we get sane values back for all |
---|
7 | * elements specified by the atom specification. It is okay for a feed |
---|
8 | * to not have some of these, but if they're not present we should |
---|
9 | * get a null or false return rather than an error. This test begins |
---|
10 | * to ensure consistency of our API. |
---|
11 | */ |
---|
12 | class XML_Feed_Parser_AccessTypes1_TestCase extends XML_Feed_Parser_TestCase |
---|
13 | { |
---|
14 | function __construct($name) |
---|
15 | { |
---|
16 | $this->PHPUnit_TestCase($name); |
---|
17 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
18 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'atom10-example1.xml'); |
---|
19 | $this->feed = new XML_Feed_Parser($this->file); |
---|
20 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
21 | } |
---|
22 | |
---|
23 | function setUp() { |
---|
24 | } |
---|
25 | |
---|
26 | function tearDown() { |
---|
27 | } |
---|
28 | |
---|
29 | function test_feedAuthor() { |
---|
30 | $this->assertEquals($this->feed->author, $this->feed->author()); |
---|
31 | } |
---|
32 | |
---|
33 | function test_feedIcon() { |
---|
34 | $this->assertEquals($this->feed->icon, $this->feed->icon()); |
---|
35 | } |
---|
36 | |
---|
37 | function test_feedId() { |
---|
38 | $this->assertEquals($this->feed->id, $this->feed->id()); |
---|
39 | } |
---|
40 | |
---|
41 | function test_feedRights() { |
---|
42 | $this->assertEquals($this->feed->rights, $this->feed->rights()); |
---|
43 | } |
---|
44 | |
---|
45 | function test_feedTitle() { |
---|
46 | $this->assertEquals($this->feed->title, $this->feed->title()); |
---|
47 | } |
---|
48 | |
---|
49 | function test_feedSubtitle() { |
---|
50 | $this->assertEquals($this->feed->subtitle, $this->feed->subtitle()); |
---|
51 | } |
---|
52 | |
---|
53 | function test_feedUpdated() { |
---|
54 | $this->assertEquals($this->feed->updated, $this->feed->updated()); |
---|
55 | } |
---|
56 | |
---|
57 | function test_feedLink() { |
---|
58 | $this->assertEquals($this->feed->link, $this->feed->link()); |
---|
59 | } |
---|
60 | |
---|
61 | function test_entryAuthor() { |
---|
62 | $this->assertEquals($this->entry->author, $this->entry->author()); |
---|
63 | } |
---|
64 | |
---|
65 | function test_entryId() { |
---|
66 | $this->assertEquals($this->entry->id, $this->entry->id()); |
---|
67 | } |
---|
68 | |
---|
69 | function test_entryPublished() { |
---|
70 | $this->assertEquals($this->entry->published, $this->entry->published()); |
---|
71 | } |
---|
72 | |
---|
73 | function testEntryTitle() { |
---|
74 | $this->assertEquals($this->entry->title, $this->entry->title()); |
---|
75 | } |
---|
76 | |
---|
77 | function testEntryRights() { |
---|
78 | $this->assertEquals($this->entry->rights, $this->entry->rights()); |
---|
79 | } |
---|
80 | |
---|
81 | function testEntrySummary() { |
---|
82 | $this->assertEquals($this->entry->summary, $this->entry->summary()); |
---|
83 | } |
---|
84 | |
---|
85 | function testEntryContent() { |
---|
86 | $this->assertEquals($this->entry->content, $this->entry->content()); |
---|
87 | } |
---|
88 | |
---|
89 | function testEntryLink() { |
---|
90 | $this->assertEquals($this->entry->link, $this->entry->link()); |
---|
91 | } |
---|
92 | } |
---|
93 | |
---|
94 | class XML_Feed_Parser_AccessTypes2_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
95 | { |
---|
96 | function __construct($name) |
---|
97 | { |
---|
98 | $this->PHPUnit_TestCase($name); |
---|
99 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
100 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'atom10-example2.xml'); |
---|
101 | $this->feed = new XML_Feed_Parser($this->file); |
---|
102 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
103 | } |
---|
104 | } |
---|
105 | |
---|
106 | class XML_Feed_Parser_AccessTypes3_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
107 | { |
---|
108 | function __construct($name) |
---|
109 | { |
---|
110 | $this->PHPUnit_TestCase($name); |
---|
111 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
112 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'rss10-example1.xml'); |
---|
113 | $this->feed = new XML_Feed_Parser($this->file); |
---|
114 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
115 | } |
---|
116 | } |
---|
117 | |
---|
118 | class XML_Feed_Parser_AccessTypes4_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
119 | { |
---|
120 | function __construct($name) |
---|
121 | { |
---|
122 | $this->PHPUnit_TestCase($name); |
---|
123 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
124 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'rss10-example2.xml'); |
---|
125 | $this->feed = new XML_Feed_Parser($this->file); |
---|
126 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
127 | } |
---|
128 | } |
---|
129 | |
---|
130 | class XML_Feed_Parser_AccessTypes5_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
131 | { |
---|
132 | function __construct($name) |
---|
133 | { |
---|
134 | $this->PHPUnit_TestCase($name); |
---|
135 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
136 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'rss2sample.xml'); |
---|
137 | $this->feed = new XML_Feed_Parser($this->file); |
---|
138 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
139 | } |
---|
140 | } |
---|
141 | |
---|
142 | class XML_Feed_Parser_AccessTypes6_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
143 | { |
---|
144 | function __construct($name) |
---|
145 | { |
---|
146 | $this->PHPUnit_TestCase($name); |
---|
147 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
148 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'delicious.feed'); |
---|
149 | $this->feed = new XML_Feed_Parser($this->file); |
---|
150 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
151 | } |
---|
152 | } |
---|
153 | |
---|
154 | class XML_Feed_Parser_AccessTypes7_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
155 | { |
---|
156 | function __construct($name) |
---|
157 | { |
---|
158 | $this->PHPUnit_TestCase($name); |
---|
159 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
160 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'technorati.feed'); |
---|
161 | $this->feed = new XML_Feed_Parser($this->file); |
---|
162 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
163 | } |
---|
164 | } |
---|
165 | |
---|
166 | class XML_Feed_Parser_AccessTypes8_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase |
---|
167 | { |
---|
168 | function __construct($name) |
---|
169 | { |
---|
170 | $this->PHPUnit_TestCase($name); |
---|
171 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
172 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'grwifi-atom.xml'); |
---|
173 | $this->feed = new XML_Feed_Parser($this->file); |
---|
174 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
175 | } |
---|
176 | } |
---|
177 | |
---|
178 | $suite = new PHPUnit_TestSuite; |
---|
179 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes1_TestCase'); |
---|
180 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes2_TestCase'); |
---|
181 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes3_TestCase'); |
---|
182 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes4_TestCase'); |
---|
183 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes5_TestCase'); |
---|
184 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes6_TestCase'); |
---|
185 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes7_TestCase'); |
---|
186 | $suite->addTestSuite('XML_Feed_Parser_AccessTypes8_TestCase'); |
---|
187 | $result = PHPUnit::run($suite, '123'); |
---|
188 | echo $result->toString(); |
---|
189 | ?> |
---|