From eb6470b8547a11074d75ee4c23e3859bdd985c8c Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Sat, 27 Dec 2025 09:45:52 +0100 Subject: [PATCH] fix: update MongoDB extension requirement and skip tests if not installed --- composer.json | 4 +++- tests/Integration/MongoDBContainerTest.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f9b0bc5..041db96 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,6 @@ "beluga-php/docker-php": "^1.45" }, "require-dev": { - "ext-mongodb": "*", "ext-pdo": "*", "ext-pdo_mysql": "*", "ext-pdo_pgsql": "*", @@ -31,6 +30,9 @@ "phpstan/extension-installer": "^1.2", "predis/predis": "^3.0 || ^2.0" }, + "suggest": { + "ext-mongodb": "Required for MongoDB container support" + }, "autoload": { "psr-4": { "Testcontainers\\": "src/" diff --git a/tests/Integration/MongoDBContainerTest.php b/tests/Integration/MongoDBContainerTest.php index e388a04..77b7d49 100644 --- a/tests/Integration/MongoDBContainerTest.php +++ b/tests/Integration/MongoDBContainerTest.php @@ -12,6 +12,10 @@ class MongoDBContainerTest extends ContainerTestCase { public function setUp(): void { + if (!extension_loaded('mongodb')) { + $this->markTestSkipped('MongoDB extension is not installed'); + } + $this->container = (new MongoDBContainer())->start(); }