Skip to content
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

Check for configured instead of hard-coded database in DbUtilsTest #4705

Merged
merged 1 commit into from
May 19, 2021

Conversation

jeromegamez
Copy link
Contributor

@jeromegamez jeromegamez commented May 18, 2021

Greetings 👋,

I'm currently setting up this repo and its test suite on my local machine (PHP 8.0.5, MySQL 8.0.23) and am coming across some problems while I'm learning the ropes 😅.

With the help of @MGatner I was able to connect the test suite to my local database by adding this snippet to my phpunit.xml:

<phpunit>
    <php>
		<!-- Database configuration -->
		<env name="database.tests.strictOn" value="true"/>
		<env name="database.tests.hostname" value="localhost"/>
		<env name="database.tests.database" value="codeigniter"/>
		<env name="database.tests.username" value="root"/>
		<env name="database.tests.password" value=""/>
		<env name="database.tests.DBDriver" value="MySQLi"/>
		<env name="database.tests.DBPrefix" value="tests_"/>
    </php>
</phpunit>

Since I like to name my local databases after the project I'm working with, I used codeigniter as the database name (instead of test); but this caused some tests to fail because test was hardcoded in them 🙈, so I'd like to propose this change which made it work for me, and, I hope, for you as well 😅.

:octocat:

@lonnieezell
Copy link
Member

Hey @jeromegamez nice catch! Thanks for the PR.

@lonnieezell lonnieezell merged commit 8dceca2 into codeigniter4:develop May 19, 2021
@jeromegamez jeromegamez deleted the db-test-utils branch May 19, 2021 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants