diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f9acf1caa4..3cc115054c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ defaults: jobs: test: name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - timeout-minutes: 15 + timeout-minutes: 20 runs-on: ubuntu-latest continue-on-error: ${{ matrix.wp == 'nightly' }} strategy: diff --git a/.github/workflows/pr-unit-tests.yml b/.github/workflows/pr-unit-tests.yml index 7b4c0d28c46..edde98d9fc5 100644 --- a/.github/workflows/pr-unit-tests.yml +++ b/.github/workflows/pr-unit-tests.yml @@ -8,7 +8,7 @@ defaults: jobs: test: name: PHP ${{ matrix.php }} WP ${{ matrix.wp }} - timeout-minutes: 15 + timeout-minutes: 20 runs-on: ubuntu-latest continue-on-error: ${{ matrix.wp == 'nightly' }} strategy: diff --git a/plugins/woocommerce/tests/bin/phpunit.sh b/plugins/woocommerce/tests/bin/phpunit.sh index dac66c29273..662ed6ac1de 100755 --- a/plugins/woocommerce/tests/bin/phpunit.sh +++ b/plugins/woocommerce/tests/bin/phpunit.sh @@ -5,7 +5,7 @@ if [[ ${RUN_PHPCS} == 1 ]] || [[ ${RUN_E2E} == 1 ]]; then fi if [[ ${RUN_CODE_COVERAGE} == 1 ]]; then - phpdbg -qrr ./vendor/bin/phpunit -d memory_limit=-1 -c phpunit.xml --coverage-clover=coverage.clover --exclude-group=timeout $@ + phpdbg -qrr ./vendor/bin/phpunit -d memory_limit=-1 -c phpunit.xml --coverage-clover=coverage.clover --exclude-group=timeout --exclude-group=run-in-seprate-process $@ else vendor/bin/phpunit -c phpunit.xml $@ fi diff --git a/plugins/woocommerce/tests/legacy/bootstrap.php b/plugins/woocommerce/tests/legacy/bootstrap.php index 4ddd4cea3d7..6c29298d0a5 100644 --- a/plugins/woocommerce/tests/legacy/bootstrap.php +++ b/plugins/woocommerce/tests/legacy/bootstrap.php @@ -7,12 +7,13 @@ */ use Automattic\WooCommerce\Proxies\LegacyProxy; +use Automattic\WooCommerce\Internal\Admin\FeaturePlugin; use Automattic\WooCommerce\Testing\Tools\CodeHacking\CodeHacker; use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\StaticMockerHack; use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\FunctionsMockerHack; use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\BypassFinalsHack; use Automattic\WooCommerce\Testing\Tools\DependencyManagement\MockableLegacyProxy; - +\PHPUnit\Framework\Error\Deprecated::$enabled = false; /** * Class WC_Unit_Tests_Bootstrap */ @@ -46,6 +47,9 @@ class WC_Unit_Tests_Bootstrap { ini_set( 'display_errors', 'on' ); // phpcs:ignore WordPress.PHP.IniSet.display_errors_Blacklisted error_reporting( E_ALL ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.prevent_path_disclosure_error_reporting, WordPress.PHP.DiscouragedPHPFunctions.runtime_configuration_error_reporting + // Ensure theme install tests use direct filesystem method. + define( 'FS_METHOD', 'direct' ); + // Ensure server variable is set for WP email functions. // phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected if ( ! isset( $_SERVER['SERVER_NAME'] ) ) { @@ -67,6 +71,9 @@ class WC_Unit_Tests_Bootstrap { // install WC. tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) ); + // Set up WC-Admin config. + tests_add_filter( 'woocommerce_admin_get_feature_config', array( $this, 'add_development_features' ) ); + /* * Load PHPUnit Polyfills for the WP testing suite. * @see https://github.com/WordPress/wordpress-develop/pull/1563/ @@ -168,7 +175,12 @@ class WC_Unit_Tests_Bootstrap { public function load_wc() { define( 'WC_TAX_ROUNDING_MODE', 'auto' ); define( 'WC_USE_TRANSACTIONS', false ); + update_option( 'woocommerce_enable_coupons', 'yes' ); + update_option( 'woocommerce_calc_taxes', 'yes' ); + update_option( 'woocommerce_onboarding_opt_in', 'yes' ); + require_once $this->plugin_dir . '/woocommerce.php'; + FeaturePlugin::instance()->init(); } /** @@ -177,7 +189,6 @@ class WC_Unit_Tests_Bootstrap { * @since 2.2 */ public function install_wc() { - // Clean existing install first. define( 'WP_UNINSTALL_PLUGIN', true ); define( 'WC_REMOVE_ALL_DATA', true ); @@ -206,13 +217,13 @@ class WC_Unit_Tests_Bootstrap { * @since 2.2 */ public function includes() { - // framework. require_once $this->tests_dir . '/framework/class-wc-unit-test-factory.php'; require_once $this->tests_dir . '/framework/class-wc-mock-session-handler.php'; require_once $this->tests_dir . '/framework/class-wc-mock-wc-data.php'; require_once $this->tests_dir . '/framework/class-wc-mock-wc-object-query.php'; require_once $this->tests_dir . '/framework/class-wc-mock-payment-gateway.php'; + require_once $this->tests_dir . '/framework/class-wc-mock-enhanced-payment-gateway.php'; require_once $this->tests_dir . '/framework/class-wc-payment-token-stub.php'; require_once $this->tests_dir . '/framework/vendor/class-wp-test-spy-rest-server.php'; @@ -232,11 +243,29 @@ class WC_Unit_Tests_Bootstrap { require_once $this->tests_dir . '/framework/helpers/class-wc-helper-shipping-zones.php'; require_once $this->tests_dir . '/framework/helpers/class-wc-helper-payment-token.php'; require_once $this->tests_dir . '/framework/helpers/class-wc-helper-settings.php'; + require_once $this->tests_dir . '/framework/helpers/class-wc-helper-reports.php'; + require_once $this->tests_dir . '/framework/helpers/class-wc-helper-admin-notes.php'; + require_once $this->tests_dir . '/framework/helpers/class-wc-test-action-queue.php'; + require_once $this->tests_dir . '/framework/helpers/class-wc-helper-queue.php'; // Traits. require_once $this->tests_dir . '/framework/traits/trait-wc-rest-api-complex-meta.php'; } + /** + * Use the `development` features for testing. + * + * @param array $flags Existing feature flags. + * @return array Filtered feature flags. + */ + public function add_development_features( $flags ) { + $config = json_decode( file_get_contents( $this->plugin_dir . '/../woocommerce-admin/config/development.json' ) ); // @codingStandardsIgnoreLine. + foreach ( $config->features as $feature => $bool ) { + $flags[ $feature ] = $bool; + } + return $flags; + } + /** * Get the single class instance. * diff --git a/plugins/woocommerce-admin/tests/framework/class-wc-mock-enhanced-payment-gateway.php b/plugins/woocommerce/tests/legacy/framework/class-wc-mock-enhanced-payment-gateway.php similarity index 100% rename from plugins/woocommerce-admin/tests/framework/class-wc-mock-enhanced-payment-gateway.php rename to plugins/woocommerce/tests/legacy/framework/class-wc-mock-enhanced-payment-gateway.php diff --git a/plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-admin-notes.php b/plugins/woocommerce/tests/legacy/framework/helpers/class-wc-helper-admin-notes.php similarity index 100% rename from plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-admin-notes.php rename to plugins/woocommerce/tests/legacy/framework/helpers/class-wc-helper-admin-notes.php diff --git a/plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-queue.php b/plugins/woocommerce/tests/legacy/framework/helpers/class-wc-helper-queue.php similarity index 100% rename from plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-queue.php rename to plugins/woocommerce/tests/legacy/framework/helpers/class-wc-helper-queue.php diff --git a/plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-reports.php b/plugins/woocommerce/tests/legacy/framework/helpers/class-wc-helper-reports.php similarity index 100% rename from plugins/woocommerce-admin/tests/framework/helpers/class-wc-helper-reports.php rename to plugins/woocommerce/tests/legacy/framework/helpers/class-wc-helper-reports.php diff --git a/plugins/woocommerce-admin/tests/framework/helpers/class-wc-test-action-queue.php b/plugins/woocommerce/tests/legacy/framework/helpers/class-wc-test-action-queue.php similarity index 100% rename from plugins/woocommerce-admin/tests/framework/helpers/class-wc-test-action-queue.php rename to plugins/woocommerce/tests/legacy/framework/helpers/class-wc-test-action-queue.php diff --git a/plugins/woocommerce-admin/tests/api-init.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api-init.php similarity index 97% rename from plugins/woocommerce-admin/tests/api-init.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api-init.php index 9dbdd996871..9b8af6ded34 100644 --- a/plugins/woocommerce-admin/tests/api-init.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api-init.php @@ -11,9 +11,9 @@ use Automattic\WooCommerce\Internal\Admin\Schedulers\OrdersScheduler; use \Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\DataStore as OrdersStatsDataStore; /** - * Class WC_Tests_API_Init + * Class WC_Admin_Tests_API_Init */ -class WC_Tests_API_Init extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Init extends WC_REST_Unit_Test_Case { /** * Set up. */ diff --git a/plugins/woocommerce-admin/tests/api/admin-notes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/admin-notes.php similarity index 99% rename from plugins/woocommerce-admin/tests/api/admin-notes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/admin-notes.php index 1e9aa57123d..87e6c9affd6 100644 --- a/plugins/woocommerce-admin/tests/api/admin-notes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/admin-notes.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Notes\Note; use Automattic\WooCommerce\Admin\Notes\Notes; /** - * Class WC_Tests_API_Admin_Notes + * Class WC_Admin_Tests_API_Admin_Notes */ -class WC_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/data.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/data.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/data.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/data.php index 320d173c33e..9dc9321f273 100644 --- a/plugins/woocommerce-admin/tests/api/data.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/data.php @@ -8,7 +8,7 @@ /** * WC Tests API Data */ -class WC_Tests_API_Data extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Data extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/experiments.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/experiments.php similarity index 94% rename from plugins/woocommerce-admin/tests/api/experiments.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/experiments.php index 878023250d6..ab28daaeea8 100644 --- a/plugins/woocommerce-admin/tests/api/experiments.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/experiments.php @@ -10,7 +10,7 @@ use \Automattic\WooCommerce\Admin\API\Experiments; /** * WC Tests API Options */ -class WC_Tests_API_Experiments extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Experiments extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/leaderboards.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/leaderboards.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/leaderboards.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/leaderboards.php index 41cfb157e67..e5d039c972c 100644 --- a/plugins/woocommerce-admin/tests/api/leaderboards.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/leaderboards.php @@ -8,7 +8,7 @@ /** * WC Tests API Leaderboards */ -class WC_Tests_API_Leaderboards extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Leaderboards extends WC_REST_Unit_Test_Case { /** * Endpoints. * diff --git a/plugins/woocommerce-admin/tests/api/onboarding-product-types.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-product-types.php similarity index 96% rename from plugins/woocommerce-admin/tests/api/onboarding-product-types.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-product-types.php index 21b10bc6434..23d39843a21 100644 --- a/plugins/woocommerce-admin/tests/api/onboarding-product-types.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-product-types.php @@ -11,7 +11,7 @@ use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProducts; /** * WC Tests API Onboarding Product Types */ -class WC_Tests_API_Onboarding_Product_Types extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Onboarding_Product_Types extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/onboarding-profile.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/onboarding-profile.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php index 715e244a8c9..365893f6ede 100644 --- a/plugins/woocommerce-admin/tests/api/onboarding-profile.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-profile.php @@ -13,7 +13,7 @@ use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile as Profil /** * WC Tests API Onboarding Profile */ -class WC_Tests_API_Onboarding_Profiles extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Onboarding_Profiles extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/onboarding-tasks.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-tasks.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/onboarding-tasks.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-tasks.php index 18c30e4e408..6cd8bdc88d4 100644 --- a/plugins/woocommerce-admin/tests/api/onboarding-tasks.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-tasks.php @@ -11,10 +11,17 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task; require_once __DIR__ . '/../features/onboarding-tasks/test-task.php'; +// Wrokaround to suppress exif_read_data errors from +// https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/image.php#L835 +define('WP_RUN_CORE_TESTS', false); + /** * WC Tests API Onboarding Tasks + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled + * @group run-in-seprate-process */ -class WC_Tests_API_Onboarding_Tasks extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Onboarding_Tasks extends WC_REST_Unit_Test_Case { /** * Endpoints. @@ -55,6 +62,8 @@ class WC_Tests_API_Onboarding_Tasks extends WC_REST_Unit_Test_Case { public function tearDown() { parent::tearDown(); $this->remove_color_or_logo_attribute_taxonomy(); + TaskLists::clear_lists(); + TaskLists::init_default_lists(); } /** diff --git a/plugins/woocommerce-admin/tests/api/onboarding-themes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-themes.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/onboarding-themes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-themes.php index 3f763c1e773..3bb563b6c8b 100644 --- a/plugins/woocommerce-admin/tests/api/onboarding-themes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/onboarding-themes.php @@ -11,7 +11,7 @@ use \Automattic\WooCommerce\Internal\Admin\Onboarding; /** * WC Tests API Onboarding Themes */ -class WC_Tests_API_Onboarding_Themes extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Onboarding_Themes extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/options.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/options.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/options.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/options.php index fedc9d4359d..3558011ba93 100644 --- a/plugins/woocommerce-admin/tests/api/options.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/options.php @@ -10,7 +10,7 @@ use \Automattic\WooCommerce\Admin\API\Options; /** * WC Tests API Options */ -class WC_Tests_API_Options extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Options extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/orders.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/orders.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/orders.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/orders.php index ad9ff519b79..270f4cf1340 100644 --- a/plugins/woocommerce-admin/tests/api/orders.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/orders.php @@ -11,7 +11,7 @@ use Automattic\WooCommerce\Admin\API\Reports\Controller as ReportsController; /** * WC Tests API Orders */ -class WC_Tests_API_Orders extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Orders extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/plugins.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/plugins.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/plugins.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/plugins.php index b09affb826d..3d23adf9cf4 100644 --- a/plugins/woocommerce-admin/tests/api/plugins.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/plugins.php @@ -10,7 +10,7 @@ use \Automattic\WooCommerce\Admin\API\Plugins; /** * WC Tests API Plugins */ -class WC_Tests_API_Plugins extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Plugins extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/product-attributes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/product-attributes.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/product-attributes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/product-attributes.php index 71276cdc2c8..5b9db85bcd6 100644 --- a/plugins/woocommerce-admin/tests/api/product-attributes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/product-attributes.php @@ -6,9 +6,9 @@ */ /** - * Class WC_Tests_API_Product_Attributes + * Class WC_Admin_Tests_API_Product_Attributes */ -class WC_Tests_API_Product_Attributes extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Product_Attributes extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/product-reviews.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/product-reviews.php similarity index 93% rename from plugins/woocommerce-admin/tests/api/product-reviews.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/product-reviews.php index 85adbe0bdc7..1b379a4c710 100644 --- a/plugins/woocommerce-admin/tests/api/product-reviews.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/product-reviews.php @@ -8,7 +8,7 @@ /** * WC Tests API Product Reviews */ -class WC_Tests_API_Product_Reviews extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Product_Reviews extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/products-lowinstock.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/products-lowinstock.php similarity index 95% rename from plugins/woocommerce-admin/tests/api/products-lowinstock.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/products-lowinstock.php index 730c69e70ef..581a10ba4f3 100644 --- a/plugins/woocommerce-admin/tests/api/products-lowinstock.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/products-lowinstock.php @@ -8,7 +8,7 @@ /** * WC Tests API ProductsLowInStock */ -class WC_Tests_API_ProductsLowInStock extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_ProductsLowInStock extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/products.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/products.php similarity index 52% rename from plugins/woocommerce-admin/tests/api/products.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/products.php index 526fa901b16..d1a3164b4ec 100644 --- a/plugins/woocommerce-admin/tests/api/products.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/products.php @@ -7,8 +7,11 @@ /** * WC Tests API Products + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled + * @group run-in-seprate-process */ -class WC_Tests_API_Products extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Products extends WC_REST_Unit_Test_Case { /** * Endpoints. @@ -61,39 +64,4 @@ class WC_Tests_API_Products extends WC_REST_Unit_Test_Case { $product->delete( true ); } - - - /** - * Test low stock query. - */ - public function test_low_stock() { - wp_set_current_user( $this->user ); - - // Create a product with stock management. - $product = WC_Helper_Product::create_simple_product(); - $product->set_manage_stock( true ); - $product->set_low_stock_amount( 2 ); - $product->set_stock_quantity( 5 ); - $product->save(); - - // Order enough of the product to trigger low stock status. - $order_time = '2020-11-24T10:00:00'; - $order = WC_Helper_Order::create_order( 1, $product ); - $order->set_status( 'completed' ); - $order->set_date_created( $order_time ); - $order->save(); - - // Sync analytics data (used for last order date). - WC_Helper_Queue::run_all_pending(); - - $request = new WP_REST_Request( 'GET', '/wc-analytics/products' ); - $request->set_param( 'low_in_stock', true ); - $response = $this->server->dispatch( $request ); - $data = $response->get_data(); - - $this->assertEquals( 200, $response->get_status() ); - $this->assertCount( 1, $data ); - $this->assertEquals( $product->get_id(), $data[0]['id'] ); - $this->assertEquals( $order_time, $data[0]['last_order_date'] ); - } } diff --git a/plugins/woocommerce-admin/tests/api/report-controllers.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/report-controllers.php similarity index 96% rename from plugins/woocommerce-admin/tests/api/report-controllers.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/report-controllers.php index 7993f028b0d..622e399b902 100644 --- a/plugins/woocommerce-admin/tests/api/report-controllers.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/report-controllers.php @@ -12,7 +12,7 @@ * @package WooCommerce\Admin\Tests\API * @since 3.6.4 */ -class WC_Tests_API_Report_Controllers extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Report_Controllers extends WC_REST_Unit_Test_Case { /** * Setup test admin notes data. Called before every test. * diff --git a/plugins/woocommerce-admin/tests/api/reports-categories.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-categories.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/reports-categories.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-categories.php index 2dbbdd6b1d2..43fcb622e53 100644 --- a/plugins/woocommerce-admin/tests/api/reports-categories.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-categories.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Internal\Admin\CategoryLookup; /** - * Class WC_Tests_API_Reports_Categories + * Class WC_Admin_Tests_API_Reports_Categories */ -class WC_Tests_API_Reports_Categories extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Categories extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-coupons-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-coupons-stats.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-coupons-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-coupons-stats.php index 785d80a5e19..b46bc172f2e 100644 --- a/plugins/woocommerce-admin/tests/api/reports-coupons-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-coupons-stats.php @@ -6,9 +6,9 @@ */ /** - * Class WC_Tests_API_Reports_Coupons_Stats + * Class WC_Admin_Tests_API_Reports_Coupons_Stats */ -class WC_Tests_API_Reports_Coupons_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Coupons_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-coupons.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-coupons.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-coupons.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-coupons.php index 6d8a2e2e6ac..6c3994cfc63 100644 --- a/plugins/woocommerce-admin/tests/api/reports-coupons.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-coupons.php @@ -6,9 +6,9 @@ */ /** - * Class WC_Tests_API_Reports_Coupons + * Class WC_Admin_Tests_API_Reports_Coupons */ -class WC_Tests_API_Reports_Coupons extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Coupons extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-customers-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-customers-stats.php similarity index 96% rename from plugins/woocommerce-admin/tests/api/reports-customers-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-customers-stats.php index c88eac12547..57a6346cb24 100644 --- a/plugins/woocommerce-admin/tests/api/reports-customers-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-customers-stats.php @@ -8,11 +8,13 @@ /** * Reports Customers Stats REST API Test Class - * + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled + * @group run-in-seprate-process * @package WooCommerce\Admin\Tests\API * @since 3.5.0 */ -class WC_Tests_API_Reports_Customers_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Customers_Stats extends WC_REST_Unit_Test_Case { /** * Endpoint. * diff --git a/plugins/woocommerce-admin/tests/api/reports-customers.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-customers.php similarity index 99% rename from plugins/woocommerce-admin/tests/api/reports-customers.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-customers.php index 018d776db1f..a48cd0955fc 100644 --- a/plugins/woocommerce-admin/tests/api/reports-customers.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-customers.php @@ -10,11 +10,13 @@ use \Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore as CustomersDa /** * Reports Customers REST API Test Class - * + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled + * @group run-in-seprate-process * @package WooCommerce\Admin\Tests\API * @since 3.5.0 */ -class WC_Tests_API_Reports_Customers extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Customers extends WC_REST_Unit_Test_Case { /** * Endpoint. * diff --git a/plugins/woocommerce-admin/tests/api/reports-downloads-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-downloads-stats.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/reports-downloads-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-downloads-stats.php index ccc0a09b71a..d8703988202 100644 --- a/plugins/woocommerce-admin/tests/api/reports-downloads-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-downloads-stats.php @@ -6,9 +6,9 @@ */ /** - * WC_Tests_API_Reports_Downloads_Stats + * WC_Admin_Tests_API_Reports_Downloads_Stats */ -class WC_Tests_API_Reports_Downloads_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Downloads_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-downloads.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-downloads.php similarity index 99% rename from plugins/woocommerce-admin/tests/api/reports-downloads.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-downloads.php index c05f28b916f..256e2594b9a 100644 --- a/plugins/woocommerce-admin/tests/api/reports-downloads.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-downloads.php @@ -6,9 +6,9 @@ */ /** - * WC_Tests_API_Reports_Downloads + * WC_Admin_Tests_API_Reports_Downloads */ -class WC_Tests_API_Reports_Downloads extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Downloads extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-export.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-export.php similarity index 95% rename from plugins/woocommerce-admin/tests/api/reports-export.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-export.php index f83eed9a170..a542faf153f 100644 --- a/plugins/woocommerce-admin/tests/api/reports-export.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-export.php @@ -7,9 +7,9 @@ */ /** - * Class WC_Tests_API_Reports_Export + * Class WC_Admin_Tests_API_Reports_Export */ -class WC_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case { /** * Export route. * @@ -67,6 +67,7 @@ class WC_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case { */ public function test_taxes_report_export() { global $wpdb; + add_filter( 'wc_tax_enabled', '__return_true' ); wp_set_current_user( $this->user ); WC_Helper_Reports::reset_stats_dbs(); @@ -152,5 +153,6 @@ class WC_Tests_API_Reports_Export extends WC_REST_Unit_Test_Case { $this->assertEquals( 100, $status['percent_complete'] ); $this->assertStringMatchesFormat( '%s/wp-admin/?action=woocommerce_admin_download_report_csv&filename=wc-taxes-report-export-%d', $status['download_url'] ); $this->assertStringMatchesFormat( '%s/wc-analytics/reports/taxes/export/%d/status', $status['_links']['self'][0]['href'] ); + remove_filter( 'wc_tax_enabled', '__return_true' ); } } diff --git a/plugins/woocommerce-admin/tests/api/reports-import.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-import.php similarity index 99% rename from plugins/woocommerce-admin/tests/api/reports-import.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-import.php index b40d7cb6476..8f01cc398ba 100644 --- a/plugins/woocommerce-admin/tests/api/reports-import.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-import.php @@ -12,7 +12,7 @@ use Automattic\WooCommerce\Admin\ReportsSync; * * @package WooCommerce\Admin\Tests\API */ -class WC_Tests_API_Reports_Import extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Import extends WC_REST_Unit_Test_Case { /** * Endpoint. * diff --git a/plugins/woocommerce-admin/tests/api/reports-interval.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-interval.php similarity index 99% rename from plugins/woocommerce-admin/tests/api/reports-interval.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-interval.php index 216a3ff1e8a..c75d6c9d604 100644 --- a/plugins/woocommerce-admin/tests/api/reports-interval.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-interval.php @@ -9,9 +9,9 @@ use \Automattic\WooCommerce\Admin\API\Reports\TimeInterval; /** - * Class WC_Tests_Reports_Interval_Stats + * Class WC_Admin_Tests_Reports_Interval_Stats */ -class WC_Tests_Reports_Interval_Stats extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Interval_Stats extends WC_Unit_Test_Case { /** * Local timezone used throughout the tests. diff --git a/plugins/woocommerce-admin/tests/api/reports-orders-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-orders-stats.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-orders-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-orders-stats.php index 893e5c95614..e13161b1496 100644 --- a/plugins/woocommerce-admin/tests/api/reports-orders-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-orders-stats.php @@ -6,13 +6,13 @@ */ /** - * WC_Tests_API_Reports_Orders_Stats + * WC_Admin_Tests_API_Reports_Orders_Stats */ /** - * Class WC_Tests_API_Reports_Orders_Stats + * Class WC_Admin_Tests_API_Reports_Orders_Stats */ -class WC_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Orders_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-orders.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-orders.php similarity index 99% rename from plugins/woocommerce-admin/tests/api/reports-orders.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-orders.php index db9198da059..19fafadc80d 100644 --- a/plugins/woocommerce-admin/tests/api/reports-orders.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-orders.php @@ -14,7 +14,7 @@ use \Automattic\WooCommerce\Admin\API\Reports\Customers\DataStore as CustomersDa * @package WooCommerce\Admin\Tests\API * @since 3.5.0 */ -class WC_Tests_API_Reports_Orders extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Orders extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-performance-indicators.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-performance-indicators.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/reports-performance-indicators.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-performance-indicators.php index 1ae7ef9242b..6f359eef767 100644 --- a/plugins/woocommerce-admin/tests/api/reports-performance-indicators.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-performance-indicators.php @@ -6,9 +6,9 @@ */ /** - * WC_Tests_API_Reports_Performance_Indicators + * WC_Admin_Tests_API_Reports_Performance_Indicators */ -class WC_Tests_API_Reports_Performance_Indicators extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Performance_Indicators extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-products-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-products-stats.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-products-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-products-stats.php index 8c0273faa94..74e754d444a 100644 --- a/plugins/woocommerce-admin/tests/api/reports-products-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-products-stats.php @@ -7,9 +7,9 @@ */ /** - * Class WC_Tests_API_Reports_Products_Stats + * Class WC_Admin_Tests_API_Reports_Products_Stats */ -class WC_Tests_API_Reports_Products_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Products_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-products.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-products.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/reports-products.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-products.php index 4fd708b5414..5bc90beae28 100644 --- a/plugins/woocommerce-admin/tests/api/reports-products.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-products.php @@ -12,7 +12,7 @@ * @package WooCommerce\Admin\Tests\API * @since 3.5.0 */ -class WC_Tests_API_Reports_Products extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Products extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-revenue-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-revenue-stats.php similarity index 96% rename from plugins/woocommerce-admin/tests/api/reports-revenue-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-revenue-stats.php index 1a396cc1c9b..8855c62d784 100644 --- a/plugins/woocommerce-admin/tests/api/reports-revenue-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-revenue-stats.php @@ -7,9 +7,9 @@ */ /** - * Class WC_Tests_API_Reports_Revenue_Stats + * Class WC_Admin_Tests_API_Reports_Revenue_Stats */ -class WC_Tests_API_Reports_Revenue_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Revenue_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-stock-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-stock-stats.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-stock-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-stock-stats.php index 1f81ca3056b..4c1ff7f4fc0 100644 --- a/plugins/woocommerce-admin/tests/api/reports-stock-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-stock-stats.php @@ -6,9 +6,9 @@ */ /** - * Class WC_Tests_API_Reports_Stock_Stats + * Class WC_Admin_Tests_API_Reports_Stock_Stats */ -class WC_Tests_API_Reports_Stock_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Stock_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-stock.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-stock.php similarity index 96% rename from plugins/woocommerce-admin/tests/api/reports-stock.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-stock.php index 6eec3f2a5d0..4f14009bac3 100644 --- a/plugins/woocommerce-admin/tests/api/reports-stock.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-stock.php @@ -7,9 +7,9 @@ */ /** - * Class WC_Tests_API_Reports_Stock + * Class WC_Admin_Tests_API_Reports_Stock */ -class WC_Tests_API_Reports_Stock extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Stock extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-taxes-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-taxes-stats.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-taxes-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-taxes-stats.php index 3c2f70f0770..537477bfe19 100644 --- a/plugins/woocommerce-admin/tests/api/reports-taxes-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-taxes-stats.php @@ -7,9 +7,9 @@ */ /** - * WC_Tests_API_Reports_Taxes_Stats + * WC_Admin_Tests_API_Reports_Taxes_Stats */ -class WC_Tests_API_Reports_Taxes_Stats extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Taxes_Stats extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-taxes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-taxes.php similarity index 98% rename from plugins/woocommerce-admin/tests/api/reports-taxes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-taxes.php index ff26561700e..90e00202fd8 100644 --- a/plugins/woocommerce-admin/tests/api/reports-taxes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-taxes.php @@ -7,9 +7,9 @@ */ /** - * WC_Tests_API_Reports_Taxes + * WC_Admin_Tests_API_Reports_Taxes */ -class WC_Tests_API_Reports_Taxes extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Taxes extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/reports-variations.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-variations.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/reports-variations.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-variations.php index c943932f569..93cbaacc743 100644 --- a/plugins/woocommerce-admin/tests/api/reports-variations.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/reports-variations.php @@ -7,9 +7,9 @@ */ /** - * Class WC_Tests_API_Reports_Variations + * Class WC_Admin_Tests_API_Reports_Variations */ -class WC_Tests_API_Reports_Variations extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Reports_Variations extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/themes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/themes.php similarity index 96% rename from plugins/woocommerce-admin/tests/api/themes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/themes.php index b3608059e7e..f49b211c278 100644 --- a/plugins/woocommerce-admin/tests/api/themes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/themes.php @@ -8,7 +8,7 @@ /** * WC Tests API Themes */ -class WC_Tests_API_Themes extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Themes extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/api/variations.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/variations.php similarity index 97% rename from plugins/woocommerce-admin/tests/api/variations.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/variations.php index 1f31d66b11d..c403505dd69 100644 --- a/plugins/woocommerce-admin/tests/api/variations.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/api/variations.php @@ -8,7 +8,7 @@ /** * WC Tests API Variations */ -class WC_Tests_API_Variations extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_API_Variations extends WC_REST_Unit_Test_Case { /** * Endpoints. diff --git a/plugins/woocommerce-admin/tests/batch-queue.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/batch-queue.php similarity index 98% rename from plugins/woocommerce-admin/tests/batch-queue.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/batch-queue.php index 31f3bbc4af3..2f76665d2e5 100644 --- a/plugins/woocommerce-admin/tests/batch-queue.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/batch-queue.php @@ -15,7 +15,7 @@ use Automattic\WooCommerce\Internal\Admin\Schedulers\OrdersScheduler; * @package WooCommerce\Admin\Tests\Reports * @since 3.5.0 */ -class WC_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_Reports_Regenerate_Batching extends WC_REST_Unit_Test_Case { /** * Queue batch size. * diff --git a/plugins/woocommerce-admin/tests/category-lookup.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/category-lookup.php similarity index 100% rename from plugins/woocommerce-admin/tests/category-lookup.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/category-lookup.php diff --git a/plugins/woocommerce-admin/tests/db-updates/class-wc-tests-update-is-read-from-last-read.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/db-updates/class-wc-tests-update-is-read-from-last-read.php similarity index 97% rename from plugins/woocommerce-admin/tests/db-updates/class-wc-tests-update-is-read-from-last-read.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/db-updates/class-wc-tests-update-is-read-from-last-read.php index 6d7f0b1b05f..697579c2743 100644 --- a/plugins/woocommerce-admin/tests/db-updates/class-wc-tests-update-is-read-from-last-read.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/db-updates/class-wc-tests-update-is-read-from-last-read.php @@ -7,7 +7,7 @@ use Automattic\WooCommerce\Admin\Notes\Note; * * @package WooCommerce\Admin\Tests\DBUpdates */ -class WC_Tests_Update_Is_Read_From_Last_Read extends WC_Unit_Test_Case { +class WC_Admin_Tests_Update_Is_Read_From_Last_Read extends WC_Unit_Test_Case { /** * @var object current user */ diff --git a/plugins/woocommerce-admin/tests/features/class-wc-tests-ces-tracks.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php similarity index 81% rename from plugins/woocommerce-admin/tests/features/class-wc-tests-ces-tracks.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php index 61993824f1e..d576d672814 100644 --- a/plugins/woocommerce-admin/tests/features/class-wc-tests-ces-tracks.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php @@ -8,24 +8,45 @@ use Automattic\WooCommerce\Internal\Admin\CustomerEffortScoreTracks; // CustomerEffortScoreTracks only works in wp-admin, so let's fake it. -define( 'WP_ADMIN', true ); +class CurrentScreenMock { + public function in_admin() { + return true; + } +} /** - * Class WC_Tests_CES_Tracks + * Class WC_Admin_Tests_CES_Tracks */ -class WC_Tests_CES_Tracks extends WC_Unit_Test_Case { +class WC_Admin_Tests_CES_Tracks extends WC_Unit_Test_Case { /** * @var CustomerEffortScoreTracks */ private $ces; + /** + * @var object Backup object of $GLOBALS['current_screen']; + */ + private $current_screen_backup; + /** * Overridden setUp method from PHPUnit */ public function setUp() { parent::setUp(); update_option( 'woocommerce_allow_tracking', 'yes' ); + if ( isset( $GLOBALS['current_screen'] ) ) { + $this->current_screen_backup = $GLOBALS['current_screen']; + } + $GLOBALS['current_screen'] = new CurrentScreenMock(); + } + + public function tearDown() { + parent::tearDown(); + if ( $this->current_screen_backup ) { + $GLOBALS['current_screen'] = $this->current_screen_backup; + } + update_option( 'woocommerce_allow_tracking', 'no' ); } /** diff --git a/plugins/woocommerce-admin/tests/features/class-wc-tests-onboarding.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-onboarding.php similarity index 90% rename from plugins/woocommerce-admin/tests/features/class-wc-tests-onboarding.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-onboarding.php index 28ee7a049f3..a7fa20a9353 100644 --- a/plugins/woocommerce-admin/tests/features/class-wc-tests-onboarding.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-onboarding.php @@ -8,9 +8,9 @@ use \Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingThemes; /** - * Class WC_Tests_Onboarding + * Class WC_Admin_Tests_Onboarding */ -class WC_Tests_Onboarding extends WC_Unit_Test_Case { +class WC_Admin_Tests_Onboarding extends WC_Unit_Test_Case { /** * Verifies that given an array of theme objects, the object containing Storefront will be sorted to the first position. diff --git a/plugins/woocommerce-admin/tests/features/class-wc-tests-shipping-label-banner-display-rules.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-shipping-label-banner-display-rules.php similarity index 98% rename from plugins/woocommerce-admin/tests/features/class-wc-tests-shipping-label-banner-display-rules.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-shipping-label-banner-display-rules.php index f4679cdf58a..ad7984352d7 100644 --- a/plugins/woocommerce-admin/tests/features/class-wc-tests-shipping-label-banner-display-rules.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-shipping-label-banner-display-rules.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Internal\Admin\ShippingLabelBannerDisplayRules; /** - * Class WC_Tests_Shipping_Label_Banner_Display_Rules + * Class WC_Admin_Tests_Shipping_Label_Banner_Display_Rules */ -class WC_Tests_Shipping_Label_Banner_Display_Rules extends WC_Unit_Test_Case { +class WC_Admin_Tests_Shipping_Label_Banner_Display_Rules extends WC_Unit_Test_Case { /** * Jetpack version to test the display manager. diff --git a/plugins/woocommerce-admin/tests/features/class-wc-tests-transient-notices.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-transient-notices.php similarity index 91% rename from plugins/woocommerce-admin/tests/features/class-wc-tests-transient-notices.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-transient-notices.php index a9373f481c9..5be12b8dbd2 100644 --- a/plugins/woocommerce-admin/tests/features/class-wc-tests-transient-notices.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-transient-notices.php @@ -8,9 +8,9 @@ use \Automattic\WooCommerce\Admin\Features\TransientNotices; /** - * Class WC_Tests_Transient_Notices + * Class WC_Admin_Tests_Transient_Notices */ -class WC_Tests_Transient_Notices extends WC_Unit_Test_Case { +class WC_Admin_Tests_Transient_Notices extends WC_Unit_Test_Case { /** * Test that notices can be added. diff --git a/plugins/woocommerce-admin/tests/features/onboarding-tasks/task-list.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/task-list.php similarity index 98% rename from plugins/woocommerce-admin/tests/features/onboarding-tasks/task-list.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/task-list.php index c2c519e5417..1a08da3c359 100644 --- a/plugins/woocommerce-admin/tests/features/onboarding-tasks/task-list.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/task-list.php @@ -10,9 +10,9 @@ require_once __DIR__ . '/test-task.php'; use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList; /** - * class WC_Tests_OnboardingTasks_TaskList + * class WC_Admin_Tests_OnboardingTasks_TaskList */ -class WC_Tests_OnboardingTasks_TaskList extends WC_Unit_Test_Case { +class WC_Admin_Tests_OnboardingTasks_TaskList extends WC_Unit_Test_Case { /** * Task list. diff --git a/plugins/woocommerce-admin/tests/features/onboarding-tasks/task.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/task.php similarity index 98% rename from plugins/woocommerce-admin/tests/features/onboarding-tasks/task.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/task.php index 29d6e39d98b..88eaeffee34 100644 --- a/plugins/woocommerce-admin/tests/features/onboarding-tasks/task.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/task.php @@ -11,9 +11,9 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task; use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList; /** - * class WC_Tests_OnboardingTasks_Task + * class WC_Admin_Tests_OnboardingTasks_Task */ -class WC_Tests_OnboardingTasks_Task extends WC_Unit_Test_Case { +class WC_Admin_Tests_OnboardingTasks_Task extends WC_Unit_Test_Case { /** * Tests that a task is visible by default. diff --git a/plugins/woocommerce-admin/tests/features/onboarding-tasks/tasks/purchase.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/tasks/purchase.php similarity index 97% rename from plugins/woocommerce-admin/tests/features/onboarding-tasks/tasks/purchase.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/tasks/purchase.php index 078d7548cd3..25ee985d644 100644 --- a/plugins/woocommerce-admin/tests/features/onboarding-tasks/tasks/purchase.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/tasks/purchase.php @@ -11,9 +11,9 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList; use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\Purchase; /** - * class WC_Tests_OnboardingTasks_TaskList + * class WC_Admin_Tests_OnboardingTasks_TaskList */ -class WC_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case { +class WC_Admin_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case { /** * Task list. diff --git a/plugins/woocommerce-admin/tests/features/onboarding-tasks/tasks/store-details.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/tasks/store-details.php similarity index 91% rename from plugins/woocommerce-admin/tests/features/onboarding-tasks/tasks/store-details.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/tasks/store-details.php index 693ba810848..bfc8afdc2c2 100644 --- a/plugins/woocommerce-admin/tests/features/onboarding-tasks/tasks/store-details.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/tasks/store-details.php @@ -10,9 +10,9 @@ use Automattic\WooCommerce\Admin\Features\OnboardingTasks\TaskList; use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks\StoreDetails; /** - * class WC_Tests_OnboardingTasks_TaskList + * class WC_Admin_Tests_OnboardingTasks_TaskList */ -class WC_Tests_OnboardingTasks_Task_StoreDetails extends WC_Unit_Test_Case { +class WC_Admin_Tests_OnboardingTasks_Task_StoreDetails extends WC_Unit_Test_Case { /** diff --git a/plugins/woocommerce-admin/tests/features/onboarding-tasks/test-task.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/test-task.php similarity index 100% rename from plugins/woocommerce-admin/tests/features/onboarding-tasks/test-task.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/onboarding-tasks/test-task.php diff --git a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/data-source-poller.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/data-source-poller.php similarity index 96% rename from plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/data-source-poller.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/data-source-poller.php index f82c6125123..c1d8616c1b7 100644 --- a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/data-source-poller.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/data-source-poller.php @@ -10,9 +10,9 @@ use Automattic\WooCommerce\Admin\DataSourcePoller; use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\PaymentGatewaySuggestionsDataSourcePoller; /** - * class WC_Tests_PaymentGatewaySuggestions_DataSourcePoller + * class WC_Admin_Tests_PaymentGatewaySuggestions_DataSourcePoller */ -class WC_Tests_PaymentGatewaySuggestions_DataSourcePoller extends WC_Unit_Test_Case { +class WC_Admin_Tests_PaymentGatewaySuggestions_DataSourcePoller extends WC_Unit_Test_Case { /** * Set up. */ diff --git a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/evaluate-suggestion.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/evaluate-suggestion.php similarity index 91% rename from plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/evaluate-suggestion.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/evaluate-suggestion.php index 23965621fbd..4dfc9005bea 100644 --- a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/evaluate-suggestion.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/evaluate-suggestion.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\EvaluateSuggestion; /** - * class WC_Tests_PaymentGatewaySuggestions_EvaluateSuggestion + * class WC_Admin_Tests_PaymentGatewaySuggestions_EvaluateSuggestion */ -class WC_Tests_PaymentGatewaySuggestions_EvaluateSuggestion extends WC_Unit_Test_Case { +class WC_Admin_Tests_PaymentGatewaySuggestions_EvaluateSuggestion extends WC_Unit_Test_Case { /** * Mock gateway option. */ diff --git a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/payment-gateway-controller.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/payment-gateway-controller.php similarity index 95% rename from plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/payment-gateway-controller.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/payment-gateway-controller.php index d7958dd3385..d944d180bb3 100644 --- a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/payment-gateway-controller.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/payment-gateway-controller.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\Features\RemotePaymentMethods\PaymentGatewaysController; /** - * class WC_Tests_PaymentGatewaySuggestions_PaymentGatewaysController + * class WC_Admin_Tests_PaymentGatewaySuggestions_PaymentGatewaysController */ -class WC_Tests_PaymentGatewaySuggestions_PaymentGatewaysController extends WC_REST_Unit_Test_Case { +class WC_Admin_Tests_PaymentGatewaySuggestions_PaymentGatewaysController extends WC_REST_Unit_Test_Case { /** * Endpoints. * diff --git a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/payment-gateway-suggestions.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/payment-gateway-suggestions.php similarity index 97% rename from plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/payment-gateway-suggestions.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/payment-gateway-suggestions.php index 5966a3a0f40..64bc6648c52 100644 --- a/plugins/woocommerce-admin/tests/features/payment-gateway-suggestions/payment-gateway-suggestions.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/payment-gateway-suggestions/payment-gateway-suggestions.php @@ -11,9 +11,9 @@ use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\DefaultPayme use Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions\PaymentGatewaySuggestionsDataSourcePoller; /** - * class WC_Tests_PaymentGatewaySuggestions_Init + * class WC_Admin_Tests_PaymentGatewaySuggestions_Init */ -class WC_Tests_PaymentGatewaySuggestions_Init extends WC_Unit_Test_Case { +class WC_Admin_Tests_PaymentGatewaySuggestions_Init extends WC_Unit_Test_Case { /** * Set up. diff --git a/plugins/woocommerce-admin/tests/includes/class-experimental-abtest-test.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/includes/class-experimental-abtest-test.php similarity index 100% rename from plugins/woocommerce-admin/tests/includes/class-experimental-abtest-test.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/includes/class-experimental-abtest-test.php diff --git a/plugins/woocommerce-admin/tests/install.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/install.php similarity index 100% rename from plugins/woocommerce-admin/tests/install.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/install.php diff --git a/plugins/woocommerce-admin/tests/navigation/class-wc-favorites.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-favorites.php similarity index 95% rename from plugins/woocommerce-admin/tests/navigation/class-wc-favorites.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-favorites.php index 15e2e8c9b6a..870205b4d6a 100644 --- a/plugins/woocommerce-admin/tests/navigation/class-wc-favorites.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-favorites.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Favorites; /** - * Class WC_Tests_Navigation_Favorites + * Class WC_Admin_Tests_Navigation_Favorites */ -class WC_Tests_Navigation_Favorites extends WC_Unit_Test_Case { +class WC_Admin_Tests_Navigation_Favorites extends WC_Unit_Test_Case { /** * @var Favorites diff --git a/plugins/woocommerce-admin/tests/navigation/class-wc-menu.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-menu.php similarity index 98% rename from plugins/woocommerce-admin/tests/navigation/class-wc-menu.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-menu.php index 175dc6810b6..488e72f1779 100644 --- a/plugins/woocommerce-admin/tests/navigation/class-wc-menu.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-menu.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Menu; /** - * Class WC_Tests_Navigation_Menu + * Class WC_Admin_Tests_Navigation_Menu */ -class WC_Tests_Navigation_Menu extends WC_Unit_Test_Case { +class WC_Admin_Tests_Navigation_Menu extends WC_Unit_Test_Case { /** * @var Menu diff --git a/plugins/woocommerce-admin/tests/navigation/class-wc-screen.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-screen.php similarity index 96% rename from plugins/woocommerce-admin/tests/navigation/class-wc-screen.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-screen.php index c8592d7e88f..a5f499a5236 100644 --- a/plugins/woocommerce-admin/tests/navigation/class-wc-screen.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/navigation/class-wc-screen.php @@ -13,9 +13,12 @@ use Automattic\WooCommerce\Admin\Features\Navigation\Screen; */ /** - * Class WC_Tests_Navigation_Screen + * Class WC_Admin_Tests_Navigation_Screen + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled + * @group run-in-seprate-process */ -class WC_Tests_Navigation_Screen extends WC_Unit_Test_Case { +class WC_Admin_Tests_Navigation_Screen extends WC_Unit_Test_Case { /** * @var Screen diff --git a/plugins/woocommerce-admin/tests/notes/class-note.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-note.php similarity index 95% rename from plugins/woocommerce-admin/tests/notes/class-note.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-note.php index ecbddb8c05a..2116db03d82 100644 --- a/plugins/woocommerce-admin/tests/notes/class-note.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-note.php @@ -8,9 +8,9 @@ use \Automattic\WooCommerce\Admin\Notes\Note; /** - * Class WC_Tests_Note + * Class WC_Admin_Tests_Note */ -class WC_Tests_Note extends WC_Unit_Test_Case { +class WC_Admin_Tests_Note extends WC_Unit_Test_Case { /** * Tests nonce data is added to the action. diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-customizing-product-catalog.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-customizing-product-catalog.php similarity index 95% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-customizing-product-catalog.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-customizing-product-catalog.php index 36a613955be..07f0bfed9f6 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-customizing-product-catalog.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-customizing-product-catalog.php @@ -10,9 +10,9 @@ use \Automattic\WooCommerce\Admin\Notes\Note; /** - * Class WC_Tests_Marketing_Notes + * Class WC_Admin_Tests_Marketing_Notes */ -class WC_Tests_Customizing_Product_Catalog extends WC_Unit_Test_Case { +class WC_Admin_Tests_Customizing_Product_Catalog extends WC_Unit_Test_Case { /** * @var CustomizingProductCatalog diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-email-notes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-email-notes.php similarity index 98% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-email-notes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-email-notes.php index 604f35da6e9..6c441c7aa7f 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-email-notes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-email-notes.php @@ -11,9 +11,9 @@ use \Automattic\WooCommerce\Admin\Notes\Notes; use \Automattic\WooCommerce\Internal\Admin\Notes\EmailNotification; /** - * Class WC_Tests_Email_Notes + * Class WC_Admin_Tests_Email_Notes */ -class WC_Tests_Email_Notes extends WC_Unit_Test_Case { +class WC_Admin_Tests_Email_Notes extends WC_Unit_Test_Case { /** * Setup test admin notes data. Called before every test. diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-marketing-notes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-marketing-notes.php similarity index 95% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-marketing-notes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-marketing-notes.php index 81286d24ae8..9081a178475 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-marketing-notes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-marketing-notes.php @@ -10,9 +10,9 @@ use \Automattic\WooCommerce\Admin\Notes\Note; use \Automattic\WooCommerce\Internal\Admin\Notes\WooCommercePayments; /** - * Class WC_Tests_Marketing_Notes + * Class WC_Admin_Tests_Marketing_Notes */ -class WC_Tests_Marketing_Notes extends WC_Unit_Test_Case { +class WC_Admin_Tests_Marketing_Notes extends WC_Unit_Test_Case { /** * Tests that a marketing note can be added. diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-newsalesrecord-note.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-newsalesrecord-note.php similarity index 94% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-newsalesrecord-note.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-newsalesrecord-note.php index a2d19e0d274..b09a28cba60 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-newsalesrecord-note.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-newsalesrecord-note.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Notes\Notes; use Automattic\WooCommerce\Internal\Admin\Notes\NewSalesRecord; /** - * Class WC_Tests_NewSalesRecord_Note + * Class WC_Admin_Tests_NewSalesRecord_Note */ -class WC_Tests_NewSalesRecord_Note extends WC_Unit_Test_Case { +class WC_Admin_Tests_NewSalesRecord_Note extends WC_Unit_Test_Case { /** * @var string diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-note-traits.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-note-traits.php similarity index 98% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-note-traits.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-note-traits.php index c2f1afacf79..7c747fb7cba 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-note-traits.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-note-traits.php @@ -10,9 +10,9 @@ use Automattic\WooCommerce\Admin\Notes\Note; use Automattic\WooCommerce\Admin\Notes\NoteTraits; /** - * Class WC_Tests_NoteTraits + * Class WC_Admin_Tests_NoteTraits */ -class WC_Tests_NoteTraits extends WC_Unit_Test_Case { +class WC_Admin_Tests_NoteTraits extends WC_Unit_Test_Case { /** Host the traits class we are testing */ use NoteTraits; diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-notes-data-store.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes-data-store.php similarity index 99% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-notes-data-store.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes-data-store.php index 182f09a28dc..b01791854d7 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-notes-data-store.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes-data-store.php @@ -9,9 +9,9 @@ use \Automattic\WooCommerce\Admin\Notes\Notes; use \Automattic\WooCommerce\Admin\Notes\Note; /** - * Class WC_Tests_Notes_Data_Store + * Class WC_Admin_Tests_Notes_Data_Store */ -class WC_Tests_Notes_Data_Store extends WC_Unit_Test_Case { +class WC_Admin_Tests_Notes_Data_Store extends WC_Unit_Test_Case { /** * Tests that the read data store method works as expected. diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-notes-note.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes-note.php similarity index 93% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-notes-note.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes-note.php index 6d3bdc810b1..60ff551e40d 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-notes-note.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes-note.php @@ -8,9 +8,9 @@ use \Automattic\WooCommerce\Admin\Notes\Note; /** - * Class WC_Tests_Notes_Note + * Class WC_Admin_Tests_Notes_Note */ -class WC_Tests_Notes_Note extends WC_Unit_Test_Case { +class WC_Admin_Tests_Notes_Note extends WC_Unit_Test_Case { /** * Tests a note can be created with timestamp. diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-notes.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes.php similarity index 90% rename from plugins/woocommerce-admin/tests/notes/class-wc-tests-notes.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes.php index 59b45edb68e..d7f8e4f659c 100644 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-notes.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/notes/class-wc-tests-notes.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\Notes\NotesUnavailableException; use Automattic\WooCommerce\Admin\Notes\Notes; /** - * Class WC_Tests_Notes + * Class WC_Admin_Tests_Notes */ -class WC_Tests_Notes extends WC_Unit_Test_Case { +class WC_Admin_Tests_Notes extends WC_Unit_Test_Case { /** * If the "admin-note" data store exists, the data store should be diff --git a/plugins/woocommerce-admin/tests/page-controller.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/page-controller.php similarity index 100% rename from plugins/woocommerce-admin/tests/page-controller.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/page-controller.php diff --git a/plugins/woocommerce-admin/tests/plugin-version.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/plugin-version.php similarity index 90% rename from plugins/woocommerce-admin/tests/plugin-version.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/plugin-version.php index 36eb370ee1b..4104bf21cb7 100644 --- a/plugins/woocommerce-admin/tests/plugin-version.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/plugin-version.php @@ -18,11 +18,11 @@ class WC_Admin_Tests_Plugin_Version extends WP_UnitTestCase { */ public function test_version_numbers() { // Get package.json version. - $package_json = file_get_contents( 'package.json' ); + $package_json = file_get_contents( '../woocommerce-admin/package.json' ); $package = json_decode( $package_json ); // Get main plugin file header version. - $plugin = get_file_data( 'woocommerce-admin.php', array( 'Version' => 'Version' ) ); + $plugin = get_file_data( '../woocommerce-admin/woocommerce-admin.php', array( 'Version' => 'Version' ) ); // Get plugin DB version. $db_version = defined( 'WC_ADMIN_VERSION_NUMBER' ) ? constant( 'WC_ADMIN_VERSION_NUMBER' ) : false; diff --git a/plugins/woocommerce-admin/tests/plugins-helper.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/plugins-helper.php similarity index 72% rename from plugins/woocommerce-admin/tests/plugins-helper.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/plugins-helper.php index 45b603cd515..65acc9c91ae 100644 --- a/plugins/woocommerce-admin/tests/plugins-helper.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/plugins-helper.php @@ -33,8 +33,6 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase { public function test_get_plugin_path_from_slug() { // Installed plugin checks. - $wc_path = PluginsHelper::get_plugin_path_from_slug( 'woocommerce' ); - $this->assertEquals( 'woocommerce/woocommerce.php', $wc_path, 'Path returned is not as expected.' ); $ak_path = PluginsHelper::get_plugin_path_from_slug( 'akismet' ); $this->assertEquals( 'akismet/akismet.php', $ak_path, 'Path returned is not as expected.' ); @@ -59,16 +57,16 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase { $this->assertEquals( array(), $active_slugs, 'Should not be any active slugs.' ); // Get facebook plugin path. - $fb_path = PluginsHelper::get_plugin_path_from_slug( 'facebook-for-woocommerce' ); + $akismet_path = PluginsHelper::get_plugin_path_from_slug( 'akismet' ); // Activate facebook plugin. - activate_plugin( $fb_path ); + activate_plugin( $akismet_path ); // Get active slugs. $active_slugs = PluginsHelper::get_active_plugin_slugs(); // Phpunit test environment active plugins option is empty. - $this->assertEquals( array( 'facebook-for-woocommerce' ), $active_slugs, 'Facebook for WooCommerce should be listed as active.' ); + $this->assertEquals( array( 'akismet' ), $active_slugs, 'Akismet should be listed as active.' ); } /** @@ -76,9 +74,9 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase { */ public function test_is_plugin_installed() { - // WooCommerce is installed in the test environment. - $installed = PluginsHelper::is_plugin_installed( 'woocommerce' ); - $this->assertEquals( true, $installed, 'WooCommerce should be installed.' ); + // Akismet is installed in the test environment. + $installed = PluginsHelper::is_plugin_installed( 'akismet' ); + $this->assertEquals( true, $installed, 'Akismet should be installed.' ); // Invalid plugin is not. $installed = PluginsHelper::is_plugin_installed( 'invalid-plugin' ); @@ -91,18 +89,18 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase { public function test_is_plugin_active() { // Check if facebook is not active. Phpunit test environment active plugins option is empty. - $active = PluginsHelper::is_plugin_active( 'facebook-for-woocommerce' ); + $active = PluginsHelper::is_plugin_active( 'akismet' ); $this->assertEquals( false, $active, 'Should not be any active slugs.' ); - // Get facebook plugin path. - $fb_path = PluginsHelper::get_plugin_path_from_slug( 'facebook-for-woocommerce' ); + // Get Akismet plugin path. + $akismet_path = PluginsHelper::get_plugin_path_from_slug( 'akismet' ); - // Activate facebook plugin. - activate_plugin( $fb_path ); + // Activate akismet plugin. + activate_plugin( $akismet_path ); - // Check if facebook is now active. - $activated = PluginsHelper::is_plugin_active( 'facebook-for-woocommerce' ); - $this->assertEquals( true, $activated, 'Facebook for WooCommerce should be installed.' ); + // Check if akismet is now active. + $activated = PluginsHelper::is_plugin_active( 'akismet' ); + $this->assertEquals( true, $activated, 'Akismet for WooCommerce should be installed.' ); } /** @@ -110,7 +108,7 @@ class WC_Admin_Tests_Plugins_Helper extends WP_UnitTestCase { */ public function test_get_plugin_data() { - $actual_data = PluginsHelper::get_plugin_data( 'woocommerce' ); + $actual_data = PluginsHelper::get_plugin_data( 'akismet' ); $expected_keys = array( 'WC requires at least', diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-column.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-column.php similarity index 85% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-column.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-column.php index 3d5d7096b06..479115627d4 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-column.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-column.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayColu /** - * class WC_Tests_RemoteInboxNotifications_Transformers_ArrayColumn + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayColumn */ -class WC_Tests_RemoteInboxNotifications_Transformers_ArrayColumn extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayColumn extends WC_Unit_Test_Case { /** * Test validate method returns false when 'key' argument is missing */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-flatten.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-flatten.php similarity index 76% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-flatten.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-flatten.php index e4f888d7971..22fc8cb244e 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-flatten.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-flatten.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayFlatten; /** - * class WC_Tests_RemoteInboxNotifications_Transformers_ArrayKeys + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayKeys */ -class WC_Tests_RemoteInboxNotifications_Transformers_ArrayFlatten extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayFlatten extends WC_Unit_Test_Case { /** * Test it returns flatten array */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-keys.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-keys.php similarity index 74% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-keys.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-keys.php index 9e57f91565c..5f132ba137f 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-keys.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-keys.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayKeys; /** - * class WC_Tests_RemoteInboxNotifications_Transformers_ArrayKeys + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayKeys */ -class WC_Tests_RemoteInboxNotifications_Transformers_ArrayKeys extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayKeys extends WC_Unit_Test_Case { /** * Test it returns array values. */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-search.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-search.php similarity index 87% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-search.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-search.php index f8b2880b32c..402ebc2025d 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-search.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-search.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArraySearch; /** - * class WC_Tests_RemoteInboxNotifications_Transformers_ArraySearch + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArraySearch */ -class WC_Tests_RemoteInboxNotifications_Transformers_ArraySearch extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArraySearch extends WC_Unit_Test_Case { /** * Test validate method returns false when 'value' argument is missing */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-values.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-values.php similarity index 74% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-values.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-values.php index ffdbcfc819b..df15f1b8f5e 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/array-values.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/array-values.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayValues; /** - * class WC_Tests_RemoteInboxNotifications_Transformers_ArrayValues + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayValues */ -class WC_Tests_RemoteInboxNotifications_Transformers_ArrayValues extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayValues extends WC_Unit_Test_Case { /** * Test it returns array values. */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/count.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/count.php similarity index 72% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/count.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/count.php index 3c4a06ddf6f..74e5c8d7075 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/count.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/count.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\Count; /** - * class WC_Tests_RemoteInboxNotifications_Transformers_ArrayValues + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayValues */ -class WC_Tests_RemoteInboxNotifications_Transformers_ArrayCount extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_ArrayCount extends WC_Unit_Test_Case { /** * Test it returns array count. */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/dot-notation.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/dot-notation.php similarity index 91% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/dot-notation.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/dot-notation.php index 94f7028ffc5..049e8bd1d2b 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/Transformers/dot-notation.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/Transformers/dot-notation.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\DotNotati /** - * class WC_Tests_RemoteInboxNotifications_Transformers_DotNotation + * class WC_Admin_Tests_RemoteInboxNotifications_Transformers_DotNotation */ -class WC_Tests_RemoteInboxNotifications_Transformers_DotNotation extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_Transformers_DotNotation extends WC_Unit_Test_Case { /** * Test validate method returns false when 'path' argument is missing diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/evaluate-and-get-status.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/evaluate-and-get-status.php similarity index 96% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/evaluate-and-get-status.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/evaluate-and-get-status.php index f191f1099bd..59b74d13374 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/evaluate-and-get-status.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/evaluate-and-get-status.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\EvaluateAndGetStatus; /** - * class WC_Tests_RemoteInboxNotifications_EvaluateAndGetStatus + * class WC_Admin_Tests_RemoteInboxNotifications_EvaluateAndGetStatus */ -class WC_Tests_RemoteInboxNotifications_EvaluateAndGetStatus extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_EvaluateAndGetStatus extends WC_Unit_Test_Case { /** * Build up a spec given the supplied parameters. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/failing-rule-evaluator.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/failing-rule-evaluator.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/failing-rule-evaluator.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/failing-rule-evaluator.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/get-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/get-rule-processor.php similarity index 79% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/get-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/get-rule-processor.php index dceba9757c0..1d06b6cbcfb 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/get-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/get-rule-processor.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\GetRuleProcessor; /** - * class WC_Tests_RemoteInboxNotifications_GetRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_GetRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_GetRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_GetRuleProcessor extends WC_Unit_Test_Case { /** * Tests that an unknown rule processor returns a FailRuleProcessor * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-date-time-provider.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-date-time-provider.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-date-time-provider.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-date-time-provider.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-get-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-get-rule-processor.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-get-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-get-rule-processor.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-plugins-provider.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-plugins-provider.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-plugins-provider.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-plugins-provider.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-product-query.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-product-query.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-product-query.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-product-query.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-wc-admin-active-for-provider.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-wc-admin-active-for-provider.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/mock-wc-admin-active-for-provider.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/mock-wc-admin-active-for-provider.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/not-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/not-rule-processor.php similarity index 92% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/not-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/not-rule-processor.php index ca925a061df..ae85aeedf53 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/not-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/not-rule-processor.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\NotRuleProcessor; use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RuleEvaluator; /** - * class WC_Tests_RemoteInboxNotifications_NotRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_NotRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_NotRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_NotRuleProcessor extends WC_Unit_Test_Case { /** * An empty operand evaluates to false, so negating that should * evaluate to true. diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/option-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/option-rule-processor.php similarity index 94% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/option-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/option-rule-processor.php index 97bbf5a68fd..f31282385a1 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/option-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/option-rule-processor.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\OptionRuleProcessor; /** - * class WC_Tests_RemoteInboxNotifications_OptionRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_OptionRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_OptionRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_OptionRuleProcessor extends WC_Unit_Test_Case { /** * No default option resolves to false. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/or-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/or-rule-processor.php similarity index 95% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/or-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/or-rule-processor.php index 4e5d4a1e951..e1037e21963 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/or-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/or-rule-processor.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\OrRuleProcessor; use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RuleEvaluator; /** - * class WC_Tests_RemoteInboxNotifications_OrRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_OrRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_OrRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_OrRuleProcessor extends WC_Unit_Test_Case { /** * Both operands evaluating to false and ORed together evaluates to false. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/passing-rule-evaluator.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/passing-rule-evaluator.php similarity index 100% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/passing-rule-evaluator.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/passing-rule-evaluator.php diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/plugin-version-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugin-version-rule-processor.php similarity index 95% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/plugin-version-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugin-version-rule-processor.php index 86f8cbd4c31..7ae0573213b 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/plugin-version-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugin-version-rule-processor.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\PluginVersionRuleProcessor; /** - * class WC_Tests_RemoteInboxNotifications_PluginVersionRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_PluginVersionRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_PluginVersionRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_PluginVersionRuleProcessor extends WC_Unit_Test_Case { /** * Test that the processor does not pass if the plugin is not activated. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/plugins-activated-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugins-activated-rule-processor.php similarity index 94% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/plugins-activated-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugins-activated-rule-processor.php index f88ea737b5b..ab3e1dbb240 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/plugins-activated-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/plugins-activated-rule-processor.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\PluginsActivatedRulePr use Automattic\WooCommerce\Admin\PluginsProvider\PluginsProviderInterface; /** - * class WC_Tests_RemoteInboxNotifications_PluginsActivatedRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_PluginsActivatedRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_PluginsActivatedRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_PluginsActivatedRuleProcessor extends WC_Unit_Test_Case { /** * Tests that the processor does not pass a plugins_activated rule with * no plugins to verify. diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/product-count-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/product-count-rule-processor.php similarity index 87% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/product-count-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/product-count-rule-processor.php index 5260e1686e9..25e47121b51 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/product-count-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/product-count-rule-processor.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\ProductCountRuleProcessor; /** - * class WC_Tests_RemoteInboxNotifications_ProductCountRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_ProductCountRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_ProductCountRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_ProductCountRuleProcessor extends WC_Unit_Test_Case { /** * Get a product_count rule that passes when the product count is > 5. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/publish-after-time-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-after-time-rule-processor.php similarity index 91% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/publish-after-time-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-after-time-rule-processor.php index a063c05a1f7..6ad2d288b5a 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/publish-after-time-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-after-time-rule-processor.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\PublishAfterTimeRulePr use Automattic\WooCommerce\Admin\DateTimeProvider\DateTimeProviderInterface; /** - * class WC_Tests_RemoteInboxNotifications_PublishAfterTimeRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_PublishAfterTimeRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_PublishAfterTimeRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_PublishAfterTimeRuleProcessor extends WC_Unit_Test_Case { /** * Get the publish_after rule. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/publish-before-time-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-before-time-rule-processor.php similarity index 91% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/publish-before-time-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-before-time-rule-processor.php index ed1390bca9c..3c1ead3f214 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/publish-before-time-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/publish-before-time-rule-processor.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\PublishBeforeTimeRuleP use Automattic\WooCommerce\Admin\DateTimeProvider\DateTimeProviderInterface; /** - * class WC_Tests_RemoteInboxNotifications_PublishBeforeTimeRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_PublishBeforeTimeRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_PublishBeforeTimeRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_PublishBeforeTimeRuleProcessor extends WC_Unit_Test_Case { /** * Get the publish_before rule. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/stored-state-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/stored-state-rule-processor.php similarity index 98% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/stored-state-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/stored-state-rule-processor.php index f5b8dca2441..075e58b8490 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/stored-state-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/stored-state-rule-processor.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\StoredStateRuleProcess use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RuleEvaluator; /** - * class WC_Tests_RemoteInboxNotifications_StoredStateRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_StoredStateRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_StoredStateRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_StoredStateRuleProcessor extends WC_Unit_Test_Case { /** * Empty $stored_state evaluates to false. * diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/transformer-service.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/transformer-service.php similarity index 95% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/transformer-service.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/transformer-service.php index b0bdef47f98..c6264f30760 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/transformer-service.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/transformer-service.php @@ -9,9 +9,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\Transformers\ArrayKeys use Automattic\WooCommerce\Admin\RemoteInboxNotifications\TransformerService; /** - * class WC_Tests_RemoteInboxNotifications_TransformerService + * class WC_Admin_Tests_RemoteInboxNotifications_TransformerService */ -class WC_Tests_RemoteInboxNotifications_TransformerService extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_TransformerService extends WC_Unit_Test_Case { /** * Test it creates a transformer with snake case 'use' value */ diff --git a/plugins/woocommerce-admin/tests/remote-inbox-notifications/wcadmin-active-for-rule-processor.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php similarity index 85% rename from plugins/woocommerce-admin/tests/remote-inbox-notifications/wcadmin-active-for-rule-processor.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php index a486caab73e..b8f0463d61b 100644 --- a/plugins/woocommerce-admin/tests/remote-inbox-notifications/wcadmin-active-for-rule-processor.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/remote-inbox-notifications/wcadmin-active-for-rule-processor.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\RemoteInboxNotifications\WCAdminActiveForRuleProcessor; /** - * class WC_Tests_RemoteInboxNotifications_WCAdminActiveForRuleProcessor + * class WC_Admin_Tests_RemoteInboxNotifications_WCAdminActiveForRuleProcessor */ -class WC_Tests_RemoteInboxNotifications_WCAdminActiveForRuleProcessor extends WC_Unit_Test_Case { +class WC_Admin_Tests_RemoteInboxNotifications_WCAdminActiveForRuleProcessor extends WC_Unit_Test_Case { /** * Greater than 7 days evaluates to true * diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-coupons-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-coupons-stats.php similarity index 97% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-coupons-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-coupons-stats.php index 878d1d22d56..e154ef91047 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-coupons-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-coupons-stats.php @@ -9,9 +9,9 @@ use \Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats\DataStore as Coupons use \Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats\Query as CouponsStatsQuery; /** - * Class WC_Tests_Reports_Coupons_Stats + * Class WC_Admin_Tests_Reports_Coupons_Stats */ -class WC_Tests_Reports_Coupons_Stats extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Coupons_Stats extends WC_Unit_Test_Case { /** * Test the for the basic cases. diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-coupons.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-coupons.php similarity index 99% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-coupons.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-coupons.php index d1c5423ba31..c848d8df8d6 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-coupons.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-coupons.php @@ -11,9 +11,9 @@ use \Automattic\WooCommerce\Admin\API\Reports\Coupons\Query as CouponsQuery; use \Automattic\WooCommerce\Admin\API\Reports\TimeInterval; /** - * Class WC_Tests_Reports_Coupons + * Class WC_Admin_Tests_Reports_Coupons */ -class WC_Tests_Reports_Coupons extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Coupons extends WC_Unit_Test_Case { /** * Test the calculations and querying works correctly for the base case of 1 product. diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-customers.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-customers.php similarity index 94% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-customers.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-customers.php index 107747baa30..1306b9351bf 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-customers.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-customers.php @@ -8,9 +8,12 @@ use \Automattic\WooCommerce\Admin\API\Reports\Customers\Stats\DataStore; /** - * Class WC_Tests_Reports_Customers + * Class WC_Admin_Tests_Reports_Customers + * @runTestsInSeparateProcesses + * @preserveGlobalState disabled + * @group run-in-seprate-process */ -class WC_Tests_Reports_Customer extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Customer extends WC_Unit_Test_Case { /** * Test order count caluclation for customer. diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-orders-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-orders-stats.php similarity index 99% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-orders-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-orders-stats.php index 794b392d0eb..a567e7589c3 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-orders-stats.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-orders-stats.php @@ -10,9 +10,9 @@ use \Automattic\WooCommerce\Admin\API\Reports\Orders\Stats\Query as OrdersStatsQ use \Automattic\WooCommerce\Admin\API\Reports\TimeInterval; /** - * Class WC_Tests_Reports_Orders_Stats + * Class WC_Admin_Tests_Reports_Orders_Stats */ -class WC_Tests_Reports_Orders_Stats extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Orders_Stats extends WC_Unit_Test_Case { /** * Don't cache report data during these tests. */ diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-orders.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-orders.php similarity index 98% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-orders.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-orders.php index a4c900d585d..91510c13a4e 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-orders.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-orders.php @@ -10,9 +10,9 @@ use \Automattic\WooCommerce\Admin\API\Reports\Orders\Query as OrdersQuery; use \Automattic\WooCommerce\Admin\API\Reports\TimeInterval; /** - * Class WC_Tests_Reports_Orders + * Class WC_Admin_Tests_Reports_Orders */ -class WC_Tests_Reports_Orders extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Orders extends WC_Unit_Test_Case { /** * Test that extended info handles variations correctly. */ diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-products.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-products.php similarity index 99% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-products.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-products.php index e18f48add87..16a68e3cb4d 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-products.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-products.php @@ -16,7 +16,7 @@ use \Automattic\WooCommerce\Admin\ReportCSVExporter; * @package WooCommerce\Admin\Tests\Orders * @todo Finish up unit testing to verify bug-free product reports. */ -class WC_Tests_Reports_Products extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Products extends WC_Unit_Test_Case { /** * Test the calculations and querying works correctly for the base case of 1 product. diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-revenue-stats.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-revenue-stats.php similarity index 100% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-revenue-stats.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-revenue-stats.php diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-variations.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-variations.php similarity index 99% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-variations.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-variations.php index defa0580e36..423a93fa41b 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports-variations.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports-variations.php @@ -15,7 +15,7 @@ use \Automattic\WooCommerce\Admin\API\Reports\Variations\Query as VariationsQuer * @package WooCommerce\Admin\Tests\Orders * @todo Finish up unit testing to verify bug-free order reports. */ -class WC_Tests_Reports_Variations extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports_Variations extends WC_Unit_Test_Case { /** * Test the calculations and querying works correctly for the base case of 1 order. diff --git a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports.php similarity index 92% rename from plugins/woocommerce-admin/tests/reports/class-wc-tests-reports.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports.php index cfd65b4b7ef..66706c15693 100644 --- a/plugins/woocommerce-admin/tests/reports/class-wc-tests-reports.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/reports/class-wc-tests-reports.php @@ -8,9 +8,9 @@ use Automattic\WooCommerce\Admin\ReportCSVExporter; /** - * Class WC_Tests_Reports + * Class WC_Admin_Tests_Reports */ -class WC_Tests_Reports extends WC_Unit_Test_Case { +class WC_Admin_Tests_Reports extends WC_Unit_Test_Case { /** * @var Directory diff --git a/plugins/woocommerce-admin/tests/schedulers/class-wc-tests-mailchimp-scheduler.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/schedulers/class-wc-tests-mailchimp-scheduler.php similarity index 98% rename from plugins/woocommerce-admin/tests/schedulers/class-wc-tests-mailchimp-scheduler.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/schedulers/class-wc-tests-mailchimp-scheduler.php index 93304d17b8d..d41c7cf273a 100644 --- a/plugins/woocommerce-admin/tests/schedulers/class-wc-tests-mailchimp-scheduler.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/schedulers/class-wc-tests-mailchimp-scheduler.php @@ -10,9 +10,9 @@ use Automattic\WooCommerce\Internal\Admin\Schedulers\MailchimpScheduler; use Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingProfile; /** - * Class WC_Tests_Mailchimp_Scheduler + * Class WC_Admin_Tests_Mailchimp_Scheduler */ -class WC_Tests_Mailchimp_Scheduler extends WC_Unit_Test_Case { +class WC_Admin_Tests_Mailchimp_Scheduler extends WC_Unit_Test_Case { /** * @var \Automattic\WooCommerce\Internal\Admin\Schedulers\MailchimpScheduler MailchimpScheduler instance to test */ diff --git a/plugins/woocommerce-admin/tests/test-sample.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/test-sample.php similarity index 100% rename from plugins/woocommerce-admin/tests/test-sample.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/test-sample.php diff --git a/plugins/woocommerce-admin/tests/wc-admin-assets.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/wc-admin-assets.php similarity index 100% rename from plugins/woocommerce-admin/tests/wc-admin-assets.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/wc-admin-assets.php diff --git a/plugins/woocommerce-admin/tests/wc-admin-helper.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/wc-admin-helper.php similarity index 100% rename from plugins/woocommerce-admin/tests/wc-admin-helper.php rename to plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/wc-admin-helper.php