-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename sync_status top wp_sync_status and move to top level field of wp_block post type #4761
Changes from all commits
39975b1
4a8245f
cbb6450
24cc9ca
bf2ccc2
ce0491b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -220,4 +220,39 @@ public function test_content() { | |||||||||||||
$data['content'] | ||||||||||||||
); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
/** | ||||||||||||||
* Check that the `wp_pattern_sync_status` postmeta is moved from meta array to top | ||||||||||||||
* level of response. | ||||||||||||||
* | ||||||||||||||
* @ticket 58677 | ||||||||||||||
*/ | ||||||||||||||
public function test_wp_patterns_sync_status_post_meta() { | ||||||||||||||
register_post_meta( | ||||||||||||||
'wp_block', | ||||||||||||||
'wp_pattern_sync_status', | ||||||||||||||
array( | ||||||||||||||
'single' => true, | ||||||||||||||
'type' => 'string', | ||||||||||||||
'show_in_rest' => array( | ||||||||||||||
'schema' => array( | ||||||||||||||
'type' => 'string', | ||||||||||||||
'properties' => array( | ||||||||||||||
'sync_status' => array( | ||||||||||||||
'type' => 'string', | ||||||||||||||
), | ||||||||||||||
), | ||||||||||||||
Comment on lines
+240
to
+244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Should this be matching the actual post meta registration? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was just mocking the minimum required to make the test valid, we are not testing the post meta registration, just that the meta field is moved so the only thing that matters in terms of this test is that a field of type string called I don't have a strong opinion on this though, can just copy and paste the full registration if that is seen as better practice. |
||||||||||||||
), | ||||||||||||||
), | ||||||||||||||
) | ||||||||||||||
); | ||||||||||||||
wp_set_current_user( self::$user_ids['author'] ); | ||||||||||||||
|
||||||||||||||
$request = new WP_REST_Request( 'GET', '/wp/v2/blocks/' . self::$post_id ); | ||||||||||||||
$response = rest_get_server()->dispatch( $request ); | ||||||||||||||
$data = $response->get_data(); | ||||||||||||||
|
||||||||||||||
$this->assertArrayHasKey( 'wp_pattern_sync_status', $data ); | ||||||||||||||
$this->assertArrayNotHasKey( 'wp_pattern_sync_status', $data['meta'] ); | ||||||||||||||
} | ||||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either Tim or @spacedmonkey will have a better idea than I as to whether this is the best approach for moving the value to the top level.
Am I correct in thinking this endpoint is read only?