Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
baa9ab4
Add initial backports
glendaviesnz Jan 31, 2023
b314cf3
Test that invalid CSS is rejected
glendaviesnz Feb 1, 2023
f0a244b
Add tests for global styles custom CSS
glendaviesnz Feb 1, 2023
cecd9ca
fix function name
glendaviesnz Feb 1, 2023
5a11f8a
Fix class naming issue
glendaviesnz Feb 1, 2023
bd7fe93
Fix linting issue
glendaviesnz Feb 1, 2023
76d3f99
Add tests for global custom CSS
glendaviesnz Feb 1, 2023
c446376
add debugging to unit test
glendaviesnz Feb 1, 2023
8f7afa8
check for array or object
glendaviesnz Feb 1, 2023
1f74f52
Remove debugging
glendaviesnz Feb 1, 2023
6787594
Add in check for edit-css capabilities
glendaviesnz Feb 1, 2023
e4d53a2
Add tests for custom CSS user capabilities
glendaviesnz Feb 1, 2023
400d437
Fix permissions issue on multisite test
glendaviesnz Feb 1, 2023
eec32b6
Put permissions assignment in the right place!
glendaviesnz Feb 1, 2023
c9fcd81
Set permissions in tests instead of setup to prevent changing permiss…
glendaviesnz Feb 1, 2023
7450db9
Fixes from code review
glendaviesnz Feb 1, 2023
d6c6e65
Remove unnecessary description
glendaviesnz Feb 1, 2023
20442c9
But make user definition that was removed by mistake
glendaviesnz Feb 1, 2023
d055fa5
Change ordering of $request[styles] assignment to $config[styles]
glendaviesnz Feb 1, 2023
d37e7f2
Change cache key and add doc comments
glendaviesnz Feb 1, 2023
d71a7fe
match cache key to method name
glendaviesnz Feb 1, 2023
b658684
Move check for theme.json to top of function
glendaviesnz Feb 1, 2023
6a986eb
Merge branch 'trunk' into backport/global-styles-custom-css
felixarntz Feb 2, 2023
7261356
Update inline comment.
felixarntz Feb 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Set permissions in tests instead of setup to prevent changing permiss…
…ions for other tests that don't require it
  • Loading branch information
glendaviesnz committed Feb 1, 2023
commit c9fcd81d8f9642c7e79f335e0c0ef9520f6bb82b
11 changes: 6 additions & 5 deletions tests/phpunit/tests/rest-api/rest-global-styles-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ public static function wpSetupBeforeClass( $factory ) {
)
);

if ( is_multisite() ) {
grant_super_admin( self::$admin_id );
}

// This creates the global styles for the current theme.
self::$global_styles_id = $factory->post->create(
array(
Expand Down Expand Up @@ -543,6 +539,9 @@ public function test_assign_edit_css_action_admin() {
*/
public function test_update_item_valid_styles_css() {
wp_set_current_user( self::$admin_id );
if ( is_multisite() ) {
grant_super_admin( self::$admin_id );
}
$request = new WP_REST_Request( 'PUT', '/wp/v2/global-styles/' . self::$global_styles_id );
$request->set_body_params(
array(
Expand All @@ -560,6 +559,9 @@ public function test_update_item_valid_styles_css() {
*/
public function test_update_item_invalid_styles_css() {
wp_set_current_user( self::$admin_id );
if ( is_multisite() ) {
grant_super_admin( self::$admin_id );
}
$request = new WP_REST_Request( 'PUT', '/wp/v2/global-styles/' . self::$global_styles_id );
$request->set_body_params(
array(
Expand All @@ -569,5 +571,4 @@ public function test_update_item_invalid_styles_css() {
$response = rest_get_server()->dispatch( $request );
$this->assertErrorResponse( 'rest_custom_css_illegal_markup', $response, 400 );
}

}
9 changes: 0 additions & 9 deletions tests/phpunit/tests/theme/wpThemeJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
*/
private static $administrator_id;

/**
* User ID.
*
* @var int
*/
private static $user_id;

public static function set_up_before_class() {
parent::set_up_before_class();

Expand All @@ -40,8 +33,6 @@ public static function set_up_before_class() {
if ( is_multisite() ) {
grant_super_admin( self::$administrator_id );
}

static::$user_id = self::factory()->user->create();
}

/**
Expand Down