first working version with simple WaitForContainerRunning implementation

This commit is contained in:
Sergei Shitikov
2024-08-29 18:01:04 +02:00
parent 27caae56c0
commit b7a274b1d9
8 changed files with 276 additions and 201 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Testcontainers\Tests\Integration;
use PHPUnit\Framework\TestCase;
use Testcontainers\Container\GenericContainer;
use Testcontainers\Registry;
class RedisContainerTest extends TestCase
{
// public static function tearDownAfterClass(): void
// {
// parent::tearDownAfterClass();
//
// Registry::cleanup();
// }
public function testRedisContainer(): void
{
$redisContainer = (new GenericContainer('redis:alpine'))
->withExposedPorts(6379)
->start();
$redisClient = new \Predis\Client([
'host' => 'localhost',
'port' => 6379,
]);
$redisClient->set('greetings', 'Hello, World!');
$this->assertEquals('Hello, World!', $redisClient->get('greetings'));
$redisContainer->remove();
}
}