Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Mar 16, 2021
1 parent f91e835 commit 9473f06
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,54 +20,41 @@
//Composer
require dirname(__DIR__) . '/vendor/autoload.php';

$db = getenv('DB') ?: null;

$drivers = [
'sqlite' => [
'driver' => Database\Driver\SQLite\SQLiteDriver::class,
'check' => static function () use ($db) {
return $db === 'sqlite' || in_array('sqlite', \PDO::getAvailableDrivers(), true);
},
'conn' => 'sqlite::memory:',
'user' => 'sqlite',
'pass' => '',
'queryCache' => 100
],
'mysql' => [
'driver' => Database\Driver\MySQL\MySQLDriver::class,
'check' => static function () use ($db) {
return $db === 'mysql' || in_array('mysql', \PDO::getAvailableDrivers(), true);
},
'conn' => 'mysql:host=127.0.0.1:13306;dbname=spiral',
'user' => 'root',
'pass' => 'root',
'queryCache' => 100
],
'postgres' => [
'driver' => Database\Driver\Postgres\PostgresDriver::class,
'check' => static function () use ($db) {
return $db === 'postgres' || in_array('pgsql', \PDO::getAvailableDrivers(), true);
},
'conn' => 'pgsql:host=127.0.0.1;port=15432;dbname=spiral',
'user' => 'postgres',
'pass' => 'postgres',
'queryCache' => 100
],
'sqlserver' => [
'driver' => Database\Driver\SQLServer\SQLServerDriver::class,
'check' => static function () use ($db) {
return $db === 'sqlserver' || in_array('sqlsrv', \PDO::getAvailableDrivers(), true);
},
'conn' => 'sqlsrv:Server=127.0.0.1,11433;Database=tempdb',
'user' => 'SA',
'pass' => 'SSpaSS__1',
'queryCache' => 100
],
];

$db = getenv('DB') ?: null;
Database\Tests\BaseTest::$config = [
'debug' => false,
] + ($db === null
? $drivers
: array_intersect_key($drivers, array_flip((array)$db))
);
);

0 comments on commit 9473f06

Please sign in to comment.