Skip to content

Commit

Permalink
Tests: simplify test set up in `WP_Block_Supports_Block_Style_Variati…
Browse files Browse the repository at this point in the history
…ons_Test` (WordPress#62637)

* Clean all JSON caches, including WP_Theme_JSON_Resolver_Gutenberg::clean_cached_data(), after test suite runs, not just after any tests

* LINT THE UNIVERSE THEN SET IT ON FIRE

* Test reverting cache reset from tear_down_after_class()


Co-authored-by: ramonjd <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent f45aa20 commit c222a5f
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions phpunit/block-supports/block-style-variations-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,6 @@ class WP_Block_Supports_Block_Style_Variations_Test extends WP_UnitTestCase {
*/
private $orig_theme_dir;

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

self::$administrator_id = self::factory()->user->create(
array(
'role' => 'administrator',
'user_email' => '[email protected]',
)
);

static::$property_blocks_cache = new ReflectionProperty( WP_Theme_JSON_Resolver_Gutenberg::class, 'blocks_cache' );
static::$property_blocks_cache->setAccessible( true );
static::$property_blocks_cache_orig_value = static::$property_blocks_cache->getValue();

static::$property_core = new ReflectionProperty( WP_Theme_JSON_Resolver_Gutenberg::class, 'core' );
static::$property_core->setAccessible( true );
static::$property_core_orig_value = static::$property_core->getValue();
}

public static function tear_down_after_class() {
static::$property_blocks_cache->setValue( null, static::$property_blocks_cache_orig_value );
static::$property_core->setValue( null, static::$property_core_orig_value );
parent::tear_down_after_class();
}

public function set_up() {
parent::set_up();
$this->theme_root = realpath( dirname( __DIR__ ) . '/data/themedir1' );
Expand Down

0 comments on commit c222a5f

Please sign in to comment.