withExposedPorts(5432); $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]); return $this; } public function withPostgresPassword(string $password): self { $this->withEnvironment(['POSTGRES_PASSWORD' => $password]); return $this; } public function withPostgresDatabase(string $database): self { $this->withEnvironment(['POSTGRES_DB' => $database]); return $this; } }