PHPUnit
Laravel Test PHPUnit
class ExampleTest extends TestCase
{
use RefreshDatabase;
}
class ExampleTest extends TestCase
{
protected $seed = true;
}
class ExampleTest extends TestCase
{
public function setUp(): void
{
parent::setUp();
DB::table((new UserModel)->getTable())->truncate();
}
}
https://laracasts.com/discuss/channels/laravel/phpunit-baseurl
class ExampleTest extends TestCase
{
public function setUp(): void
{
parent::setUp();
$app_url= "http://". request()->getHttpHost();;
config(['app.url' => $app_url]);
\URL::forceRootUrl($app_url);
}
}