WordPress.org

Make WordPress Core

Ticket #29908: 29908.test.patch

File 29908.test.patch, 1010 bytes (added by boonebgorges, 7 years ago)
  • tests/phpunit/tests/query/dateQuery.php

    diff --git tests/phpunit/tests/query/dateQuery.php tests/phpunit/tests/query/dateQuery.php
    index 2f94c4a..735a149 100644
    class Tests_Query_DateQuery extends WP_UnitTestCase { 
    287287                $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    288288        }
    289289
     290        /**
     291         * @ticket 29908
     292         */
     293        public function test_inclusive_before_with_ymd_date() {
     294                $p1 = $this->factory->post->create( array(
     295                        'post_date' => '2008-05-06 13:00:00',
     296                ) );
     297                $p2 = $this->factory->post->create( array(
     298                        'post_date' => '2008-05-07 13:00:00',
     299                ) );
     300
     301                $posts = $this->_get_query_result( array(
     302                        'date_query' => array(
     303                                'before' => '2008-05-07',
     304                                'inclusive' => true
     305                        ),
     306                ) );
     307
     308                $this->assertTrue( in_array( $p2, wp_list_pluck( $posts, 'ID' ) ) );
     309        }
     310
    290311        public function test_date_query_year_expecting_results() {
    291312                $posts = $this->_get_query_result( array(
    292313                        'date_query' => array(