From f440a2a24435c17010495d28e0685da12de40d55 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 22 Aug 2021 21:04:47 -0700 Subject: [PATCH 1/8] Replace deprecated `assertInternalType` calls with appropriate replacements --- tests/test-class-wp-web-app-manifest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-class-wp-web-app-manifest.php b/tests/test-class-wp-web-app-manifest.php index cdfadcc1a..319d94474 100644 --- a/tests/test-class-wp-web-app-manifest.php +++ b/tests/test-class-wp-web-app-manifest.php @@ -112,7 +112,7 @@ public function test_manifest_link_and_meta() { add_filter( 'apple_touch_startup_images', function ( $images ) use ( $added_images ) { - $this->assertInternalType( 'array', $images ); + $this->assertIsArray( $images ); $this->assertCount( 1, $images ); $images = array_merge( $images, $added_images ); $images[] = array( 'bad' => 'yes' ); From 42ebbf0d1d6e46fb9b76bdf03d4ad1d6beb458ac Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 22 Aug 2021 21:07:20 -0700 Subject: [PATCH 2/8] Replace deprecated assertContains() with `assertStringContainsString()` --- ...-class-wp-service-worker-caching-routes.php | 18 +++++++++--------- tests/test-class-wp-service-workers.php | 12 ++++++------ tests/test-class-wp-web-app-manifest.php | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/components/test-class-wp-service-worker-caching-routes.php b/tests/components/test-class-wp-service-worker-caching-routes.php index 9945d83f8..6fbfbb703 100644 --- a/tests/components/test-class-wp-service-worker-caching-routes.php +++ b/tests/components/test-class-wp-service-worker-caching-routes.php @@ -280,14 +280,14 @@ public function test_prepare_strategy_args_for_js_export() { ) ); - $this->assertContains( WP_Service_Worker_Caching_Routes::STRATEGY_NETWORK_FIRST, $prepared ); - $this->assertContains( '"strategy":"NetworkFirst"', $prepared ); - $this->assertContains( '"networkTimeoutSeconds":2', $prepared ); - $this->assertContains( '"cacheName":"bank-cash"', $prepared ); - $this->assertContains( '{"maxEntries":4,"maxAgeSeconds":20}', $prepared ); - $this->assertContains( 'broadcastUpdate', $prepared ); - $this->assertContains( 'BroadcastUpdatePlugin', $prepared ); - $this->assertContains( 'expiration', $prepared ); - $this->assertContains( 'ExpirationPlugin', $prepared ); + $this->assertStringContainsString( WP_Service_Worker_Caching_Routes::STRATEGY_NETWORK_FIRST, $prepared ); + $this->assertStringContainsString( '"strategy":"NetworkFirst"', $prepared ); + $this->assertStringContainsString( '"networkTimeoutSeconds":2', $prepared ); + $this->assertStringContainsString( '"cacheName":"bank-cash"', $prepared ); + $this->assertStringContainsString( '{"maxEntries":4,"maxAgeSeconds":20}', $prepared ); + $this->assertStringContainsString( 'broadcastUpdate', $prepared ); + $this->assertStringContainsString( 'BroadcastUpdatePlugin', $prepared ); + $this->assertStringContainsString( 'expiration', $prepared ); + $this->assertStringContainsString( 'ExpirationPlugin', $prepared ); } } diff --git a/tests/test-class-wp-service-workers.php b/tests/test-class-wp-service-workers.php index b8d174843..0ecbe5ce8 100644 --- a/tests/test-class-wp-service-workers.php +++ b/tests/test-class-wp-service-workers.php @@ -69,8 +69,8 @@ public function test_serve_request_front() { $output = ob_get_clean(); $this->assertSame( 0, get_current_user_id() ); - $this->assertContains( $this->return_foo_sw(), $output ); - $this->assertContains( $this->return_bar_sw(), $output ); + $this->assertStringContainsString( $this->return_foo_sw(), $output ); + $this->assertStringContainsString( $this->return_bar_sw(), $output ); $this->assertNotContains( $this->return_baz_sw(), $output ); $this->assertTrue( strpos( $output, $this->return_foo_sw() ) < strpos( $output, $this->return_bar_sw() ) @@ -96,9 +96,9 @@ public function test_serve_request_admin() { $output = ob_get_clean(); $this->assertSame( 0, get_current_user_id() ); - $this->assertContains( $this->return_foo_sw(), $output ); + $this->assertStringContainsString( $this->return_foo_sw(), $output ); $this->assertNotContains( $this->return_bar_sw(), $output ); - $this->assertContains( $this->return_baz_sw(), $output ); + $this->assertStringContainsString( $this->return_baz_sw(), $output ); $this->assertTrue( strpos( $output, $this->return_foo_sw() ) < strpos( $output, $this->return_baz_sw() ) ); @@ -124,7 +124,7 @@ public function test_serve_request_bad_src_callback() { wp_service_workers()->serve_request(); $output = ob_get_clean(); - $this->assertContains( 'Service worker src is invalid', $output ); + $this->assertStringContainsString( 'Service worker src is invalid', $output ); } /** @@ -146,7 +146,7 @@ public function test_serve_request_bad_src_url() { wp_service_workers()->serve_request(); $output = ob_get_clean(); - $this->assertContains( 'Service worker src is invalid', $output ); + $this->assertStringContainsString( 'Service worker src is invalid', $output ); } /** diff --git a/tests/test-class-wp-web-app-manifest.php b/tests/test-class-wp-web-app-manifest.php index 319d94474..47817636f 100644 --- a/tests/test-class-wp-web-app-manifest.php +++ b/tests/test-class-wp-web-app-manifest.php @@ -125,20 +125,20 @@ function ( $images ) use ( $added_images ) { $output = ob_get_clean(); $this->assertSame( 3, substr_count( $output, 'assertContains( sprintf( '', esc_url( get_site_icon_url() ) ), $output ); + $this->assertStringContainsString( sprintf( '', esc_url( get_site_icon_url() ) ), $output ); foreach ( $added_images as $added_image ) { $tag = sprintf( 'assertContains( $tag, $output ); + $this->assertStringContainsString( $tag, $output ); } - $this->assertContains( 'assertContains( rest_url( WP_Web_App_Manifest::REST_NAMESPACE . WP_Web_App_Manifest::REST_ROUTE ), $output ); - $this->assertContains( 'assertStringContainsString( rest_url( WP_Web_App_Manifest::REST_NAMESPACE . WP_Web_App_Manifest::REST_ROUTE ), $output ); + $this->assertStringContainsString( '=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4" + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignas Rudaitis", + "email": "ignas.rudaitis@gmail.com" + } + ], + "description": "Method redefinition (monkey-patching) functionality for PHP.", + "homepage": "http://patchwork2.org/", + "keywords": [ + "aop", + "aspect", + "interception", + "monkeypatching", + "redefinition", + "runkit", + "testing" + ], + "support": { + "issues": "https://github.com/antecedent/patchwork/issues", + "source": "https://github.com/antecedent/patchwork/tree/2.1.15" + }, + "time": "2021-08-22T08:00:13+00:00" + }, { "name": "automattic/vipwpcs", "version": "2.3.2", @@ -59,6 +107,76 @@ }, "time": "2021-04-28T16:41:50+00:00" }, + { + "name": "brain/monkey", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/Brain-WP/BrainMonkey.git", + "reference": "7042140000b4b18034c0c0010d86274a00f25442" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Brain-WP/BrainMonkey/zipball/7042140000b4b18034c0c0010d86274a00f25442", + "reference": "7042140000b4b18034c0c0010d86274a00f25442", + "shasum": "" + }, + "require": { + "antecedent/patchwork": "^2.0", + "mockery/mockery": ">=0.9 <2", + "php": ">=5.6.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || ^0.7", + "phpcompatibility/php-compatibility": "^9.3.0", + "phpunit/phpunit": "^5.7.9 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-version/1": "1.x-dev", + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Brain\\Monkey\\": "src/" + }, + "files": [ + "inc/api.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Giuseppe Mazzapica", + "email": "giuseppe.mazzapica@gmail.com", + "homepage": "https://gmazzap.me", + "role": "Developer" + } + ], + "description": "Mocking utility for PHP functions and WordPress plugin API", + "keywords": [ + "Monkey Patching", + "interception", + "mock", + "mock functions", + "mockery", + "patchwork", + "redefinition", + "runkit", + "test", + "testing" + ], + "support": { + "issues": "https://github.com/Brain-WP/BrainMonkey/issues", + "source": "https://github.com/Brain-WP/BrainMonkey" + }, + "time": "2020-10-13T17:56:14+00:00" + }, { "name": "civicrm/composer-downloads-plugin", "version": "v3.0.1", @@ -241,6 +359,126 @@ }, "time": "2015-06-14T21:17:01+00:00" }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0|^8.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, + "time": "2020-07-09T08:09:16+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.3.4", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "31467aeb3ca3188158613322d66df81cedd86626" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626", + "reference": "31467aeb3ca3188158613322d66df81cedd86626", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.4" + }, + "time": "2021-02-24T09:51:00+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.7.0", @@ -2112,6 +2350,135 @@ "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, "time": "2020-05-13T23:57:56+00:00" + }, + { + "name": "yoast/phpunit-polyfills", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Yoast/PHPUnit-Polyfills.git", + "reference": "f014fb21c2b0038fd329515d59025af42fb98715" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/PHPUnit-Polyfills/zipball/f014fb21c2b0038fd329515d59025af42fb98715", + "reference": "f014fb21c2b0038fd329515d59025af42fb98715", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^0.5", + "php-parallel-lint/php-parallel-lint": "^1.3.0", + "yoast/yoastcs": "^2.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "files": [ + "phpunitpolyfills-autoload.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills/graphs/contributors" + } + ], + "description": "Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests", + "homepage": "https://github.com/Yoast/PHPUnit-Polyfills", + "keywords": [ + "phpunit", + "polyfill", + "testing" + ], + "support": { + "issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues", + "source": "https://github.com/Yoast/PHPUnit-Polyfills" + }, + "time": "2021-08-09T16:28:08+00:00" + }, + { + "name": "yoast/wp-test-utils", + "version": "0.2.2", + "source": { + "type": "git", + "url": "https://github.com/Yoast/wp-test-utils.git", + "reference": "896f7640d86162ff7a0dc6ce59f8837f284521c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Yoast/wp-test-utils/zipball/896f7640d86162ff7a0dc6ce59f8837f284521c5", + "reference": "896f7640d86162ff7a0dc6ce59f8837f284521c5", + "shasum": "" + }, + "require": { + "brain/monkey": "^2.6.0", + "php": ">=5.6", + "yoast/phpunit-polyfills": "^1.0.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^0.5", + "php-parallel-lint/php-parallel-lint": "^1.3.0", + "yoast/yoastcs": "^2.1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Team Yoast", + "email": "support@yoast.com", + "homepage": "https://yoast.com" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Yoast/wp-test-utils/graphs/contributors" + } + ], + "description": "PHPUnit cross-version compatibility layer for testing plugins and themes build for WordPress", + "homepage": "https://github.com/Yoast/wp-test-utils/", + "keywords": [ + "brainmonkey", + "integration-testing", + "phpunit", + "unit-testing", + "wordpress" + ], + "support": { + "issues": "https://github.com/Yoast/wp-test-utils/issues", + "source": "https://github.com/Yoast/wp-test-utils" + }, + "time": "2021-06-21T03:45:02+00:00" } ], "aliases": [], From ff8135239a20f89ca84d98fe55cccd95115afc64 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 22 Aug 2021 21:16:48 -0700 Subject: [PATCH 5/8] Remove composer.json patch used to run phpunit on PHP 8 --- bin/ci/after-wp-install.sh | 40 -------------------------------------- 1 file changed, 40 deletions(-) diff --git a/bin/ci/after-wp-install.sh b/bin/ci/after-wp-install.sh index 92467c22d..5edbf0477 100755 --- a/bin/ci/after-wp-install.sh +++ b/bin/ci/after-wp-install.sh @@ -9,43 +9,3 @@ if [[ -z $WP_VERSION ]]; then echo "usage: $0 " exit 1 fi - -if [[ $(php -r "echo PHP_VERSION;") == 8.0* ]]; then - echo "Installing compatible PHPUnit for use with PHP 8..." - - DIFF=$( - cat <<-EOF -diff --git a/composer.json b/composer.json -index 562c54a..0c6a247 100644 ---- a/composer.json -+++ b/composer.json -@@ -31,6 +31,20 @@ - } - } - }, -+ "autoload-dev": { -+ "files": [ -+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/Builder/NamespaceMatch.php", -+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/Builder/ParametersMatch.php", -+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/InvocationMocker.php", -+ "${WP_TESTS_DIR}/includes/phpunit7/MockObject/MockMethod.php" -+ ], -+ "exclude-from-classmap": [ -+ "vendor/phpunit/phpunit/src/Framework/MockObject/Builder/NamespaceMatch.php", -+ "vendor/phpunit/phpunit/src/Framework/MockObject/Builder/ParametersMatch.php", -+ "vendor/phpunit/phpunit/src/Framework/MockObject/InvocationMocker.php", -+ "vendor/phpunit/phpunit/src/Framework/MockObject/MockMethod.php" -+ ] -+ }, - "minimum-stability": "dev", - "prefer-stable": true, - "scripts": { - EOF - ) - - echo "${DIFF}" | git apply - - composer require --dev --ignore-platform-reqs --update-with-dependencies phpunit/phpunit:^7.5 - - PATH="$(composer config bin-dir --absolute):$PATH" - echo "done" -fi From a1bb84f72e31f9bf362dcae96f9f64329a0a1f8a Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 22 Aug 2021 21:17:59 -0700 Subject: [PATCH 6/8] Remove now obsolete after-wp-install.sh --- .github/workflows/build-test-measure.yml | 3 --- bin/ci/after-wp-install.sh | 11 ----------- 2 files changed, 14 deletions(-) delete mode 100755 bin/ci/after-wp-install.sh diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index 05717da4a..ba53e6339 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -339,9 +339,6 @@ jobs: - name: Install WP tests run: bash bin/ci/install-wp-tests.sh wordpress_test root '' 127.0.0.1:${{ job.services.mysql.ports['3306'] }} ${{ matrix.wp }} true - - name: Post install of WP tests - run: bash bin/ci/after-wp-install.sh ${{ matrix.wp }} /tmp/wordpress-tests - - name: Setup PCOV if: ${{ matrix.coverage == true }} # phpdocumentor/reflection has to be removed as it makes use of an outdated dependency, making pcov/clobber diff --git a/bin/ci/after-wp-install.sh b/bin/ci/after-wp-install.sh deleted file mode 100755 index 5edbf0477..000000000 --- a/bin/ci/after-wp-install.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -WP_VERSION=$1 -WP_TESTS_DIR=$2 - -if [[ -z $WP_VERSION ]]; then - echo "usage: $0 " - exit 1 -fi From 51f42ea9b93993058eed0c8dcecfa200470b3418 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 22 Aug 2021 21:28:14 -0700 Subject: [PATCH 7/8] Use polyfilled PHPUnit TestCase --- .../test-class-wp-service-worker-caching-routes.php | 4 +++- ...t-class-wp-service-worker-core-asset-caching-component.php | 4 +++- ...t-class-wp-service-worker-navigation-routing-component.php | 4 +++- ...class-wp-service-worker-plugin-asset-caching-component.php | 4 +++- .../test-class-wp-service-worker-precaching-routes.php | 4 +++- ...-class-wp-service-worker-theme-asset-caching-component.php | 4 +++- ...ass-wp-service-worker-uploaded-image-caching-component.php | 4 +++- tests/test-class-wp-service-worker-scripts.php | 4 +++- tests/test-class-wp-service-workers.php | 4 +++- tests/test-class-wp-web-app-manifest.php | 4 +++- tests/test-general-template.php | 4 +++- tests/test-pwa.php | 4 +++- tests/test-service-workers.php | 4 +++- 13 files changed, 39 insertions(+), 13 deletions(-) diff --git a/tests/components/test-class-wp-service-worker-caching-routes.php b/tests/components/test-class-wp-service-worker-caching-routes.php index 6fbfbb703..ebaad84e3 100644 --- a/tests/components/test-class-wp-service-worker-caching-routes.php +++ b/tests/components/test-class-wp-service-worker-caching-routes.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Caching_Routes. * * @coversDefaultClass WP_Service_Worker_Caching_Routes */ -class Test_WP_Service_Worker_Caching_Routes extends WP_UnitTestCase { +class Test_WP_Service_Worker_Caching_Routes extends TestCase { /** * Tested instance. diff --git a/tests/components/test-class-wp-service-worker-core-asset-caching-component.php b/tests/components/test-class-wp-service-worker-core-asset-caching-component.php index f11d5a345..daefc542d 100644 --- a/tests/components/test-class-wp-service-worker-core-asset-caching-component.php +++ b/tests/components/test-class-wp-service-worker-core-asset-caching-component.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Core_Asset_Caching_Component. * * @coversDefaultClass WP_Service_Worker_Core_Asset_Caching_Component */ -class Test_WP_Service_Worker_Core_Asset_Caching_Component extends WP_UnitTestCase { +class Test_WP_Service_Worker_Core_Asset_Caching_Component extends TestCase { /** * Get data for test_serve. diff --git a/tests/components/test-class-wp-service-worker-navigation-routing-component.php b/tests/components/test-class-wp-service-worker-navigation-routing-component.php index c3fb7626c..db2f20eb4 100644 --- a/tests/components/test-class-wp-service-worker-navigation-routing-component.php +++ b/tests/components/test-class-wp-service-worker-navigation-routing-component.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Navigation_Routing_Component. * * @coversDefaultClass WP_Service_Worker_Navigation_Routing_Component */ -class Test_WP_Service_Worker_Navigation_Routing_Component extends WP_UnitTestCase { +class Test_WP_Service_Worker_Navigation_Routing_Component extends TestCase { /** * Test registering a route. diff --git a/tests/components/test-class-wp-service-worker-plugin-asset-caching-component.php b/tests/components/test-class-wp-service-worker-plugin-asset-caching-component.php index db73abff9..ded66c491 100644 --- a/tests/components/test-class-wp-service-worker-plugin-asset-caching-component.php +++ b/tests/components/test-class-wp-service-worker-plugin-asset-caching-component.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Plugin_Asset_Caching_Component. * * @coversDefaultClass WP_Service_Worker_Plugin_Asset_Caching_Component */ -class Test_WP_Service_Worker_Plugin_Asset_Caching_Component extends WP_UnitTestCase { +class Test_WP_Service_Worker_Plugin_Asset_Caching_Component extends TestCase { /** * Get data for test_serve. diff --git a/tests/components/test-class-wp-service-worker-precaching-routes.php b/tests/components/test-class-wp-service-worker-precaching-routes.php index a0ea57c25..377547073 100644 --- a/tests/components/test-class-wp-service-worker-precaching-routes.php +++ b/tests/components/test-class-wp-service-worker-precaching-routes.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Precaching_Routes. * * @coversDefaultClass WP_Service_Worker_Precaching_Routes */ -class Test_WP_Service_Worker_Precaching_Routes extends WP_UnitTestCase { +class Test_WP_Service_Worker_Precaching_Routes extends TestCase { /** * Tested instance. diff --git a/tests/components/test-class-wp-service-worker-theme-asset-caching-component.php b/tests/components/test-class-wp-service-worker-theme-asset-caching-component.php index e22595ed8..66f1a3729 100644 --- a/tests/components/test-class-wp-service-worker-theme-asset-caching-component.php +++ b/tests/components/test-class-wp-service-worker-theme-asset-caching-component.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Theme_Asset_Caching_Component. * * @coversDefaultClass WP_Service_Worker_Theme_Asset_Caching_Component */ -class Test_WP_Service_Worker_Theme_Asset_Caching_Component extends WP_UnitTestCase { +class Test_WP_Service_Worker_Theme_Asset_Caching_Component extends TestCase { /** * Get data for test_serve. diff --git a/tests/components/test-class-wp-service-worker-uploaded-image-caching-component.php b/tests/components/test-class-wp-service-worker-uploaded-image-caching-component.php index e936f0668..204fec5c6 100644 --- a/tests/components/test-class-wp-service-worker-uploaded-image-caching-component.php +++ b/tests/components/test-class-wp-service-worker-uploaded-image-caching-component.php @@ -5,12 +5,14 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Uploaded_Image_Caching_Component. * * @coversDefaultClass WP_Service_Worker_Uploaded_Image_Caching_Component */ -class Test_WP_Service_Worker_Uploaded_Image_Caching_Component extends WP_UnitTestCase { +class Test_WP_Service_Worker_Uploaded_Image_Caching_Component extends TestCase { /** * Get data for test_serve. diff --git a/tests/test-class-wp-service-worker-scripts.php b/tests/test-class-wp-service-worker-scripts.php index 7c51c7bbc..b22a66ecf 100644 --- a/tests/test-class-wp-service-worker-scripts.php +++ b/tests/test-class-wp-service-worker-scripts.php @@ -5,10 +5,12 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Worker_Scripts. */ -class Test_WP_Service_Worker_Scripts extends WP_UnitTestCase { +class Test_WP_Service_Worker_Scripts extends TestCase { /** * Tested instance. diff --git a/tests/test-class-wp-service-workers.php b/tests/test-class-wp-service-workers.php index bbd591b31..465eb5a69 100644 --- a/tests/test-class-wp-service-workers.php +++ b/tests/test-class-wp-service-workers.php @@ -5,10 +5,12 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Service_Workers. */ -class Test_WP_Service_Workers extends WP_UnitTestCase { +class Test_WP_Service_Workers extends TestCase { /** * Tested instance. diff --git a/tests/test-class-wp-web-app-manifest.php b/tests/test-class-wp-web-app-manifest.php index 47817636f..6fd072f26 100644 --- a/tests/test-class-wp-web-app-manifest.php +++ b/tests/test-class-wp-web-app-manifest.php @@ -5,10 +5,12 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for class WP_Web_App_Manifest. */ -class Test_WP_Web_App_Manifest extends WP_UnitTestCase { +class Test_WP_Web_App_Manifest extends TestCase { /** * Tested instance. diff --git a/tests/test-general-template.php b/tests/test-general-template.php index 85e54c7e7..d4cb5a52c 100644 --- a/tests/test-general-template.php +++ b/tests/test-general-template.php @@ -5,10 +5,12 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for general-template.php. */ -class Test_General_Template extends WP_UnitTestCase { +class Test_General_Template extends TestCase { /** * Get data for testing wp_unauthenticate_error_template_requests(). diff --git a/tests/test-pwa.php b/tests/test-pwa.php index 6af5da884..2624ac6a5 100644 --- a/tests/test-pwa.php +++ b/tests/test-pwa.php @@ -5,10 +5,12 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for pwa.php. */ -class Test_PWA extends WP_UnitTestCase { +class Test_PWA extends TestCase { /** * Test bootstrap. diff --git a/tests/test-service-workers.php b/tests/test-service-workers.php index 492a3adfb..4e9eb8090 100644 --- a/tests/test-service-workers.php +++ b/tests/test-service-workers.php @@ -5,10 +5,12 @@ * @package PWA */ +use Yoast\WPTestUtils\WPIntegration\TestCase; + /** * Tests for service worker functions. */ -class Test_Service_Workers_Includes extends WP_UnitTestCase { +class Test_Service_Workers_Includes extends TestCase { /** * Tear down. From 01d91e823a201bc41b7d14695bceb7b9559327b0 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 22 Aug 2021 21:37:02 -0700 Subject: [PATCH 8/8] Use npm cache and update codecov-action version --- .github/workflows/build-test-measure.yml | 28 +++--------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index ba53e6339..abf610982 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -87,18 +87,7 @@ jobs: uses: actions/setup-node@v2 with: node-version: ${{ steps.nvm.outputs.NVMRC }} - - - name: Get npm cache directory - id: npm-cache - run: echo "::set-output name=dir::$(npm config get cache)" - - - name: Configure npm cache - uses: actions/cache@v2 - with: - path: ${{ steps.npm-cache.outputs.dir }} - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- + cache: npm - name: Install Node dependencies run: npm ci @@ -295,6 +284,7 @@ jobs: uses: actions/setup-node@v2 with: node-version: ${{ steps.nvm.outputs.NVMRC }} + cache: npm - name: Get Composer Cache Directory id: composer-cache @@ -311,18 +301,6 @@ jobs: - name: Install Composer dependencies run: composer install --prefer-dist --ignore-platform-reqs --no-progress --no-interaction - - name: Get npm cache directory - id: npm-cache - run: echo "::set-output name=dir::$(npm config get cache)" - - - name: Configure npm cache - uses: actions/cache@v2 - with: - path: ${{ steps.npm-cache.outputs.dir }} - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - name: Install Node dependencies run: npm ci env: @@ -363,7 +341,7 @@ jobs: - name: Upload code coverage report if: ${{ matrix.coverage == true }} - uses: codecov/codecov-action@v1.5.2 + uses: codecov/codecov-action@v2.0.2 with: file: ${{ env.WP_CORE_DIR }}/src/wp-content/plugins/pwa/build/logs/clover.xml flags: php,unit