Skip to content

Commit 0df5a4c

Browse files
test(*): Add php 8.4 in matrix (#134)
* test(*): Add php 8.4 in matrix * test(*): Hide deprecated error for Gregwar Captcha if PHP 8.4
1 parent e7ffb7c commit 0df5a4c

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-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
@@ -71,7 +71,7 @@ jobs:
7171
strategy:
7272
fail-fast: false
7373
matrix:
74-
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
74+
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
7575

7676
name: Test suite
7777
runs-on: ubuntu-20.04

.github/workflows/test-suite.yml

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

2626
name: Test suite
2727
runs-on: ubuntu-latest

docs/USER_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Please note that first and foremost a CrowdSec agent must be installed on a serv
4646
- `Live mode` or `Stream mode`
4747
- AppSec support
4848
- Support IpV4 and Ipv6 (Ipv6 range decisions are yet only supported in `Live mode`)
49-
- Large PHP matrix compatibility: 7.2, 7.3, 7.4, 8.0, 8.1, 8.2 and 8.3
49+
- Large PHP matrix compatibility: from 7.2 to 8.4
5050
- Built-in support for the most known cache systems Redis, Memcached and PhpFiles
5151
- Clear, prune and refresh the bouncer cache
5252
- Cap remediation level (ex: for sensitives websites: ban will be capped to captcha)

tests/Unit/AbstractBouncerTest.php

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

199199
public function testPrivateAndProtectedMethods()
200200
{
201+
if (PHP_VERSION_ID >= 80400) {
202+
// Retrieve the current error reporting level
203+
$originalErrorReporting = error_reporting();
204+
// Suppress deprecated warnings temporarily
205+
// We do this because of
206+
// Deprecated: Gregwar\Captcha\CaptchaBuilder::__construct(): Implicitly marking parameter $builder as nullable
207+
// is deprecated, the explicit nullable type must be used instead
208+
error_reporting($originalErrorReporting & ~E_DEPRECATED);
209+
}
210+
201211
// shouldUseAppSec
202212
// Test with TLS
203213
$configs = array_merge($this->configs, [
@@ -583,6 +593,11 @@ public function testPrivateAndProtectedMethods()
583593
['not-an-ip']
584594
);
585595
$this->assertEquals(false, $result, 'Should return false if ip is invalid');
596+
597+
if (PHP_VERSION_ID >= 80400 && isset($originalErrorReporting)) {
598+
// Restore the original error reporting level
599+
error_reporting($originalErrorReporting);
600+
}
586601
}
587602

588603
/**

0 commit comments

Comments
 (0)