From f9c09d9d02f252c93934396da539112f106b3fd6 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Wed, 2 Dec 2020 00:11:07 -0300 Subject: [PATCH] Fixed test. --- tests/ConnectionTest.php | 4 ++-- tests/TestCase.php | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index cb0a6d7c4..eb7f23ce2 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -445,7 +445,7 @@ protected function prepareMasterSlave($masterCount, $slaveCount): Connection $db = $this->getConnection(true); for ($i = 0; $i < $masterCount; ++$i) { - $this->prepareDatabase(null, 'sqlite:' . __DIR__ . "/Data/yii_test_master{$i}.sq3"); + $this->prepareDatabase('sqlite:' . __DIR__ . "/Data/yii_test_master{$i}.sq3"); $db->setMasters( "$i", @@ -459,7 +459,7 @@ protected function prepareMasterSlave($masterCount, $slaveCount): Connection } for ($i = 0; $i < $slaveCount; ++$i) { - $this->prepareDatabase(null, 'sqlite:' . __DIR__ . "/Data/yii_test_slave{$i}.sq3"); + $this->prepareDatabase('sqlite:' . __DIR__ . "/Data/yii_test_slave{$i}.sq3"); $db->setSlaves( "$i", diff --git a/tests/TestCase.php b/tests/TestCase.php index 9559d00db..c1ff0c30b 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -172,11 +172,9 @@ protected function getConnection($reset = false): Connection return $this->connection; } - protected function prepareDatabase(?string $fixture = null, ?string $dsn = null): void + protected function prepareDatabase(string $dsn = null): void { - if ($fixture === null) { - $fixture = $this->params()['yiisoft/db-sqlite']['fixture']; - } + $fixture = $this->params()['yiisoft/db-sqlite']['fixture']; if ($dsn !== null) { $this->connection = $this->createConnection($dsn); @@ -299,7 +297,7 @@ private function config(): array ]; } - protected function createConnection(?string $dsn = null): ?Connection + protected function createConnection(string $dsn = null): ?Connection { $db = null; @@ -310,7 +308,7 @@ protected function createConnection(?string $dsn = null): ?Connection [ '__class' => Connection::class, '__construct()' => [ - 'dsn' => $this->params()['yiisoft/db-sqlite']['dsn'], + 'dsn' => $dsn, ], ] );