Merge branch 'feat-database-indexing' into feat-quest-filters

This commit is contained in:
Matej Baco
2022-01-03 10:52:35 +01:00
53 changed files with 747 additions and 766 deletions
+23 -13
View File
@@ -128,26 +128,36 @@ class HTTPTest extends Scope
'content-type' => 'application/json',
], []);
if(!file_put_contents(__DIR__ . '/../../resources/open-api3.json', json_encode($response['body']))) {
throw new Exception('Failed to save spec file');
}
$directory = __DIR__ . '/../../../app/config/specs/';
$files = scandir($directory);
$client = new Client();
$client->setEndpoint('https://validator.swagger.io');
/**
* Test for SUCCESS
*/
$response = $client->call(Client::METHOD_POST, '/validator/debug', [
'content-type' => 'application/json',
], json_decode(file_get_contents(realpath(__DIR__ . '/../../resources/open-api3.json')), true));
foreach($files as $file) {
if(in_array($file, ['.', '..'])) {
continue;
}
$response['body'] = json_decode($response['body'], true);
if(
(strpos($file, 'latest') === false) &&
(strpos($file, '0.12.x') === false)
) {
continue;
}
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertTrue(empty($response['body']));
/**
* Test for SUCCESS
*/
$response = $client->call(Client::METHOD_POST, '/validator/debug', [
'content-type' => 'application/json',
], json_decode(file_get_contents($directory.$file), true));
unlink(realpath(__DIR__ . '/../../resources/open-api3.json'));
$response['body'] = json_decode($response['body'], true);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertTrue(empty($response['body']));
}
}
public function testResponseHeader() {