Add invalid note ID test (https://github.com/woocommerce/woocommerce-admin/pull/1197)
This commit is contained in:
parent
e0596ea249
commit
268182e75f
|
@ -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.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue