mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 19:29:39 +00:00
32 lines
765 B
PHP
32 lines
765 B
PHP
<?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);
|
|
}
|
|
}
|