mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 19:29:39 +00:00
- Added random port logic - Updated wait wtrategies - API alignments to make it similar to other official implementations - ...
34 lines
779 B
PHP
34 lines
779 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Testcontainers\Tests\Integration;
|
|
|
|
use Predis\Client;
|
|
use Testcontainers\Modules\RedisContainer;
|
|
|
|
class RedisContainerTest extends ContainerTestCase
|
|
{
|
|
public static function setUpBeforeClass(): void
|
|
{
|
|
self::$container = (new RedisContainer())
|
|
->start();
|
|
}
|
|
|
|
public function testRedisContainer(): void
|
|
{
|
|
$redisClient = new Client([
|
|
'host' => self::$container->getHost(),
|
|
'port' => self::$container->getFirstMappedPort(),
|
|
]);
|
|
|
|
$redisClient->ping();
|
|
|
|
$this->assertTrue($redisClient->isConnected());
|
|
|
|
$redisClient->set('greetings', 'Hello, World!');
|
|
|
|
$this->assertEquals('Hello, World!', $redisClient->get('greetings'));
|
|
}
|
|
}
|