@@ -143,7 +143,52 @@ public function testAsXML()
143
143
<description> {$ data ['description ' ]}</description>
144
144
<category> {$ data ['categories ' ][0 ][0 ]}</category>
145
145
<category domain= \"{$ data ['categories ' ][1 ][1 ]}\"> {$ data ['categories ' ][1 ][0 ]}</category>
146
- <guid isPermaLink= \"true \"> {$ data ['guid ' ]}</guid>
146
+ <guid> {$ data ['guid ' ]}</guid>
147
+ <pubDate> {$ nowString }</pubDate>
148
+ <enclosure url= \"{$ data ['enclosure ' ]['url ' ]}\" type= \"{$ data ['enclosure ' ]['type ' ]}\" length= \"{$ data ['enclosure ' ]['length ' ]}\"/>
149
+ <author> {$ data ['author ' ]}</author>
150
+ </item>
151
+ " ;
152
+ $ this ->assertXmlStringEqualsXmlString ($ expect , $ item ->asXML ()->asXML ());
153
+ }
154
+
155
+ public function testAsXML_false_permalink ()
156
+ {
157
+ $ now = time ();
158
+ $ nowString = date (DATE_RSS , $ now );
159
+
160
+ $ data = array (
161
+ 'title ' => "Venice Film Festival Tries to Quit Sinking " ,
162
+ 'url ' => 'http://nytimes.com/2004/12/07FEST.html ' ,
163
+ 'description ' => "Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged. " ,
164
+ 'categories ' => array (
165
+ array ("Grateful Dead " , null ),
166
+ array ("MSFT " , 'http://www.fool.com/cusips ' ),
167
+ ),
168
+ 'guid ' => "http://inessential.com/2002/09/01.php#a2 " ,
169
+ 'isPermalink ' => false ,
170
+ 'pubDate ' => $ now ,
171
+ 'enclosure ' => array (
172
+ 'url ' => 'http://link-to-audio-file.com/test.mp3 ' ,
173
+ 'length ' => 4992 ,
174
+ 'type ' => 'audio/mpeg ' ),
175
+ 'author ' => 'Hidehito Nozawa aka Suin '
176
+ );
177
+
178
+ $ item = new Item ();
179
+
180
+ foreach ($ data as $ key => $ value ) {
181
+ $ this ->reveal ($ item )->attr ($ key , $ value );
182
+ }
183
+
184
+ $ expect = "
185
+ <item>
186
+ <title> {$ data ['title ' ]}</title>
187
+ <link> {$ data ['url ' ]}</link>
188
+ <description> {$ data ['description ' ]}</description>
189
+ <category> {$ data ['categories ' ][0 ][0 ]}</category>
190
+ <category domain= \"{$ data ['categories ' ][1 ][1 ]}\"> {$ data ['categories ' ][1 ][0 ]}</category>
191
+ <guid isPermaLink= \"false \"> {$ data ['guid ' ]}</guid>
147
192
<pubDate> {$ nowString }</pubDate>
148
193
<enclosure url= \"{$ data ['enclosure ' ]['url ' ]}\" type= \"{$ data ['enclosure ' ]['type ' ]}\" length= \"{$ data ['enclosure ' ]['length ' ]}\"/>
149
194
<author> {$ data ['author ' ]}</author>
0 commit comments