draft: new router

This commit is contained in:
Torsten Dittmann
2023-04-13 13:50:25 +02:00
parent e5fa4883b2
commit 19c17e56ec
14 changed files with 50 additions and 200 deletions
+14 -5
View File
@@ -52,19 +52,22 @@ class HTTPTest extends Scope
public function testHumans()
{
$previousEndpoint = $this->client->getEndpoint();
$this->client->setEndpoint("http://localhost");
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/humans.txt', \array_merge([
'origin' => 'http://localhost',
]), []);
$response = $this->client->call(Client::METHOD_GET, '/humans.txt');
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString('# humanstxt.org/', $response['body']);
$this->client->setEndpoint($previousEndpoint);
}
public function testRobots()
{
$previousEndpoint = $this->client->getEndpoint();
$this->client->setEndpoint("http://localhost");
/**
* Test for SUCCESS
*/
@@ -74,6 +77,7 @@ class HTTPTest extends Scope
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertStringContainsString('# robotstxt.org/', $response['body']);
$this->client->setEndpoint($previousEndpoint);
}
public function testAcmeChallenge()
@@ -99,7 +103,7 @@ class HTTPTest extends Scope
'origin' => 'http://localhost',
]), []);
$this->assertEquals(400, $response['headers']['status-code']);
$this->assertEquals(404, $response['headers']['status-code']);
// Cleanup
$this->client->setEndpoint($previousEndpoint);
@@ -151,7 +155,10 @@ class HTTPTest extends Scope
public function testVersions()
{
/**
$previousEndpoint = $this->client->getEndpoint();
$this->client->setEndpoint("http://localhost");
/**
* Test without header
*/
$response = $this->client->call(Client::METHOD_GET, '/versions', \array_merge([
@@ -170,5 +177,7 @@ class HTTPTest extends Scope
$this->assertIsString($body['server-python']);
$this->assertIsString($body['server-ruby']);
$this->assertIsString($body['console-cli']);
$this->client->setEndpoint($previousEndpoint);
}
}