Changeset 42343 for trunk/tests/phpunit/tests/comment/dateQuery.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/comment/dateQuery.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/dateQuery.php
r35242 r42343 23 23 // Just some dummy posts to use as parents for comments 24 24 for ( $i = 1; $i <= 2; $i++ ) { 25 $this->posts[ $i] = self::factory()->post->create();25 $this->posts[ $i ] = self::factory()->post->create(); 26 26 } 27 27 … … 40 40 41 41 foreach ( $comment_dates as $comment_date => $comment_parent ) { 42 $result = self::factory()->comment->create( array( 43 'comment_date' => $comment_date, 44 'comment_post_ID' => $this->posts[ $comment_parent ], 45 ) ); 42 $result = self::factory()->comment->create( 43 array( 44 'comment_date' => $comment_date, 45 'comment_post_ID' => $this->posts[ $comment_parent ], 46 ) 47 ); 46 48 } 47 49 } 48 50 49 51 public function _get_query_result( $args = array() ) { 50 $args = wp_parse_args( $args, array( 51 'post_id' => $this->posts[1], 52 'orderby' => 'comment_ID', // Same order they were created 53 'order' => 'ASC', 54 ) ); 52 $args = wp_parse_args( 53 $args, array( 54 'post_id' => $this->posts[1], 55 'orderby' => 'comment_ID', // Same order they were created 56 'order' => 'ASC', 57 ) 58 ); 55 59 56 60 return get_comments( $args ); … … 58 62 59 63 public function test_year() { 60 $comments = $this->_get_query_result( array( 61 'date_query' => array( 62 array( 63 'year' => 2008, 64 $comments = $this->_get_query_result( 65 array( 66 'date_query' => array( 67 array( 68 'year' => 2008, 69 ), 64 70 ), 65 ) ,66 ) );71 ) 72 ); 67 73 68 74 $expected_dates = array(
Note: See TracChangeset
for help on using the changeset viewer.