REST API: Add some missing assertions to various REST API tests.
See #41463 git-svn-id: https://develop.svn.wordpress.org/trunk@41176 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cc134ea791
commit
3304df16d8
|
@ -393,6 +393,8 @@ class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
|
|||
$response = $this->server->dispatch( $request );
|
||||
remove_filter( 'query', array( $this, 'error_insert_query' ) );
|
||||
$wpdb->show_errors = true;
|
||||
|
||||
$this->assertErrorResponse( 'rest_meta_database_error', $response, 500 );
|
||||
}
|
||||
|
||||
public function test_set_value_invalid_type() {
|
||||
|
|
|
@ -101,14 +101,23 @@ class WP_Test_REST_Post_Statuses_Controller extends WP_Test_REST_Controller_Test
|
|||
|
||||
public function test_create_item() {
|
||||
/** Post statuses can't be created **/
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/statuses' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_update_item() {
|
||||
/** Post statuses can't be updated **/
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/statuses/draft' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_delete_item() {
|
||||
/** Post statuses can't be deleted **/
|
||||
$request = new WP_REST_Request( 'DELETE', '/wp/v2/statuses/draft' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_prepare_item() {
|
||||
|
|
|
@ -95,14 +95,23 @@ class WP_Test_REST_Post_Types_Controller extends WP_Test_REST_Controller_Testcas
|
|||
|
||||
public function test_create_item() {
|
||||
/** Post types can't be created **/
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/types' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_update_item() {
|
||||
/** Post types can't be updated **/
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/types/post' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_delete_item() {
|
||||
/** Post types can't be deleted **/
|
||||
$request = new WP_REST_Request( 'DELETE', '/wp/v2/types/post' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_prepare_item() {
|
||||
|
|
|
@ -111,14 +111,23 @@ class WP_Test_REST_Taxonomies_Controller extends WP_Test_REST_Controller_Testcas
|
|||
|
||||
public function test_create_item() {
|
||||
/** Taxonomies can't be created **/
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/taxonomies' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_update_item() {
|
||||
/** Taxonomies can't be updated **/
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/taxonomies/category' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_delete_item() {
|
||||
/** Taxonomies can't be deleted **/
|
||||
$request = new WP_REST_Request( 'DELETE', '/wp/v2/taxonomies/category' );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$this->assertEquals( 404, $response->get_status() );
|
||||
}
|
||||
|
||||
public function test_prepare_item() {
|
||||
|
|
Loading…
Reference in New Issue