From a269ec0f0f48ae842b6d6477dbd5ceb19241f12e Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 17 Dec 2024 17:18:07 +0000 Subject: [PATCH 1/4] Use PHPStan 2.0 --- composer.json | 6 +++--- phpstan.neon.dist | 3 +++ phpstan.neon.example | 3 +++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index c998af9..3c96eb3 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,9 @@ "codeception/util-universalframework": "^1.0", "php-webdriver/webdriver": "<=1.14.0", "wp-coding-standards/wpcs": "^3.0.0", - "phpstan/phpstan": "^1.7", - "szepeviktor/phpstan-wordpress": "^1.0", - "wp-cli/wp-cli": "2.8.1" + "phpstan/phpstan": "^1.0 || ^2.0", + "szepeviktor/phpstan-wordpress": "^1.0 || ^2.0", + "wp-cli/wp-cli": "2.11" }, "minimum-stability": "stable", "config": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 545ea4f..1b2e0f5 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -18,6 +18,9 @@ parameters: scanDirectories: - /home/runner/work/convertkit-wordpress-libraries/convertkit-wordpress-libraries/wordpress/wp-content/plugins + # Don't report unmatched ignored errors on older PHP versions (7.2, 7.3) + reportUnmatchedIgnoredErrors: false + # Should not need to edit anything below here # Rule Level: https://phpstan.org/user-guide/rule-levels level: 5 \ No newline at end of file diff --git a/phpstan.neon.example b/phpstan.neon.example index e2ba448..d1c89ea 100644 --- a/phpstan.neon.example +++ b/phpstan.neon.example @@ -18,6 +18,9 @@ parameters: scanDirectories: - /Users/tim/Local Sites/convertkit-github/app/public/wp-content/plugins + # Don't report unmatched ignored errors on older PHP versions (7.2, 7.3) + reportUnmatchedIgnoredErrors: false + # Should not need to edit anything below here # Rule Level: https://phpstan.org/user-guide/rule-levels level: 5 \ No newline at end of file From 7f8e148faf9f4c4887f55d6d3e833635806e6cb1 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 18 Dec 2024 15:37:47 +0000 Subject: [PATCH 2/4] Update PHPStan configuration --- phpstan.neon.dist | 4 ++++ phpstan.neon.example | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 1b2e0f5..7dc6e9e 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -18,6 +18,10 @@ parameters: scanDirectories: - /home/runner/work/convertkit-wordpress-libraries/convertkit-wordpress-libraries/wordpress/wp-content/plugins + # Location of constants for PHPStan to scan, building symbols. + scanFiles: + - /home/runner/work/convertkit-wordpress-libraries/convertkit-wordpress-libraries/wordpress/wp-config.php + # Don't report unmatched ignored errors on older PHP versions (7.2, 7.3) reportUnmatchedIgnoredErrors: false diff --git a/phpstan.neon.example b/phpstan.neon.example index d1c89ea..124ef84 100644 --- a/phpstan.neon.example +++ b/phpstan.neon.example @@ -18,6 +18,10 @@ parameters: scanDirectories: - /Users/tim/Local Sites/convertkit-github/app/public/wp-content/plugins + # Location of constants for PHPStan to scan, building symbols. + scanFiles: + - /Users/tim/Local Sites/convertkit-github/app/public/wp-config.php + # Don't report unmatched ignored errors on older PHP versions (7.2, 7.3) reportUnmatchedIgnoredErrors: false From b1f1b927ce562a57d067b714a58d1fdef7ce4dc4 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 18 Dec 2024 15:46:12 +0000 Subject: [PATCH 3/4] Run tests against latest WordPress stable version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 709e443..ded4e07 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: strategy: fail-fast: false matrix: - wp-versions: [ '6.7-RC4' ] #[ 'latest', '6.1.1' ] + wp-versions: [ 'latest' ] #[ 'latest', '6.1.1' ] php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3' ] #[ '7.4', '8.0', '8.1', '8.2' ] # Steps to install, configure and run tests From 0cf783d60abe6c83fc256deabcc9ceffe9596bf9 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Wed, 18 Dec 2024 16:29:28 +0000 Subject: [PATCH 4/4] Pause before each test to avoid 429 rate limits --- tests/wpunit/APITest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/wpunit/APITest.php b/tests/wpunit/APITest.php index c39d4d7..9484840 100644 --- a/tests/wpunit/APITest.php +++ b/tests/wpunit/APITest.php @@ -95,6 +95,9 @@ public function setUp(): void $_ENV['CONVERTKIT_OAUTH_ACCESS_TOKEN_NO_DATA'], $_ENV['CONVERTKIT_OAUTH_REFRESH_TOKEN_NO_DATA'] ); + + // Wait a second to avoid hitting a 429 rate limit. + sleep(1); } /**