Make WordPress Core


Ignore:
Timestamp:
07/07/2023 07:27:53 AM (2 years ago)
Author:
isabel_brison
Message:

Editor: rename sync_status and move it to top level.

Renames sync_status to wp_pattern_sync_status and moves it to top level field of wp_block post type.

Props glendaviesnz, aaronrobertshaw, mukesh27, peterwilsoncc.
Fixes 58677.

File:
1 edited

Legend:

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

    r55457 r56160  
    221221        );
    222222    }
     223
     224    /**
     225     * Check that the `wp_pattern_sync_status` postmeta is moved from meta array to top
     226     * level of response.
     227     *
     228     * @ticket 58677
     229     */
     230    public function test_wp_patterns_sync_status_post_meta() {
     231        register_post_meta(
     232            'wp_block',
     233            'wp_pattern_sync_status',
     234            array(
     235                'single'       => true,
     236                'type'         => 'string',
     237                'show_in_rest' => array(
     238                    'schema' => array(
     239                        'type'       => 'string',
     240                        'properties' => array(
     241                            'sync_status' => array(
     242                                'type' => 'string',
     243                            ),
     244                        ),
     245                    ),
     246                ),
     247            )
     248        );
     249        wp_set_current_user( self::$user_ids['author'] );
     250
     251        $request  = new WP_REST_Request( 'GET', '/wp/v2/blocks/' . self::$post_id );
     252        $response = rest_get_server()->dispatch( $request );
     253        $data     = $response->get_data();
     254
     255        $this->assertArrayHasKey( 'wp_pattern_sync_status', $data );
     256        $this->assertArrayNotHasKey( 'wp_pattern_sync_status', $data['meta'] );
     257    }
    223258}
Note: See TracChangeset for help on using the changeset viewer.