Level 104
in my app I do not have migration I just connect to database that already exist somewhere.
Use the DatabaseTransactions trait in that case, not RefreshDatabase.
I have created the following unit test:
<?php
namespace Tests\Feature\Auth;
use Tests\TestCase;
use Asu\Domain\Admins\Admin;
use Illuminate\Foundation\Testing\RefreshDatabase;
class LoginAdminTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function admin_can_login_and_see_his_token()
{
$admin = Admin::factory()->create();
dd($admin);
}
}
When I run it, I get:
SQLSTATE[HY000]: General error: 1 no such table: fresh.admins
However, in tinker, the seed is just working fine, and I have used both RefreshDatabase & DatabaseMigrations and still got the same error.
⭕️ Note: in my app I do not have migration I just connect to database that already exist somewhere.
in my app I do not have migration I just connect to database that already exist somewhere.
Use the DatabaseTransactions trait in that case, not RefreshDatabase.
Please or to participate in this conversation.