Update stub for unit tests #39602
Replies: 1 comment
-
This is the expected behaviour for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
PROBLEM
As a newbie to testing, when I run
php artisan make:test SomeTest --unit
Then I write a test, and then when I run it, I get this error:
Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist.
The problem is that all out-of-the-box generated
--unit
tests contain this on line 5:use PHPUnit\Framework\TestCase;
So one of the first things I do when I create a new test is change this line to:
use Tests\TestCase;
SOLUTION:
I can run
php artisan stub:publish
And update my own copy of
stubs/test.unit.stub.php
But it would be nice if this worked as expected out of the box.
I plan on submitting a pull request for this momentarily...
Beta Was this translation helpful? Give feedback.
All reactions