1 | <?php |
---|
2 | |
---|
3 | require_once 'XML_Feed_Parser_TestCase.php'; |
---|
4 | |
---|
5 | class XML_Feed_Parser_RSS2_valueValidity_TestCase extends XML_Feed_Parser_TestCase |
---|
6 | { |
---|
7 | function __construct($name) |
---|
8 | { |
---|
9 | $this->PHPUnit_TestCase($name); |
---|
10 | $sample_dir = XML_Feed_Parser_TestCase::getSampleDir(); |
---|
11 | $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "rss2sample.xml"); |
---|
12 | $this->feed = new XML_Feed_Parser($this->file); |
---|
13 | $this->entry = $this->feed->getEntryByOffset(2); |
---|
14 | } |
---|
15 | |
---|
16 | function test_feedNumberItems() |
---|
17 | { |
---|
18 | $value = 4; |
---|
19 | $this->assertEquals($value, $this->feed->numberEntries); |
---|
20 | } |
---|
21 | function test_feedTitle() |
---|
22 | { |
---|
23 | $value = "Liftoff News"; |
---|
24 | $this->assertEquals($value, $this->feed->title); |
---|
25 | } |
---|
26 | |
---|
27 | function test_feedLink() |
---|
28 | { |
---|
29 | $value = "http://liftoff.msfc.nasa.gov/"; |
---|
30 | $this->assertEquals($value, $this->feed->link); |
---|
31 | } |
---|
32 | |
---|
33 | function test_feedDescription() |
---|
34 | { |
---|
35 | $value = "Liftoff to Space Exploration."; |
---|
36 | $this->assertEquals($value, $this->feed->description); |
---|
37 | } |
---|
38 | |
---|
39 | function test_feedSubtitleEquivalence() |
---|
40 | { |
---|
41 | $value = "Liftoff to Space Exploration."; |
---|
42 | $this->assertEquals($value, $this->feed->subtitle); |
---|
43 | } |
---|
44 | |
---|
45 | function test_feedDate() |
---|
46 | { |
---|
47 | $value = strtotime("Tue, 10 Jun 2003 04:00:00 GMT"); |
---|
48 | $this->assertEquals($value, $this->feed->date); |
---|
49 | } |
---|
50 | |
---|
51 | function test_feedLastBuildDate() |
---|
52 | { |
---|
53 | $value = strtotime("Tue, 10 Jun 2003 09:41:01 GMT"); |
---|
54 | $this->assertEquals($value, $this->feed->lastBuildDate); |
---|
55 | } |
---|
56 | |
---|
57 | function test_feedUpdatedEquivalence() |
---|
58 | { |
---|
59 | $value = strtotime("Tue, 10 Jun 2003 09:41:01 GMT"); |
---|
60 | $this->assertEquals($value, $this->feed->updated); |
---|
61 | } |
---|
62 | |
---|
63 | function test_feedGenerator() |
---|
64 | { |
---|
65 | $value = 'Weblog Editor 2.0'; |
---|
66 | $this->assertEquals($value, $this->feed->generator); |
---|
67 | } |
---|
68 | |
---|
69 | function test_feedLanguage() |
---|
70 | { |
---|
71 | $value = "en-us"; |
---|
72 | $this->assertEquals($value, $this->feed->language); |
---|
73 | } |
---|
74 | |
---|
75 | function test_feedDocs() |
---|
76 | { |
---|
77 | $value = "http://blogs.law.harvard.edu/tech/rss"; |
---|
78 | $this->assertEquals($value, $this->feed->docs); |
---|
79 | } |
---|
80 | |
---|
81 | function test_feedManagingEditor() |
---|
82 | { |
---|
83 | $value = "editor@example.com"; |
---|
84 | $this->assertEquals($value, $this->feed->managingEditor); |
---|
85 | } |
---|
86 | |
---|
87 | function test_feedAuthorEquivalence() |
---|
88 | { |
---|
89 | $value = "editor@example.com"; |
---|
90 | $this->assertEquals($value, $this->feed->author); |
---|
91 | } |
---|
92 | |
---|
93 | function test_feedWebmaster() |
---|
94 | { |
---|
95 | $value = "webmaster@example.com"; |
---|
96 | $this->assertEquals($value, $this->feed->webMaster); |
---|
97 | } |
---|
98 | |
---|
99 | function test_entryTitle() |
---|
100 | { |
---|
101 | $value = "The Engine That Does More"; |
---|
102 | $this->assertEquals($value, $this->entry->title); |
---|
103 | } |
---|
104 | |
---|
105 | function test_entryLink() |
---|
106 | { |
---|
107 | $value = "http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp"; |
---|
108 | $this->assertEquals($value, $this->entry->link); |
---|
109 | } |
---|
110 | |
---|
111 | function test_entryDescription() |
---|
112 | { |
---|
113 | $value = "Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that."; |
---|
114 | $this->assertEquals($value, $this->entry->description); |
---|
115 | } |
---|
116 | |
---|
117 | function test_entryPubDate() |
---|
118 | { |
---|
119 | $value = strtotime("Tue, 27 May 2003 08:37:32 GMT"); |
---|
120 | $this->assertEquals($value, $this->entry->pubDate); |
---|
121 | } |
---|
122 | |
---|
123 | function test_entryGuid() |
---|
124 | { |
---|
125 | $value = "http://liftoff.msfc.nasa.gov/2003/05/27.html#item571"; |
---|
126 | $this->assertEquals($value, $this->entry->guid); |
---|
127 | } |
---|
128 | |
---|
129 | function test_entryIdEquivalence() |
---|
130 | { |
---|
131 | $value = "http://liftoff.msfc.nasa.gov/2003/05/27.html#item571"; |
---|
132 | $this->assertEquals($value, $this->entry->id); |
---|
133 | } |
---|
134 | |
---|
135 | function test_entryContent() |
---|
136 | { |
---|
137 | $value = "<p>Test content</p>"; |
---|
138 | $this->assertEquals($value, $this->entry->content); |
---|
139 | } |
---|
140 | } |
---|
141 | |
---|
142 | $suite = new PHPUnit_TestSuite; |
---|
143 | $suite->addTestSuite("XML_Feed_Parser_RSS2_valueValidity_TestCase"); |
---|
144 | $result = PHPUnit::run($suite, "123"); |
---|
145 | echo $result->toString(); |
---|
146 | |
---|
147 | ?> |
---|