Ad
Laravel 6 PHPUnit Testing - Could Not Find Driver (SQL: PRAGMA Foreign_keys = ON;)
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.
Ad
Answer
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.
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad