|
@@ 527-538 (lines=12) @@
|
| 524 |
|
* @author tonykova |
| 525 |
|
* @covers ::grunion_delete_old_spam |
| 526 |
|
*/ |
| 527 |
|
public function test_grunion_delete_old_spam_deletes_an_old_post_marked_as_spam() { |
| 528 |
|
$post_id = $this->factory->post->create( |
| 529 |
|
array( |
| 530 |
|
'post_type' => 'feedback', |
| 531 |
|
'post_status' => 'spam', |
| 532 |
|
'post_date_gmt' => '1987-01-01 12:00:00', |
| 533 |
|
) |
| 534 |
|
); |
| 535 |
|
|
| 536 |
|
grunion_delete_old_spam(); |
| 537 |
|
$this->assertNull( get_post( $post_id ), 'An old spam feedback should be deleted' ); |
| 538 |
|
} |
| 539 |
|
|
| 540 |
|
/** |
| 541 |
|
* Tests that 'grunion_delete_old_spam' does not delete a new post that is marked as spam. |
|
@@ 546-556 (lines=11) @@
|
| 543 |
|
* @author tonykova |
| 544 |
|
* @covers ::grunion_delete_old_spam |
| 545 |
|
*/ |
| 546 |
|
public function test_grunion_delete_old_spam_does_not_delete_a_new_post_marked_as_spam() { |
| 547 |
|
$post_id = $this->factory->post->create( |
| 548 |
|
array( |
| 549 |
|
'post_type' => 'feedback', |
| 550 |
|
'post_status' => 'spam', |
| 551 |
|
) |
| 552 |
|
); |
| 553 |
|
|
| 554 |
|
grunion_delete_old_spam(); |
| 555 |
|
$this->assertEquals( $post_id, get_post( $post_id )->ID, 'A new spam feedback should be left intact when deleting old spam' ); |
| 556 |
|
} |
| 557 |
|
|
| 558 |
|
/** |
| 559 |
|
* Tests that token is left intact when there is not matching field. |