Changeset 48937 for trunk/tests/phpunit/tests/feed/rss2.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/feed/rss2.php
r47198 r48937 107 107 108 108 // There should only be one <rss> child element. 109 $this->assert Equals( 1, count( $rss ) );110 111 $this->assert Equals( '2.0', $rss[0]['attributes']['version'] );112 $this->assert Equals( 'http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content'] );113 $this->assert Equals( 'http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw'] );114 $this->assert Equals( 'http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc'] );109 $this->assertSame( 1, count( $rss ) ); 110 111 $this->assertSame( '2.0', $rss[0]['attributes']['version'] ); 112 $this->assertSame( 'http://purl.org/rss/1.0/modules/content/', $rss[0]['attributes']['xmlns:content'] ); 113 $this->assertSame( 'http://wellformedweb.org/CommentAPI/', $rss[0]['attributes']['xmlns:wfw'] ); 114 $this->assertSame( 'http://purl.org/dc/elements/1.1/', $rss[0]['attributes']['xmlns:dc'] ); 115 115 116 116 // RSS should have exactly one child element (channel). 117 $this->assert Equals( 1, count( $rss[0]['child'] ) );117 $this->assertSame( 1, count( $rss[0]['child'] ) ); 118 118 } 119 119 … … 136 136 // Verify the channel is present and contains a title child element. 137 137 $title = xml_find( $xml, 'rss', 'channel', 'title' ); 138 $this->assert Equals( get_option( 'blogname' ), $title[0]['content'] );138 $this->assertSame( get_option( 'blogname' ), $title[0]['content'] ); 139 139 140 140 $desc = xml_find( $xml, 'rss', 'channel', 'description' ); 141 $this->assert Equals( get_option( 'blogdescription' ), $desc[0]['content'] );141 $this->assertSame( get_option( 'blogdescription' ), $desc[0]['content'] ); 142 142 143 143 $link = xml_find( $xml, 'rss', 'channel', 'link' ); 144 $this->assert Equals( get_option( 'siteurl' ), $link[0]['content'] );144 $this->assertSame( get_option( 'siteurl' ), $link[0]['content'] ); 145 145 146 146 $pubdate = xml_find( $xml, 'rss', 'channel', 'lastBuildDate' ); 147 $this->assert Equals( strtotime( get_lastpostmodified() ), strtotime( $pubdate[0]['content'] ) );147 $this->assertSame( strtotime( get_lastpostmodified() ), strtotime( $pubdate[0]['content'] ) ); 148 148 } 149 149 … … 200 200 // Title. 201 201 $title = xml_find( $items[ $key ]['child'], 'title' ); 202 $this->assert Equals( $post->post_title, $title[0]['content'] );202 $this->assertSame( $post->post_title, $title[0]['content'] ); 203 203 204 204 // Link. 205 205 $link = xml_find( $items[ $key ]['child'], 'link' ); 206 $this->assert Equals( get_permalink( $post ), $link[0]['content'] );206 $this->assertSame( get_permalink( $post ), $link[0]['content'] ); 207 207 208 208 // Comment link. 209 209 $comments_link = xml_find( $items[ $key ]['child'], 'comments' ); 210 $this->assert Equals( get_permalink( $post ) . '#respond', $comments_link[0]['content'] );210 $this->assertSame( get_permalink( $post ) . '#respond', $comments_link[0]['content'] ); 211 211 212 212 // Pub date. 213 213 $pubdate = xml_find( $items[ $key ]['child'], 'pubDate' ); 214 $this->assert Equals( strtotime( $post->post_date_gmt ), strtotime( $pubdate[0]['content'] ) );214 $this->assertSame( strtotime( $post->post_date_gmt ), strtotime( $pubdate[0]['content'] ) ); 215 215 216 216 // Author. 217 217 $creator = xml_find( $items[ $key ]['child'], 'dc:creator' ); 218 218 $user = new WP_User( $post->post_author ); 219 $this->assert Equals( $user->display_name, $creator[0]['content'] );219 $this->assertSame( $user->display_name, $creator[0]['content'] ); 220 220 221 221 // Categories (perhaps multiple). … … 234 234 $cats = array_filter( $cats ); 235 235 // Should be the same number of categories. 236 $this->assert Equals( count( $cats ), count( $categories ) );236 $this->assertSame( count( $cats ), count( $categories ) ); 237 237 238 238 // ..with the same names. 239 239 foreach ( $cats as $id => $cat ) { 240 $this->assert Equals( $cat, $categories[ $id ]['content'] );240 $this->assertSame( $cat, $categories[ $id ]['content'] ); 241 241 } 242 242 243 243 // GUID. 244 244 $guid = xml_find( $items[ $key ]['child'], 'guid' ); 245 $this->assert Equals( 'false', $guid[0]['attributes']['isPermaLink'] );246 $this->assert Equals( $post->guid, $guid[0]['content'] );245 $this->assertSame( 'false', $guid[0]['attributes']['isPermaLink'] ); 246 $this->assertSame( $post->guid, $guid[0]['content'] ); 247 247 248 248 // Description / Excerpt. 249 249 if ( ! empty( $post->post_excerpt ) ) { 250 250 $description = xml_find( $items[ $key ]['child'], 'description' ); 251 $this->assert Equals( trim( $post->post_excerpt ), trim( $description[0]['content'] ) );251 $this->assertSame( trim( $post->post_excerpt ), trim( $description[0]['content'] ) ); 252 252 } 253 253 … … 255 255 if ( ! $this->excerpt_only ) { 256 256 $content = xml_find( $items[ $key ]['child'], 'content:encoded' ); 257 $this->assert Equals( trim( apply_filters( 'the_content', $post->post_content ) ), trim( $content[0]['content'] ) );257 $this->assertSame( trim( apply_filters( 'the_content', $post->post_content ) ), trim( $content[0]['content'] ) ); 258 258 } 259 259 260 260 // Comment RSS. 261 261 $comment_rss = xml_find( $items[ $key ]['child'], 'wfw:commentRss' ); 262 $this->assert Equals( html_entity_decode( get_post_comments_feed_link( $post->ID ) ), $comment_rss[0]['content'] );262 $this->assertSame( html_entity_decode( get_post_comments_feed_link( $post->ID ) ), $comment_rss[0]['content'] ); 263 263 } 264 264 } … … 321 321 322 322 // There should only be one <rss> child element. 323 $this->assert Equals( 1, count( $rss ) );323 $this->assertSame( 1, count( $rss ) ); 324 324 } 325 325 … … 349 349 350 350 // There should only be one <rss> child element. 351 $this->assert Equals( 1, count( $rss ) );351 $this->assertSame( 1, count( $rss ) ); 352 352 } 353 353 … … 382 382 383 383 // There should only be one <rss> child element. 384 $this->assert Equals( 1, count( $rss ) );384 $this->assertSame( 1, count( $rss ) ); 385 385 } 386 386 … … 410 410 411 411 // There should only be one <rss> child element. 412 $this->assert Equals( 1, count( $rss ) );412 $this->assertSame( 1, count( $rss ) ); 413 413 } 414 414 … … 438 438 439 439 // There should only be one <rss> child element. 440 $this->assert Equals( 1, count( $rss ) );440 $this->assertSame( 1, count( $rss ) ); 441 441 } 442 442 … … 466 466 467 467 // There should only be one <rss> child element. 468 $this->assert Equals( 1, count( $rss ) );468 $this->assertSame( 1, count( $rss ) ); 469 469 } 470 470 … … 484 484 $rss = xml_find( $xml, $element ); 485 485 $last_build_date = $rss[0]['child'][0]['child'][4]['content']; 486 $this->assert Equals( strtotime( get_feed_build_date( 'r' ) ), strtotime( $last_build_date ) );486 $this->assertSame( strtotime( get_feed_build_date( 'r' ) ), strtotime( $last_build_date ) ); 487 487 } 488 488
Note: See TracChangeset
for help on using the changeset viewer.