Make WordPress Core


Ignore:
Timestamp:
10/31/2021 05:17:53 AM (3 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Add visibility information to the Post Types controller.

Props spacedmonkey, peterwilsoncc.
Fixes #54055.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php

    r51397 r51959  
    145145        $data       = $response->get_data();
    146146        $properties = $data['schema']['properties'];
    147         $this->assertCount( 10, $properties );
     147        $this->assertCount( 11, $properties );
    148148        $this->assertArrayHasKey( 'capabilities', $properties );
    149149        $this->assertArrayHasKey( 'description', $properties );
     
    156156        $this->assertArrayHasKey( 'taxonomies', $properties );
    157157        $this->assertArrayHasKey( 'rest_base', $properties );
     158        $this->assertArrayHasKey( 'visibility', $properties );
    158159    }
    159160
     
    217218            }
    218219            $this->assertSame( $viewable, $data['viewable'] );
     220            $visibility = array(
     221                'show_in_nav_menus' => (bool) $post_type_obj->show_in_nav_menus,
     222                'show_ui'           => (bool) $post_type_obj->show_ui,
     223            );
     224            $this->assertSame( $visibility, $data['visibility'] );
    219225            $this->assertSame( get_all_post_type_supports( $post_type_obj->name ), $data['supports'] );
    220226        } else {
Note: See TracChangeset for help on using the changeset viewer.