Changeset 47122 for trunk/tests/phpunit/tests/feed/atom.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/feed/atom.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/feed/atom.php
r46586 r47122 18 18 */ 19 19 public static function wpSetUpBeforeClass( $factory ) { 20 // Create a user 20 // Create a user. 21 21 self::$user_id = $factory->user->create( 22 22 array( … … 27 27 ); 28 28 29 // Create a taxonomy 29 // Create a taxonomy. 30 30 self::$category = self::factory()->category->create_and_get( 31 31 array( … … 37 37 $count = get_option( 'posts_per_rss' ) + 1; 38 38 39 // Create a few posts 39 // Create a few posts. 40 40 self::$posts = $factory->post->create_many( 41 41 $count, … … 47 47 ); 48 48 49 // Assign a category to those posts 49 // Assign a category to those posts. 50 50 foreach ( self::$posts as $post ) { 51 51 wp_set_object_terms( $post, self::$category->slug, 'category' ); … … 141 141 $this->assertCount( $this->post_count, $entries ); 142 142 143 // We Really only need to test X number of entries unless the content is different143 // We really only need to test X number of entries unless the content is different. 144 144 $entries = array_slice( $entries, 1 ); 145 145 … … 147 147 foreach ( $entries as $key => $entry ) { 148 148 149 // Get post for comparison 149 // Get post for comparison. 150 150 $id = xml_find( $entries[ $key ]['child'], 'id' ); 151 151 preg_match( '/\?p=(\d+)/', $id[0]['content'], $matches ); 152 152 $post = get_post( $matches[1] ); 153 153 154 // Author 154 // Author. 155 155 $author = xml_find( $entries[ $key ]['child'], 'author', 'name' ); 156 156 $user = new WP_User( $post->post_author ); 157 157 $this->assertEquals( $user->display_name, $author[0]['content'] ); 158 158 159 // Title 159 // Title. 160 160 $title = xml_find( $entries[ $key ]['child'], 'title' ); 161 161 $this->assertEquals( $post->post_title, $title[0]['content'] ); 162 162 163 // Link rel="alternate" 163 // Link rel="alternate". 164 164 $link_alts = xml_find( $entries[ $key ]['child'], 'link' ); 165 165 foreach ( $link_alts as $link_alt ) { … … 169 169 } 170 170 171 // I d171 // ID. 172 172 $guid = xml_find( $entries[ $key ]['child'], 'id' ); 173 173 $this->assertEquals( $post->guid, $id[0]['content'] ); 174 174 175 // Updated 175 // Updated. 176 176 $updated = xml_find( $entries[ $key ]['child'], 'updated' ); 177 177 $this->assertEquals( strtotime( $post->post_modified_gmt ), strtotime( $updated[0]['content'] ) ); 178 178 179 // Published 179 // Published. 180 180 $published = xml_find( $entries[ $key ]['child'], 'published' ); 181 181 $this->assertEquals( strtotime( $post->post_date_gmt ), strtotime( $published[0]['content'] ) ); 182 182 183 // Category 183 // Category. 184 184 foreach ( get_the_category( $post->ID ) as $term ) { 185 185 $terms[] = $term->name; … … 191 191 unset( $terms ); 192 192 193 // Content 193 // Content. 194 194 if ( ! $this->excerpt_only ) { 195 195 $content = xml_find( $entries[ $key ]['child'], 'content' ); … … 197 197 } 198 198 199 // Link rel="replies" 199 // Link rel="replies". 200 200 $link_replies = xml_find( $entries[ $key ]['child'], 'link' ); 201 201 foreach ( $link_replies as $link_reply ) {
Note: See TracChangeset
for help on using the changeset viewer.