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'] ); } } }