From ac8d03c27bebd867a76e9db40894d0734bc662e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Fri, 17 Oct 2025 21:46:55 +0200 Subject: [PATCH 1/2] Make server URI configurable for functional tests --- tests/Command/CommandTestKernel.php | 2 +- tests/DocumentValueResolverFunctionalTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Command/CommandTestKernel.php b/tests/Command/CommandTestKernel.php index bc6958dd..30594622 100644 --- a/tests/Command/CommandTestKernel.php +++ b/tests/Command/CommandTestKernel.php @@ -44,7 +44,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa ]); $container->loadFromExtension('doctrine_mongodb', [ - 'connections' => ['default' => []], + 'connections' => ['default' => ['server' => '%env(DOCTRINE_MONGODB_SERVER)%']], 'document_managers' => [ 'command_test' => [ 'connection' => 'default', diff --git a/tests/DocumentValueResolverFunctionalTest.php b/tests/DocumentValueResolverFunctionalTest.php index 5fb51468..2ffe3d72 100644 --- a/tests/DocumentValueResolverFunctionalTest.php +++ b/tests/DocumentValueResolverFunctionalTest.php @@ -111,7 +111,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ]); $c->loadFromExtension('doctrine_mongodb', [ - 'connections' => ['default' => []], + 'connections' => ['default' => ['server' => '%env(DOCTRINE_MONGODB_SERVER)%']], 'document_managers' => [ 'default' => [ 'mappings' => [ From fbe2dfeec9623cd1ed8b1dad863d99be24354a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Wed, 29 Oct 2025 13:08:40 +0100 Subject: [PATCH 2/2] Use MONGODB_URI --- phpunit.xml.dist | 2 +- tests/Command/CommandTestKernel.php | 2 +- tests/DocumentValueResolverFunctionalTest.php | 2 +- tests/TestCase.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2ef3bdec..a8cc034b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,7 +20,7 @@ - + diff --git a/tests/Command/CommandTestKernel.php b/tests/Command/CommandTestKernel.php index 30594622..19abc844 100644 --- a/tests/Command/CommandTestKernel.php +++ b/tests/Command/CommandTestKernel.php @@ -44,7 +44,7 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa ]); $container->loadFromExtension('doctrine_mongodb', [ - 'connections' => ['default' => ['server' => '%env(DOCTRINE_MONGODB_SERVER)%']], + 'connections' => ['default' => ['server' => '%env(MONGODB_URI)%']], 'document_managers' => [ 'command_test' => [ 'connection' => 'default', diff --git a/tests/DocumentValueResolverFunctionalTest.php b/tests/DocumentValueResolverFunctionalTest.php index 2ffe3d72..41255d24 100644 --- a/tests/DocumentValueResolverFunctionalTest.php +++ b/tests/DocumentValueResolverFunctionalTest.php @@ -111,7 +111,7 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ]); $c->loadFromExtension('doctrine_mongodb', [ - 'connections' => ['default' => ['server' => '%env(DOCTRINE_MONGODB_SERVER)%']], + 'connections' => ['default' => ['server' => '%env(MONGODB_URI)%']], 'document_managers' => [ 'default' => [ 'mappings' => [ diff --git a/tests/TestCase.php b/tests/TestCase.php index 13ffb25d..2b1492ef 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -27,7 +27,7 @@ public static function createTestDocumentManager(array $paths = []): DocumentMan $config->setHydratorNamespace('SymfonyTests\Doctrine'); $config->setMetadataDriverImpl(new AttributeDriver($paths)); $config->setMetadataCache(new ArrayAdapter()); - $uri = getenv('DOCTRINE_MONGODB_SERVER') ?: 'mongodb://localhost:27017'; + $uri = getenv('MONGODB_URI'); return DocumentManager::create(new Client($uri), $config); }