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/post.php

    r32186 r47338  
    447447
    448448        global $wp_rewrite;
     449        $wp_rewrite->init();
    449450        $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
     451        $wp_rewrite->flush_rules();
    450452
    451453        $post = array(
     
    736738        $this->assertEquals( $post->post_author, $this->author_id );
    737739        $this->assertEquals( $post->post_title, $title );
    738     }
    739 
    740     /**
    741      * @ticket 19373
    742      */
    743     function test_insert_programmatic_without_current_user_success() {
    744         $this->_unset_current_user();
    745 
    746         register_taxonomy( 'test_tax', 'post' );
    747 
    748         $title = rand_str();
    749         $post_data = array(
    750             'post_author' => $this->author_id,
    751             'post_status' => 'public',
    752             'post_content' => rand_str(),
    753             'post_title' => $title,
    754             'tax_input' => array(
    755                 'test_tax' => array( 'term', 'term2', 'term3' )
    756             )
    757         );
    758         // with sanitize set to false
    759         $insert_post_id = wp_insert_post( $post_data, true, false );
    760 
    761         $post = get_post( $insert_post_id );
    762         $this->assertEquals( $post->post_author, $this->author_id );
    763         $this->assertEquals( $post->post_title, $title );
    764 
    765         $terms = wp_get_object_terms( $insert_post_id, 'test_tax' );
    766         $this->assertTrue( ( is_array( $terms ) && count( $terms ) == 3 ) );
    767     }
    768 
    769     /**
    770      * @ticket 19373
    771      */
    772     function test_insert_programmatic_without_current_user_fail() {
    773         $this->_unset_current_user();
    774 
    775         register_taxonomy( 'test_tax', 'post' );
    776 
    777         $title = rand_str();
    778         $post_data = array(
    779             // post_author not set
    780             'post_status' => 'public',
    781             'post_content' => rand_str(),
    782             'post_title' => $title,
    783             'tax_input' => array(
    784                 'test_tax' => array( 'term', 'term2', 'term3' )
    785             )
    786         );
    787         // with sanitize set to false
    788         $insert_post_id = wp_insert_post( $post_data, true, false );
    789 
    790         // should error because no default user exists and no post author is passed in
    791         $this->assertInstanceOf( 'WP_Error', $insert_post_id );
    792         $this->assertEquals( 'empty_author', $insert_post_id->get_error_code() );
    793740    }
    794741
Note: See TracChangeset for help on using the changeset viewer.