Changeset 47122 for trunk/tests/phpunit/tests/query/results.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/query/results.php
r46586 r47122 305 305 $posts = $this->q->query( '' ); 306 306 307 // the output should be the most recent 10 posts as listed here307 // The output should be the most recent 10 posts as listed here. 308 308 $expected = array( 309 309 0 => 'tags-a-and-c', … … 325 325 $posts = $this->q->query( 'tag=tag-a' ); 326 326 327 // there are 4 posts with Tag A327 // There are 4 posts with Tag A. 328 328 $this->assertCount( 4, $posts ); 329 329 $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name ); … … 336 336 $posts = $this->q->query( 'tag=tag-b' ); 337 337 338 // there are 4 posts with Tag A338 // There are 4 posts with Tag A. 339 339 $this->assertCount( 4, $posts ); 340 340 $this->assertEquals( 'tags-b-and-c', $posts[0]->post_name ); … … 350 350 $posts = $this->q->query( 'tag=tag-נ' ); 351 351 352 // there is 1 post with Tag נ352 // There is 1 post with Tag נ. 353 353 $this->assertCount( 1, $posts ); 354 354 $this->assertEquals( 'tag-%d7%a0', $posts[0]->post_name ); … … 359 359 $posts = $this->q->query( 'tag_id=' . $tag['term_id'] ); 360 360 361 // there are 4 posts with Tag A361 // There are 4 posts with Tag A. 362 362 $this->assertCount( 4, $posts ); 363 363 $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name ); … … 370 370 $posts = $this->q->query( 'tag_slug__in[]=tag-b&tag_slug__in[]=tag-c' ); 371 371 372 // there are 4 posts with either Tag B or Tag C372 // There are 4 posts with either Tag B or Tag C. 373 373 $this->assertCount( 6, $posts ); 374 374 $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name ); … … 386 386 $posts = $this->q->query( 'tag__in[]=' . $tag_a['term_id'] . '&tag__in[]=' . $tag_b['term_id'] ); 387 387 388 // there are 6 posts with either Tag A or Tag B388 // There are 6 posts with either Tag A or Tag B. 389 389 $this->assertCount( 6, $posts ); 390 390 $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name ); … … 400 400 $posts = $this->q->query( 'tag__not_in[]=' . $tag_a['term_id'] ); 401 401 402 // the most recent 10 posts with Tag A excluded403 // (note the different between this and test_query_default) 402 // The most recent 10 posts with Tag A excluded 403 // (note the different between this and test_query_default). 404 404 $expected = array( 405 405 0 => 'tags-b-and-c', … … 423 423 $posts = $this->q->query( 'tag__in[]=' . $tag_a['term_id'] . '&tag__not_in[]=' . $tag_b['term_id'] ); 424 424 425 // there are 4 posts with Tag A, only 2 when we exclude Tag B425 // There are 4 posts with Tag A, only 2 when we exclude Tag B. 426 426 $this->assertCount( 2, $posts ); 427 427 $this->assertEquals( 'tags-a-and-c', $posts[0]->post_name ); … … 434 434 $posts = $this->q->query( 'category_name=cat-a' ); 435 435 436 // there are 4 posts with Cat A, we'll check for them by name436 // There are 4 posts with Cat A, we'll check for them by name. 437 437 $this->assertCount( 4, $posts ); 438 438 $this->assertEquals( 'cat-a', $posts[0]->post_name ); … … 446 446 $posts = $this->q->query( "cat=$cat" ); 447 447 448 // there are 4 posts with Cat B448 // There are 4 posts with Cat B. 449 449 $this->assertCount( 4, $posts ); 450 450 $this->assertEquals( 'cat-b', $posts[0]->post_name ); … … 529 529 */ 530 530 function test_query_post_parent__in() { 531 // Query for first parent's children 531 // Query for first parent's children. 532 532 $posts = $this->q->query( 533 533 array( … … 546 546 ); 547 547 548 // Second parent's children 548 // Second parent's children. 549 549 $posts = $this->q->query( 550 550 array( … … 563 563 ); 564 564 565 // Both first and second parent's children 565 // Both first and second parent's children. 566 566 $posts = $this->q->query( 567 567 array( … … 582 582 ); 583 583 584 // Third parent's children 584 // Third parent's children. 585 585 $posts = $this->q->query( 586 586 array( … … 630 630 ); 631 631 632 // order=desc does not influence the order of returned results (returns same order as order=asc)632 // 'order=desc' does not influence the order of returned results (returns same order as 'order=asc'). 633 633 $this->assertEquals( $expected_returned_array, wp_list_pluck( $posts, 'post_title' ) ); 634 634 } … … 649 649 ); 650 650 651 // Expect post ids in the same order as post__in array when no 'order' param is passed in651 // Expect post IDs in the same order as post__in array when no 'order' param is passed in. 652 652 $this->assertSame( $expected_returned_array, $q->posts ); 653 653 } … … 669 669 ); 670 670 671 // Expect post ids in the same order as post__in array when order=asc is passed in671 // Expect post IDs in the same order as post__in array when order=asc is passed in. 672 672 $this->assertSame( $expected_returned_array, $q->posts ); 673 673 } … … 689 689 ); 690 690 691 // Note that results are returned in the order specified in the post__in array 692 // Order=desc does not have an effect on the order of returned results691 // Note that results are returned in the order specified in the post__in array. 692 // 'order=desc' does not influence the order of returned results. 693 693 $this->assertSame( $expected_returned_array, $q->posts ); 694 694 } … … 725 725 ); 726 726 727 // order=desc does not influence the order of returned results (returns same order as order=asc)727 // 'order=desc' does not influence the order of returned results (returns same order as 'order=asc'). 728 728 $this->assertSame( $post_name__in_array, array_unique( wp_list_pluck( $q->posts, 'post_title' ) ) ); 729 729 }
Note: See TracChangeset
for help on using the changeset viewer.