use FixedPortGenerator for legacy implementations

This commit is contained in:
Sergei Shitikov
2024-09-29 18:10:01 +02:00
parent a58ff460fa
commit 353977c7bb
7 changed files with 22 additions and 9 deletions
+2
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Testcontainers\Container;
use Testcontainers\Utils\PortGenerator\FixedPortGenerator;
use Testcontainers\Wait\WaitForExec;
/**
@@ -16,6 +17,7 @@ class MySQLContainer extends Container
public function __construct(string $version = 'latest', string $mysqlRootPassword = 'root')
{
parent::__construct('mysql:' . $version);
$this->withPortGenerator(new FixedPortGenerator([3306]));
$this->withExposedPorts(3306);
$this->withEnvironment('MYSQL_ROOT_PASSWORD', $mysqlRootPassword);
$this->withWait(new WaitForExec([