1 | <?php |
---|
2 | |
---|
3 | require_once 'XML_Feed_Parser_TestCase.php'; |
---|
4 | |
---|
5 | class XML_Feed_Parser_RSS091_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 . "rss091-complete.xml"); |
---|
12 | $this->feed = new XML_Feed_Parser($this->file, false, true); |
---|
13 | $this->entry = $this->feed->getEntryByOffset(0); |
---|
14 | } |
---|
15 | |
---|
16 | function test_feedRights() |
---|
17 | { |
---|
18 | $value = "Copyright 1997-1999 UserLand Software, Inc."; |
---|
19 | $this->assertEquals($value, $this->feed->rights); |
---|
20 | $this->assertEquals($value, $this->feed->copyright); |
---|
21 | } |
---|
22 | |
---|
23 | function test_feedNumberItems() |
---|
24 | { |
---|
25 | $value = 1; |
---|
26 | $this->assertEquals($value, $this->feed->numberEntries); |
---|
27 | } |
---|
28 | |
---|
29 | function test_feedTitle() |
---|
30 | { |
---|
31 | $value = "Scripting News"; |
---|
32 | $this->assertEquals($value, $this->feed->title); |
---|
33 | } |
---|
34 | |
---|
35 | function test_feedLink() |
---|
36 | { |
---|
37 | $value = "http://www.scripting.com/"; |
---|
38 | $this->assertEquals($value, $this->feed->link); |
---|
39 | } |
---|
40 | |
---|
41 | function test_feedImage() |
---|
42 | { |
---|
43 | $value = array( |
---|
44 | "title" => "Scripting News", |
---|
45 | "link" => "http://www.scripting.com/", |
---|
46 | "url" => "http://www.scripting.com/gifs/tinyScriptingNews.gif", |
---|
47 | "description" => "What is this used for?", |
---|
48 | 'height' => "40", |
---|
49 | 'width' => "78"); |
---|
50 | $this->assertEquals($value, $this->feed->image); |
---|
51 | } |
---|
52 | |
---|
53 | function test_feedDescription() |
---|
54 | { |
---|
55 | $value = "News and commentary from the cross-platform scripting community."; |
---|
56 | $this->assertEquals($value, $this->feed->description); |
---|
57 | } |
---|
58 | |
---|
59 | function test_feedSubtitleEquivalence() |
---|
60 | { |
---|
61 | $value = "News and commentary from the cross-platform scripting community."; |
---|
62 | $this->assertEquals($value, $this->feed->subtitle); |
---|
63 | } |
---|
64 | |
---|
65 | function test_feedDate() |
---|
66 | { |
---|
67 | $value = strtotime("Thu, 08 Jul 1999 07:00:00 GMT"); |
---|
68 | $this->assertEquals($value, $this->feed->date); |
---|
69 | } |
---|
70 | |
---|
71 | function test_feedLastBuildDate() |
---|
72 | { |
---|
73 | $value = strtotime("Thu, 08 Jul 1999 16:20:26 GMT"); |
---|
74 | $this->assertEquals($value, $this->feed->lastBuildDate); |
---|
75 | } |
---|
76 | |
---|
77 | function test_feedUpdatedEquivalence() |
---|
78 | { |
---|
79 | $value = strtotime("Thu, 08 Jul 1999 16:20:26 GMT"); |
---|
80 | $this->assertEquals($value, $this->feed->updated); |
---|
81 | } |
---|
82 | |
---|
83 | function test_feedLanguage() |
---|
84 | { |
---|
85 | $value = "en-us"; |
---|
86 | $this->assertEquals($value, $this->feed->language); |
---|
87 | } |
---|
88 | |
---|
89 | function test_feedSkipHours() |
---|
90 | { |
---|
91 | $value = array("6", "7", "8", "9", "10", "11"); |
---|
92 | $this->assertEquals($value, $this->feed->skipHours); |
---|
93 | } |
---|
94 | |
---|
95 | function test_feedSkipDays() |
---|
96 | { |
---|
97 | $value = array("Sunday"); |
---|
98 | $this->assertEquals($value, $this->feed->skipDays); |
---|
99 | } |
---|
100 | |
---|
101 | function test_feedDocs() |
---|
102 | { |
---|
103 | $value = "http://my.userland.com/stories/storyReader$11"; |
---|
104 | $this->assertEquals($value, $this->feed->docs); |
---|
105 | } |
---|
106 | |
---|
107 | function test_feedManagingEditor() |
---|
108 | { |
---|
109 | $value = "dave@userland.com (Dave Winer)"; |
---|
110 | $this->assertEquals($value, $this->feed->managingEditor); |
---|
111 | } |
---|
112 | |
---|
113 | function test_feedAuthorEquivalence() |
---|
114 | { |
---|
115 | $value = "dave@userland.com (Dave Winer)"; |
---|
116 | $this->assertEquals($value, $this->feed->author); |
---|
117 | } |
---|
118 | |
---|
119 | function test_feedWebmaster() |
---|
120 | { |
---|
121 | $value = "dave@userland.com (Dave Winer)"; |
---|
122 | $this->assertEquals($value, $this->feed->webMaster); |
---|
123 | } |
---|
124 | |
---|
125 | function test_entryTitle() |
---|
126 | { |
---|
127 | $value = "stuff"; |
---|
128 | $this->assertEquals($value, $this->entry->title); |
---|
129 | } |
---|
130 | |
---|
131 | function test_entryLink() |
---|
132 | { |
---|
133 | $value = "http://bar"; |
---|
134 | $this->assertEquals($value, $this->entry->link); |
---|
135 | } |
---|
136 | |
---|
137 | function test_entryDescription() |
---|
138 | { |
---|
139 | $value = "This is an article about some stuff"; |
---|
140 | $this->assertEquals($value, $this->entry->description); |
---|
141 | } |
---|
142 | } |
---|
143 | |
---|
144 | $suite = new PHPUnit_TestSuite; |
---|
145 | $suite->addTestSuite("XML_Feed_Parser_RSS091_valueValidity_TestCase"); |
---|
146 | $result = PHPUnit::run($suite, "123"); |
---|
147 | echo $result->toString(); |
---|
148 | |
---|
149 | ?> |
---|