Skip to content

refactor: fix Security test fail by itself - #9969

Merged
paulbalandan merged 1 commit into
codeigniter4:developfrom
paulbalandan:fix-security
Feb 21, 2026
Merged

refactor: fix Security test fail by itself#9969
paulbalandan merged 1 commit into
codeigniter4:developfrom
paulbalandan:fix-security

Conversation

@paulbalandan

Copy link
Copy Markdown
Member

Description
Running SecurityTest by itself leads to failures, which means it is not isolated enough and dependent on other tests.

vendor/bin/phpunit --filter SecurityTestPHPUnit 11.5.55 by Sebastian Bergmann and contributors.Runtime: PHP 8.5.3 with Xdebug 3.5.1Configuration: /Users/paul/Workspace/CodeIgniter4/phpunit.xml.dist........E.E.E......FFF....... 29 / 29 (100%)Time: 00:02.360, Memory: 82.00 MBThere were 3 errors:1) CodeIgniter\Security\SecurityTest::testCSRFVerifyHeaderReturnsSelfOnMatchCodeIgniter\Security\Exceptions\SecurityException: The action you requested is not allowed./Users/paul/Workspace/CodeIgniter4/system/Security/Security.php:263/Users/paul/Workspace/CodeIgniter4/tests/system/Security/SecurityTest.php:1702) CodeIgniter\Security\SecurityTest::testCSRFVerifyJsonReturnsSelfOnMatchCodeIgniter\Security\Exceptions\SecurityException: The action you requested is not allowed./Users/paul/Workspace/CodeIgniter4/system/Security/Security.php:263/Users/paul/Workspace/CodeIgniter4/tests/system/Security/SecurityTest.php:2063) CodeIgniter\Security\SecurityTest::testCSRFVerifyPutBodyReturnsSelfOnMatchCodeIgniter\Security\Exceptions\SecurityException: The action you requested is not allowed./Users/paul/Workspace/CodeIgniter4/system/Security/Security.php:263/Users/paul/Workspace/CodeIgniter4/tests/system/Security/SecurityTest.php:242--There were 3 failures:1) CodeIgniter\Security\SecurityTest::testGetPostedTokenReturnsTokenFromHeaderFailed asserting that null is identical to '8b9218a55906f9dcc1dc263dce7f005a'./Users/paul/Workspace/CodeIgniter4/tests/system/Security/SecurityTest.php:3462) CodeIgniter\Security\SecurityTest::testGetPostedTokenReturnsTokenFromJsonBodyFailed asserting that null is identical to '8b9218a55906f9dcc1dc263dce7f005a'./Users/paul/Workspace/CodeIgniter4/tests/system/Security/SecurityTest.php:3553) CodeIgniter\Security\SecurityTest::testGetPostedTokenReturnsTokenFromFormBodyFailed asserting that null is identical to '8b9218a55906f9dcc1dc263dce7f005a'./Users/paul/Workspace/CodeIgniter4/tests/system/Security/SecurityTest.php:364ERRORS!Tests: 29, Assertions: 34, Errors: 3, Failures: 3.Generating code coverage report in Clover XML format ... done [00:00.463]Generating code coverage report in HTML format ... done [00:03.204]

Ref: #9968

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@paulbalandanpaulbalandan added the refactor Pull requests that refactor code label Feb 20, 2026
@paulbalandan
paulbalandan merged commit a87043b into codeigniter4:developFeb 21, 2026
49 checks passed
@paulbalandan
paulbalandan deleted the fix-security branch February 21, 2026 10:07
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactorPull requests that refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@paulbalandan@michalsn