File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
plugins/dominant-color-images/tests Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 5
5
use WP_UnitTestCase ;
6
6
7
7
abstract class TestCase extends WP_UnitTestCase {
8
+
9
+ /**
10
+ * Runs the routine before each test is executed.
11
+ */
12
+ public function set_up (): void {
13
+ parent ::set_up ();
14
+ $ this ->reset_wp_dependencies ();
15
+ }
16
+
17
+ /**
18
+ * After a test method runs, resets any state in WordPress the test method might have changed.
19
+ */
20
+ public function tear_down (): void {
21
+ parent ::tear_down ();
22
+ $ this ->reset_wp_dependencies ();
23
+ }
24
+
25
+ /**
26
+ * Reset WP_Scripts and WP_Styles.
27
+ */
28
+ private function reset_wp_dependencies (): void {
29
+ $ GLOBALS ['wp_scripts ' ] = null ;
30
+ $ GLOBALS ['wp_styles ' ] = null ;
31
+ }
32
+
8
33
/**
9
34
* Data provider for test_get_dominant_color_GD.
10
35
*
Original file line number Diff line number Diff line change @@ -480,9 +480,8 @@ public function test_dominant_color_admin_inline_style(): void {
480
480
* @covers ::dominant_color_admin_script
481
481
*/
482
482
public function test_dominant_color_admin_script (): void {
483
- ob_start ();
484
- dominant_color_admin_script ();
485
- $ output = ob_get_clean ();
483
+
484
+ $ output = get_echo ( 'dominant_color_admin_script ' );
486
485
487
486
// Verify if script tag exists.
488
487
$ this ->assertStringEndsWith ( '</script> ' , trim ( $ output ) );
You can’t perform that action at this time.
0 commit comments