mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Merge branch 'feat-database-indexing' into feat-quest-filters
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user