File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 66
77class Server
88{
9+ const ENV_SERVER_PORT = 'TEST_SERVER_PORT ' ;
10+
911 /** @var \GuzzleHttp\Client */
1012 protected $ client ;
1113
@@ -40,6 +42,10 @@ public function setResponseBody(string $text, int $statusCode = 200)
4042
4143 public static function boot ()
4244 {
45+ if (empty (getenv (self ::ENV_SERVER_PORT ))) {
46+ throw new \InvalidArgumentException (sprintf ('`%s` environment variable is not set ' , self ::ENV_SERVER_PORT ));
47+ }
48+
4349 if (! file_exists (__DIR__ .'/server/vendor ' )) {
4450 exec ('cd " ' .__DIR__ .'/server"; composer install ' );
4551 }
@@ -60,7 +66,7 @@ public static function boot()
6066
6167 public static function getServerUrl (string $ endPoint = '' ): string
6268 {
63- return 'localhost: ' . getenv ('TEST_SERVER_PORT ' ). ' / ' . $ endPoint ;
69+ return sprintf ( 'localhost:%s/%s ' , getenv ('TEST_SERVER_PORT ' ), $ endPoint) ;
6470 }
6571
6672 public static function serverHasBooted (): bool
You can’t perform that action at this time.
0 commit comments