Make WordPress Core


Ignore:
Timestamp:
08/29/2019 04:43:28 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: Update XML-RPC tests for invalid date input to account for a more consistent mysql2date() error handling in [45908].

The tests were meant to check for the lack of a fatal error in case of invalid date input, not specifically mark a particular outcome as the correct one.

Props Rarst.
Fixes #28992.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php

    r42343 r45911  
    356356        $fetched_post = get_post( $result );
    357357        $this->assertStringMatchesFormat( '%d', $result );
    358         $this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date );
     358        $this->assertEquals( current_time( 'Y-m-d' ), substr( $fetched_post->post_date, 0, 10 ) );
    359359    }
    360360
     
    364364    function test_invalid_post_date_gmt_does_not_fatal() {
    365365        $this->make_user_by_role( 'author' );
    366         $date_string  = 'invalid date';
     366        $date_string  = 'invalid_date';
    367367        $post         = array(
    368368            'post_title'    => 'test',
     
    373373        $fetched_post = get_post( $result );
    374374        $this->assertStringMatchesFormat( '%d', $result );
    375         $this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date_gmt );
     375        $this->assertEquals( '0000-00-00', substr( $fetched_post->post_date_gmt, 0, 10 ) );
    376376    }
    377377
Note: See TracChangeset for help on using the changeset viewer.