diff --git a/tests/phpunit/tests/rest-api/rest-post-meta-fields.php b/tests/phpunit/tests/rest-api/rest-post-meta-fields.php
index 71bcfdcd87..61cce6a1f5 100644
|
a
|
b
|
class WP_Test_REST_Post_Meta_Fields extends WP_Test_REST_TestCase {
|
| 2120 | 2120 | $this->assertEquals( array( 'BuddyPress' ), $meta[1] ); |
| 2121 | 2121 | } |
| 2122 | 2122 | |
| | 2123 | public function test_update_meta_with_unchanged_values() { |
| | 2124 | register_post_meta( |
| | 2125 | 'post', |
| | 2126 | 'list', |
| | 2127 | array( |
| | 2128 | 'single' => true, |
| | 2129 | 'type' => 'array', |
| | 2130 | 'show_in_rest' => array( |
| | 2131 | 'schema' => array( |
| | 2132 | 'type' => 'array', |
| | 2133 | 'items' => array( |
| | 2134 | 'type' => 'string', |
| | 2135 | ), |
| | 2136 | ), |
| | 2137 | ), |
| | 2138 | ) |
| | 2139 | ); |
| | 2140 | |
| | 2141 | add_post_meta( self::$post_id, 'list', array( 'WordCamp' ) ); |
| | 2142 | |
| | 2143 | $this->grant_write_permission(); |
| | 2144 | |
| | 2145 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| | 2146 | $request->set_body_params( |
| | 2147 | array( |
| | 2148 | 'meta' => array( |
| | 2149 | 'list' => array( 'WordCamp' ), |
| | 2150 | ), |
| | 2151 | ) |
| | 2152 | ); |
| | 2153 | |
| | 2154 | $response = rest_get_server()->dispatch( $request ); |
| | 2155 | $this->assertEquals( 200, $response->get_status() ); |
| | 2156 | |
| | 2157 | $data = $response->get_data(); |
| | 2158 | $this->assertEquals( array( 'WordCamp' ), $data['meta']['list'] ); |
| | 2159 | } |
| | 2160 | |
| 2123 | 2161 | /** |
| 2124 | 2162 | * Internal function used to disable an insert query which |
| 2125 | 2163 | * will trigger a wpdb error for testing purposes. |