-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes unit and feature test suite #12640
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
This is awesome - thank you so much, @marcusmoore!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR gets the test suite back to a runnable and green state!
To test it for yourself follow the updated docs in
TESTING.md
(basicallycp .env.testing. .env.testing
and update values).I made an effort to get the configuration closer to what Laravel ships by default. This includes:
phpunit.xml
.env.testing
file, adding it to.gitignore
, and instructing users to copy the new.env.testing.example
file to.env.testing
and populate it with their testing database information/tests/Unit/BaseTest.php
and/tests/TestCase.php
into Laravel's standard/tests/TestCase.php
.TestCase.php
has the following characteristics:LazilyRefreshDatabase
is defined at this level (more details below)SecurityHeaders
middleware is disabled for all tests. This is because it callsheader_remove()
which causes problems for some requests in testsLazilyRefreshDatabase
details: this trait that is provided by Laravel has been added to theTestCase
that all tests extend. It works similar toRefreshDatabase
but only triggers a database refresh right before a database query is executed. This means pure unit tests that don't interact with the database do not incur a performance hit. But the time to start running the first test is still "slow" because the trait runsmigrate:fresh
before the first test but then starts using a transaction so subsequent tests are faster. I'd like to explore ways to improve this at at later date.Something to note: The tests are run from a pure state meaning each test (or possibly group of tests using
setup()
) need to build the world for their use case. In the future we can explore seeding the database with data that is standard for all tests.Another note: This PR doesn't do any work to migrate the Codeception tests 馃槵 (that can happen next)