Try write a unit test and i need do sql query
class UpdateThrowsTest extends TestCase
{
protected $bgame;
protected $game_id = 95;
public function setUp(){
$game = new Game();
$game = $game::find($this->game_id);
}
}
and then i write "phpunit" in console and try exception
Call to a member function connection() on null.
If anyone bounce to this error during test with Laravel 6 project.
Try to check if the extends TestCase is using the right TestCase. It could be due to Laravel 6 make:test generated test using the wrong TestCase.
Change
use PHPUnit\Framework\TestCase;
To
use Tests\TestCase;
The problem should solve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With