Skip to content

Commit

Permalink
test(*): Add php 8.4 in matrix (#134)
Browse files Browse the repository at this point in the history
* test(*): Add php 8.4 in matrix

* test(*): Hide deprecated error for Gregwar Captcha if PHP 8.4
  • Loading branch information
julienloizelet authored Dec 6, 2024
1 parent e7ffb7c commit 0df5a4c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3']
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']

name: Coding standards
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-sdk-development-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"]
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]

name: Test suite
runs-on: ubuntu-20.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']

name: Test suite
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Please note that first and foremost a CrowdSec agent must be installed on a serv
- `Live mode` or `Stream mode`
- AppSec support
- Support IpV4 and Ipv6 (Ipv6 range decisions are yet only supported in `Live mode`)
- Large PHP matrix compatibility: 7.2, 7.3, 7.4, 8.0, 8.1, 8.2 and 8.3
- Large PHP matrix compatibility: from 7.2 to 8.4
- Built-in support for the most known cache systems Redis, Memcached and PhpFiles
- Clear, prune and refresh the bouncer cache
- Cap remediation level (ex: for sensitives websites: ban will be capped to captcha)
Expand Down
15 changes: 15 additions & 0 deletions tests/Unit/AbstractBouncerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ protected function setUp(): void

public function testPrivateAndProtectedMethods()
{
if (PHP_VERSION_ID >= 80400) {
// Retrieve the current error reporting level
$originalErrorReporting = error_reporting();
// Suppress deprecated warnings temporarily
// We do this because of
// Deprecated: Gregwar\Captcha\CaptchaBuilder::__construct(): Implicitly marking parameter $builder as nullable
// is deprecated, the explicit nullable type must be used instead
error_reporting($originalErrorReporting & ~E_DEPRECATED);
}

// shouldUseAppSec
// Test with TLS
$configs = array_merge($this->configs, [
Expand Down Expand Up @@ -583,6 +593,11 @@ public function testPrivateAndProtectedMethods()
['not-an-ip']
);
$this->assertEquals(false, $result, 'Should return false if ip is invalid');

if (PHP_VERSION_ID >= 80400 && isset($originalErrorReporting)) {
// Restore the original error reporting level
error_reporting($originalErrorReporting);
}
}

/**
Expand Down

0 comments on commit 0df5a4c

Please sign in to comment.