This commit is contained in:
Joshua T Flowers 2018-12-29 01:44:53 +08:00 committed by Timmy Crawford
parent e0596ea249
commit 268182e75f
1 changed files with 14 additions and 0 deletions

View File

@ -82,6 +82,20 @@ class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
$this->assertEquals( 'http://example.org/wp-admin/admin.php?s=PHPUNIT_TEST_NOTE_1_ACTION_1_URL', $note['actions'][0]->url ); $this->assertEquals( 'http://example.org/wp-admin/admin.php?s=PHPUNIT_TEST_NOTE_1_ACTION_1_URL', $note['actions'][0]->url );
} }
/**
* Test getting a 404 from invalid ID.
*
* @since 3.5.0
*/
public function test_get_invalid_note() {
wp_set_current_user( $this->user );
$response = $this->server->dispatch( new WP_REST_Request( 'GET', $this->endpoint . '/999' ) );
$note = $response->get_data();
$this->assertEquals( 404, $response->get_status() );
}
/** /**
* Test getting a single note without permission. It should fail. * Test getting a single note without permission. It should fail.
* *