danzar's avatar

Migration error on unit test run

When I run the unit tests i receive an error about missing migration table.

I have put the use RefreshDatabase; on the unit test class.

Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: migrations (SQL: select exists(select * from "migrations" where "migration" = 2019_12_26_131421_create_subscription_details) as "exists")
    use RefreshDatabase;

    public function testBasicTest()
    {

        $user = factory(User::class)->create();
        $user->name = 'danzar';
        $this->assertTrue($user->save());
    }

I am using the defaults in phpunit.xml

        <server name="BCRYPT_ROUNDS" value="4"/>
        <server name="CACHE_DRIVER" value="array"/>
        <server name="MAIL_DRIVER" value="array"/>
        <server name="QUEUE_CONNECTION" value="sync"/>
        <server name="SESSION_DRIVER" value="array"/>
        <server name="DB_CONNECTION" value="sqlite_testing"/>
        <server name="DB_DATABASE" value=":memory:"/>

Any tips would be greatly appreciated!!

I even went as far as created a new separate project and running unit test. It works fine with in that project. So I do not know what i have setup wrong in this project.

0 likes
4 replies
Tray2's avatar

Try changing this line

<server name="DB_CONNECTION" value="sqlite_testing"/>

to

<server name="DB_CONNECTION" value="sqlite"/>
Hesesses's avatar

I suddenly got this same error... how did you solve it?

Please or to participate in this conversation.