Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running PHPUnit and test case with migrations #8

Open
fpena opened this issue Feb 9, 2018 · 2 comments
Open

Error when running PHPUnit and test case with migrations #8

fpena opened this issue Feb 9, 2018 · 2 comments

Comments

@fpena
Copy link

fpena commented Feb 9, 2018

When running PHPUnit and having a class extending from TestCase and using use RefreshDatabase; for migrations, it returns an error:

Example class:

<?php

namespace Tests\Feature;

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

class ExampleTest extends TestCase
{
    use RefreshDatabase;
    
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }
}

Error:

Illuminate\Database\QueryException: could not find driver (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

Is there something to add to the config.yml file?

@ryanwohara
Copy link
Contributor

You just need to install the driver for the database you're using in testing. What driver do you have configured for your tests to run?

@kristof-siket
Copy link

Same problem is there for me, in the pipeline config I install sqlite with sudo apt install -y libsqlite3-dev zlib1g-dev . Then, migration is successful, while the tests are failing due to error: could not find the driver (same as explained above). Could anyone solve the issue so far?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants