Changeset 33616 for trunk/tests/phpunit/tests/term/wpUpdateTerm.php
- Timestamp:
- 08/14/2015 04:15:34 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpUpdateTerm.php
r32208 r33616 299 299 $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' ); 300 300 $this->assertNotEquals( $t1_terms[0]->term_id, $t2_terms[0]->term_id ); 301 }302 303 /**304 * @ticket 5809305 */306 public function test_wp_update_term_should_not_split_shared_term_before_410_schema_change() {307 global $wpdb;308 309 $db_version = get_option( 'db_version' );310 update_option( 'db_version', 30055 );311 312 register_taxonomy( 'wptests_tax', 'post' );313 register_taxonomy( 'wptests_tax_2', 'post' );314 315 $t1 = wp_insert_term( 'Foo', 'wptests_tax' );316 $t2 = wp_insert_term( 'Foo', 'wptests_tax_2' );317 318 // Manually modify because shared terms shouldn't naturally occur.319 $wpdb->update( $wpdb->term_taxonomy,320 array( 'term_id' => $t1['term_id'] ),321 array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),322 array( '%d' ),323 array( '%d' )324 );325 326 $posts = $this->factory->post->create_many( 2 );327 wp_set_object_terms( $posts[0], array( 'Foo' ), 'wptests_tax' );328 wp_set_object_terms( $posts[1], array( 'Foo' ), 'wptests_tax_2' );329 330 // Verify that the term is shared.331 $t1_terms = wp_get_object_terms( $posts[0], 'wptests_tax' );332 $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' );333 $this->assertSame( $t1_terms[0]->term_id, $t2_terms[0]->term_id );334 335 wp_update_term( $t2_terms[0]->term_id, 'wptests_tax_2', array(336 'name' => 'New Foo',337 ) );338 339 // Term should still be shared.340 $t1_terms = wp_get_object_terms( $posts[0], 'wptests_tax' );341 $t2_terms = wp_get_object_terms( $posts[1], 'wptests_tax_2' );342 $this->assertSame( $t1_terms[0]->term_id, $t2_terms[0]->term_id );343 344 update_option( 'db_version', $db_version );345 301 } 346 302
Note: See TracChangeset
for help on using the changeset viewer.