WordPress.org

Make WordPress Core

Ticket #41605: 41605.patch

File 41605.patch, 3.2 KB (added by johnbillion, 3 years ago)
  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index f9de7360bd..cb8620afdb 100644
    class WP_REST_Posts_Controller extends WP_REST_Controller { 
    18141814                                'title',
    18151815                                'editor',
    18161816                                'author',
    1817                                 'excerpt',
    18181817                                'thumbnail',
    18191818                                'comments',
    18201819                                'revisions',
  • tests/phpunit/tests/rest-api/rest-pages-controller.php

    diff --git tests/phpunit/tests/rest-api/rest-pages-controller.php tests/phpunit/tests/rest-api/rest-pages-controller.php
    index ee24f7af69..105f49c9a6 100644
    class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    446446                $data = $response->get_data();
    447447                $this->assertEquals( '', $data['content']['rendered'] );
    448448                $this->assertTrue( $data['content']['protected'] );
    449                 $this->assertEquals( '', $data['excerpt']['rendered'] );
    450                 $this->assertTrue( $data['excerpt']['protected'] );
     449                $this->assertArrayNotHasKey( 'excerpt', $data );
    451450        }
    452451
    453452        public function test_get_page_with_password_using_password() {
    class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    466465                $data = $response->get_data();
    467466                $this->assertEquals( wpautop( $page->post_content ), $data['content']['rendered'] );
    468467                $this->assertTrue( $data['content']['protected'] );
    469                 $this->assertEquals( wpautop( $page->post_excerpt ), $data['excerpt']['rendered'] );
    470                 $this->assertTrue( $data['excerpt']['protected'] );
     468                $this->assertArrayNotHasKey( 'excerpt', $data );
    471469        }
    472470
    473471        public function test_get_page_with_password_using_incorrect_password() {
    class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    496494                $data = $response->get_data();
    497495                $this->assertEquals( '', $data['content']['rendered'] );
    498496                $this->assertTrue( $data['content']['protected'] );
    499                 $this->assertEquals( '', $data['excerpt']['rendered'] );
    500                 $this->assertTrue( $data['excerpt']['protected'] );
     497                $this->assertArrayNotHasKey( 'excerpt', $data );
    501498        }
    502499
    503500        public function test_get_item_schema() {
    class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    505502                $response = $this->server->dispatch( $request );
    506503                $data = $response->get_data();
    507504                $properties = $data['schema']['properties'];
    508                 $this->assertEquals( 22, count( $properties ) );
     505                $this->assertEquals( 21, count( $properties ) );
    509506                $this->assertArrayHasKey( 'author', $properties );
    510507                $this->assertArrayHasKey( 'comment_status', $properties );
    511508                $this->assertArrayHasKey( 'content', $properties );
    512509                $this->assertArrayHasKey( 'date', $properties );
    513510                $this->assertArrayHasKey( 'date_gmt', $properties );
    514511                $this->assertArrayHasKey( 'guid', $properties );
    515                 $this->assertArrayHasKey( 'excerpt', $properties );
     512                $this->assertArrayNotHasKey( 'excerpt', $properties );
    516513                $this->assertArrayHasKey( 'featured_media', $properties );
    517514                $this->assertArrayHasKey( 'id', $properties );
    518515                $this->assertArrayHasKey( 'link', $properties );