diff --git a/tests/framework/class-wc-unit-test-case.php b/tests/framework/class-wc-unit-test-case.php index 6cf77fed61b..0eda33d48c0 100644 --- a/tests/framework/class-wc-unit-test-case.php +++ b/tests/framework/class-wc-unit-test-case.php @@ -22,28 +22,6 @@ class WC_Unit_Test_Case extends WP_UnitTestCase { */ protected $factory; - /** - * Additional files, relative to the plugin's root directory, that should be explicitly included. - * - * @var array - */ - protected static $includes; - - /** - * If a test has declared include files, load them before running the tests in the class. - * - * @beforeClass - */ - public static function include_dependencies() { - $base_dir = trailingslashit( dirname( dirname( __DIR__ ) ) ); - - if ( ! empty( static::$includes ) ) { - foreach ( (array) static::$includes as $include ) { - include_once $base_dir . $include; - } - } - } - /** * Setup test case. * diff --git a/tests/unit-tests/admin/reports/class-wc-tests-admin-report.php b/tests/unit-tests/admin/reports/class-wc-tests-admin-report.php index 5f29301255d..2ae0ec743dd 100644 --- a/tests/unit-tests/admin/reports/class-wc-tests-admin-report.php +++ b/tests/unit-tests/admin/reports/class-wc-tests-admin-report.php @@ -11,13 +11,12 @@ class WC_Tests_Admin_Report extends WC_Unit_Test_Case { /** - * Additional files, relative to the plugin's root directory, that should be explicitly included. + * Load the necessary files, as they're not automatically loaded by WooCommerce. * - * @var array */ - public static $includes = array( - 'includes/admin/reports/class-wc-admin-report.php', - ); + public static function setUpBeforeClass() { + include_once WC_Unit_Tests_Bootstrap::instance()->plugin_dir . '/includes/admin/reports/class-wc-admin-report.php'; + } /** * Clear cached report data. diff --git a/tests/unit-tests/admin/reports/class-wc-tests-report-sales-by-date.php b/tests/unit-tests/admin/reports/class-wc-tests-report-sales-by-date.php index a046d1a2db5..89def3b5903 100644 --- a/tests/unit-tests/admin/reports/class-wc-tests-report-sales-by-date.php +++ b/tests/unit-tests/admin/reports/class-wc-tests-report-sales-by-date.php @@ -11,14 +11,12 @@ class WC_Tests_Report_Sales_By_Date extends WC_Unit_Test_Case { /** - * Additional files, relative to the plugin's root directory, that should be explicitly included. - * - * @var array + * Load the necessary files, as they're not automatically loaded by WooCommerce. */ - protected static $includes = array( - 'includes/admin/reports/class-wc-admin-report.php', - 'includes/admin/reports/class-wc-report-sales-by-date.php', - ); + public static function setUpBeforeClass() { + include_once WC_Unit_Tests_Bootstrap::instance()->plugin_dir . '/includes/admin/reports/class-wc-admin-report.php'; + include_once WC_Unit_Tests_Bootstrap::instance()->plugin_dir . '/includes/admin/reports/class-wc-report-sales-by-date.php'; + } /** * Clear cached report data.