Commit 92db7ba 1 parent 2b570aa commit 92db7ba Copy full SHA for 92db7ba
File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
class WP_Theme_Json_Test extends WP_UnitTestCase {
9
9
10
+ public function set_up () {
11
+ parent ::set_up ();
12
+ $ this ->theme_root = realpath ( __DIR__ . '/data/themedir1 ' );
13
+
14
+ $ this ->orig_theme_dir = $ GLOBALS ['wp_theme_directories ' ];
15
+
16
+ // /themes is necessary as theme.php functions assume /themes is the root if there is only one root.
17
+ $ GLOBALS ['wp_theme_directories ' ] = array ( WP_CONTENT_DIR . '/themes ' , $ this ->theme_root );
18
+
19
+ add_filter ( 'theme_root ' , array ( $ this , 'filter_set_theme_root ' ) );
20
+ add_filter ( 'stylesheet_root ' , array ( $ this , 'filter_set_theme_root ' ) );
21
+ add_filter ( 'template_root ' , array ( $ this , 'filter_set_theme_root ' ) );
22
+ $ this ->queries = array ();
23
+ // Clear caches.
24
+ wp_clean_themes_cache ();
25
+ unset( $ GLOBALS ['wp_themes ' ] );
26
+ }
27
+
28
+ public function tear_down () {
29
+ $ GLOBALS ['wp_theme_directories ' ] = $ this ->orig_theme_dir ;
30
+ wp_clean_themes_cache ();
31
+ unset( $ GLOBALS ['wp_themes ' ] );
32
+ parent ::tear_down ();
33
+ }
34
+
35
+ public function filter_set_theme_root () {
36
+ return $ this ->theme_root ;
37
+ }
38
+
10
39
/**
11
40
* Test that it reports correctly themes that have a theme.json.
12
41
*
You can’t perform that action at this time.
0 commit comments