This commit is contained in:
Marcel Pociot
2021-06-21 22:32:37 +02:00
parent 3a9d4fb6b6
commit 136e435403

View File

@@ -44,7 +44,7 @@ class AdminTest extends TestCase
$this->expectExceptionMessage(401); $this->expectExceptionMessage(401);
/** @var ResponseInterface $response */ /** @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', 'Host' => 'expose.localhost',
])); ]));
} }
@@ -53,7 +53,7 @@ class AdminTest extends TestCase
public function it_accepts_valid_credentials() public function it_accepts_valid_credentials()
{ {
/** @var ResponseInterface $response */ /** @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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
])); ]));
@@ -66,7 +66,7 @@ class AdminTest extends TestCase
$this->app['config']['expose.admin.validate_auth_tokens'] = false; $this->app['config']['expose.admin.validate_auth_tokens'] = false;
/** @var ResponseInterface $response */ /** @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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
@@ -81,7 +81,7 @@ class AdminTest extends TestCase
public function it_can_create_users() public function it_can_create_users()
{ {
/** @var Response $response */ /** @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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
@@ -99,7 +99,7 @@ class AdminTest extends TestCase
public function it_can_delete_users() public function it_can_delete_users()
{ {
/** @var Response $response */ /** @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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
@@ -107,7 +107,7 @@ class AdminTest extends TestCase
'name' => 'Marcel', '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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
@@ -120,7 +120,7 @@ class AdminTest extends TestCase
public function it_can_list_all_users() public function it_can_list_all_users()
{ {
/** @var Response $response */ /** @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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
@@ -129,7 +129,7 @@ class AdminTest extends TestCase
]))); ])));
/** @var Response $response */ /** @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', 'Host' => 'expose.localhost',
'Authorization' => base64_encode('username:secret'), 'Authorization' => base64_encode('username:secret'),
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
@@ -142,6 +142,7 @@ class AdminTest extends TestCase
protected function startServer() protected function startServer()
{ {
$this->port = rand(8080, 9000);
$this->app['config']['expose.admin.subdomain'] = 'expose'; $this->app['config']['expose.admin.subdomain'] = 'expose';
$this->app['config']['expose.admin.database'] = ':memory:'; $this->app['config']['expose.admin.database'] = ':memory:';
@@ -158,6 +159,7 @@ class AdminTest extends TestCase
$this->serverFactory = new Factory(); $this->serverFactory = new Factory();
$this->serverFactory->setLoop($this->loop) $this->serverFactory->setLoop($this->loop)
->setPort($this->port)
->createServer(); ->createServer();
} }
} }