- Move most of the stuff for backwards compatibility support into one class

- Added random port logic
- Updated wait wtrategies
- API alignments to make it similar to other official implementations
- ...
This commit is contained in:
Sergei Shitikov
2024-09-06 19:08:37 +02:00
parent a956794279
commit f05ea0020d
43 changed files with 1191 additions and 601 deletions
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Testcontainers\Utils\PortGenerator;
class FixedPortGenerator implements PortGenerator
{
protected int $portIndex = 0;
public function __construct(
/** @var int[] */
protected array $ports
) {
}
public function generatePort(): int
{
if (!isset($this->ports[$this->portIndex])) {
throw new \RuntimeException('No more ports available in the fixed list.');
}
return $this->ports[$this->portIndex++];
}
}