From 147db933beb9592d9d64bdf64387e9c6405a61b7 Mon Sep 17 00:00:00 2001 From: Leif Singer Date: Thu, 20 Jul 2023 18:36:01 +0200 Subject: [PATCH] Revert "Shard unit test runs" (#39344) Revert "Shard unit test runs (#39302)" This reverts commit 9ee44947e0224c7d520946b5d79c558447a5c00a. --- .github/workflows/ci.yml | 11 +---------- .github/workflows/pr-unit-tests.yml | 16 +--------------- .../changelog/dev-shard-unit-tests | 4 ---- plugins/woocommerce/phpunit.xml | 10 +--------- .../features/class-wc-tests-ces-tracks.php | 19 +++++-------------- .../class-wc-tests-reports-orders-stats.php | 4 ---- .../class-wc-orders-tracking-test.php | 16 ---------------- 7 files changed, 8 insertions(+), 72 deletions(-) delete mode 100644 plugins/woocommerce/changelog/dev-shard-unit-tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b04553aedf1..c9785c61b61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,20 +28,11 @@ jobs: matrix: php: ['7.4', '8.0'] wp: ['latest'] - unittests: ['shard1', 'shard2'] include: - wp: nightly php: '7.4' - unittests: 'shard1' - - wp: nightly - php: '7.4' - unittests: 'shard2' - wp: '6.1' php: 7.4 - unittests: 'shard1' - - wp: '6.1' - php: 7.4 - unittests: 'shard2' services: database: image: mysql:5.6 @@ -87,4 +78,4 @@ jobs: env: WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }} WP_ENV_PHP_VERSION: ${{ matrix.php }} - run: pnpm --filter=woocommerce test:unit:env --testsuite ${{ matrix.unittests }} + run: pnpm --filter=woocommerce test:unit:env diff --git a/.github/workflows/pr-unit-tests.yml b/.github/workflows/pr-unit-tests.yml index 5961726929f..3afbd0be4b7 100644 --- a/.github/workflows/pr-unit-tests.yml +++ b/.github/workflows/pr-unit-tests.yml @@ -28,28 +28,14 @@ jobs: matrix: php: ['7.4', '8.0'] wp: ['latest'] - unittests: ['shard1', 'shard2'] include: - wp: nightly php: '7.4' - unittests: 'shard1' - - wp: nightly - php: '7.4' - unittests: 'shard2' - wp: '6.1' php: 7.4 - unittests: 'shard1' - - wp: '6.1' - php: 7.4 - unittests: 'shard2' - wp: 'latest' php: '7.4' hpos: true - unittests: 'shard1' - - wp: 'latest' - php: '7.4' - hpos: true - unittests: 'shard2' services: database: image: mysql:5.6 @@ -86,4 +72,4 @@ jobs: env: WP_ENV_CORE: ${{ steps.parseMatrix.outputs.wpVersion }} WP_ENV_PHP_VERSION: ${{ matrix.php }} - run: pnpm --filter=woocommerce test:unit:env --testsuite ${{ matrix.unittests }} + run: pnpm --filter=woocommerce test:unit:env diff --git a/plugins/woocommerce/changelog/dev-shard-unit-tests b/plugins/woocommerce/changelog/dev-shard-unit-tests deleted file mode 100644 index edfc2bb4509..00000000000 --- a/plugins/woocommerce/changelog/dev-shard-unit-tests +++ /dev/null @@ -1,4 +0,0 @@ -Significance: minor -Type: dev - -Shard the unit tests running on GitHub Actions. diff --git a/plugins/woocommerce/phpunit.xml b/plugins/woocommerce/phpunit.xml index 9d733d317d1..c9e675d826f 100644 --- a/plugins/woocommerce/phpunit.xml +++ b/plugins/woocommerce/phpunit.xml @@ -9,18 +9,10 @@ verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> - + ./tests/legacy/unit-tests ./tests/php - - ./tests/legacy/unit-tests - ./tests/php - ./tests/legacy/unit-tests/woocommerce-admin - - - ./tests/legacy/unit-tests/woocommerce-admin - diff --git a/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php index bd336e9d2f0..f1574ac751b 100644 --- a/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php +++ b/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/features/class-wc-tests-ces-tracks.php @@ -7,19 +7,10 @@ use Automattic\WooCommerce\Internal\Admin\CustomerEffortScoreTracks; -// phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound - -if ( ! class_exists( 'CurrentScreenMock' ) ) { - /** - * Class CurrentScreenMock - */ - class CurrentScreenMock { - /** - * CustomerEffortScoreTracks only works in wp-admin, so let's fake it. - */ - public function in_admin() { - return true; - } +// CustomerEffortScoreTracks only works in wp-admin, so let's fake it. +class CurrentScreenMock { + public function in_admin() { + return true; } } @@ -51,7 +42,7 @@ class WC_Admin_Tests_CES_Tracks extends WC_Unit_Test_Case { } public function tearDown(): void { - parent::tearDown(); + parent::tearDown(); if ( $this->current_screen_backup ) { $GLOBALS['current_screen'] = $this->current_screen_backup; } diff --git a/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/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 index c597fb85ce3..f19ee7b5dc0 100644 --- a/plugins/woocommerce/tests/legacy/unit-tests/woocommerce-admin/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 @@ -666,12 +666,8 @@ class WC_Admin_Tests_Reports_Orders_Stats extends WC_Unit_Test_Case { $orders[] = $order; } - $this->assertEquals( 15, count( WC_Helper_Queue::get_all_pending() ) ); - WC_Helper_Queue::run_all_pending(); - $this->assertEquals( 0, count( WC_Helper_Queue::get_all_pending() ) ); - $data_store = new OrdersStatsDataStore(); // Test for the current hour. diff --git a/plugins/woocommerce/tests/php/includes/class-wc-orders-tracking-test.php b/plugins/woocommerce/tests/php/includes/class-wc-orders-tracking-test.php index b14f1018718..b9c2868b4f5 100644 --- a/plugins/woocommerce/tests/php/includes/class-wc-orders-tracking-test.php +++ b/plugins/woocommerce/tests/php/includes/class-wc-orders-tracking-test.php @@ -1,21 +1,5 @@