|
@@ 468-480 (lines=13) @@
|
| 465 |
|
/** |
| 466 |
|
* @ticket 29612 |
| 467 |
|
*/ |
| 468 |
|
public function test_status_empty_string() |
| 469 |
|
{ |
| 470 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 471 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' )); |
| 472 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'spam' )); |
| 473 |
|
|
| 474 |
|
$q = new WP_Comment_Query(); |
| 475 |
|
$found = $q->query( |
| 476 |
|
array( |
| 477 |
|
'status' => '', |
| 478 |
|
'fields' => 'ids', |
| 479 |
|
) |
| 480 |
|
); |
| 481 |
|
|
| 482 |
|
$this->assertEqualSets(array( $c1, $c2 ), $found); |
| 483 |
|
} |
|
@@ 523-535 (lines=13) @@
|
| 520 |
|
$this->assertEquals(array( $c1 ), $found); |
| 521 |
|
} |
| 522 |
|
|
| 523 |
|
public function test_status_custom() |
| 524 |
|
{ |
| 525 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 526 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' )); |
| 527 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo1' )); |
| 528 |
|
|
| 529 |
|
$q = new WP_Comment_Query(); |
| 530 |
|
$found = $q->query( |
| 531 |
|
array( |
| 532 |
|
'status' => 'foo', |
| 533 |
|
'fields' => 'ids', |
| 534 |
|
) |
| 535 |
|
); |
| 536 |
|
|
| 537 |
|
$this->assertEquals(array( $c2 ), $found); |
| 538 |
|
} |
|
@@ 540-552 (lines=13) @@
|
| 537 |
|
$this->assertEquals(array( $c2 ), $found); |
| 538 |
|
} |
| 539 |
|
|
| 540 |
|
public function test_status_all() |
| 541 |
|
{ |
| 542 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 543 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' )); |
| 544 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' )); |
| 545 |
|
|
| 546 |
|
$q = new WP_Comment_Query(); |
| 547 |
|
$found = $q->query( |
| 548 |
|
array( |
| 549 |
|
'status' => 'all', |
| 550 |
|
'fields' => 'ids', |
| 551 |
|
) |
| 552 |
|
); |
| 553 |
|
|
| 554 |
|
$this->assertEqualSets(array( $c1, $c3 ), $found); |
| 555 |
|
} |
|
@@ 557-568 (lines=12) @@
|
| 554 |
|
$this->assertEqualSets(array( $c1, $c3 ), $found); |
| 555 |
|
} |
| 556 |
|
|
| 557 |
|
public function test_status_default_to_all() |
| 558 |
|
{ |
| 559 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 560 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' )); |
| 561 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' )); |
| 562 |
|
|
| 563 |
|
$q = new WP_Comment_Query(); |
| 564 |
|
$found = $q->query( |
| 565 |
|
array( |
| 566 |
|
'fields' => 'ids', |
| 567 |
|
) |
| 568 |
|
); |
| 569 |
|
|
| 570 |
|
$this->assertEqualSets(array( $c1, $c3 ), $found); |
| 571 |
|
} |
|
@@ 576-588 (lines=13) @@
|
| 573 |
|
/** |
| 574 |
|
* @ticket 29612 |
| 575 |
|
*/ |
| 576 |
|
public function test_status_comma_any() |
| 577 |
|
{ |
| 578 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 579 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' )); |
| 580 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' )); |
| 581 |
|
|
| 582 |
|
$q = new WP_Comment_Query(); |
| 583 |
|
$found = $q->query( |
| 584 |
|
array( |
| 585 |
|
'status' => 'any', |
| 586 |
|
'fields' => 'ids', |
| 587 |
|
) |
| 588 |
|
); |
| 589 |
|
|
| 590 |
|
$this->assertEqualSets(array( $c1, $c2, $c3 ), $found); |
| 591 |
|
} |
|
@@ 596-608 (lines=13) @@
|
| 593 |
|
/** |
| 594 |
|
* @ticket 29612 |
| 595 |
|
*/ |
| 596 |
|
public function test_status_comma_separated() |
| 597 |
|
{ |
| 598 |
|
$c1 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' )); |
| 599 |
|
$c2 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => 'foo' )); |
| 600 |
|
$c3 = self::factory()->comment->create(array( 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' )); |
| 601 |
|
|
| 602 |
|
$q = new WP_Comment_Query(); |
| 603 |
|
$found = $q->query( |
| 604 |
|
array( |
| 605 |
|
'status' => 'approve,foo,bar', |
| 606 |
|
'fields' => 'ids', |
| 607 |
|
) |
| 608 |
|
); |
| 609 |
|
|
| 610 |
|
$this->assertEqualSets(array( $c1, $c2 ), $found); |
| 611 |
|
} |