8000 Merge pull request #29 from Pierstoval/port-and-host · chalasr/symfony@d638f38 · GitHub
[go: up one dir, main page]

Skip to content

Commit d638f38

Browse files
authored
Merge pull request symfony#29 from Pierstoval/port-and-host
Allow customization of host & port for the web server at creation
2 parents e009954 + cf9eaf9 commit d638f38

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/PanthereTestCase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static function tearDownAfterClass()
8484
self::$baseUri = null;
8585
}
8686

87-
protected static function startWebServer(?string $webServerDir = null): void
87+
protected static function startWebServer(?string $webServerDir = null, string $hostname = '127.0.0.1', int $port = 9000): void
8888
{
8989
if (null !== static::$webServerManager) {
9090
return;
@@ -95,15 +95,15 @@ protected static function startWebServer(?string $webServerDir = null): void
9595
$webServerDir = static::$webServerDir ?? $_ENV['PANTHERE_WEB_SERVER_DIR'] ?? __DIR__.'/../../../../public';
9696
}
9797

98-
self::$webServerManager = new WebServerManager($webServerDir, '127.0.0.1', 9000);
98+
self::$webServerManager = new WebServerManager($webServerDir, $hostname, $port);
9999
self::$webServerManager->start();
100100

101-
self::$baseUri = 'http://127.0.0.1:9000';
101+
self::$baseUri = "http://$hostname:$port";
102102
}
103103

104-
protected static function createPanthereClient(): PanthereClient
104+
protected static function createPanthereClient(string $hostname = '127.0.0.1', int $port = 9000): PanthereClient
105105
{
106-
self::startWebServer();
106+
self::startWebServer(null, $hostname, $port);
107107
if (null === self::$panthereClient) {
108108
self::$panthereClient = Client::createChromeClient();
109109
}

0 commit comments

Comments
 (0)
0