mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 16:29:29 +00:00
update interfaces, small phpstan improvements
This commit is contained in:
@@ -33,7 +33,7 @@ class GenericContainer implements TestContainer
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* User-defined key/value metadata.
|
* User-defined key/value metadata.
|
||||||
* @param array<string, string>|null $labels
|
* @var array<string, string>|null $labels
|
||||||
*/
|
*/
|
||||||
protected ?array $labels = null;
|
protected ?array $labels = null;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ class StartedGenericContainer implements StartedTestContainer
|
|||||||
$this->dockerClient = DockerContainerClient::getDockerClient();
|
$this->dockerClient = DockerContainerClient::getDockerClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getId(): string
|
public function getId(): string
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
|||||||
@@ -8,36 +8,36 @@ use Docker\Docker;
|
|||||||
|
|
||||||
interface StartedTestContainer
|
interface StartedTestContainer
|
||||||
{
|
{
|
||||||
public function stop(): StoppedTestContainer;
|
|
||||||
|
|
||||||
public function restart(): self;
|
|
||||||
|
|
||||||
public function getClient(): Docker;
|
|
||||||
|
|
||||||
public function getHost(): string;
|
|
||||||
|
|
||||||
public function getFirstMappedPort(): int;
|
|
||||||
|
|
||||||
public function getMappedPort(int $port): int;
|
|
||||||
|
|
||||||
public function getName(): string;
|
|
||||||
|
|
||||||
public function getLabels(): array;
|
|
||||||
|
|
||||||
public function getId(): string;
|
|
||||||
|
|
||||||
public function getLastExecId(): string | null;
|
|
||||||
|
|
||||||
public function getNetworkNames(): array;
|
|
||||||
|
|
||||||
public function getNetworkId(string $networkName): string;
|
|
||||||
|
|
||||||
public function getIpAddress(string $networkName): string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param list<string> $command
|
* @param list<string> $command
|
||||||
*/
|
*/
|
||||||
public function exec(array $command): string;
|
public function exec(array $command): string;
|
||||||
|
|
||||||
|
public function getClient(): Docker;
|
||||||
|
|
||||||
|
public function getFirstMappedPort(): int;
|
||||||
|
|
||||||
|
public function getHost(): string;
|
||||||
|
|
||||||
|
public function getId(): string;
|
||||||
|
|
||||||
|
public function getIpAddress(string $networkName): string;
|
||||||
|
|
||||||
|
public function getLabels(): array;
|
||||||
|
|
||||||
public function logs(): string;
|
public function logs(): string;
|
||||||
|
|
||||||
|
public function getLastExecId(): string | null;
|
||||||
|
|
||||||
|
public function getMappedPort(int $port): int;
|
||||||
|
|
||||||
|
public function getName(): string;
|
||||||
|
|
||||||
|
public function getNetworkId(string $networkName): string;
|
||||||
|
|
||||||
|
public function getNetworkNames(): array;
|
||||||
|
|
||||||
|
public function restart(): self;
|
||||||
|
|
||||||
|
public function stop(): StoppedTestContainer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,18 +4,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Testcontainers\Container;
|
namespace Testcontainers\Container;
|
||||||
|
|
||||||
|
use Testcontainers\Utils\PortGenerator\PortGenerator;
|
||||||
use Testcontainers\Wait\WaitStrategy;
|
use Testcontainers\Wait\WaitStrategy;
|
||||||
|
|
||||||
interface TestContainer
|
interface TestContainer
|
||||||
{
|
{
|
||||||
public function start(): StartedGenericContainer;
|
public function start(): StartedGenericContainer;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: replace with array after deprecated implementation is removed
|
|
||||||
* @param array<string, string>|string $env
|
|
||||||
*/
|
|
||||||
public function withEnvironment(array | string $env, ?string $value): static;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array<string> $command
|
* @param array<string> $command
|
||||||
*/
|
*/
|
||||||
@@ -23,12 +18,39 @@ interface TestContainer
|
|||||||
|
|
||||||
public function withEntrypoint(string $entryPoint): static;
|
public function withEntrypoint(string $entryPoint): static;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: replace with array after deprecated implementation is removed
|
||||||
|
* @param array<string, string>|string $env
|
||||||
|
*/
|
||||||
|
public function withEnvironment(array | string $env, ?string $value): static;
|
||||||
|
|
||||||
/** @param int|string|array<int|string> $ports One or more ports to expose. */
|
/** @param int|string|array<int|string> $ports One or more ports to expose. */
|
||||||
public function withExposedPorts(...$ports): static;
|
public function withExposedPorts(...$ports): static;
|
||||||
|
|
||||||
public function withWait(WaitStrategy $waitStrategy): static;
|
public function withHealthCheckCommand(
|
||||||
|
string $command,
|
||||||
|
int $intervalInMilliseconds,
|
||||||
|
int $timeoutInMilliseconds,
|
||||||
|
int $retries,
|
||||||
|
int $startPeriodInMilliseconds
|
||||||
|
): static;
|
||||||
|
|
||||||
|
public function withHostname(string $hostname): static;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $labels
|
||||||
|
*/
|
||||||
|
public function withLabels(array $labels): static;
|
||||||
|
|
||||||
|
public function withMount(string $localPath, string $containerPath): static;
|
||||||
|
|
||||||
|
public function withName(string $name): static;
|
||||||
|
|
||||||
public function withNetwork(string $networkName): static;
|
public function withNetwork(string $networkName): static;
|
||||||
|
|
||||||
public function withPrivilegedMode(): static;
|
public function withPortGenerator(PortGenerator $portGenerator): static;
|
||||||
|
|
||||||
|
public function withPrivilegedMode(bool $privileged): static;
|
||||||
|
|
||||||
|
public function withWait(WaitStrategy $waitStrategy): static;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user