diff --git a/tests/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php b/tests/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php index b0965d119b103..254958137f8f0 100644 --- a/tests/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php +++ b/tests/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php @@ -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 ); } /**