diff --git a/src/EntityManagerFactory.php b/src/EntityManagerFactory.php index 1f9659da..377b2b23 100644 --- a/src/EntityManagerFactory.php +++ b/src/EntityManagerFactory.php @@ -524,6 +524,7 @@ private function isPrimaryReadReplicaConfigured(array $driverConfig) * Check if slave configuration is valid. * * @param array $driverConfig + * @return bool */ private function hasValidPrimaryReadReplicaConfig(array $driverConfig) { @@ -540,5 +541,7 @@ private function hasValidPrimaryReadReplicaConfig(array $driverConfig) if (($key = array_search(0, array_map('count', $slaves))) !== false) { throw new \InvalidArgumentException("Parameter 'read' config no. {$key} is empty."); } + + return true; } } diff --git a/tests/EntityManagerFactoryTest.php b/tests/EntityManagerFactoryTest.php index f2026095..a3f2b868 100644 --- a/tests/EntityManagerFactoryTest.php +++ b/tests/EntityManagerFactoryTest.php @@ -3,6 +3,7 @@ use Doctrine\Common\Cache\Cache; use Doctrine\Common\EventSubscriber; use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Connections\PrimaryReadReplicaConnection; use Doctrine\DBAL\Schema\DefaultSchemaManagerFactory; use Doctrine\ORM\Cache\CacheFactory; use Doctrine\ORM\Cache\RegionsConfiguration; @@ -1172,9 +1173,9 @@ public function testPrimaryReadReplicaConnection( } $this->settings['connection'] = 'mysql'; - $factory->create($this->settings); + $em = $factory->create($this->settings); - $this->assertTrue(true); + $this->assertInstanceOf(PrimaryReadReplicaConnection::class, $em->getConnection()); } protected function tearDown(): void