Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 4 additions & 6 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -299,7 +297,7 @@ private function config(): array
];
}

protected function createConnection(?string $dsn = null): ?Connection
protected function createConnection(string $dsn = null): ?Connection
{
$db = null;

Expand All @@ -310,7 +308,7 @@ protected function createConnection(?string $dsn = null): ?Connection
[
'__class' => Connection::class,
'__construct()' => [
'dsn' => $this->params()['yiisoft/db-sqlite']['dsn'],
'dsn' => $dsn,
],
]
);
Expand Down