124 | 124 | // Verify the channel is present and contains a title child element |
125 | 125 | $title = xml_find( $xml, 'rss', 'channel', 'title' ); |
126 | 126 | $this->assertEquals( get_option( 'blogname' ), $title[0]['content'] ); |
127 | 127 | |
128 | 128 | $desc = xml_find( $xml, 'rss', 'channel', 'description' ); |
129 | 129 | $this->assertEquals( get_option( 'blogdescription' ), $desc[0]['content'] ); |
130 | 130 | |
131 | 131 | $link = xml_find( $xml, 'rss', 'channel', 'link' ); |
132 | 132 | $this->assertEquals( get_option( 'siteurl' ), $link[0]['content'] ); |
133 | 133 | |
134 | 134 | $pubdate = xml_find( $xml, 'rss', 'channel', 'lastBuildDate' ); |
135 | 135 | $this->assertEquals( strtotime( get_lastpostmodified() ), strtotime( $pubdate[0]['content'] ) ); |
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
| 139 | * Test that translated feeds have a valid listed date. |
| 140 | * @group 39141 |
| 141 | */ |
| 142 | function test_channel_pubdate_element_translated() { |
| 143 | $original_locale = $GLOBALS['wp_locale']; |
| 144 | /* @var WP_Locale $locale */ |
| 145 | $locale = clone $GLOBALS['wp_locale']; |
| 146 | |
| 147 | $locale->weekday[2] = 'Tuesday_Translated'; |
| 148 | $locale->weekday_abbrev[ 'Tuesday_Translated' ] = 'Tue_Translated'; |
| 149 | |
| 150 | $GLOBALS['wp_locale'] = $locale; |
| 151 | |
| 152 | $this->go_to( '/?feed=rss2' ); |
| 153 | $feed = $this->do_rss2(); |
| 154 | |
| 155 | // Restore original locale. |
| 156 | $GLOBALS['wp_locale'] = $original_locale; |
| 157 | |
| 158 | $xml = xml_to_array( $feed ); |
| 159 | |
| 160 | // Verify the date is untranslated. |
| 161 | $pubdate = xml_find( $xml, 'rss', 'channel', 'lastBuildDate' ); |
| 162 | $this->assertNotContains( 'Tue_Translated', $pubdate[0]['content'] ); |
| 163 | } |
| 164 | |
| 165 | /** |
139 | 166 | * @ticket UT32 |
140 | 167 | */ |
141 | 168 | function test_item_elements() { |
142 | 169 | $this->go_to( '/?feed=rss2' ); |
143 | 170 | $feed = $this->do_rss2(); |
144 | 171 | $xml = xml_to_array( $feed ); |
145 | 172 | |
146 | 173 | // Get all the <item> child elements of the <channel> element |
147 | 174 | $items = xml_find( $xml, 'rss', 'channel', 'item' ); |
148 | 175 | |
149 | 176 | // Verify we are displaying the correct number of posts. |
150 | 177 | $this->assertCount( $this->post_count, $items ); |
151 | 178 | |
152 | 179 | // We Really only need to test X number of items unless the content is different |
153 | 180 | $items = array_slice( $items, 1 ); |