| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
require_once 'XML_Feed_Parser_TestCase.php';
|
|
|
4 |
|
|
|
5 |
class rss1Values extends XML_Feed_Parser_TestCase
|
|
|
6 |
{
|
|
|
7 |
function setUp()
|
|
|
8 |
{
|
|
|
9 |
$sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
|
|
|
10 |
$this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "rss10-example2.xml");
|
|
|
11 |
$this->feed = new XML_Feed_Parser($this->file);
|
|
|
12 |
$this->entry = $this->feed->getEntryByOffset(0);
|
|
|
13 |
}
|
|
|
14 |
|
|
|
15 |
function test_feedNumberItems()
|
|
|
16 |
{
|
|
|
17 |
$value = 1;
|
|
|
18 |
$this->assertEquals($value, $this->feed->numberEntries);
|
|
|
19 |
}
|
|
|
20 |
function test_feedTitle()
|
|
|
21 |
{
|
|
|
22 |
$value = "Meerkat";
|
|
|
23 |
$this->assertEquals($value, $this->feed->title);
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
function test_feedLink()
|
|
|
27 |
{
|
|
|
28 |
$value = "http://meerkat.oreillynet.com";
|
|
|
29 |
$this->assertEquals($value, $this->feed->link);
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
function test_feedDescription()
|
|
|
33 |
{
|
|
|
34 |
$value = "Meerkat: An Open Wire Service";
|
|
|
35 |
$this->assertEquals($value, $this->feed->description);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
function test_feedSubtitleEquivalence()
|
|
|
39 |
{
|
|
|
40 |
$value = "Meerkat: An Open Wire Service";
|
|
|
41 |
$this->assertEquals($value, $this->feed->subtitle);
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
function test_feedPublisher()
|
|
|
45 |
{
|
|
|
46 |
$value = "The O'Reilly Network";
|
|
|
47 |
$this->assertEquals($value, $this->feed->publisher);
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
function test_feedCreator()
|
|
|
51 |
{
|
|
|
52 |
$value = "Rael Dornfest (mailto:rael@oreilly.com)";
|
|
|
53 |
$this->assertEquals($value, $this->feed->creator);
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
function test_feedAuthorEquivalence()
|
|
|
57 |
{
|
|
|
58 |
$value = "Rael Dornfest (mailto:rael@oreilly.com)";
|
|
|
59 |
$this->assertEquals($value, $this->feed->author);
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
function test_feedRights()
|
|
|
63 |
{
|
|
|
64 |
$value = "Copyright © 2000 O'Reilly & Associates, Inc.";
|
|
|
65 |
$this->assertEquals($value, htmlentities(utf8_decode($this->feed->rights)));
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
function test_feedDate()
|
|
|
69 |
{
|
|
|
70 |
$value = strtotime("2000-01-01T12:00+00:00");
|
|
|
71 |
$this->assertEquals($value, $this->feed->date);
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
function test_feedUpdatedEquivalence()
|
|
|
75 |
{
|
|
|
76 |
$value = strtotime("2000-01-01T12:00+00:00");
|
|
|
77 |
$this->assertEquals($value, $this->feed->updated);
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
function test_feedUpdatePeriod()
|
|
|
81 |
{
|
|
|
82 |
$value = 'hourly';
|
|
|
83 |
$this->assertEquals($value, $this->feed->updatePeriod);
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
function test_feedUpdateFrequency()
|
|
|
87 |
{
|
|
|
88 |
$value = "2";
|
|
|
89 |
$this->assertEquals($value, $this->feed->updateFrequency);
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
function test_feedUpdateBase()
|
|
|
93 |
{
|
|
|
94 |
$value = strtotime("2000-01-01T12:00+00:00");
|
|
|
95 |
$this->assertEquals($value, $this->feed->updateBase);
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
function test_feedImage()
|
|
|
99 |
{
|
|
|
100 |
$value = array(
|
|
|
101 |
'title' => false,
|
|
|
102 |
'link' => false,
|
|
|
103 |
'url' => "http://meerkat.oreillynet.com/icons/meerkat-powered.jpg",
|
|
|
104 |
'description' => false,
|
|
|
105 |
'height' => false,
|
|
|
106 |
'width' => false);
|
|
|
107 |
$this->assertEquals($value, $this->feed->image);
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
function test_entryTitle()
|
|
|
111 |
{
|
|
|
112 |
$value = "XML: A Disruptive Technology";
|
|
|
113 |
$this->assertEquals($value, $this->entry->title);
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
function test_entryLink()
|
|
|
117 |
{
|
|
|
118 |
$value = "http://c.moreover.com/click/here.pl?r123";
|
|
|
119 |
$this->assertEquals($value, $this->entry->link);
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
function test_entryDescription()
|
|
|
123 |
{
|
|
|
124 |
$value = "XML is placing increasingly heavy loads on the existing technical infrastructure of the Internet.";
|
|
|
125 |
$description = trim($this->entry->description);
|
|
|
126 |
$description = preg_replace("/\t/", " ", $description);
|
|
|
127 |
$description = preg_replace("/(\s\s)+/", " ", $description);
|
|
|
128 |
$description = preg_replace("/(\s\s)+/", " ", $description);
|
|
|
129 |
$this->assertEquals($value, $description);
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
function test_entryRights()
|
|
|
133 |
{
|
|
|
134 |
$value = "Copyright © 2000 O'Reilly & Associates, Inc.";
|
|
|
135 |
$this->assertEquals($value, htmlentities(utf8_decode($this->feed->rights)));
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
function test_entryCreator()
|
|
|
139 |
{
|
|
|
140 |
$value = "Simon St.Laurent (mailto:simonstl@simonstl.com)";
|
|
|
141 |
$this->assertEquals($value, $this->entry->creator);
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
function test_entryAuthorEquivalence()
|
|
|
145 |
{
|
|
|
146 |
$value = "Simon St.Laurent (mailto:simonstl@simonstl.com)";
|
|
|
147 |
$this->assertEquals($value, $this->entry->author);
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
function test_entryPublisher()
|
|
|
151 |
{
|
|
|
152 |
$value = "The O'Reilly Network";
|
|
|
153 |
$this->assertEquals($value, $this->entry->publisher);
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
function test_entryCategory()
|
|
|
157 |
{
|
|
|
158 |
$value = "XML";
|
|
|
159 |
$this->assertEquals($value, $this->entry->category);
|
|
|
160 |
}
|
|
|
161 |
|
|
|
162 |
function test_entryIdEquivalence()
|
|
|
163 |
{
|
|
|
164 |
$value = "http://c.moreover.com/click/here.pl?r123";
|
|
|
165 |
$this->assertEquals($value, $this->entry->id);
|
|
|
166 |
}
|
|
|
167 |
|
|
|
168 |
function test_feedTextInput()
|
|
|
169 |
{
|
|
|
170 |
$value = array(
|
|
|
171 |
'title' => null,
|
|
|
172 |
'description' => null,
|
|
|
173 |
'name' => null,
|
|
|
174 |
'link' => "http://meerkat.oreillynet.com");
|
|
|
175 |
$this->assertEquals($value, $this->feed->textinput);
|
|
|
176 |
}
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
?>
|