Make WordPress Core


Ignore:
Timestamp:
02/22/2020 12:05:12 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Fix the Travis CI build for the 3.7 branch.

Among other fixes, this backports [26087], [26091], [26095], [26252], [26307], [26318], [26512], [26705], [26871], [26909-26910], [26940], [27086], [27168], [28799], [28873], [28943], [28961], [28964], [28966-28967], [29120], [29251], [29503], [29860], [29869], [29954], [30001], [30282], [30285], [30289-30291], [30513-30514], [30516-30521], [30524], [30526], [30529-30530], [31253-31254], [31257-31259], [31622], [40241], [40255], [40257], [40259], [40269], [40271], [40446], [40449], [40457], [40604], [40538], [40833], [41082], [41303], [41306], [44993].

See #49485.

Location:
branches/3.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/tests/phpunit/tests/term.php

    r25551 r47343  
    388388        }
    389389
    390         /**
    391          * @ticket 5809
    392          */
    393         function test_update_shared_term() {
    394                 $random_tax = __FUNCTION__;
    395 
    396                 register_taxonomy( $random_tax, 'post' );
    397 
    398                 $post_id = $this->factory->post->create();
    399 
    400                 $old_name = 'Initial';
    401 
    402                 $t1 = wp_insert_term( $old_name, 'category' );
    403                 $t2 = wp_insert_term( $old_name, 'post_tag' );
    404 
    405                 $this->assertEquals( $t1['term_id'], $t2['term_id'] );
    406 
    407                 wp_set_post_categories( $post_id, array( $t1['term_id'] ) );
    408                 wp_set_post_tags( $post_id, array( (int) $t2['term_id'] ) );
    409 
    410                 $new_name = 'Updated';
    411 
    412                 // create the term in a third taxonomy, just to keep things interesting
    413                 $t3 = wp_insert_term( $old_name, $random_tax );
    414                 wp_set_post_terms( $post_id, array( (int) $t3['term_id'] ), $random_tax );
    415                 $this->assertPostHasTerms( $post_id, array( $t3['term_id'] ), $random_tax );
    416 
    417                 $t2_updated = wp_update_term( $t2['term_id'], 'post_tag', array(
    418                         'name' => $new_name
    419                 ) );
    420 
    421                 $this->assertNotEquals( $t2_updated['term_id'], $t3['term_id'] );
    422 
    423                 // make sure the terms have split
    424                 $this->assertEquals( $old_name, get_term_field( 'name', $t1['term_id'], 'category' ) );
    425                 $this->assertEquals( $new_name, get_term_field( 'name', $t2_updated['term_id'], 'post_tag' ) );
    426 
    427                 // and that they are still assigned to the correct post
    428                 $this->assertPostHasTerms( $post_id, array( $t1['term_id'] ), 'category' );
    429                 $this->assertPostHasTerms( $post_id, array( $t2_updated['term_id'] ), 'post_tag' );
    430                 $this->assertPostHasTerms( $post_id, array( $t3['term_id'] ), $random_tax );
    431 
    432                 // clean up
    433                 unset( $GLOBALS['wp_taxonomies'][ $random_tax ] );
    434         }
    435 
    436390        private function assertPostHasTerms( $post_id, $expected_term_ids, $taxonomy ) {
    437391                $assigned_term_ids = wp_get_object_terms( $post_id, $taxonomy, array(
    … …  
    440394
    441395                $this->assertEquals( $expected_term_ids, $assigned_term_ids );
    442         }
    443 
    444         /**
    445          * @ticket 24189
    446          */
    447         function test_object_term_cache_when_term_changes() {
    448                 $post_id = $this->factory->post->create();
    449                 $tag_id = $this->factory->tag->create( array( 'description' => 'My Amazing Tag' ) );
    450 
    451                 $tt_1 = wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
    452 
    453                 $terms = get_the_terms( $post_id, 'post_tag' );
    454                 $this->assertEquals( $tag_id, $terms[0]->term_id );
    455                 $this->assertEquals( 'My Amazing Tag', $terms[0]->description );
    456 
    457                 $_updated = wp_update_term( $tag_id, 'post_tag', array(
    458                         'description' => 'This description is even more amazing!'
    459                 ) );
    460 
    461                 $_new_term = get_term( $tag_id, 'post_tag' );
    462                 $this->assertEquals( $tag_id, $_new_term->term_id );
    463                 $this->assertEquals( 'This description is even more amazing!', $_new_term->description );
    464 
    465                 $terms = get_the_terms( $post_id, 'post_tag' );
    466                 $this->assertEquals( $tag_id, $terms[0]->term_id );
    467                 $this->assertEquals( 'This description is even more amazing!', $terms[0]->description );
    468396        }
    469397
Note: See TracChangeset for help on using the changeset viewer.