From 136e435403d9c983923fa0e4287d110951a16906 Mon Sep 17 00:00:00 2001 From: Marcel Pociot Date: Mon, 21 Jun 2021 22:32:37 +0200 Subject: [PATCH] wip --- tests/Feature/Server/AdminTest.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/Feature/Server/AdminTest.php b/tests/Feature/Server/AdminTest.php index 05f5f67..a705aae 100644 --- a/tests/Feature/Server/AdminTest.php +++ b/tests/Feature/Server/AdminTest.php @@ -44,7 +44,7 @@ class AdminTest extends TestCase $this->expectExceptionMessage(401); /** @var ResponseInterface $response */ - $this->await($this->browser->get('http://127.0.0.1:8080', [ + $this->await($this->browser->get('http://127.0.0.1:'.$this->port, [ 'Host' => 'expose.localhost', ])); } @@ -53,7 +53,7 @@ class AdminTest extends TestCase public function it_accepts_valid_credentials() { /** @var ResponseInterface $response */ - $response = $this->await($this->browser->get('http://127.0.0.1:8080/', [ + $response = $this->await($this->browser->get('http://127.0.0.1:'.$this->port, [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), ])); @@ -66,7 +66,7 @@ class AdminTest extends TestCase $this->app['config']['expose.admin.validate_auth_tokens'] = false; /** @var ResponseInterface $response */ - $this->await($this->browser->post('http://127.0.0.1:8080/api/settings', [ + $this->await($this->browser->post('http://127.0.0.1:'.$this->port.'/api/settings', [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), 'Content-Type' => 'application/json', @@ -81,7 +81,7 @@ class AdminTest extends TestCase public function it_can_create_users() { /** @var Response $response */ - $response = $this->await($this->browser->post('http://127.0.0.1:8080/api/users', [ + $response = $this->await($this->browser->post('http://127.0.0.1:'.$this->port.'/api/users', [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), 'Content-Type' => 'application/json', @@ -99,7 +99,7 @@ class AdminTest extends TestCase public function it_can_delete_users() { /** @var Response $response */ - $this->await($this->browser->post('http://127.0.0.1:8080/api/users', [ + $this->await($this->browser->post('http://127.0.0.1:'.$this->port.'/api/users', [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), 'Content-Type' => 'application/json', @@ -107,7 +107,7 @@ class AdminTest extends TestCase 'name' => 'Marcel', ]))); - $this->await($this->browser->delete('http://127.0.0.1:8080/api/users/1', [ + $this->await($this->browser->delete('http://127.0.0.1:'.$this->port.'/api/users/1', [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), 'Content-Type' => 'application/json', @@ -120,7 +120,7 @@ class AdminTest extends TestCase public function it_can_list_all_users() { /** @var Response $response */ - $this->await($this->browser->post('http://127.0.0.1:8080/api/users', [ + $this->await($this->browser->post('http://127.0.0.1:'.$this->port.'/api/users', [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), 'Content-Type' => 'application/json', @@ -129,7 +129,7 @@ class AdminTest extends TestCase ]))); /** @var Response $response */ - $response = $this->await($this->browser->get('http://127.0.0.1:8080/users', [ + $response = $this->await($this->browser->get('http://127.0.0.1:'.$this->port.'/users', [ 'Host' => 'expose.localhost', 'Authorization' => base64_encode('username:secret'), 'Content-Type' => 'application/json', @@ -142,6 +142,7 @@ class AdminTest extends TestCase protected function startServer() { + $this->port = rand(8080, 9000); $this->app['config']['expose.admin.subdomain'] = 'expose'; $this->app['config']['expose.admin.database'] = ':memory:'; @@ -158,6 +159,7 @@ class AdminTest extends TestCase $this->serverFactory = new Factory(); $this->serverFactory->setLoop($this->loop) + ->setPort($this->port) ->createServer(); } }