My test case:
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
use Illuminate\Http\Response;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class UserTest extends TestCase
{
use RefreshDatabase, WithFaker, DatabaseMigrations;
protected $endPoint = '/dashboard/users';
public function setUp():void
{
parent::setUp();
$this->artisan('migrate:fresh');
$this->artisan('db:seed');
}
public function test_users_list_is_showing_correctly()
{
$this->signIn();
$this->get($this->endPoint)
->assertStatus(Response::HTTP_OK);
}
}
But, I am receiving error:
SQLSTATE[HY000]: General error: 1 no such table: settings (SQL: select "id", "name", "setting_value" from "settings")
It might be throwing error because, I have this code in boot method of AppServiceProvider
config(['settings' => Setting::get(['id','name','setting_value'])]);
How to fix this? Its probably that migration and seeder are not working, but not sure.