Make WordPress Core

Ticket #10935: 10935.tests.diff

File 10935.tests.diff, 1.4 KB (added by kovshenin, 13 years ago)
  • tests/query/results.php

     
    369369                        'child-two',
    370370                ), wp_list_pluck( $posts, 'post_title' ) );
    371371        }
     372
     373        /**
     374         * @ticket 10935
     375         */
     376        function test_query_is_date() {
     377                $this->q->query( array(
     378                        'year' => '2007',
     379                        'monthnum' => '01',
     380                        'day' => '01',
     381                ) );
     382
     383                $this->assertTrue( $this->q->is_date );
     384                $this->assertTrue( $this->q->is_day );
     385                $this->assertFalse( $this->q->is_month );
     386                $this->assertFalse( $this->q->is_year );
     387
     388                $this->q->query( array(
     389                        'year' => '2007',
     390                        'monthnum' => '01',
     391                ) );
     392
     393                $this->assertTrue( $this->q->is_date );
     394                $this->assertFalse( $this->q->is_day );
     395                $this->assertTrue( $this->q->is_month );
     396                $this->assertFalse( $this->q->is_year );
     397
     398                $this->q->query( array(
     399                        'year' => '2007',
     400                ) );
     401
     402                $this->assertTrue( $this->q->is_date );
     403                $this->assertFalse( $this->q->is_day );
     404                $this->assertFalse( $this->q->is_month );
     405                $this->assertTrue( $this->q->is_year );
     406
     407                $this->q->query( array(
     408                        'year' => '2007',
     409                        'monthnum' => '01',
     410                        'day' => '50',
     411                ) );
     412
     413                $this->assertTrue( $this->q->is_404 );
     414                $this->assertFalse( $this->q->is_date );
     415                $this->assertFalse( $this->q->is_day );
     416                $this->assertFalse( $this->q->is_month );
     417                $this->assertFalse( $this->q->is_year );
     418        }
    372419}