This commit is contained in:
Sergei Shitikov
2024-09-06 20:15:10 +02:00
parent a10484e7f5
commit 656f38f056
10 changed files with 10 additions and 72 deletions
+8 -7
View File
@@ -14,6 +14,7 @@ class Container extends GenericContainer
protected ?StartedTestContainer $startedContainer = null; protected ?StartedTestContainer $startedContainer = null;
protected ?StoppedTestContainer $stoppedContainer = null; protected ?StoppedTestContainer $stoppedContainer = null;
public static function make(string $image): self public static function make(string $image): self
{ {
return new self($image); return new self($image);
@@ -61,7 +62,7 @@ class Container extends GenericContainer
*/ */
public function execute(array $commandAsArray): string public function execute(array $commandAsArray): string
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
@@ -73,7 +74,7 @@ class Container extends GenericContainer
*/ */
public function logs(): string public function logs(): string
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
@@ -85,7 +86,7 @@ class Container extends GenericContainer
*/ */
public function getAddress(): string public function getAddress(): string
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
@@ -97,7 +98,7 @@ class Container extends GenericContainer
*/ */
public function getPort(): int public function getPort(): int
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
@@ -119,7 +120,7 @@ class Container extends GenericContainer
*/ */
public function stop(): self public function stop(): self
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
@@ -133,7 +134,7 @@ class Container extends GenericContainer
*/ */
public function restart(): self public function restart(): self
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
@@ -148,7 +149,7 @@ class Container extends GenericContainer
*/ */
public function remove(): self public function remove(): self
{ {
if($this->startedContainer === null) { if ($this->startedContainer === null) {
throw new \RuntimeException('Container is not started'); throw new \RuntimeException('Container is not started');
} }
-4
View File
@@ -21,10 +21,6 @@ class MariaDBContainer extends Container
$this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword); $this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword);
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self
{ {
return new self($version, $mysqlRootPassword); return new self($version, $mysqlRootPassword);
+1 -5
View File
@@ -21,10 +21,6 @@ class MySQLContainer extends Container
$this->withWait(new WaitForLog('ready for connections')); $this->withWait(new WaitForLog('ready for connections'));
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self
{ {
return new self($version, $mysqlRootPassword); return new self($version, $mysqlRootPassword);
@@ -44,4 +40,4 @@ class MySQLContainer extends Container
return $this; return $this;
} }
} }
+1 -13
View File
@@ -26,27 +26,15 @@ class OpenSearchContainer extends Container
)); ));
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest'): self public static function make(string $version = 'latest'): self
{ {
return new self($version); return new self($version);
} }
public function withDisabledSecurityPlugin(): self public function disableSecurityPlugin(): self
{ {
$this->withEnvironment('plugins.security.disabled', 'true'); $this->withEnvironment('plugins.security.disabled', 'true');
return $this; return $this;
} }
/**
* @deprecated Use withDisabledSecurityPlugin instead
*/
public function disableSecurityPlugin(): self
{
return $this->withDisabledSecurityPlugin();
}
} }
-4
View File
@@ -27,10 +27,6 @@ class PostgresContainer extends Container
$this->withWait(new WaitForExec(["pg_isready", "-h", "127.0.0.1", "-U", $this->username])); $this->withWait(new WaitForExec(["pg_isready", "-h", "127.0.0.1", "-U", $this->username]));
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest', string $dbPassword = 'root'): self public static function make(string $version = 'latest', string $dbPassword = 'root'): self
{ {
return new self( return new self(
-4
View File
@@ -20,10 +20,6 @@ class RedisContainer extends Container
$this->withWait(new WaitForLog('Ready to accept connections')); $this->withWait(new WaitForLog('Ready to accept connections'));
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest'): self public static function make(string $version = 'latest'): self
{ {
return new self($version); return new self($version);
-9
View File
@@ -17,15 +17,6 @@ class MariaDBContainer extends GenericContainer
$this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword); $this->withEnvironment('MARIADB_ROOT_PASSWORD', $mysqlRootPassword);
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self
{
return new self($version, $mysqlRootPassword);
}
public function withMariaDBUser(string $username, string $password): self public function withMariaDBUser(string $username, string $password): self
{ {
$this->withEnvironment('MARIADB_USER', $username); $this->withEnvironment('MARIADB_USER', $username);
-9
View File
@@ -17,15 +17,6 @@ class MySQLContainer extends GenericContainer
$this->withWait(new WaitForLog('ready for connections')); $this->withWait(new WaitForLog('ready for connections'));
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest', string $mysqlRootPassword = 'root'): self
{
return new self($version, $mysqlRootPassword);
}
public function withMySQLUser(string $username, string $password): self public function withMySQLUser(string $username, string $password): self
{ {
$this->withEnvironment('MYSQL_USER', $username); $this->withEnvironment('MYSQL_USER', $username);
-8
View File
@@ -37,12 +37,4 @@ class OpenSearchContainer extends GenericContainer
return $this; return $this;
} }
/**
* @deprecated Use withDisabledSecurityPlugin instead
*/
public function disableSecurityPlugin(): self
{
return $this->withDisabledSecurityPlugin();
}
} }
-9
View File
@@ -15,13 +15,4 @@ class RedisContainer extends GenericContainer
$this->withExposedPorts(6379); $this->withExposedPorts(6379);
$this->withWait(new WaitForLog('Ready to accept connections')); $this->withWait(new WaitForLog('Ready to accept connections'));
} }
/**
* @deprecated Use constructor instead
* Left for backward compatibility
*/
public static function make(string $version = 'latest'): self
{
return new self($version);
}
} }