mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
See #51344 git-svn-id: https://develop.svn.wordpress.org/trunk@49606 602fd350-edb4-49c9-b593-d223f7449a82
20 lines
517 B
PHP
20 lines
517 B
PHP
<?php
|
|
|
|
abstract class WP_Test_REST_TestCase extends WP_UnitTestCase {
|
|
protected function assertErrorResponse( $code, $response, $status = null ) {
|
|
|
|
if ( is_a( $response, 'WP_REST_Response' ) ) {
|
|
$response = $response->as_error();
|
|
}
|
|
|
|
$this->assertWPError( $response );
|
|
$this->assertEquals( $code, $response->get_error_code() );
|
|
|
|
if ( null !== $status ) {
|
|
$data = $response->get_error_data();
|
|
$this->assertArrayHasKey( 'status', $data );
|
|
$this->assertEquals( $status, $data['status'] );
|
|
}
|
|
}
|
|
}
|