Changeset 48937 for trunk/tests/phpunit/tests/term.php
- Timestamp:
- 09/02/2020 12:35:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term.php
r48840 r48937 102 102 103 103 $tt = wp_add_object_terms( $posts[0], $tags[1], 'post_tag' ); 104 $this->assert Equals( 1, count( $tt ) );105 $this->assert Equals( array( $tags[1] ), wp_get_object_terms( $posts[0], 'post_tag', array( 'fields' => 'ids' ) ) );104 $this->assertSame( 1, count( $tt ) ); 105 $this->assertSame( array( $tags[1] ), wp_get_object_terms( $posts[0], 'post_tag', array( 'fields' => 'ids' ) ) ); 106 106 107 107 $three_tags = array( $tags[0], $tags[1], $tags[2] ); 108 108 $tt = wp_add_object_terms( $posts[1], $three_tags, 'post_tag' ); 109 $this->assert Equals( 3, count( $tt ) );110 $this->assert Equals( $three_tags, wp_get_object_terms( $posts[1], 'post_tag', array( 'fields' => 'ids' ) ) );109 $this->assertSame( 3, count( $tt ) ); 110 $this->assertSame( $three_tags, wp_get_object_terms( $posts[1], 'post_tag', array( 'fields' => 'ids' ) ) ); 111 111 112 112 $this->assertTrue( wp_remove_object_terms( $posts[0], $tags[1], 'post_tag' ) ); … … 114 114 $this->assertInstanceOf( 'WP_Error', wp_remove_object_terms( $posts[0], $tags[1], 'non_existing_taxonomy' ) ); 115 115 $this->assertTrue( wp_remove_object_terms( $posts[1], $three_tags, 'post_tag' ) ); 116 $this->assert Equals( 0, count( wp_get_object_terms( $posts[1], 'post_tag' ) ) );116 $this->assertSame( 0, count( wp_get_object_terms( $posts[1], 'post_tag' ) ) ); 117 117 118 118 foreach ( $tags as $term_id ) { … … 178 178 179 179 $this->assertInternalType( 'array', $post->post_category ); 180 $this->assert Equals( 1, count( $post->post_category ) );180 $this->assertSame( 1, count( $post->post_category ) ); 181 181 $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] ); 182 182 … … 186 186 187 187 wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ) ); 188 $this->assert Equals( 2, count( $post->post_category ) );189 $this->assert Equals( array( $term2['term_id'], $term1['term_id'] ), $post->post_category );188 $this->assertSame( 2, count( $post->post_category ) ); 189 $this->assertSame( array( $term2['term_id'], $term1['term_id'] ), $post->post_category ); 190 190 191 191 wp_set_post_categories( $post_id, $term3['term_id'], true ); 192 $this->assert Equals( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post->post_category );192 $this->assertSame( array( $term2['term_id'], $term3['term_id'], $term1['term_id'] ), $post->post_category ); 193 193 194 194 $term4 = wp_insert_term( 'Burrito', 'category' ); 195 195 196 196 wp_set_post_categories( $post_id, $term4['term_id'] ); 197 $this->assert Equals( array( $term4['term_id'] ), $post->post_category );197 $this->assertSame( array( $term4['term_id'] ), $post->post_category ); 198 198 199 199 wp_set_post_categories( $post_id, array( $term1['term_id'], $term2['term_id'] ), true ); 200 $this->assert Equals( array( $term2['term_id'], $term4['term_id'], $term1['term_id'] ), $post->post_category );200 $this->assertSame( array( $term2['term_id'], $term4['term_id'], $term1['term_id'] ), $post->post_category ); 201 201 202 202 wp_set_post_categories( $post_id, array(), true ); 203 $this->assert Equals( 1, count( $post->post_category ) );203 $this->assertSame( 1, count( $post->post_category ) ); 204 204 $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] ); 205 205 206 206 wp_set_post_categories( $post_id, array() ); 207 $this->assert Equals( 1, count( $post->post_category ) );207 $this->assertSame( 1, count( $post->post_category ) ); 208 208 $this->assertEquals( get_option( 'default_category' ), $post->post_category[0] ); 209 209 } … … 225 225 226 226 wp_set_post_categories( $post_id, $term['term_id'] ); 227 $this->assert Equals( $term['term_id'], $post->post_category[0] );227 $this->assertSame( $term['term_id'], $post->post_category[0] ); 228 228 229 229 wp_set_post_categories( $post_id, array() ); … … 244 244 $term = wp_insert_term( 'foo', $this->taxonomy ); 245 245 246 $this->assert Equals( 0, sanitize_term_field( 'parent', 0, $term['term_id'], $this->taxonomy, 'raw' ) );247 $this->assert Equals( 1, sanitize_term_field( 'parent', 1, $term['term_id'], $this->taxonomy, 'raw' ) );248 $this->assert Equals( 0, sanitize_term_field( 'parent', -1, $term['term_id'], $this->taxonomy, 'raw' ) );249 $this->assert Equals( 0, sanitize_term_field( 'parent', '', $term['term_id'], $this->taxonomy, 'raw' ) );246 $this->assertSame( 0, sanitize_term_field( 'parent', 0, $term['term_id'], $this->taxonomy, 'raw' ) ); 247 $this->assertSame( 1, sanitize_term_field( 'parent', 1, $term['term_id'], $this->taxonomy, 'raw' ) ); 248 $this->assertSame( 0, sanitize_term_field( 'parent', -1, $term['term_id'], $this->taxonomy, 'raw' ) ); 249 $this->assertSame( 0, sanitize_term_field( 'parent', '', $term['term_id'], $this->taxonomy, 'raw' ) ); 250 250 } 251 251
Note: See TracChangeset
for help on using the changeset viewer.