Make WordPress Core

Changeset 63952


Ignore:
Timestamp:
09/27/2026 05:40:51 PM (44 hours ago)
Author:
lancewillett
Message:

Tests: Assert the block pattern categories item schema.

Verify that OPTIONS advertises the expected name, label, and description properties in the block pattern categories schema.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/13781

Props shailu25.
See #40538.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php

    r62957 r63952  
    227227
    228228        /**
    229          * @doesNotPerformAssertions
     229         * @ticket 40538
     230         *
     231         * @covers WP_REST_Block_Pattern_Categories_Controller::get_item_schema
    230232         */
    231233        public function test_get_item_schema() {
    232                 // Controller does not implement get_item_schema().
     234                $request  = new WP_REST_Request( 'OPTIONS', static::REQUEST_ROUTE );
     235                $response = rest_get_server()->dispatch( $request );
     236                $data     = $response->get_data();
     237
     238                $properties = $data['schema']['properties'];
     239                $this->assertCount( 3, $properties, 'The schema should contain 3 properties.' );
     240                $this->assertArrayHasKey( 'name', $properties, 'The schema should contain a name property.' );
     241                $this->assertArrayHasKey( 'label', $properties, 'The schema should contain a label property.' );
     242                $this->assertArrayHasKey( 'description', $properties, 'The schema should contain a description property.' );
    233243        }
    234244}
Note: See TracChangeset for help on using the changeset viewer.