You appear to be a bot. Output may be restricted
Description
Usage
WP_Test_REST_TestCase::assertErrorResponse( $code, $response, $status );
Parameters
- $code
- ( mixed ) required –
- $response
- ( mixed ) required –
- $status
- ( mixed ) optional –
Returns
void
Source
File name: wordpress-develop-tests/phpunit/includes/testcase-rest-api.php
Lines:
1 to 16 of 16
protected function assertErrorResponse( $code, $response, $status = null ) { if ( is_a( $response, 'WP_REST_Response' ) ) { $response = $response->as_error(); } $this->assertWPError( $response ); $this->assertSame( $code, $response->get_error_code() ); if ( null !== $status ) { $data = $response->get_error_data(); $this->assertArrayHasKey( 'status', $data ); $this->assertSame( $status, $data['status'] ); } }