I added a new line in my Pest.php, below uses(TestCase::class)->in('Feature');:
uses(RefreshDatabase::class)->in('Feature');
Like suggested in https://pestphp.com/docs/underlying-test-case/
After some debugging, with no functionality from TestCase::class, I figured out I had to combine these, or else the latter will override the former, leaving TestCase functionality out of my tests.
This gave me errors like
Unable to locate factory for [App\Category].
and
Call to undefined method Tests\Feature\AddingStatementsToCategoriesTest::get()
when trying to use pestphp on Laravel 7.
I fixed it all this way:
uses(TestCase::class, RefreshDatabase::class)->in('Feature');
Maybe the documentation could be clearer about this, or I'm just stupid for trying ;-).
You are not stupid :)
Indeed I think we could improve the doc clarity on that point.
You can submit a revised version of the documentation page, just click the "Edit this page" link on the top right 馃檪
If you prefer, you can also open an issue with your edit suggestion on the Pest website repo: https://github.com/pestphp/website and I'll be happy to edit/publish it into the doc.
Thanks!
The documentation should now be clearer about the correct usage of uses() : Underlying Test Case.
Most helpful comment
The documentation should now be clearer about the correct usage of
uses(): Underlying Test Case.