Skip to content

Commit cf72bca

Browse files
Fixed test. (#56)
1 parent 75c57c3 commit cf72bca

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

tests/ConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ protected function prepareMasterSlave($masterCount, $slaveCount): Connection
445445
$db = $this->getConnection(true);
446446

447447
for ($i = 0; $i < $masterCount; ++$i) {
448-
$this->prepareDatabase(null, 'sqlite:' . __DIR__ . "/Data/yii_test_master{$i}.sq3");
448+
$this->prepareDatabase('sqlite:' . __DIR__ . "/Data/yii_test_master{$i}.sq3");
449449

450450
$db->setMasters(
451451
"$i",
@@ -459,7 +459,7 @@ protected function prepareMasterSlave($masterCount, $slaveCount): Connection
459459
}
460460

461461
for ($i = 0; $i < $slaveCount; ++$i) {
462-
$this->prepareDatabase(null, 'sqlite:' . __DIR__ . "/Data/yii_test_slave{$i}.sq3");
462+
$this->prepareDatabase('sqlite:' . __DIR__ . "/Data/yii_test_slave{$i}.sq3");
463463

464464
$db->setSlaves(
465465
"$i",

tests/TestCase.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,9 @@ protected function getConnection($reset = false): Connection
172172
return $this->connection;
173173
}
174174

175-
protected function prepareDatabase(?string $fixture = null, ?string $dsn = null): void
175+
protected function prepareDatabase(string $dsn = null): void
176176
{
177-
if ($fixture === null) {
178-
$fixture = $this->params()['yiisoft/db-sqlite']['fixture'];
179-
}
177+
$fixture = $this->params()['yiisoft/db-sqlite']['fixture'];
180178

181179
if ($dsn !== null) {
182180
$this->connection = $this->createConnection($dsn);
@@ -299,7 +297,7 @@ private function config(): array
299297
];
300298
}
301299

302-
protected function createConnection(?string $dsn = null): ?Connection
300+
protected function createConnection(string $dsn = null): ?Connection
303301
{
304302
$db = null;
305303

@@ -310,7 +308,7 @@ protected function createConnection(?string $dsn = null): ?Connection
310308
[
311309
'__class' => Connection::class,
312310
'__construct()' => [
313-
'dsn' => $this->params()['yiisoft/db-sqlite']['dsn'],
311+
'dsn' => $dsn,
314312
],
315313
]
316314
);

0 commit comments

Comments
 (0)