Skip to content

Commit 51a3dc8

Browse files
committed
Eliminte defining constant
1 parent 326b970 commit 51a3dc8

File tree

4 files changed

+29
-11
lines changed

4 files changed

+29
-11
lines changed

plugins/web-worker-offloading/tests/test-web-worker-offloading.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ public function set_up(): void {
1414
parent::set_up();
1515
$this->reset_wp_dependencies();
1616
add_theme_support( 'html5', array( 'script' ) );
17-
require_once __DIR__ . '/../third-party/woocommerce.php';
18-
require_once __DIR__ . '/../third-party/seo-by-rank-math.php';
1917
}
2018

2119
/**
@@ -351,14 +349,13 @@ public function test_plwwo_mark_scripts_for_offloading(): void {
351349
* @covers ::plwwo_load_third_party_integrations
352350
*/
353351
public function test_plwwo_load_third_party_integrations(): void {
354-
if ( ! defined( 'GOOGLESITEKIT_VERSION' ) ) {
355-
define( 'GOOGLESITEKIT_VERSION', '1.0.0' );
356-
}
357-
do_action( 'plugins_loaded' );
358-
359-
// Check that the integrations have been loaded.
360-
$this->assertTrue( function_exists( 'plwwo_google_site_kit_configure' ) );
361-
$this->assertTrue( function_exists( 'plwwo_rank_math_configure' ) );
362-
$this->assertTrue( function_exists( 'plwwo_woocommerce_configure' ) );
352+
plwwo_load_third_party_integrations();
353+
354+
// Note: Calling the above function won't actually impact these since none of the plugins are active.
355+
// In order to test these being true it would depend on either actually loading those plugins,
356+
// or defining constants/classes in separate processes.
357+
$this->assertFalse( function_exists( 'plwwo_google_site_kit_configure' ) );
358+
$this->assertFalse( function_exists( 'plwwo_rank_math_configure' ) );
359+
$this->assertFalse( function_exists( 'plwwo_woocommerce_configure' ) );
363360
}
364361
}

plugins/web-worker-offloading/tests/third-party/test-google-site-kit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
* @package web-worker-offloading
66
*/
77
class Test_Google_Site_Kit extends WP_UnitTestCase {
8+
/**
9+
* Runs the routine before each test is executed.
10+
*/
11+
public function set_up(): void {
12+
parent::set_up();
13+
require_once __DIR__ . '/../../third-party/google-site-kit.php';
14+
}
815

916
/**
1017
* Test the function that configures WWO for Google Site Kit.

plugins/web-worker-offloading/tests/third-party/test-seo-by-rank-math.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
*/
77

88
class Test_Seo_By_Rank_Math extends WP_UnitTestCase {
9+
/**
10+
* Runs the routine before each test is executed.
11+
*/
12+
public function set_up(): void {
13+
parent::set_up();
14+
require_once __DIR__ . '/../../third-party/seo-by-rank-math.php';
15+
}
916

1017
/**
1118
* Test the function that configures WWO for Rank Math SEO.

plugins/web-worker-offloading/tests/third-party/test-woocommerce.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
*/
77

88
class Test_WooCommerce extends WP_UnitTestCase {
9+
/**
10+
* Runs the routine before each test is executed.
11+
*/
12+
public function set_up(): void {
13+
parent::set_up();
14+
require_once __DIR__ . '/../../third-party/woocommerce.php';
15+
}
916

1017
/**
1118
* Test the function that configures WWO for WooCommerce.

0 commit comments

Comments
 (0)