Changeset 48429 for trunk/tests/phpunit/tests/feed/atom.php
- Timestamp:
- 07/10/2020 10:21:22 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/feed/atom.php
r47198 r48429 206 206 } 207 207 } 208 209 /** 210 * @test 33591 211 */ 212 function test_atom_enclosure_with_extended_url_length_type_parsing() { 213 $enclosures = array( 214 array( 215 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\n318465\nvideo/mp4", // url length type 216 'expected' => array( 217 'href' => 'https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4', 218 'length' => 318465, 219 'type' => 'video/mp4', 220 ), 221 ), 222 array( 223 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\nvideo/mp4\n318465", // url type length 224 'expected' => array( 225 'href' => 'https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4', 226 'length' => 318465, 227 'type' => 'video/mp4', 228 ), 229 ), 230 array( 231 'actual' => "https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4\n318465", // url length 232 'expected' => array( 233 'href' => 'https://wordpress.dev/wp-content/uploads/2017/09/movie.mp4', 234 'length' => 318465, 235 'type' => '', 236 ), 237 ), 238 array( 239 'actual' => "https://wordpress.dev/wp-content/uploads/2017/01/audio.mp3\n\naudio/mpeg", // url type 240 'expected' => array( 241 'href' => 'https://wordpress.dev/wp-content/uploads/2017/01/audio.mp3', 242 'length' => 0, 243 'type' => 'audio/mpeg', 244 ), 245 ), 246 array( 247 'actual' => 'https://wordpress.dev/wp-content/uploads/2016/01/test.mp4', // url 248 'expected' => array( 249 'href' => 'https://wordpress.dev/wp-content/uploads/2016/01/test.mp4', 250 'length' => 0, 251 'type' => '', 252 ), 253 ), 254 ); 255 256 $post_id = end( self::$posts ); 257 foreach ( $enclosures as $enclosure ) { 258 add_post_meta( $post_id, 'enclosure', $enclosure['actual'] ); 259 } 260 $this->go_to( '/?feed=atom' ); 261 $feed = $this->do_atom(); 262 $xml = xml_to_array( $feed ); 263 $entries = xml_find( $xml, 'feed', 'entry' ); 264 $entries = array_slice( $entries, 0, 1 ); 265 266 foreach ( $entries as $key => $entry ) { 267 $links = xml_find( $entries[ $key ]['child'], 'link' ); 268 $i = 0; 269 foreach ( (array) $links as $link ) { 270 if ( 'enclosure' == $link['attributes']['rel'] ) { 271 $this->assertEquals( $enclosures[ $i ]['expected']['href'], $link['attributes']['href'] ); 272 $this->assertEquals( $enclosures[ $i ]['expected']['length'], $link['attributes']['length'] ); 273 $this->assertEquals( $enclosures[ $i ]['expected']['type'], $link['attributes']['type'] ); 274 $i++; 275 } 276 } 277 } 278 } 208 279 }
Note: See TracChangeset
for help on using the changeset viewer.