diff --git a/tests/specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.php b/tests/specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.php new file mode 100644 index 00000000..c2bc94f3 --- /dev/null +++ b/tests/specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.php @@ -0,0 +1,13 @@ + '@specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.yml', + 'generateUrls' => true, + 'generateModels' => false, + 'excludeModels' => [ + 'Error', + ], + 'generateControllers' => true, + 'generateMigrations' => false, + 'generateModelFaker' => false, +]; diff --git a/tests/specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.yml b/tests/specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.yml new file mode 100644 index 00000000..0e11df6d --- /dev/null +++ b/tests/specs/issue_fix/102_fractalaction_not_generated_for_root_path/index.yml @@ -0,0 +1,76 @@ +openapi: "3.0.0" +info: + version: 1.0.0 + title: 96_component_schema_should_be_optional + +paths: + '/': + get: + x-route: fruit/mango/alphonso/list # action ID `list` is mandatory for fractal standalone action generation + operationId: listTasks + responses: + '200': + $ref: '#/components/responses/Tasks' + + +components: + schemas: + _TaskResource: + type: object + properties: + id: + type: integer + example: 1 + type: + type: string + enum: + - tasks + attributes: + $ref: '#/components/schemas/Task' + relationships: + type: object + JSONAPI_links: + type: object + example: + self: 'https://api.example.com/...' + additionalProperties: + oneOf: + - type: string + - type: object + properties: + href: + type: string + meta: + type: object + Task: + type: object + properties: + id: + type: integer + title: + type: string + responses: + Task: + description: Task + content: + application/vnd.api+json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/_TaskResource' + links: + $ref: '#/components/schemas/JSONAPI_links' + Tasks: + description: 'An array of Tasks' + content: + application/vnd.api+json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/_TaskResource' + links: + $ref: '#/components/schemas/JSONAPI_links' \ No newline at end of file diff --git a/tests/unit/issues/Issue102Test.php b/tests/unit/issues/Issue102Test.php new file mode 100644 index 00000000..14e4edab --- /dev/null +++ b/tests/unit/issues/Issue102Test.php @@ -0,0 +1,25 @@ +runGenerator($testFile); + // TODO +// $actualFiles = FileHelper::findFiles(Yii::getAlias('@app'), [ +// 'recursive' => true, +// ]); +// $expectedFiles = FileHelper::findFiles(Yii::getAlias("@specs/issue_fix/102_fractalaction_not_generated_for_root_path/mysql"), [ +// 'recursive' => true, +// ]); +// $this->checkFiles($actualFiles, $expectedFiles); + } +}