From c742dc8fb593cdd01143c5ac0cf75ba0fe6b2b82 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sat, 1 Jan 2022 19:41:32 +0200 Subject: [PATCH] Updated names and review comments --- app/tasks/specs.php | 18 +++++++++--------- src/Appwrite/Specification/Format/Swagger2.php | 2 -- tests/e2e/General/HTTPTest.php | 5 ----- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/app/tasks/specs.php b/app/tasks/specs.php index ce3c63ab7..ff8f02d53 100644 --- a/app/tasks/specs.php +++ b/app/tasks/specs.php @@ -17,13 +17,13 @@ use Utopia\Validator\WhiteList; $cli ->task('specs') ->param('version', 'latest', new Text(8), 'Spec version', true) - ->param('mode', 'normal', new WhiteList(['normal', 'tests']), 'Spec Mode', true) + ->param('mode', 'normal', new WhiteList(['normal', 'mocks']), 'Spec Mode', true) ->action(function ($version, $mode) use ($register) { $db = $register->get('db'); $redis = $register->get('cache'); $appRoutes = App::getRoutes(); $response = new Response(new HttpResponse()); - $tests = ($mode === 'tests'); + $mocks = ($mode === 'mocks'); App::setResource('request', function() { return new Request; @@ -166,11 +166,11 @@ $cli continue; } - if ($route->getLabel('sdk.mock', false) && !$tests) { + if ($route->getLabel('sdk.mock', false) && !$mocks) { continue; } - if (!$route->getLabel('sdk.mock', false) && $tests) { + if (!$route->getLabel('sdk.mock', false) && $mocks) { continue; } @@ -184,7 +184,7 @@ $cli $routes[] = $route; $modelLabel = $route->getLabel('sdk.response.model', 'none'); - $model = \is_array($modelLabel) ? \array_map(function($m) use($response) { + \is_array($modelLabel) ? \array_map(function($m) use($response) { return $response->getModel($m); }, $modelLabel) : $response->getModel($modelLabel); } @@ -247,14 +247,14 @@ $cli ->setParam('docs.url', $endpoint.'/docs') ; - if($tests) { - $path = __DIR__.'/../config/specs/'.$format.'-tests-'.$platform.'.json'; + if($mocks) { + $path = __DIR__.'/../config/specs/'.$format.'-mocks-'.$platform.'.json'; if(!file_put_contents($path, json_encode($specs->parse()))) { - throw new Exception('Failed to save tests spec file: '.$path); + throw new Exception('Failed to save mocks spec file: '.$path); } - Console::success('Saved tests spec file: ' . realpath($path)); + Console::success('Saved mocks spec file: ' . realpath($path)); continue; } diff --git a/src/Appwrite/Specification/Format/Swagger2.php b/src/Appwrite/Specification/Format/Swagger2.php index 79ff464a7..6cb0012b7 100644 --- a/src/Appwrite/Specification/Format/Swagger2.php +++ b/src/Appwrite/Specification/Format/Swagger2.php @@ -478,8 +478,6 @@ class Swagger2 extends Format }, $rule['type']) ]; } - - // $items['$ref'] = '#/definitions/document'; } else { $items = [ 'type' => $type, diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index c25b54e0c..9129d7b4b 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -156,11 +156,6 @@ class HTTPTest extends Scope $response['body'] = json_decode($response['body'], true); $this->assertEquals(200, $response['headers']['status-code']); - - if(!empty($response['body'])){ - var_dump($directory.$file); - var_dump($response['body']); - } $this->assertTrue(empty($response['body'])); } }