mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-11 19:29:34 +00:00
fix issue with passing envs into the container. Remove container registry usage.
This commit is contained in:
@@ -4,33 +4,30 @@ declare(strict_types=1);
|
||||
|
||||
namespace Testcontainers\Tests\Integration;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Testcontainers\Container\GenericContainer;
|
||||
use Testcontainers\Registry;
|
||||
use Predis\Client;
|
||||
use Testcontainers\Container\RedisContainer;
|
||||
|
||||
class RedisContainerTest extends TestCase
|
||||
class RedisContainerTest extends ContainerTestCase
|
||||
{
|
||||
// public static function tearDownAfterClass(): void
|
||||
// {
|
||||
// parent::tearDownAfterClass();
|
||||
//
|
||||
// Registry::cleanup();
|
||||
// }
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
self::$container = (new RedisContainer())
|
||||
->start();
|
||||
}
|
||||
|
||||
public function testRedisContainer(): void
|
||||
{
|
||||
$redisContainer = (new GenericContainer('redis:alpine'))
|
||||
->withExposedPorts(6379)
|
||||
->start();
|
||||
|
||||
$redisClient = new \Predis\Client([
|
||||
$redisClient = new Client([
|
||||
'host' => 'localhost',
|
||||
'port' => 6379,
|
||||
]);
|
||||
|
||||
$redisClient->ping();
|
||||
|
||||
$this->assertTrue($redisClient->isConnected());
|
||||
|
||||
$redisClient->set('greetings', 'Hello, World!');
|
||||
|
||||
$this->assertEquals('Hello, World!', $redisClient->get('greetings'));
|
||||
$redisContainer->remove();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user