Make WordPress Core


Ignore:
Timestamp:
09/21/2022 12:27:33 PM (3 years ago)
Author:
jorgefilipecosta
Message:

Editor: Add has_archive property to the post types REST endpoint.

Backports PHP changes in WordPress/gutenberg#42746 to the core. Adds a has_archive field to the post types endpoint.

Props mcsf, ntsekouras, oandregal.
See #56467.

File:
1 edited

Legend:

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

    r54269 r54273  
    168168        $properties = $data['schema']['properties'];
    169169
    170         $this->assertCount( 13, $properties, 'Schema should have 13 properties' );
     170        $this->assertCount( 14, $properties, 'Schema should have 14 properties' );
    171171        $this->assertArrayHasKey( 'capabilities', $properties, '`capabilities` should be included in the schema' );
    172172        $this->assertArrayHasKey( 'description', $properties, '`description` should be included in the schema' );
     
    177177        $this->assertArrayHasKey( 'slug', $properties, '`slug` should be included in the schema' );
    178178        $this->assertArrayHasKey( 'supports', $properties, '`supports` should be included in the schema' );
     179        $this->assertArrayHasKey( 'has_archive', $properties, '`has_archive` should be included in the schema' );
    179180        $this->assertArrayHasKey( 'taxonomies', $properties, '`taxonomies` should be included in the schema' );
    180181        $this->assertArrayHasKey( 'rest_base', $properties, '`rest_base` should be included in the schema' );
     
    231232        $this->assertSame( $post_type_obj->rest_base, $data['rest_base'] );
    232233        $this->assertSame( $post_type_obj->rest_namespace, $data['rest_namespace'] );
     234        $this->assertSame( $post_type_obj->has_archive, $data['has_archive'] );
    233235
    234236        $links = test_rest_expand_compact_links( $links );
Note: See TracChangeset for help on using the changeset viewer.