Make WordPress Core


Ignore:
Timestamp:
03/26/2019 12:45:57 AM (6 years ago)
Author:
johnbillion
Message:

Build/Test tools: Fix the Travis CI build for the 4.0 branch.

Among other fixes, this backports [29860], [29869], [29954], [30160], [30530].

Fixes #46646

Location:
branches/4.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/tests/phpunit/tests/post.php

    r40456 r45013  
    741741
    742742    /**
    743      * @ticket 19373
    744      */
    745     function test_insert_programmatic_without_current_user_success() {
    746         $this->_unset_current_user();
    747 
    748         register_taxonomy( 'test_tax', 'post' );
    749 
    750         $title = rand_str();
    751         $post_data = array(
    752             'post_author' => $this->author_id,
    753             'post_status' => 'public',
    754             'post_content' => rand_str(),
    755             'post_title' => $title,
    756             'tax_input' => array(
    757                 'test_tax' => array( 'term', 'term2', 'term3' )
    758             )
    759         );
    760         // with sanitize set to false
    761         $insert_post_id = wp_insert_post( $post_data, true, false );
    762 
    763         $post = get_post( $insert_post_id );
    764         $this->assertEquals( $post->post_author, $this->author_id );
    765         $this->assertEquals( $post->post_title, $title );
    766 
    767         $terms = wp_get_object_terms( $insert_post_id, 'test_tax' );
    768         $this->assertTrue( ( is_array( $terms ) && count( $terms ) == 3 ) );
    769     }
    770 
    771     /**
    772      * @ticket 19373
    773      */
    774     function test_insert_programmatic_without_current_user_fail() {
    775         $this->_unset_current_user();
    776 
    777         register_taxonomy( 'test_tax', 'post' );
    778 
    779         $title = rand_str();
    780         $post_data = array(
    781             // post_author not set
    782             'post_status' => 'public',
    783             'post_content' => rand_str(),
    784             'post_title' => $title,
    785             'tax_input' => array(
    786                 'test_tax' => array( 'term', 'term2', 'term3' )
    787             )
    788         );
    789         // with sanitize set to false
    790         $insert_post_id = wp_insert_post( $post_data, true, false );
    791 
    792         // should error because no default user exists and no post author is passed in
    793         $this->assertInstanceOf( 'WP_Error', $insert_post_id );
    794         $this->assertEquals( 'empty_author', $insert_post_id->get_error_code() );
    795     }
    796 
    797     /**
    798743     * @ticket 24803
    799744     */
Note: See TracChangeset for help on using the changeset viewer.