classPostgreSqlContainer
abstract class PostgreSqlContainer
extends GenericContainer
Defines a reusable PostgreSQL server with a disposable test database.
Each version extends it and sets only $IMAGE. The server is ready once it logs that it accepts connections; the user is test / test.
Properties§
protected static $EXPOSED_PORTS = [5432]protected static $ENVIRONMENTS = ['POSTGRES_USER' => 'test', 'POSTGRES_PASSWORD' => 'test', 'POSTGRES_DB' => 'te…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): WaitStrategy