Just made a new fresh Laravel 6 project and added 1 test.
When I run phpunit
even when the test is empty totally:
/** @test */
public function a_user_can_see_threads()
{
}
results in:
Tests\Feature\ViewThreadsTest::a_user_can_see_threads
Mockery\Exception\BadMethodCallException: Received Mockery_1_Illuminate_Console_OutputStyle::askQuestion(), but no expectations were specified
I was currently doing the "build a forum with laravel TDD" and my test are running well from within phpstorm when I trigger the run command, but when I run phpunit from the command line all test fail again in the same manner.
Tried already: php artisan config:clear
& php artisan config:cache
. Same errors
With the local phpunit you are pretty sure you have a correct version that could work with your project whereas the global one can have a different version.
I think that most of the guys are using an alias which is relative to the folder you are in. But why not use PhpStorm to run tests? It is more readable, and almost not slower at all if you have decent computer.
I like to use phpstorm since I have a hotkey for running the test for the current file I'm in but I didn't find a way to run all the test in several files, so I was trying to use the command line instead.
thanks for the fast replies guys. much appreciated.
The stack overflow thread is also interesting.I'll keep it in mind
If your cursor is not in the test method but in the test class same hotkey will run all tests on that test class. You can select a folder to run more tests. Also select the tests folder and run the hotkey and it will run all tests you have.
Ah, great. didn't know that about the folder selection.
Thats super handy. Well got smarter overall now. thanks a lot - now I have multiple working ways