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

Avoid accidentally wiping local database when running tests #13292

Merged
merged 1 commit into from
Jul 12, 2023

Conversation

marcusmoore
Copy link
Collaborator

Description

This PR adds guards before the running of PHPUnit and Dusk tests that check to see if env files have been created to avoid falling back to the .env file and ending up with the local database being wiped.

For PHPUnit tests, if the user hasn't created a .env.testing file then the tests will not run.
For Dusk tests, a .env.dusk.local is required.

Type of change

  • New feature (non-breaking change which adds functionality)

@marcusmoore marcusmoore requested a review from snipe as a code owner July 11, 2023 19:20
@what-the-diff
Copy link

what-the-diff bot commented Jul 11, 2023

PR Summary

  • Modification of .chipperci.yml File
    This Pull Request adds a new line to the .chipperci.yml file to create a .env.testing file, improving the setup process of our testing environment.

  • Update to DuskTestCase.php File
    This Pull Request introduces improvements to error handling. Now, the system will explicitly check if the required .env.dusk.local file is available. If not, a useful alert message will be triggered, preventing cryptic errors down the line.

  • Improvements to TestCase.php File
    Similarly to the DuskTestCase.php update, this Pull Request adds a file existence check for .env.testing. This acts as a preventative measure, enabling clearer communication of issues if the necessary testing file is not present.

@snipe
Copy link
Owner

snipe commented Jul 12, 2023

Love this, thank you!

@snipe snipe merged commit 1b8b117 into snipe:develop Jul 12, 2023
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

Absolutely love this, thank you!

@marcusmoore marcusmoore deleted the guard-against-wiping-local-db branch July 12, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants