Skip to content

Commit

Permalink
Merge branch '1.4' into 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
eigan committed Feb 4, 2020
2 parents 688c67e + ee79c7f commit 03dd5ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: php
php:
- 7.2
- 7.3
- 7.4snapshot
- 7.4

before_script:
- travis_retry composer self-update
Expand Down
8 changes: 7 additions & 1 deletion src/Configuration/Connections/MasterSlaveConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ public function resolve(array $settings = [])
{
$driver = $this->resolvedBaseSettings['driver'];

return [
$resolvedSettings = [
'wrapperClass' => $settings['wrapperClass'] ?? MasterSlaveDoctrineWrapper::class,
'driver' => $driver,
'master' => $this->getConnectionData(isset($settings['write']) ? $settings['write'] : [], $driver),
'slaves' => $this->getSlavesConfig($settings['read'], $driver),
];

if (!empty($settings['serverVersion'])) {
$resolvedSettings['serverVersion'] = $settings['serverVersion'];
}

return $resolvedSettings;
}

/**
Expand Down
11 changes: 8 additions & 3 deletions tests/Configuration/Connections/MasterSlaveConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private function getInputConfig()
'port' => 3309
],
],
'serverVersion' => '5.8',
];
}

Expand All @@ -100,9 +101,10 @@ private function getInputConfig()
private function getExpectedConfig()
{
return [
'wrapperClass' => MasterSlaveDoctrineWrapper::class,
'driver' => 'pdo_mysql',
'slaves' => [
'wrapperClass' => MasterSlaveDoctrineWrapper::class,
'driver' => 'pdo_mysql',
'serverVersion' => '5.8',
'slaves' => [
[
'host' => 'localhost',
'user' => 'homestead',
Expand Down Expand Up @@ -217,6 +219,7 @@ private function getOracleExpectedConfig()
$expectedConfigOracle = $this->getNodesExpectedConfig();
$expectedConfigOracle['driver'] = 'oci8';
$expectedConfigOracle['master']['user'] = 'homestead1';
$expectedConfigOracle['serverVersion'] = '5.8';

return $expectedConfigOracle;
}
Expand All @@ -234,6 +237,7 @@ private function getPgsqlExpectedConfig()
$expectedConfigPgsql['master']['sslmode'] = 'sslmode';
$expectedConfigPgsql['slaves'][0]['sslmode'] = 'sslmode';
$expectedConfigPgsql['slaves'][1]['sslmode'] = 'sslmode';
$expectedConfigPgsql['serverVersion'] = '5.8';

return $expectedConfigPgsql;
}
Expand Down Expand Up @@ -272,6 +276,7 @@ private function getSqliteExpectedConfig()
'memory' => true,
'path' => ':memory',
],
'serverVersion' => '5.8',
];
}

Expand Down

0 comments on commit 03dd5ed

Please sign in to comment.