fix issue with passing envs into the container. Remove container registry usage.

This commit is contained in:
Sergei Shitikov
2024-09-01 14:43:34 +02:00
parent 58f811ec8a
commit b0e4f60592
10 changed files with 60 additions and 46 deletions
+13 -16
View File
@@ -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();
}
}