codeigniter4/CodeIgniter4

Dev: Ensure tests are run in random

Open

#9968 opened on Feb 20, 2026

View on GitHub
 (4 comments) (1 reaction) (0 assignees)PHP (4,492 stars) (1,707 forks)batch import
devhelp wantedtesting

Description

PHP Version

8.5.0

CodeIgniter4 Version

4.7.1-dev

Per ChatGPT, tests need to run in random to enjoy the following benefits:

✔️ It reveals hidden dependencies ✔️ Forces true test isolation ✔️ Prevents flaky, misleading test results ✔️ Makes your test suite production-realistic

This issue has been initially tackled by #7717, but due to other complications it didn't fare well. As this is not a fairly easy task, I'm proposing we do it on pieces. Currently, our test suite runs in default order but should be random at some point (i.e., executionOrder="random").

Here's the plan, instead of one big PR changing all tests, we can do it by component (HTTP, Cache, Database, etc.). Then, after all tests run green on randomised testing, we set executionOrder in phpunit.xml to "random".

Please reference this issue for any PRs addressing pieces of this.

  • API: #9983
  • AutoReview: #10073
  • Autoloader: #10073
  • Cache
  • CLI:
    • #9998
    • #10014
  • Commands
  • Config
  • Cookie: #10073
  • Database
  • DataCaster
  • DataConverter
  • Debug
  • Email
  • Encryption
  • Entity
  • Events: #10073
  • Files: #10073
  • Filters
  • Format: #10073
  • Helpers
  • Honeypot
  • HotReloader: #10073
  • HTTP
  • I18n
  • Images
  • Language: #10073
  • Log: #10073
  • Pager: #10073
  • Publisher: #10073
  • RESTful: #10073
  • Router
    • #9967
  • Security
    • #9969
    • #10073
  • Session
  • Test
  • Throttle: #10073
  • Typography: #10073
  • Validation
  • View: #10073

Contributor guide