diff --git a/.travis.yml b/.travis.yml index d7d57cdb..81c4e9e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: php php: - 7.2 - 7.3 - - 7.4snapshot + - 7.4 before_script: - travis_retry composer self-update diff --git a/src/Configuration/Connections/MasterSlaveConnection.php b/src/Configuration/Connections/MasterSlaveConnection.php index 83c7236a..71933172 100644 --- a/src/Configuration/Connections/MasterSlaveConnection.php +++ b/src/Configuration/Connections/MasterSlaveConnection.php @@ -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; } /** diff --git a/tests/Configuration/Connections/MasterSlaveConnectionTest.php b/tests/Configuration/Connections/MasterSlaveConnectionTest.php index 2e15c9ac..0ace8057 100644 --- a/tests/Configuration/Connections/MasterSlaveConnectionTest.php +++ b/tests/Configuration/Connections/MasterSlaveConnectionTest.php @@ -89,6 +89,7 @@ private function getInputConfig() 'port' => 3309 ], ], + 'serverVersion' => '5.8', ]; } @@ -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', @@ -217,6 +219,7 @@ private function getOracleExpectedConfig() $expectedConfigOracle = $this->getNodesExpectedConfig(); $expectedConfigOracle['driver'] = 'oci8'; $expectedConfigOracle['master']['user'] = 'homestead1'; + $expectedConfigOracle['serverVersion'] = '5.8'; return $expectedConfigOracle; } @@ -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; } @@ -272,6 +276,7 @@ private function getSqliteExpectedConfig() 'memory' => true, 'path' => ':memory', ], + 'serverVersion' => '5.8', ]; }