Make WordPress Core


Ignore:
Timestamp:
01/19/2023 12:11:57 PM (2 years ago)
Author:
youknowriad
Message:

Editor: Allow block pattern categories to have descriptions.

Updates the corresponding REST API endpoint and unit test.

Fixes #57478.

File:
1 edited

Legend:

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

    r54088 r55097  
    7575
    7676        // Register some categories in the test registry.
    77         $test_registry->register( 'test', array( 'label' => 'Test' ) );
    78         $test_registry->register( 'query', array( 'label' => 'Query' ) );
     77        $test_registry->register(
     78            'test',
     79            array(
     80                'label'       => 'Test',
     81                'description' => 'Test description',
     82            )
     83        );
     84        $test_registry->register(
     85            'query',
     86            array(
     87                'label'       => 'Query',
     88                'description' => 'Query',
     89            )
     90        );
    7991    }
    8092
     
    104116
    105117        $expected_names  = array( 'test', 'query' );
    106         $expected_fields = array( 'name', 'label' );
     118        $expected_fields = array( 'name', 'label', 'description' );
    107119
    108120        $request            = new WP_REST_Request( 'GET', static::REQUEST_ROUTE );
    109         $request['_fields'] = 'name,label';
     121        $request['_fields'] = 'name,label,description';
    110122        $response           = rest_get_server()->dispatch( $request );
    111123        $data               = $response->get_data();
Note: See TracChangeset for help on using the changeset viewer.