Make WordPress Core

Ticket #39466: 39466.2.diff

File 39466.2.diff, 1.6 KB (added by jnylen0, 7 years ago)

Improved unit tests

  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index 25e9c9a..16765a5 100644
    a b class WP_REST_Posts_Controller extends WP_REST_Controller { 
    17671767                                        'description' => __( 'A named status for the object.' ),
    17681768                                        'type'        => 'string',
    17691769                                        'enum'        => array_keys( get_post_stati( array( 'internal' => false ) ) ),
    1770                                         'context'     => array( 'edit' ),
     1770                                        'context'     => array( 'view', 'edit' ),
    17711771                                ),
    17721772                                'type'            => array(
    17731773                                        'description' => __( 'Type of Post for the object.' ),
  • tests/phpunit/includes/testcase-rest-post-type-controller.php

    diff --git a/tests/phpunit/includes/testcase-rest-post-type-controller.php b/tests/phpunit/includes/testcase-rest-post-type-controller.php
    index 49c2eba..387d359 100644
    a b abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C 
    134134                        $this->assertFalse( isset( $data['excerpt'] ) );
    135135                }
    136136
     137                $this->assertEquals( $post->post_status, $data['status'] );
    137138                $this->assertEquals( $post->guid, $data['guid']['rendered'] );
    138139
    139140                if ( 'edit' === $context ) {
    140141                        $this->assertEquals( $post->guid, $data['guid']['raw'] );
    141                         $this->assertEquals( $post->post_status, $data['status'] );
    142142
    143143                        if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
    144144                                $this->assertNull( $data['date_gmt'] );