Make WordPress Core


Ignore:
Timestamp:
02/21/2020 01:05:39 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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

Among other fixes, this backports [26871], [26909-26910], [26940], [27086], [27168], [28799], [28873], [28943], [28961], [28964], [28966-28967], [29120], [29251], [29503], [29860], [29869], [29954], [30001], [30160], [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.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

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

    r26511 r47338  
    413413
    414414    /**
    415      * @ticket 5809
    416      */
    417     function test_update_shared_term() {
    418         $random_tax = __FUNCTION__;
    419 
    420         register_taxonomy( $random_tax, 'post' );
    421 
    422         $post_id = $this->factory->post->create();
    423 
    424         $old_name = 'Initial';
    425 
    426         $t1 = wp_insert_term( $old_name, 'category' );
    427         $t2 = wp_insert_term( $old_name, 'post_tag' );
    428 
    429         $this->assertEquals( $t1['term_id'], $t2['term_id'] );
    430 
    431         wp_set_post_categories( $post_id, array( $t1['term_id'] ) );
    432         wp_set_post_tags( $post_id, array( (int) $t2['term_id'] ) );
    433 
    434         $new_name = 'Updated';
    435 
    436         // create the term in a third taxonomy, just to keep things interesting
    437         $t3 = wp_insert_term( $old_name, $random_tax );
    438         wp_set_post_terms( $post_id, array( (int) $t3['term_id'] ), $random_tax );
    439         $this->assertPostHasTerms( $post_id, array( $t3['term_id'] ), $random_tax );
    440 
    441         $t2_updated = wp_update_term( $t2['term_id'], 'post_tag', array(
    442             'name' => $new_name
    443         ) );
    444 
    445         $this->assertNotEquals( $t2_updated['term_id'], $t3['term_id'] );
    446 
    447         // make sure the terms have split
    448         $this->assertEquals( $old_name, get_term_field( 'name', $t1['term_id'], 'category' ) );
    449         $this->assertEquals( $new_name, get_term_field( 'name', $t2_updated['term_id'], 'post_tag' ) );
    450 
    451         // and that they are still assigned to the correct post
    452         $this->assertPostHasTerms( $post_id, array( $t1['term_id'] ), 'category' );
    453         $this->assertPostHasTerms( $post_id, array( $t2_updated['term_id'] ), 'post_tag' );
    454         $this->assertPostHasTerms( $post_id, array( $t3['term_id'] ), $random_tax );
    455 
    456         // clean up
    457         unset( $GLOBALS['wp_taxonomies'][ $random_tax ] );
    458     }
    459 
    460     /**
    461415     * @ticket 17646
    462416     */
     
    495449
    496450        $this->assertEquals( $expected_term_ids, $assigned_term_ids );
    497     }
    498 
    499     /**
    500      * @ticket 24189
    501      */
    502     function test_object_term_cache_when_term_changes() {
    503         $post_id = $this->factory->post->create();
    504         $tag_id = $this->factory->tag->create( array( 'description' => 'My Amazing Tag' ) );
    505 
    506         $tt_1 = wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
    507 
    508         $terms = get_the_terms( $post_id, 'post_tag' );
    509         $this->assertEquals( $tag_id, $terms[0]->term_id );
    510         $this->assertEquals( 'My Amazing Tag', $terms[0]->description );
    511 
    512         $_updated = wp_update_term( $tag_id, 'post_tag', array(
    513             'description' => 'This description is even more amazing!'
    514         ) );
    515 
    516         $_new_term = get_term( $tag_id, 'post_tag' );
    517         $this->assertEquals( $tag_id, $_new_term->term_id );
    518         $this->assertEquals( 'This description is even more amazing!', $_new_term->description );
    519 
    520         $terms = get_the_terms( $post_id, 'post_tag' );
    521         $this->assertEquals( $tag_id, $terms[0]->term_id );
    522         $this->assertEquals( 'This description is even more amazing!', $terms[0]->description );
    523451    }
    524452
Note: See TracChangeset for help on using the changeset viewer.