Skip to content

docs: update about test database setup #6416

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 3 commits into from
Aug 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,24 @@ for code coverage to be calculated successfully. After installing `XDebug`, you
## Setting Up

A number of the tests use a running database.
In order to set up the database edit the details for the `tests` group in
**app/Config/Database.php** or **phpunit.xml**.
The default configuration uses SQLite3 transient in-memory database, so it works if you can use SQLite3.

In order to change the database for testing, edit the details for the `tests` group in
**app/Config/Database.php** or **phpunit.xml** or use **.env** file.

E.g.:
```
database.tests.hostname = localhost
database.tests.database = ci4_test
database.tests.username = root
database.tests.password = root
database.tests.DBDriver = MySQLi
database.tests.DBPrefix = db_
database.default.port = 3306
```

Make sure that you provide a database engine that is currently running on your machine.

More details on a test database setup are in the
[Testing Your Database](https://codeigniter4.github.io/CodeIgniter4/testing/database.html) section of the documentation.

Expand Down