Skip to content

Commit

Permalink
Add test coverage for “unsnoozing” notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffstieler committed Mar 20, 2019
1 parent e59a3d3 commit 5a7c069
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/api/admin-notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,31 @@ public function test_get_actioned_notes() {
$this->assertEquals( 3, count( $notes ) );
}

/**
* Test note "unsnoozing".
*/
public function test_note_unsnoozing() {
wp_set_current_user( $this->user );

$request = new WP_REST_Request( 'GET', $this->endpoint );
$request->set_query_params( array( 'status' => 'snoozed' ) );
$response = $this->server->dispatch( $request );
$notes = $response->get_data();

$this->assertEquals( 200, $response->get_status() );
$this->assertEquals( 1, count( $notes ) );
$this->assertEquals( $notes[0]['title'], 'PHPUNIT_TEST_NOTE_3_TITLE' );

// The test snoozed note's reminder date is an hour ago.
WC_Admin_Notes::unsnooze_notes();

$response = $this->server->dispatch( $request );
$notes = $response->get_data();

$this->assertEquals( 200, $response->get_status() );
$this->assertEmpty( $notes );
}

/**
* Test getting lots of notes without permission. It should fail.
*
Expand Down

0 comments on commit 5a7c069

Please sign in to comment.