WordPress.org

Make WordPress Core

Ticket #40270: 40270.diff

File 40270.diff, 2.7 KB (added by dlh, 2 years ago)
  • tests/phpunit/includes/testcase-rest-post-type-controller.php

     
    202202        protected function check_get_posts_response( $response, $context = 'view' ) {
    203203                $this->assertNotInstanceOf( 'WP_Error', $response );
    204204                $response = rest_ensure_response( $response );
     205                $this->assertNotInstanceOf( 'WP_Error', $response->as_error() );
    205206                $this->assertEquals( 200, $response->get_status() );
    206207
    207208                $headers = $response->get_headers();
     
    229230        protected function check_get_post_response( $response, $context = 'view' ) {
    230231                $this->assertNotInstanceOf( 'WP_Error', $response );
    231232                $response = rest_ensure_response( $response );
     233                $this->assertNotInstanceOf( 'WP_Error', $response->as_error() );
    232234                $this->assertEquals( 200, $response->get_status() );
    233235
    234236                $data = $response->get_data();
     
    240242        protected function check_create_post_response( $response ) {
    241243                $this->assertNotInstanceOf( 'WP_Error', $response );
    242244                $response = rest_ensure_response( $response );
     245                $this->assertNotInstanceOf( 'WP_Error', $response->as_error() );
    243246
    244247                $this->assertEquals( 201, $response->get_status() );
    245248                $headers = $response->get_headers();
     
    253256        protected function check_update_post_response( $response ) {
    254257                $this->assertNotInstanceOf( 'WP_Error', $response );
    255258                $response = rest_ensure_response( $response );
     259                $this->assertNotInstanceOf( 'WP_Error', $response->as_error() );
    256260
    257261                $this->assertEquals( 200, $response->get_status() );
    258262                $headers = $response->get_headers();
  • tests/phpunit/tests/rest-api/rest-posts-controller.php

     
    28372837                $request->set_param( 'force', 'false' );
    28382838                $response = $this->server->dispatch( $request );
    28392839
    2840                 $this->assertNotInstanceOf( 'WP_Error', $response );
     2840                $this->assertNotInstanceOf( 'WP_Error', $response->as_error() );
    28412841                $this->assertEquals( 200, $response->get_status() );
    28422842                $data = $response->get_data();
    28432843                $this->assertEquals( 'Deleted post', $data['title']['raw'] );
     
    28522852                $request['force'] = true;
    28532853                $response = $this->server->dispatch( $request );
    28542854
    2855                 $this->assertNotInstanceOf( 'WP_Error', $response );
     2855                $this->assertNotInstanceOf( 'WP_Error', $response->as_error() );
    28562856                $this->assertEquals( 200, $response->get_status() );
    28572857                $data = $response->get_data();
    28582858                $this->assertTrue( $data['deleted'] );