Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -268,24 +268,57 @@ public function test_context_param() {
}

/**
* @doesNotPerformAssertions
* Font collections is read-only; create requests should not match a route.
*
* @ticket 66073
*/
public function test_create_item() {
// Controller does not use test_create_item().
wp_set_current_user( self::$admin_id );

$request = new WP_REST_Request( 'POST', '/wp/v2/font-collections' );
$response = rest_get_server()->dispatch( $request );

$this->assertErrorResponse( 'rest_no_route', $response, 404 );
}

/**
* @doesNotPerformAssertions
* Font collections is read-only; update requests should not match a route.
*
* @ticket 66073
*/
public function test_update_item() {
// Controller does not use test_update_item().
wp_set_current_user( self::$admin_id );

$route = '/wp/v2/font-collections/mock-col-slug';

$response = rest_get_server()->dispatch( new WP_REST_Request( 'GET', $route ) );
$this->assertSame( 200, $response->get_status() );

foreach ( array( 'POST', 'PUT', 'PATCH' ) as $method ) {
$request = new WP_REST_Request( $method, $route );
$response = rest_get_server()->dispatch( $request );

$this->assertErrorResponse( 'rest_no_route', $response, 404 );
}
}

/**
* @doesNotPerformAssertions
* Font collections is read-only; delete requests should not match a route.
*
* @ticket 66073
*/
public function test_delete_item() {
// Controller does not use test_delete_item().
wp_set_current_user( self::$admin_id );

$route = '/wp/v2/font-collections/mock-col-slug';

$response = rest_get_server()->dispatch( new WP_REST_Request( 'GET', $route ) );
$this->assertSame( 200, $response->get_status() );

$request = new WP_REST_Request( 'DELETE', $route );
$response = rest_get_server()->dispatch( $request );

$this->assertErrorResponse( 'rest_no_route', $response, 404 );
}

/**
Expand Down
Loading