mirror of
https://github.com/stan220/testcontainers-php.git
synced 2026-09-08 18:29:47 +00:00
adjust wait for host port strategy
This commit is contained in:
@@ -7,7 +7,6 @@ namespace Testcontainers\Tests\Integration;
|
||||
use Docker\API\Model\ContainersIdJsonGetResponse200;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Testcontainers\Container\GenericContainer;
|
||||
use Testcontainers\Utils\PortGenerator\FixedPortGenerator;
|
||||
use Testcontainers\Wait\WaitForHostPort;
|
||||
|
||||
class GenericContainerTest extends TestCase
|
||||
@@ -115,13 +114,12 @@ class GenericContainerTest extends TestCase
|
||||
public function testShouldReturnFirstMappedPort(): void
|
||||
{
|
||||
$container = (new GenericContainer('nginx'))
|
||||
->withPortGenerator(new FixedPortGenerator([9090]))
|
||||
->withExposedPorts(80)
|
||||
->withWait(new WaitForHostPort(9090))
|
||||
->withWait(new WaitForHostPort())
|
||||
->start();
|
||||
$firstMappedPort = $container->getFirstMappedPort();
|
||||
|
||||
self::assertSame($firstMappedPort, 9090, 'First mapped port does not match 9090');
|
||||
self::assertSame($firstMappedPort, $container->getMappedPort(80));
|
||||
|
||||
$container->stop();
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Testcontainers\Tests\Integration;
|
||||
|
||||
use Testcontainers\Container\GenericContainer;
|
||||
use Testcontainers\Wait\WaitForHostPort;
|
||||
|
||||
class StartedGenericContainerTest extends ContainerTestCase
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user