From 656f38f05649add33c1ece9a7c5b027a31d05dad Mon Sep 17 00:00:00 2001 From: Sergei Shitikov Date: Fri, 6 Sep 2024 20:15:10 +0200 Subject: [PATCH] cleanup --- src/Container/Container.php | 15 ++++++++------- src/Container/MariaDBContainer.php | 4 ---- src/Container/MySQLContainer.php | 6 +----- src/Container/OpenSearchContainer.php | 14 +------------- src/Container/PostgresContainer.php | 4 ---- src/Container/RedisContainer.php | 4 ---- src/Modules/MariaDBContainer.php | 9 --------- src/Modules/MySQLContainer.php | 9 --------- src/Modules/OpenSearchContainer.php | 8 -------- src/Modules/RedisContainer.php | 9 --------- 10 files changed, 10 insertions(+), 72 deletions(-) diff --git a/src/Container/Container.php b/src/Container/Container.php index 2074a23..ce482c5 100644 --- a/src/Container/Container.php +++ b/src/Container/Container.php @@ -14,6 +14,7 @@ class Container extends GenericContainer protected ?StartedTestContainer $startedContainer = null; protected ?StoppedTestContainer $stoppedContainer = null; + public static function make(string $image): self { return new self($image); @@ -61,7 +62,7 @@ class Container extends GenericContainer */ public function execute(array $commandAsArray): string { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } @@ -73,7 +74,7 @@ class Container extends GenericContainer */ public function logs(): string { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } @@ -85,7 +86,7 @@ class Container extends GenericContainer */ public function getAddress(): string { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } @@ -97,7 +98,7 @@ class Container extends GenericContainer */ public function getPort(): int { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } @@ -119,7 +120,7 @@ class Container extends GenericContainer */ public function stop(): self { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } @@ -133,7 +134,7 @@ class Container extends GenericContainer */ public function restart(): self { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } @@ -148,7 +149,7 @@ class Container extends GenericContainer */ public function remove(): self { - if($this->startedContainer === null) { + if ($this->startedContainer === null) { throw new \RuntimeException('Container is not started'); } diff --git a/src/Container/MariaDBContainer.php b/src/Container/MariaDBContainer.php index 79fcbb9..72f0aac 100644 --- a/src/Container/MariaDBContainer.php +++ b/src/Container/MariaDBContainer.php @@ -21,10 +21,6 @@ class MariaDBContainer extends Container $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); diff --git a/src/Container/MySQLContainer.php b/src/Container/MySQLContainer.php index b2a3bfa..232c912 100644 --- a/src/Container/MySQLContainer.php +++ b/src/Container/MySQLContainer.php @@ -21,10 +21,6 @@ class MySQLContainer extends Container $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); @@ -44,4 +40,4 @@ class MySQLContainer extends Container return $this; } -} \ No newline at end of file +} diff --git a/src/Container/OpenSearchContainer.php b/src/Container/OpenSearchContainer.php index f8c43a8..c3ba7cc 100644 --- a/src/Container/OpenSearchContainer.php +++ b/src/Container/OpenSearchContainer.php @@ -26,27 +26,15 @@ class OpenSearchContainer extends Container )); } - /** - * @deprecated Use constructor instead - * Left for backward compatibility - */ public static function make(string $version = 'latest'): self { return new self($version); } - public function withDisabledSecurityPlugin(): self + public function disableSecurityPlugin(): self { $this->withEnvironment('plugins.security.disabled', 'true'); return $this; } - - /** - * @deprecated Use withDisabledSecurityPlugin instead - */ - public function disableSecurityPlugin(): self - { - return $this->withDisabledSecurityPlugin(); - } } diff --git a/src/Container/PostgresContainer.php b/src/Container/PostgresContainer.php index 599c475..5bb2e0a 100644 --- a/src/Container/PostgresContainer.php +++ b/src/Container/PostgresContainer.php @@ -27,10 +27,6 @@ class PostgresContainer extends Container $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 { return new self( diff --git a/src/Container/RedisContainer.php b/src/Container/RedisContainer.php index 52625f1..1ec3f24 100644 --- a/src/Container/RedisContainer.php +++ b/src/Container/RedisContainer.php @@ -20,10 +20,6 @@ class RedisContainer extends Container $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); diff --git a/src/Modules/MariaDBContainer.php b/src/Modules/MariaDBContainer.php index 94f66c6..07ea973 100644 --- a/src/Modules/MariaDBContainer.php +++ b/src/Modules/MariaDBContainer.php @@ -17,15 +17,6 @@ class MariaDBContainer extends GenericContainer $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 { $this->withEnvironment('MARIADB_USER', $username); diff --git a/src/Modules/MySQLContainer.php b/src/Modules/MySQLContainer.php index fcef5bb..b5daaea 100644 --- a/src/Modules/MySQLContainer.php +++ b/src/Modules/MySQLContainer.php @@ -17,15 +17,6 @@ class MySQLContainer extends GenericContainer $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 { $this->withEnvironment('MYSQL_USER', $username); diff --git a/src/Modules/OpenSearchContainer.php b/src/Modules/OpenSearchContainer.php index 24d3f7d..b4e1f5e 100644 --- a/src/Modules/OpenSearchContainer.php +++ b/src/Modules/OpenSearchContainer.php @@ -37,12 +37,4 @@ class OpenSearchContainer extends GenericContainer return $this; } - - /** - * @deprecated Use withDisabledSecurityPlugin instead - */ - public function disableSecurityPlugin(): self - { - return $this->withDisabledSecurityPlugin(); - } } diff --git a/src/Modules/RedisContainer.php b/src/Modules/RedisContainer.php index a31dde9..e40f068 100644 --- a/src/Modules/RedisContainer.php +++ b/src/Modules/RedisContainer.php @@ -15,13 +15,4 @@ class RedisContainer extends GenericContainer $this->withExposedPorts(6379); $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); - } }