Skip to content

fix: DatabaseLive tests failing locally #9669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 12, 2025

Conversation

paulbalandan
Copy link
Member

@paulbalandan paulbalandan commented Aug 11, 2025

Description
Fixes #9668

Checklist:

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

@paulbalandan paulbalandan added the testing Pull requests that changes tests only label Aug 11, 2025
@paulbalandan
Copy link
Member Author

This fix, although passing, is not yet deterministic, as this assumes there's no database.db in the writable/ folder. After running the DB tests, the database db file remains, so the next local run will now cause test failures.

@neznaika0
Copy link
Contributor

If I understood databases better (and I don't have some on unix), I would try to change the tests. Make them unique, without dependencies. PHPUnit has a randomization option, which is ideal for applying it to the entire project.

@paulbalandan
Copy link
Member Author

Randomising the tests has been envisioned before but early attempts proved very difficult to implement as there are hidden interdependencies within the tests, especially the database tests. That's why up until now we don't have random testing and mutation testing cannot be setup also.

@paulbalandan
Copy link
Member Author

This fix is okay for the meantime as we are not using randomised testing. Once we randomise the tests, we need to isolate and eliminate dependencies.

Copy link
Contributor

@neznaika0 neznaika0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My local tests passed. Thanks!

@michalsn
Copy link
Member

I'm glad you figured it out. Thanks @paulbalandan

@paulbalandan
Copy link
Member Author

Thanks for the reviews!

@paulbalandan paulbalandan merged commit c2d9440 into codeigniter4:develop Aug 12, 2025
47 checks passed
@paulbalandan paulbalandan deleted the fix-db-tests branch August 12, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Pull requests that changes tests only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Database tests failed
3 participants