Skip to content

Commit a0849d5

Browse files
committed
test: fix test for error handling
There was 1 error: 1) CodeIgniter\Security\SecurityCSRFSessionRandomizeTokenTest::testCSRFVerifyPostInvalidToken PHPUnit\Framework\Exception: PHP Warning: hex2bin(): Hexadecimal input string must have an even length in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Security/Security.php on line 378 PHP Warning: hex2bin(): Hexadecimal input string must have an even length in /home/runner/work/CodeIgniter4/CodeIgniter4/system/Security/Security.php on line 378
1 parent 21e99b5 commit a0849d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/system/Security/SecurityCSRFSessionRandomizeTokenTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Config\Logger as LoggerConfig;
3333
use Config\Security as SecurityConfig;
3434
use Config\Session as SessionConfig;
35+
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
3536

3637
/**
3738
* @runTestsInSeparateProcesses
@@ -170,8 +171,11 @@ public function testCSRFVerifyPostThrowsExceptionOnNoMatch(): void
170171
$security->verify($request);
171172
}
172173

174+
#[WithoutErrorHandler]
173175
public function testCSRFVerifyPostInvalidToken(): void
174176
{
177+
Services::exceptions()->initialize();
178+
175179
$this->expectException(SecurityException::class);
176180
$this->expectExceptionMessage('The action you requested is not allowed.');
177181

0 commit comments

Comments
 (0)