mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-12 10:29:37 +00:00
first working version with simple WaitForContainerRunning implementation
This commit is contained in:
@@ -21,6 +21,7 @@ class ContainerTest extends TestCase
|
||||
$container->withMySQLUser('bar', 'baz');
|
||||
|
||||
$container->run();
|
||||
die(123);
|
||||
|
||||
$pdo = new \PDO(
|
||||
sprintf('mysql:host=%s;port=3306', $container->getAddress()),
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user