Add mongodb module

This commit is contained in:
stan220
2025-05-08 10:47:41 +03:00
parent dc94649504
commit 4134cf951d
4 changed files with 69 additions and 1 deletions
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Integration;
use Testcontainers\Container\StartedGenericContainer;
use Testcontainers\Modules\MongoDBContainer;
use Testcontainers\Tests\Integration\ContainerTestCase;
class MongoDBContainerTest extends ContainerTestCase
{
public function setUp(): void
{
$this->container = (new MongoDBContainer())->start();
}
public function testMongoDBContainer(): void
{
self::assertInstanceOf(StartedGenericContainer::class, $this->container);
$pingResult = $this->container->exec([
'mongosh', 'admin',
'-u', 'test',
'-p', 'test',
'--eval', "'db.runCommand(\"ping\").ok'",
]);
self::assertEquals(1, $pingResult);
}
}