mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 21:29:39 +00:00
remove legacy
This commit is contained in:
@@ -17,29 +17,31 @@ class PostgresContainer extends GenericContainer
|
||||
) {
|
||||
parent::__construct('postgres:' . $version);
|
||||
$this->withExposedPorts(5432);
|
||||
$this->withEnvironment('POSTGRES_USER', $this->username);
|
||||
$this->withEnvironment('POSTGRES_PASSWORD', $this->password);
|
||||
$this->withEnvironment('POSTGRES_DB', $this->database);
|
||||
$this->withEnvironment([
|
||||
'POSTGRES_USER' => $this->username,
|
||||
'POSTGRES_PASSWORD' => $this->password,
|
||||
'POSTGRES_DB' => $this->database,
|
||||
]);
|
||||
$this->withWait(new WaitForExec(["pg_isready", "-h", "127.0.0.1", "-U", $this->username]));
|
||||
}
|
||||
|
||||
public function withPostgresUser(string $username): self
|
||||
{
|
||||
$this->withEnvironment('POSTGRES_USER', $username);
|
||||
$this->withEnvironment(['POSTGRES_USER' => $username]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withPostgresPassword(string $password): self
|
||||
{
|
||||
$this->withEnvironment('POSTGRES_PASSWORD', $password);
|
||||
$this->withEnvironment(['POSTGRES_PASSWORD' => $password]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withPostgresDatabase(string $database): self
|
||||
{
|
||||
$this->withEnvironment('POSTGRES_DB', $database);
|
||||
$this->withEnvironment(['POSTGRES_DB' => $database]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user