mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-11 23:29:36 +00:00
Add mongodb module
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user