classMySqlContainer
abstract class MySqlContainer
extends GenericContainer
Defines a reusable MySQL server with a disposable test database.
Each version extends it and sets only $IMAGE. The server runs on tmpfs and skips loading the time zone tables to start fast; it is ready once PDO can connect as root / root.
Properties§
protected static $EXPOSED_PORTS = [3306]protected static $MOUNTS = ['type=tmpfs,destination=/var/lib/mysql']protected static $ENVIRONMENTS = ['MYSQL_ROOT_PASSWORD' => 'root', 'MYSQL_ROOT_HOST' => '%', 'MYSQL_DATABASE' =>…protected static $REUSE_MODE = 'reuse'protected static $STARTUP_TIMEOUT = 300protected static $STARTUP_CONFLICT_RETRY_ATTEMPTS = 10protected static $AUTO_REMOVE_ON_EXIT = trueMethods§
public static function getGrammarVersion(): stringpublic function afterStart(ContainerInstance $instance): voidAttaches the server endpoint once the container has started.
The host is given as 127.0.0.1 instead of localhost so that clients connect over TCP.
Parameters
$instance | ContainerInstance | Started container instance. |
Throws
RuntimeException If the server port is not mapped to the host.protected function waitStrategy(ContainerInstance $instance): WaitStrategyWaits until PDO can connect to the test database.
Parameters
$instance | ContainerInstance | Started container instance. |
Returns
WaitStrategy PDO connection wait strategy.Relations§
Extended by 9
- MySql56Container packages/container/src/MySql56Container.php:14
- MySql57Container packages/container/src/MySql57Container.php:14
- MySql80Container packages/container/src/MySql80Container.php:14
- MySql81Container packages/container/src/MySql81Container.php:14
- MySql82Container packages/container/src/MySql82Container.php:14
- MySql83Container packages/container/src/MySql83Container.php:14
- MySql84Container packages/container/src/MySql84Container.php:14
- MySql90Container packages/container/src/MySql90Container.php:14
- MySql91Container packages/container/src/MySql91Container.php:14