- Timestamp:
- 12/14/2021 04:29:03 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php
r52342 r52374 153 153 $response = rest_get_server()->dispatch( $request ); 154 154 $data = $response->get_data(); 155 unset( $data['_links'] ); 156 155 $links = $response->get_links(); 157 156 $this->assertArrayHasKey( 'settings', $data ); 158 157 $this->assertArrayHasKey( 'styles', $data ); 158 $this->assertArrayHasKey( 'self', $links ); 159 $this->assertStringContainsString( '/wp/v2/global-styles/themes/tt1-blocks', $links['self'][0]['href'] ); 160 } 161 162 /** 163 * @covers WP_REST_Global_Styles_Controller::get_theme_item 164 * @ticket 54595 165 */ 166 public function test_get_theme_item_fields() { 167 wp_set_current_user( self::$admin_id ); 168 $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/themes/tt1-blocks' ); 169 $request->set_param( '_fields', 'settings' ); 170 $response = rest_get_server()->dispatch( $request ); 171 $data = $response->get_data(); 172 $this->assertArrayHasKey( 'settings', $data ); 173 $this->assertArrayNotHasKey( 'styles', $data ); 159 174 } 160 175 … … 224 239 $response = rest_get_server()->dispatch( $request ); 225 240 $data = $response->get_data(); 226 unset( $data['_links']);241 $links = $response->get_links(); 227 242 228 243 $this->assertEquals( … … 238 253 $data 239 254 ); 255 256 $this->assertArrayHasKey( 'self', $links ); 257 $this->assertStringContainsString( '/wp/v2/global-styles/' . self::$global_styles_id, $links['self'][0]['href'] ); 240 258 } 241 259
Note: See TracChangeset
for help on using the changeset viewer.