1 year ago

Unknown database ':memory:'

Posted 1 year ago by nexxai

Am I missing something here? I've got my phpunit.xml set up correctly (I think):

<env name="APP_ENV" value="testing"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="CACHE_DRIVER" value="array"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="QUEUE_DRIVER" value="sync"/> 

But no matter what I do, I keep getting this error:

PHPUnit 7.2.7 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 874 ms, Memory: 42.66MB

There was 1 error:

1) Tests\Feature\ProductionTest::a_user_can_browse_productions
Illuminate\Database\QueryException: SQLSTATE[HY000] [1049] Unknown database ':memory:' (SQL: select * from `sessions` where `id` = zX4xORwbal5OzBZv7ZfuvAhHamcHZkAFTHUgxjn5 limit 1)


Tests: 1, Assertions: 0, Errors: 1.

This is the entirety of the test file:


namespace Tests\Feature;

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\TestCase;

class ProductionTest extends TestCase
    use DatabaseMigrations;

    /** @test */
    public function a_user_can_browse_productions()
        $response = $this->get('/productions');



I feel like I'm taking crazy pills.

Please sign in or create an account to participate in this conversation.