Skip to content

Commit 01c20ea

Browse files
test(*): Add php 8.4 in matrix (#26)
* test(*): Add php 8.4 in matrix * test(*): Hide deprecated error for Gregwar Captcha if PHP 8.4
1 parent 22b9a34 commit 01c20ea

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
27+
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
2828

2929
name: Coding standards
3030
runs-on: ubuntu-latest

.github/workflows/php-sdk-development-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
strategy:
8787
fail-fast: false
8888
matrix:
89-
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
89+
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
9090

9191
name: Test suite
9292
runs-on: ubuntu-20.04

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
25+
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
2626

2727
name: Test suite
2828
runs-on: ubuntu-20.04

docs/USER_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This project provides a CrowdSec "standalone" bouncer for PHP-based websites. It
3434
- API key or TLS authentication
3535
- AppSec remediation support (only with API key authentication)
3636
- Support IpV4 and Ipv6 (Ipv6 range decisions are yet only supported in `Live mode`)
37-
- Large PHP matrix compatibility: 7.2, 7.3, 7.4, 8.0, 8.1, 8.2 and 8.3
37+
- Large PHP matrix compatibility: from 7.2 to 8.4
3838
- Built-in support for the most known cache systems Redis, Memcached and PhpFiles
3939
- Clear, prune and refresh the bouncer cache
4040

tests/Unit/BouncerTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ protected function setUp(): void
154154

155155
public function testPrivateAndProtectedMethods()
156156
{
157+
if (PHP_VERSION_ID >= 80400) {
158+
// Retrieve the current error reporting level
159+
$originalErrorReporting = error_reporting();
160+
// Suppress deprecated warnings temporarily
161+
// We do this because of
162+
// Deprecated: Gregwar\Captcha\CaptchaBuilder::__construct(): Implicitly marking parameter $builder as nullable
163+
// is deprecated, the explicit nullable type must be used instead
164+
error_reporting($originalErrorReporting & ~E_DEPRECATED);
165+
}
157166
// capRemediationLevel
158167
$bouncer = new Bouncer($this->configs);
159168
$result = PHPUnitUtil::callMethod(
@@ -347,5 +356,9 @@ public function testPrivateAndProtectedMethods()
347356
$error,
348357
'Should have throw an error'
349358
);
359+
if (PHP_VERSION_ID >= 80400 && isset($originalErrorReporting)) {
360+
// Restore the original error reporting level
361+
error_reporting($originalErrorReporting);
362+
}
350363
}
351364
}

0 commit comments

Comments
 (0)