Added new spec for tests
This commit is contained in:
parent
213f6e9783
commit
eb5d37cdce
|
@ -438,8 +438,9 @@ $utopia->get('/v1/open-api-2.json')
|
|||
->label('docs', false)
|
||||
->param('platform', 'client', function () {return new WhiteList(['client', 'server']);}, 'Choose target platform.', true)
|
||||
->param('extensions', 0, function () {return new Range(0, 1);}, 'Show extra data.', true)
|
||||
->param('tests', 0, function () {return new Range(0, 1);}, 'Include only test services.', true)
|
||||
->action(
|
||||
function ($platform, $extensions) use ($response, $request, $utopia, $domain, $services) {
|
||||
function ($platform, $extensions, $tests) use ($response, $request, $utopia, $domain, $services) {
|
||||
function fromCamelCase($input)
|
||||
{
|
||||
preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
|
||||
|
@ -457,7 +458,11 @@ $utopia->get('/v1/open-api-2.json')
|
|||
}
|
||||
|
||||
foreach ($services as $service) { /* @noinspection PhpIncludeInspection */
|
||||
if (!$service['sdk']) {
|
||||
if($tests && !$service['tests']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$tests && !$service['sdk']) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,74 +5,87 @@ return [
|
|||
'name' => 'Homepage',
|
||||
'controller' => 'controllers/home.php',
|
||||
'sdk' => false,
|
||||
'tests' => false,
|
||||
],
|
||||
'console/' => [
|
||||
'name' => 'Console',
|
||||
'controller' => 'controllers/console.php',
|
||||
'sdk' => false,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/account' => [
|
||||
'name' => 'Account',
|
||||
'description' => '/docs/services/account.md',
|
||||
'controller' => 'controllers/account.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/auth' => [ // Add to docs later: You can also learn how to [configure support for our supported OAuth providers](/docs/oauth)
|
||||
'name' => 'Auth',
|
||||
'description' => '/docs/services/auth.md',
|
||||
'controller' => 'controllers/auth.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/avatars' => [
|
||||
'name' => 'Avatars',
|
||||
'description' => '/docs/services/avatars.md',
|
||||
'controller' => 'controllers/avatars.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/database' => [
|
||||
'name' => 'Database',
|
||||
'description' => '/docs/services/database.md',
|
||||
'controller' => 'controllers/database.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/locale' => [
|
||||
'name' => 'Locale',
|
||||
'description' => '/docs/services/locale.md',
|
||||
'controller' => 'controllers/locale.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/health' => [
|
||||
'name' => 'Health',
|
||||
'controller' => 'controllers/health.php',
|
||||
'sdk' => false,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/projects' => [
|
||||
'name' => 'Projects',
|
||||
'controller' => 'controllers/projects.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/storage' => [
|
||||
'name' => 'Storage',
|
||||
'description' => '/docs/services/storage.md',
|
||||
'controller' => 'controllers/storage.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/teams' => [
|
||||
'name' => 'Teams',
|
||||
'description' => '/docs/services/teams.md',
|
||||
'controller' => 'controllers/teams.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/users' => [
|
||||
'name' => 'Users',
|
||||
'description' => '/docs/services/users.md',
|
||||
'controller' => 'controllers/users.php',
|
||||
'sdk' => true,
|
||||
'tests' => false,
|
||||
],
|
||||
'v1/mock' => [
|
||||
'name' => 'Mock',
|
||||
'description' => '',
|
||||
'controller' => 'controllers/mock.php',
|
||||
'sdk' => false,
|
||||
'tests' => true,
|
||||
],
|
||||
];
|
||||
|
|
|
@ -245,6 +245,6 @@ $utopia->shutdown(function() use ($response, $request, &$result, $utopia) {
|
|||
if(!file_put_contents($path, json_encode($tests), LOCK_EX)) {
|
||||
throw new Exception('Failed to save resutls', 500);
|
||||
}
|
||||
|
||||
$response->json(['result' => 'passed']);
|
||||
|
||||
$response->json(['result' => $route->getMethod() . ':' . $route->getURL() . ':passed']);
|
||||
});
|
Loading…
Reference in a new issue