Ticket #10935: 10935.tests.diff

File 10935.tests.diff, 1.4 KB (added by kovshenin, 3 months ago)
Line 
1Index: tests/query/results.php
2===================================================================
3--- tests/query/results.php     (revision 1219)
4+++ tests/query/results.php     (working copy)
5@@ -369,4 +369,51 @@
6                        'child-two',
7                ), wp_list_pluck( $posts, 'post_title' ) );
8        }
9+
10+       /**
11+        * @ticket 10935
12+        */
13+       function test_query_is_date() {
14+               $this->q->query( array(
15+                       'year' => '2007',
16+                       'monthnum' => '01',
17+                       'day' => '01',
18+               ) );
19+
20+               $this->assertTrue( $this->q->is_date );
21+               $this->assertTrue( $this->q->is_day );
22+               $this->assertFalse( $this->q->is_month );
23+               $this->assertFalse( $this->q->is_year );
24+
25+               $this->q->query( array(
26+                       'year' => '2007',
27+                       'monthnum' => '01',
28+               ) );
29+
30+               $this->assertTrue( $this->q->is_date );
31+               $this->assertFalse( $this->q->is_day );
32+               $this->assertTrue( $this->q->is_month );
33+               $this->assertFalse( $this->q->is_year );
34+
35+               $this->q->query( array(
36+                       'year' => '2007',
37+               ) );
38+
39+               $this->assertTrue( $this->q->is_date );
40+               $this->assertFalse( $this->q->is_day );
41+               $this->assertFalse( $this->q->is_month );
42+               $this->assertTrue( $this->q->is_year );
43+
44+               $this->q->query( array(
45+                       'year' => '2007',
46+                       'monthnum' => '01',
47+                       'day' => '50',
48+               ) );
49+
50+               $this->assertTrue( $this->q->is_404 );
51+               $this->assertFalse( $this->q->is_date );
52+               $this->assertFalse( $this->q->is_day );
53+               $this->assertFalse( $this->q->is_month );
54+               $this->assertFalse( $this->q->is_year );
55+       }
56 }