Skip to content

Commit 4e0de9a

Browse files
committed
Tests: Check that theme tests start without cached theme.json data.
The new class fills the theme.json caches in `wpSetUpBeforeClass()`, as an earlier class can, and checks that its test does not see that data. See #66755.
1 parent 635c42c commit 4e0de9a

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
require_once __DIR__ . '/base.php';
4+
5+
/**
6+
* Tests for the `WP_Theme_UnitTestCase` base class.
7+
*
8+
* @group themes
9+
*/
10+
class Tests_Theme_WpThemeUnitTestCase extends WP_Theme_UnitTestCase {
11+
12+
public static function wpSetUpBeforeClass() {
13+
add_theme_support(
14+
'editor-color-palette',
15+
array(
16+
array(
17+
'name' => 'Stale',
18+
'slug' => 'stale',
19+
'color' => '#123456',
20+
),
21+
)
22+
);
23+
wp_get_global_settings();
24+
remove_theme_support( 'editor-color-palette' );
25+
}
26+
27+
/**
28+
* @ticket 66755
29+
*/
30+
public function test_set_up_discards_theme_json_data_cached_before_the_test() {
31+
$this->assertStringNotContainsString( '--wp--preset--color--stale', wp_get_global_stylesheet( array( 'variables' ) ) );
32+
}
33+
}

0 commit comments

Comments
 (0)