Changeset 48937 for trunk/tests/phpunit/tests/import/import.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/import/import.php
r48840 r48937 52 52 // Ensure that authors were imported correctly. 53 53 $user_count = count_users(); 54 $this->assert Equals( 3, $user_count['total_users'] );54 $this->assertSame( 3, $user_count['total_users'] ); 55 55 $admin = get_user_by( 'login', 'admin' ); 56 $this->assert Equals( 'admin', $admin->user_login );57 $this->assert Equals( 'local@host.null', $admin->user_email );56 $this->assertSame( 'admin', $admin->user_login ); 57 $this->assertSame( 'local@host.null', $admin->user_email ); 58 58 $editor = get_user_by( 'login', 'editor' ); 59 $this->assert Equals( 'editor', $editor->user_login );60 $this->assert Equals( 'editor@example.org', $editor->user_email );61 $this->assert Equals( 'FirstName', $editor->user_firstname );62 $this->assert Equals( 'LastName', $editor->user_lastname );59 $this->assertSame( 'editor', $editor->user_login ); 60 $this->assertSame( 'editor@example.org', $editor->user_email ); 61 $this->assertSame( 'FirstName', $editor->user_firstname ); 62 $this->assertSame( 'LastName', $editor->user_lastname ); 63 63 $author = get_user_by( 'login', 'author' ); 64 $this->assert Equals( 'author', $author->user_login );65 $this->assert Equals( 'author@example.org', $author->user_email );64 $this->assertSame( 'author', $author->user_login ); 65 $this->assertSame( 'author@example.org', $author->user_email ); 66 66 67 67 // Check that terms were imported correctly. … … 69 69 $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) ); 70 70 $foo = get_term_by( 'slug', 'foo', 'category' ); 71 $this->assert Equals( 0, $foo->parent );71 $this->assertSame( 0, $foo->parent ); 72 72 $bar = get_term_by( 'slug', 'bar', 'category' ); 73 73 $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' ); 74 $this->assert Equals( $bar->term_id, $foo_bar->parent );74 $this->assertSame( $bar->term_id, $foo_bar->parent ); 75 75 76 76 // Check that posts/pages were imported correctly. … … 92 92 ) 93 93 ); 94 $this->assert Equals( 11, count( $posts ) );94 $this->assertSame( 11, count( $posts ) ); 95 95 96 96 $post = $posts[0]; 97 $this->assert Equals( 'Many Categories', $post->post_title );98 $this->assert Equals( 'many-categories', $post->post_name );99 $this->assertEquals( $admin->ID, $post->post_author ); 100 $this->assert Equals( 'post', $post->post_type );101 $this->assert Equals( 'publish', $post->post_status );102 $this->assert Equals( 0, $post->post_parent );103 $cats = wp_get_post_categories( $post->ID ); 104 $this->assert Equals( 27, count( $cats ) );97 $this->assertSame( 'Many Categories', $post->post_title ); 98 $this->assertSame( 'many-categories', $post->post_name ); 99 $this->assertEquals( $admin->ID, $post->post_author ); 100 $this->assertSame( 'post', $post->post_type ); 101 $this->assertSame( 'publish', $post->post_status ); 102 $this->assertSame( 0, $post->post_parent ); 103 $cats = wp_get_post_categories( $post->ID ); 104 $this->assertSame( 27, count( $cats ) ); 105 105 106 106 $post = $posts[1]; 107 $this->assert Equals( 'Non-standard post format', $post->post_title );108 $this->assert Equals( 'non-standard-post-format', $post->post_name );109 $this->assertEquals( $admin->ID, $post->post_author ); 110 $this->assert Equals( 'post', $post->post_type );111 $this->assert Equals( 'publish', $post->post_status );112 $this->assert Equals( 0, $post->post_parent );113 $cats = wp_get_post_categories( $post->ID ); 114 $this->assert Equals( 1, count( $cats ) );107 $this->assertSame( 'Non-standard post format', $post->post_title ); 108 $this->assertSame( 'non-standard-post-format', $post->post_name ); 109 $this->assertEquals( $admin->ID, $post->post_author ); 110 $this->assertSame( 'post', $post->post_type ); 111 $this->assertSame( 'publish', $post->post_status ); 112 $this->assertSame( 0, $post->post_parent ); 113 $cats = wp_get_post_categories( $post->ID ); 114 $this->assertSame( 1, count( $cats ) ); 115 115 $this->assertTrue( has_post_format( 'aside', $post->ID ) ); 116 116 117 117 $post = $posts[2]; 118 $this->assert Equals( 'Top-level Foo', $post->post_title );119 $this->assert Equals( 'top-level-foo', $post->post_name );120 $this->assertEquals( $admin->ID, $post->post_author ); 121 $this->assert Equals( 'post', $post->post_type );122 $this->assert Equals( 'publish', $post->post_status );123 $this->assert Equals( 0, $post->post_parent );118 $this->assertSame( 'Top-level Foo', $post->post_title ); 119 $this->assertSame( 'top-level-foo', $post->post_name ); 120 $this->assertEquals( $admin->ID, $post->post_author ); 121 $this->assertSame( 'post', $post->post_type ); 122 $this->assertSame( 'publish', $post->post_status ); 123 $this->assertSame( 0, $post->post_parent ); 124 124 $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) ); 125 $this->assert Equals( 1, count( $cats ) );126 $this->assert Equals( 'foo', $cats[0]->slug );125 $this->assertSame( 1, count( $cats ) ); 126 $this->assertSame( 'foo', $cats[0]->slug ); 127 127 128 128 $post = $posts[3]; 129 $this->assert Equals( 'Foo-child', $post->post_title );130 $this->assert Equals( 'foo-child', $post->post_name );129 $this->assertSame( 'Foo-child', $post->post_title ); 130 $this->assertSame( 'foo-child', $post->post_name ); 131 131 $this->assertEquals( $editor->ID, $post->post_author ); 132 $this->assert Equals( 'post', $post->post_type );133 $this->assert Equals( 'publish', $post->post_status );134 $this->assert Equals( 0, $post->post_parent );132 $this->assertSame( 'post', $post->post_type ); 133 $this->assertSame( 'publish', $post->post_status ); 134 $this->assertSame( 0, $post->post_parent ); 135 135 $cats = wp_get_post_categories( $post->ID, array( 'fields' => 'all' ) ); 136 $this->assert Equals( 1, count( $cats ) );137 $this->assert Equals( 'foo-bar', $cats[0]->slug );136 $this->assertSame( 1, count( $cats ) ); 137 $this->assertSame( 'foo-bar', $cats[0]->slug ); 138 138 139 139 $post = $posts[4]; 140 $this->assert Equals( 'Private Post', $post->post_title );141 $this->assert Equals( 'private-post', $post->post_name );142 $this->assertEquals( $admin->ID, $post->post_author ); 143 $this->assert Equals( 'post', $post->post_type );144 $this->assert Equals( 'private', $post->post_status );145 $this->assert Equals( 0, $post->post_parent );146 $cats = wp_get_post_categories( $post->ID ); 147 $this->assert Equals( 1, count( $cats ) );140 $this->assertSame( 'Private Post', $post->post_title ); 141 $this->assertSame( 'private-post', $post->post_name ); 142 $this->assertEquals( $admin->ID, $post->post_author ); 143 $this->assertSame( 'post', $post->post_type ); 144 $this->assertSame( 'private', $post->post_status ); 145 $this->assertSame( 0, $post->post_parent ); 146 $cats = wp_get_post_categories( $post->ID ); 147 $this->assertSame( 1, count( $cats ) ); 148 148 $tags = wp_get_post_tags( $post->ID ); 149 $this->assert Equals( 3, count( $tags ) );150 $this->assert Equals( 'tag1', $tags[0]->slug );151 $this->assert Equals( 'tag2', $tags[1]->slug );152 $this->assert Equals( 'tag3', $tags[2]->slug );149 $this->assertSame( 3, count( $tags ) ); 150 $this->assertSame( 'tag1', $tags[0]->slug ); 151 $this->assertSame( 'tag2', $tags[1]->slug ); 152 $this->assertSame( 'tag3', $tags[2]->slug ); 153 153 154 154 $post = $posts[5]; 155 $this->assert Equals( '1-col page', $post->post_title );156 $this->assert Equals( '1-col-page', $post->post_name );157 $this->assertEquals( $admin->ID, $post->post_author ); 158 $this->assert Equals( 'page', $post->post_type );159 $this->assert Equals( 'publish', $post->post_status );160 $this->assert Equals( 0, $post->post_parent );161 $this->assert Equals( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) );155 $this->assertSame( '1-col page', $post->post_title ); 156 $this->assertSame( '1-col-page', $post->post_name ); 157 $this->assertEquals( $admin->ID, $post->post_author ); 158 $this->assertSame( 'page', $post->post_type ); 159 $this->assertSame( 'publish', $post->post_status ); 160 $this->assertSame( 0, $post->post_parent ); 161 $this->assertSame( 'onecolumn-page.php', get_post_meta( $post->ID, '_wp_page_template', true ) ); 162 162 163 163 $post = $posts[6]; 164 $this->assert Equals( 'Draft Page', $post->post_title );165 $this->assert Equals( '', $post->post_name );166 $this->assertEquals( $admin->ID, $post->post_author ); 167 $this->assert Equals( 'page', $post->post_type );168 $this->assert Equals( 'draft', $post->post_status );169 $this->assert Equals( 0, $post->post_parent );170 $this->assert Equals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );164 $this->assertSame( 'Draft Page', $post->post_title ); 165 $this->assertSame( '', $post->post_name ); 166 $this->assertEquals( $admin->ID, $post->post_author ); 167 $this->assertSame( 'page', $post->post_type ); 168 $this->assertSame( 'draft', $post->post_status ); 169 $this->assertSame( 0, $post->post_parent ); 170 $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) ); 171 171 172 172 $post = $posts[7]; 173 $this->assert Equals( 'Parent Page', $post->post_title );174 $this->assert Equals( 'parent-page', $post->post_name );175 $this->assertEquals( $admin->ID, $post->post_author ); 176 $this->assert Equals( 'page', $post->post_type );177 $this->assert Equals( 'publish', $post->post_status );178 $this->assert Equals( 0, $post->post_parent );179 $this->assert Equals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );173 $this->assertSame( 'Parent Page', $post->post_title ); 174 $this->assertSame( 'parent-page', $post->post_name ); 175 $this->assertEquals( $admin->ID, $post->post_author ); 176 $this->assertSame( 'page', $post->post_type ); 177 $this->assertSame( 'publish', $post->post_status ); 178 $this->assertSame( 0, $post->post_parent ); 179 $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) ); 180 180 181 181 $post = $posts[8]; 182 $this->assert Equals( 'Child Page', $post->post_title );183 $this->assert Equals( 'child-page', $post->post_name );184 $this->assertEquals( $admin->ID, $post->post_author ); 185 $this->assert Equals( 'page', $post->post_type );186 $this->assert Equals( 'publish', $post->post_status );187 $this->assert Equals( $posts[7]->ID, $post->post_parent );188 $this->assert Equals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );182 $this->assertSame( 'Child Page', $post->post_title ); 183 $this->assertSame( 'child-page', $post->post_name ); 184 $this->assertEquals( $admin->ID, $post->post_author ); 185 $this->assertSame( 'page', $post->post_type ); 186 $this->assertSame( 'publish', $post->post_status ); 187 $this->assertSame( $posts[7]->ID, $post->post_parent ); 188 $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) ); 189 189 190 190 $post = $posts[9]; 191 $this->assert Equals( 'Sample Page', $post->post_title );192 $this->assert Equals( 'sample-page', $post->post_name );193 $this->assertEquals( $admin->ID, $post->post_author ); 194 $this->assert Equals( 'page', $post->post_type );195 $this->assert Equals( 'publish', $post->post_status );196 $this->assert Equals( 0, $post->post_parent );197 $this->assert Equals( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) );191 $this->assertSame( 'Sample Page', $post->post_title ); 192 $this->assertSame( 'sample-page', $post->post_name ); 193 $this->assertEquals( $admin->ID, $post->post_author ); 194 $this->assertSame( 'page', $post->post_type ); 195 $this->assertSame( 'publish', $post->post_status ); 196 $this->assertSame( 0, $post->post_parent ); 197 $this->assertSame( 'default', get_post_meta( $post->ID, '_wp_page_template', true ) ); 198 198 199 199 $post = $posts[10]; 200 $this->assert Equals( 'Hello world!', $post->post_title );201 $this->assert Equals( 'hello-world', $post->post_name );200 $this->assertSame( 'Hello world!', $post->post_title ); 201 $this->assertSame( 'hello-world', $post->post_name ); 202 202 $this->assertEquals( $author->ID, $post->post_author ); 203 $this->assert Equals( 'post', $post->post_type );204 $this->assert Equals( 'publish', $post->post_status );205 $this->assert Equals( 0, $post->post_parent );206 $cats = wp_get_post_categories( $post->ID ); 207 $this->assert Equals( 1, count( $cats ) );203 $this->assertSame( 'post', $post->post_type ); 204 $this->assertSame( 'publish', $post->post_status ); 205 $this->assertSame( 0, $post->post_parent ); 206 $cats = wp_get_post_categories( $post->ID ); 207 $this->assertSame( 1, count( $cats ) ); 208 208 } 209 209 … … 218 218 219 219 $user_count = count_users(); 220 $this->assert Equals( 3, $user_count['total_users'] );220 $this->assertSame( 3, $user_count['total_users'] ); 221 221 $admin = get_user_by( 'login', 'admin' ); 222 $this->assert Equals( 'admin', $admin->user_login );223 $this->assert Equals( 'local@host.null', $admin->user_email );222 $this->assertSame( 'admin', $admin->user_login ); 223 $this->assertSame( 'local@host.null', $admin->user_email ); 224 224 $editor = get_user_by( 'login', 'editor' ); 225 $this->assert Equals( 'editor', $editor->user_login );226 $this->assert Equals( 'editor@example.org', $editor->user_email );227 $this->assert Equals( 'FirstName', $editor->user_firstname );228 $this->assert Equals( 'LastName', $editor->user_lastname );225 $this->assertSame( 'editor', $editor->user_login ); 226 $this->assertSame( 'editor@example.org', $editor->user_email ); 227 $this->assertSame( 'FirstName', $editor->user_firstname ); 228 $this->assertSame( 'LastName', $editor->user_lastname ); 229 229 $author = get_user_by( 'login', 'author' ); 230 $this->assert Equals( 'author', $author->user_login );231 $this->assert Equals( 'author@example.org', $author->user_email );230 $this->assertSame( 'author', $author->user_login ); 231 $this->assertSame( 'author@example.org', $author->user_email ); 232 232 233 233 $this->assertEquals( 30, wp_count_terms( array( 'taxonomy' => 'category' ) ) ); 234 234 $this->assertEquals( 3, wp_count_terms( array( 'taxonomy' => 'post_tag' ) ) ); 235 235 $foo = get_term_by( 'slug', 'foo', 'category' ); 236 $this->assert Equals( 0, $foo->parent );236 $this->assertSame( 0, $foo->parent ); 237 237 $bar = get_term_by( 'slug', 'bar', 'category' ); 238 238 $foo_bar = get_term_by( 'slug', 'foo-bar', 'category' ); 239 $this->assert Equals( $bar->term_id, $foo_bar->parent );239 $this->assertSame( $bar->term_id, $foo_bar->parent ); 240 240 241 241 $post_count = wp_count_posts( 'post' ); … … 259 259 'def1' => array( 'def1' ), 260 260 ); 261 $this->assert Equals(261 $this->assertSame( 262 262 array( 263 263 'ABC1' => array( 'ABC1' ),
Note: See TracChangeset
for help on using the changeset viewer.