Changeset 47122 for trunk/tests/phpunit/tests/post/query.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post/query.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/query.php
r46586 r47122 96 96 ); 97 97 98 // Fourth post added in filter 98 // Fourth post added in filter. 99 99 $this->assertEquals( 4, count( $query->posts ) ); 100 100 $this->assertEquals( 4, $query->post_count ); … … 102 102 foreach ( $query->posts as $post ) { 103 103 104 // posts are WP_Post objects104 // Posts are WP_Post objects. 105 105 $this->assertTrue( is_a( $post, 'WP_Post' ) ); 106 106 107 // filters are raw107 // Filters are raw. 108 108 $this->assertEquals( 'raw', $post->filter ); 109 109 110 // custom data added in the_posts filter is preserved110 // Custom data added in the_posts filter is preserved. 111 111 $this->assertEquals( array( $post->ID, 'custom data' ), $post->custom_data ); 112 112 } … … 409 409 */ 410 410 function test_orderby() { 411 // 'rand' is a valid value 411 // 'rand' is a valid value. 412 412 $q = new WP_Query( array( 'orderby' => 'rand' ) ); 413 413 $this->assertContains( 'ORDER BY RAND()', $q->request ); … … 415 415 $this->assertNotContains( 'DESC', $q->request ); 416 416 417 // This isn't allowed 417 // This isn't allowed. 418 418 $q2 = new WP_Query( array( 'order' => 'rand' ) ); 419 419 $this->assertContains( 'ORDER BY', $q2->request ); … … 421 421 $this->assertContains( 'DESC', $q2->request ); 422 422 423 // 'none' is a valid value 423 // 'none' is a valid value. 424 424 $q3 = new WP_Query( array( 'orderby' => 'none' ) ); 425 425 $this->assertNotContains( 'ORDER BY', $q3->request ); … … 427 427 $this->assertNotContains( 'ASC', $q3->request ); 428 428 429 // false is a valid value429 // False is a valid value. 430 430 $q4 = new WP_Query( array( 'orderby' => false ) ); 431 431 $this->assertNotContains( 'ORDER BY', $q4->request ); … … 433 433 $this->assertNotContains( 'ASC', $q4->request ); 434 434 435 // empty array() is a valid value435 // Empty array() is a valid value. 436 436 $q5 = new WP_Query( array( 'orderby' => array() ) ); 437 437 $this->assertNotContains( 'ORDER BY', $q5->request ); … … 567 567 $this->post_id = self::factory()->post->create(); 568 568 569 // Prevent the DB query 569 // Prevent the DB query. 570 570 add_filter( 'posts_request', '__return_empty_string' ); 571 571 add_filter( 'found_posts_query', '__return_empty_string' ); 572 572 573 // Add the post and found_posts 573 // Add the post and found_posts. 574 574 add_filter( 'the_posts', array( $this, 'filter_the_posts' ) ); 575 575 add_filter( 'found_posts', array( $this, 'filter_found_posts' ) ); … … 691 691 692 692 public function set_found_posts_provider() { 693 // count return 0 for null, but 1 for other data you may not expect693 // Count return 0 for null, but 1 for other data you may not expect. 694 694 return array( 695 695 array( null, 0 ),
Note: See TracChangeset
for help on using the changeset viewer.