I'm started to write tests in Laravel. My application works, I can login, run migrations, but when I'm trying to test the login, I'm getting the following error:
could not find driver (SQL: PRAGMA foreign_keys = ON;)
My DB is in Postgres, and my test is as follows:
/** @test */
public function user_login_ok()
{
$response = $this->json('POST', '/api/login', [
'email' => '[email protected]',
'password' => 'test'
]);
$this->assertEquals(200, $response->getStatusCode());
}
I'm not worried (for now) if my test is good enough or even right, but to solve this error.
You may need to enable extension for pdo_sqlite
in your php.ini file that is being used by phpunit.
Do you have a testing environment specific .env
file?
Do you have php
section environment configuration in your phpunit.xml
file?
If either of these has configuration for your database connection, they should be reviewed to make sure they are configured correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With