- Timestamp:
- 04/05/2022 09:50:13 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php
r52399 r53072 117 117 $routes['/wp/v2/global-styles/themes/(?P<stylesheet>[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?)'], 118 118 'Theme global styles route does not have exactly one element' 119 ); 120 $this->assertArrayHasKey( 121 '/wp/v2/global-styles/themes/(?P<stylesheet>[\/\s%\w\.\(\)\[\]\@_\-]+)/variations', 122 $routes, 123 'Theme global styles variations route does not exist' 119 124 ); 120 125 } … … 456 461 $this->assertArrayHasKey( 'title', $properties, 'Schema properties array does not have "title" key' ); 457 462 } 463 464 465 public function test_get_theme_items() { 466 wp_set_current_user( self::$admin_id ); 467 switch_theme( 'block-theme' ); 468 $request = new WP_REST_Request( 'GET', '/wp/v2/global-styles/themes/block-theme/variations' ); 469 $response = rest_get_server()->dispatch( $request ); 470 $data = $response->get_data(); 471 $expected = array( 472 array( 473 'version' => 2, 474 'settings' => array( 475 'color' => array( 476 'palette' => array( 477 'theme' => array( 478 array( 479 'slug' => 'foreground', 480 'color' => '#3F67C6', 481 'name' => 'Foreground', 482 ), 483 ), 484 ), 485 ), 486 ), 487 'styles' => array( 488 'blocks' => array( 489 'core/post-title' => array( 490 'typography' => array( 491 'fontWeight' => '700', 492 ), 493 ), 494 ), 495 ), 496 'title' => 'variation', 497 ), 498 ); 499 $this->assertSameSetsWithIndex( $data, $expected ); 500 } 458 501 }
Note: See TracChangeset
for help on using the changeset viewer.