diff --git a/.gitignore b/.gitignore index ea14a76..3020e37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ composer.lock +vendor/ public/* !public/.keep cache/* !cache/.keep schemas/* !schemas/.keep +build/logs/ +.idea/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7802812 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: php + +sudo: false + +php: +- "7.1" +- "7.2" + +cache: + directories: + - $HOME/.composer/cache + +install: composer install + +script: +- vendor/bin/phpunit + +after_script: +- travis_retry php vendor/bin/php-coveralls -v diff --git a/README.md b/README.md index 34a889d..6da35cf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Build Status](https://travis-ci.com/maddy2101/fluid-documentation-generator.svg?branch=master)](https://travis-ci.com/maddy2101/fluid-documentation-generator) +[![Coverage Status](https://coveralls.io/repos/github/maddy2101/fluid-documentation-generator/badge.svg?branch=master)](https://coveralls.io/github/maddy2101/fluid-documentation-generator?branch=master) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/maddy2101/fluid-documentation-generator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/maddy2101/fluid-documentation-generator/?branch=master) + Fluid (ViewHelper) Documentation Generator ========================================== diff --git a/bin/generate-fluid-documentation b/bin/generate-fluid-documentation index bbd7f40..7c6c193 100755 --- a/bin/generate-fluid-documentation +++ b/bin/generate-fluid-documentation @@ -9,6 +9,7 @@ require_once $pwd . DIRECTORY_SEPARATOR . 'vendor/autoload.php'; use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; use NamelessCoder\FluidDocumentationGenerator\Export\HtmlExporter; use NamelessCoder\FluidDocumentationGenerator\Export\JsonExporter; +use NamelessCoder\FluidDocumentationGenerator\Export\RstExporter; use NamelessCoder\FluidDocumentationGenerator\Export\XsdExporter; use NamelessCoder\FluidDocumentationGenerator\Entity\Schema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; @@ -22,6 +23,7 @@ $exporters = [ new XsdExporter($publicUrlPrefix), new JsonExporter($publicUrlPrefix), new HtmlExporter($publicUrlPrefix), + new RstExporter($publicUrlPrefix) ]; $generator = SchemaDocumentationGenerator::getInstance($exporters, $force); $generator->generateFilesForRoot(); diff --git a/composer.json b/composer.json index daa8e4b..c1442b6 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,9 @@ "bin/generate-fluid-documentation.php" ], "require-dev": { + "ext-json": "*", "phpunit/phpunit": "^7.1", - "mikey179/vfsStream": "^1.6" + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.1" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 26e5e92..65f997c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,25 +1,29 @@ + + backupGlobals="false" + backupStaticAttributes="false" + colors="false" + convertErrorsToExceptions="true" + convertWarningsToExceptions="true" + forceCoversAnnotation="false" + processIsolation="false" + stopOnError="false" + stopOnFailure="false" + stopOnIncomplete="false" + stopOnSkipped="false" + verbose="false"> - - - tests/ - - - - - src/ - - + + + tests/ + + + + + src/ + + + + + diff --git a/resources/templates/Default/Root.rst b/resources/templates/Default/Root.rst new file mode 100644 index 0000000..212975c --- /dev/null +++ b/resources/templates/Default/Root.rst @@ -0,0 +1,31 @@ +.. include:: Includes.txt + +.. _start: + +============================== +Fluid ViewHelper Documentation +============================== + +:Rendered: |today| + +This is a complete reference of all available Fluid ViewHelper within TYPO3 CMS. +This documentation is generated from PHP Source code of TYPO3 CMS. + +This reference is auto generated from TYPO3 CMS 9.5 source code. Right now there is no +auto generation for TYPO3 versions below 9.5. You can find a hand written reference +for 6.2 at https://docs.typo3.org/typo3cms/ExtbaseGuide/6.2/Fluid/ViewHelper/Index.html. + +Right now this might look ugly in some places, e.g. ``= EXAMPLE =`` and rendered +HTML markup like ````. This will be polished in the future. The current +state still is much better then nothing. + +Also notice that package names are not 1:1 Composer packages. ``cms-`` is +striped. + +Content +------- + +.. toctree:: + :titlesonly: + +{line} diff --git a/resources/templates/Default/Schema.rst b/resources/templates/Default/Schema.rst new file mode 100644 index 0000000..9dfdc31 --- /dev/null +++ b/resources/templates/Default/Schema.rst @@ -0,0 +1,14 @@ +.. include:: {rootPath}Includes.txt + +{headlineDecoration} +{headline} +{headlineDecoration} + +* {viewHelpers} ViewHelpers documented +* {subGroups} Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + +{line} diff --git a/resources/templates/Default/ViewHelper.rst b/resources/templates/Default/ViewHelper.rst new file mode 100644 index 0000000..de49311 --- /dev/null +++ b/resources/templates/Default/ViewHelper.rst @@ -0,0 +1,35 @@ +.. include:: {rootPath}Includes.txt + +.. _{headlineIdentifier}: + +{headlineDecoration} +{headline} +{headlineDecoration} + + +{viewHelper.description -> f:format.raw()} + +Arguments +========= + + + +This ViewHelper has no arguments. + + +.. _{argumentData.headlineIdentifier}: +{argumentData.headline} +{argumentData.headlineDecoration} + +:aspect:`DataType` + {argumentData.dataType} + +:aspect:`Default` + {argumentData.default -> f:format.raw()} + +:aspect:`Required` + {argumentData.isRequired ? 'true' : 'false'} +:aspect:`Description` + {argumentData.description -> f:format.raw()} + + diff --git a/resources/templates/Default/ViewHelperGroup.rst b/resources/templates/Default/ViewHelperGroup.rst new file mode 100644 index 0000000..631ec57 --- /dev/null +++ b/resources/templates/Default/ViewHelperGroup.rst @@ -0,0 +1,19 @@ +.. include:: {rootPath}Includes.txt + +{headlineDecoration} +{headline} +{headlineDecoration} + + + +* {viewHelpers} ViewHelpers documented +* {subGroups} Sub namespaces + + +.. toctree:: + :titlesonly: + :glob: + +{line} + + diff --git a/src/Export/ExporterInterface.php b/src/Export/ExporterInterface.php index c89b27e..1e48c4f 100644 --- a/src/Export/ExporterInterface.php +++ b/src/Export/ExporterInterface.php @@ -3,9 +3,9 @@ namespace NamelessCoder\FluidDocumentationGenerator\Export; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -14,7 +14,8 @@ interface ExporterInterface { public function getIdentifier(): string; public function setGenerator(SchemaDocumentationGenerator $generator): void; - public function exportRoot(): void; + + public function exportRoot(bool $forceUpdate): void; public function exportVendor(SchemaVendor $vendor): void; public function exportPackage(SchemaPackage $package): void; public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void; diff --git a/src/Export/JsonExporter.php b/src/Export/JsonExporter.php index 7022ba8..1e1cdd8 100644 --- a/src/Export/JsonExporter.php +++ b/src/Export/JsonExporter.php @@ -6,9 +6,9 @@ use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; use NamelessCoder\FluidDocumentationGenerator\Data\GraphDataHandler; use NamelessCoder\FluidDocumentationGenerator\Entity\Schema; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -53,7 +53,7 @@ public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string ]; } - public function exportRoot(): void + public function exportRoot(bool $forceUpdate): void { $resolver = DataFileResolver::getInstance(); $index = []; diff --git a/src/Export/RstExporter.php b/src/Export/RstExporter.php new file mode 100644 index 0000000..81babb5 --- /dev/null +++ b/src/Export/RstExporter.php @@ -0,0 +1,230 @@ +rootUrl = $rootUrl; + $resourcesDirectory = DataFileResolver::getInstance()->getResourcesDirectoryPath(); + $this->view = new TemplateView(); + $this->view->getRenderingContext()->setCache(new SimpleFileCache(DataFileResolver::getInstance()->getCacheDirectoryPath())); + $this->view->getRenderingContext()->setTemplatePaths(new TemplatePaths( + [ + TemplatePaths::CONFIG_TEMPLATEROOTPATHS => [$resourcesDirectory . 'templates' . DIRECTORY_SEPARATOR], + TemplatePaths::CONFIG_LAYOUTROOTPATHS => [$resourcesDirectory . 'layouts' . DIRECTORY_SEPARATOR], + TemplatePaths::CONFIG_PARTIALROOTPATHS => [$resourcesDirectory . 'partials' . DIRECTORY_SEPARATOR], + TemplatePaths::CONFIG_FORMAT => 'rst' + ] + )); + } + + public function getIdentifier(): string + { + return 'rst'; + } + + public function setGenerator(SchemaDocumentationGenerator $generator): void + { + $this->generator = $generator; + } + + public function createAdditionalViewHelperResources(ViewHelperDocumentation $viewHelperDocumentation, ?string $label = null): array + { + return []; + } + + public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string $label = null): array + { + return []; + } + + public function exportRoot(bool $forceUpdate = false): void + { + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . 'Index.rst')) { + return; + } + + $vendors = $resolver->resolveInstalledVendors(); + // better to put the output together here, because fluid tends to mess up the empty lines + // that are important to proper rst rendering + $toctree = []; + foreach ($vendors as $vendor) { + foreach ($vendor->getPackages() as $package) { + foreach ($package->getVersions() as $version) { + $toctree[] = $this->intend . $vendor->getVendorName() . '/' . $package->getPackageName() . '/' . $version->getVersion() . '/Index' . PHP_EOL; + } + } + } + $this->view->assign('tocTree', $toctree); + $resolver->getWriter()->publishDataFile( + 'Index.rst', + $this->view->render('Root') + ); + } + + public function exportVendor(SchemaVendor $vendor): void + { + // not needed in this export + } + + public function exportPackage(SchemaPackage $package): void + { + // not needed in this export + } + + public function exportSchema(ProcessedSchema $processedSchema, bool $forceUpdate = false): void + { + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $processedSchema->getPath() . 'Index.rst')) { + return; + } + $schema = $processedSchema->getSchema(); + $headline = $schema->getPackage()->getVendor()->getVendorName() . '/' . $schema->getPackage()->getPackageName(); + $headlineDecoration = array_pad([], strlen($headline), '='); + $subGroupsCount = \count($processedSchema->getDocumentationTree()->getSubGroups()); + $viewHelpers = $processedSchema->getDocumentationTree()->getDocumentedViewHelpers(); + $this->view->assignMultiple([ + 'headline' => $headline, + 'headlineDecoration' => implode('', $headlineDecoration), + 'rootPath' => '../../../', + 'subGroups' => $subGroupsCount, + 'viewHelpers' => \count($viewHelpers), + 'tocTree' => $this->getTocTree($viewHelpers, $subGroupsCount), + ]); + $resolver->getWriter()->publishDataFileForSchema( + $processedSchema, + 'Index.rst', + $this->view->render('Schema') + ); + } + + public function exportViewHelper(ViewHelperDocumentation $viewHelperDocumentation, bool $forceUpdate = false): void + { + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $viewHelperDocumentation->getSchema()->getPath() . $viewHelperDocumentation->getPath() . '.rst')) { + return; + } + $path = $viewHelperDocumentation->getPath(); + $backPath = str_repeat('../', substr_count($path, '/')); + $rootPath = $backPath . '../../../'; + + $headline = $viewHelperDocumentation->getName(); + $headlineDecoration = array_pad([], strlen($headline), '='); + $namespace = array_filter(explode('/', $viewHelperDocumentation->getSchema()->getPath())); + array_pop($namespace); + $namespace = implode('/', $namespace); + $headlineIdentifier = str_replace(['.', '\'', '/'], '-', strtolower($namespace . '-' . $headline)); + + $arguments = []; + foreach ($viewHelperDocumentation->getArgumentDefinitions() as $argumentDefinition) { + $argumentHeadline = trim($argumentDefinition->getName()); + $argumentHeadlineDecoration = array_pad([], strlen($argumentHeadline), '-'); + $argumentHeadlineIdentifier = strtolower($headline . '_' . $argumentHeadline); + $argumentsData = [ + 'headline' => $argumentHeadline, + 'headlineIdentifier' => $argumentHeadlineIdentifier, + 'headlineDecoration' => implode('', $argumentHeadlineDecoration), + 'description' => ucfirst(trim($argumentDefinition->getDescription())), + 'dataType' => ($argumentDefinition->getType() === 'anySimpleType') ? 'mixed' : trim($argumentDefinition->getType()), + 'isRequired' => $argumentDefinition->isRequired(), + ]; + + $defaultValue = $argumentDefinition->getDefaultValue(); + if ($defaultValue !== 'NULL' && $defaultValue !== "''") { + $argumentsData['default'] = trim(str_replace(PHP_EOL, '', $defaultValue)); + } + $arguments[] = $argumentsData; + } + $this->view->assignMultiple([ + 'headline' => $headline, + 'headlineDecoration' => implode('', $headlineDecoration), + 'headlineIdentifier' => $headlineIdentifier, + 'rootPath' => $rootPath, + 'viewHelper' => $viewHelperDocumentation, + 'arguments' => $arguments, + ]); + $resolver->getWriter()->publishDataFileForSchema( + $viewHelperDocumentation->getSchema(), + $path . '.rst', + $this->view->render('ViewHelper') + ); + } + + public function exportViewHelperGroup(ViewHelperDocumentationGroup $viewHelperDocumentationGroup, bool $forceUpdate = false): void + { + $resolver = DataFileResolver::getInstance(); + if (!$forceUpdate && file_exists($resolver->getPublicDirectoryPath() . $viewHelperDocumentationGroup->getPath() . 'Index.rst')) { + return; + } + + $groupPath = $viewHelperDocumentationGroup->getPath() . DIRECTORY_SEPARATOR; + $backPath = str_repeat('../', substr_count($groupPath, '/')); + $rootPath = $backPath . '../../../'; + + $headline = $viewHelperDocumentationGroup->getGroupId(); + $headlineDecoration = array_pad([], strlen($headline), '='); + $viewHelpers = $viewHelperDocumentationGroup->getDocumentedViewHelpers(); + $subGroupsCount = \count($viewHelperDocumentationGroup->getSubGroups()); + $this->view->assignMultiple([ + 'headline' => $headline, + 'headlineDecoration' => implode('', $headlineDecoration), + 'rootPath' => $rootPath, + 'viewHelpers' => \count($viewHelpers), + 'subGroups' => $subGroupsCount, + 'tocTree' => $this->getTocTree($viewHelpers, $subGroupsCount), + ]); + $resolver->getWriter()->publishDataFileForSchema( + $viewHelperDocumentationGroup->getSchema(), + $groupPath . 'Index.rst', + $this->view->render('ViewHelperGroup') + ); + } + + protected function getTocTree(array $viewHelpers, int $subGroupsCount): array + { + $toctree = []; + if ($subGroupsCount > 0) { + $toctree[] = $this->intend . '*/Index' . PHP_EOL; + } + foreach ($viewHelpers as $viewHelper) { + $toctree[] = $this->intend . $viewHelper->getLocalName() . PHP_EOL; + } + return $toctree; + } +} diff --git a/src/Export/XsdExporter.php b/src/Export/XsdExporter.php index 8f8b9b3..84127d3 100644 --- a/src/Export/XsdExporter.php +++ b/src/Export/XsdExporter.php @@ -4,9 +4,9 @@ namespace NamelessCoder\FluidDocumentationGenerator\Export; use NamelessCoder\FluidDocumentationGenerator\Data\DataFileResolver; -use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaPackage; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; +use NamelessCoder\FluidDocumentationGenerator\ProcessedSchema; use NamelessCoder\FluidDocumentationGenerator\SchemaDocumentationGenerator; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentation; use NamelessCoder\FluidDocumentationGenerator\ViewHelperDocumentationGroup; @@ -47,7 +47,7 @@ public function createAdditionalSchemaResources(ProcessedSchema $schema, ?string ]; } - public function exportRoot(): void + public function exportRoot(bool $forceUpdate): void { // This method has no function in this exporter } diff --git a/tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd b/tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd new file mode 100644 index 0000000..0ca64d9 --- /dev/null +++ b/tests/Fixtures/rendering/input/typo3/backend/9.4/schema.xsd @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/]]> + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + and accepts +only view helpers as children. += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Fixtures/rendering/input/typo3/backend/9.5/schema.xsd b/tests/Fixtures/rendering/input/typo3/backend/9.5/schema.xsd new file mode 100644 index 0000000..0ca64d9 --- /dev/null +++ b/tests/Fixtures/rendering/input/typo3/backend/9.5/schema.xsd @@ -0,0 +1,607 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/]]> + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + and accepts +only view helpers as children. += Examples = + + + + + + + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + +/]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Fixtures/rendering/output/Documentation/Index.rst b/tests/Fixtures/rendering/output/Documentation/Index.rst new file mode 100644 index 0000000..c8b980e --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/Index.rst @@ -0,0 +1,13 @@ +.. include:: Includes.txt + +============================== +Fluid ViewHelper Documentation +============================== + +:Rendered: |today| + +.. toctree:: + :titlesonly: + + typo3/backend/9.4/Index + typo3/backend/9.5/Index diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst new file mode 100644 index 0000000..974eb80 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Avatar.rst @@ -0,0 +1,36 @@ +.. include:: ../../../Includes.txt + +====== +avatar +====== + + +Render the avatar img tag for a given backend user + +Arguments +========= + + +backendUser (anySimpleType) +--------------------------- + + +Default: 0 + +uid of the backend user + +size (anySimpleType) +-------------------- + + +Default: 32 + +width and height of the image + +showIcon (anySimpleType) +------------------------ + + +Default: false + +show the record icon as well \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst new file mode 100644 index 0000000..737adab --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../Includes.txt + +============= +typo3/backend +============= + +* 3 ViewHelpers documented +* 3 Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + + */Index + Avatar + ModuleLayout + ModuleLink + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst new file mode 100644 index 0000000..e23afa1 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/EditRecord.rst @@ -0,0 +1,196 @@ +.. include:: ../../../../Includes.txt + +.. _typo3-backend-link-editrecord: + +=============== +link.editRecord +=============== + + +Use this ViewHelper to provide edit links to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + + + Edit record + + + +Arguments +========= + + +.. _link.editrecord_additionalattributes: +additionalAttributes +-------------------- + +:aspect:`DataType` + mixed + +:aspect:`Required` + false +:aspect:`Description` + Additional tag attributes. They will be added directly to the resulting HTML tag. + +.. _link.editrecord_data: +data +---- + +:aspect:`DataType` + mixed + +:aspect:`Required` + false +:aspect:`Description` + Additional data-* attributes. They will each be added with a "data-" prefix. + +.. _link.editrecord_class: +class +----- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + CSS class(es) for this element + +.. _link.editrecord_dir: +dir +--- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + +.. _link.editrecord_id: +id +-- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Unique (in this file) identifier for this HTML element. + +.. _link.editrecord_lang: +lang +---- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Language for this element. Use short names specified in RFC 1766 + +.. _link.editrecord_style: +style +----- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Individual CSS styles for this element + +.. _link.editrecord_title: +title +----- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Tooltip text of element + +.. _link.editrecord_accesskey: +accesskey +--------- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Keyboard shortcut to access this element + +.. _link.editrecord_tabindex: +tabindex +-------- + +:aspect:`DataType` + integer + +:aspect:`Required` + false +:aspect:`Description` + Specifies the tab order of this element + +.. _link.editrecord_onclick: +onclick +------- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + JavaScript evaluated for the onclick event + +.. _link.editrecord_uid: +uid +--- + +:aspect:`DataType` + mixed + +:aspect:`Required` + false +:aspect:`Description` + Uid of record to be edited + +.. _link.editrecord_table: +table +----- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Target database table + +.. _link.editrecord_returnurl: +returnUrl +--------- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst new file mode 100644 index 0000000..26e77a8 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../../Includes.txt + +==== +link +==== + + +* 2 ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + EditRecord + NewRecord + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst new file mode 100644 index 0000000..c06e8c6 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Link/NewRecord.rst @@ -0,0 +1,144 @@ +.. include:: ../../../../Includes.txt + +============== +link.newRecord +============== + + +Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + + +Arguments +========= + + +additionalAttributes (anySimpleType) +------------------------------------ + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + +data (anySimpleType) +-------------------- + + +Additional data-* attributes. They will each be added with a "data-" prefix. + +class (string) +-------------- + + +CSS class(es) for this element + +dir (string) +------------ + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + +id (string) +----------- + + +Unique (in this file) identifier for this HTML element. + +lang (string) +------------- + + +Language for this element. Use short names specified in RFC 1766 + +style (string) +-------------- + + +Individual CSS styles for this element + +title (string) +-------------- + + +Tooltip text of element + +accesskey (string) +------------------ + + +Keyboard shortcut to access this element + +tabindex (integer) +------------------ + + +Specifies the tab order of this element + +onclick (string) +---------------- + + +JavaScript evaluated for the onclick event + +uid (anySimpleType) +------------------- + + +uid < 0 will insert the record after the given uid + +pid (anySimpleType) +------------------- + + +the page id where the record will be created + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst new file mode 100644 index 0000000..88bde63 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout.rst @@ -0,0 +1,27 @@ +.. include:: ../../../Includes.txt + +============ +moduleLayout +============ + + +A view helper for having properly styled backend modules. +It is recommended to use it in Fluid Layouts. +It will render the required HTML for the doc header. +All module specific output and further configuration of the doc header +must be rendered as children of this view helper. += Examples = + + + + + + + + + +Arguments +========= + + +This ViewHelper has no arguments. \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst new file mode 100644 index 0000000..4efef2f --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../../../Includes.txt + +====== +button +====== + + +* 2 ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + LinkButton + ShortcutButton + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst new file mode 100644 index 0000000..157e057 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/LinkButton.rst @@ -0,0 +1,69 @@ +.. include:: ../../../../../Includes.txt + +============================== +moduleLayout.button.linkButton +============================== + + +A view helper for adding a link button to the doc header area. +It must be a child of += Examples = + + + + + + +Arguments +========= + + +icon (string) +------------- + + +Icon identifier for the button + +title (string) +-------------- + + +Title of the button + +disabled (anySimpleType) +------------------------ + + +Default: false + +Whether the button is disabled + +showLabel (anySimpleType) +------------------------- + + +Default: false + +Defines whether to show the title as a label within the button + +position (string) +----------------- + + +Position of the button (left or right) + +group (integer) +--------------- + + +Button group of the button + +link (string) +------------- + + +Link for the button \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst new file mode 100644 index 0000000..e144150 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Button/ShortcutButton.rst @@ -0,0 +1,73 @@ +.. include:: ../../../../../Includes.txt + +================================== +moduleLayout.button.shortcutButton +================================== + + +A view helper for adding a shortcut button to the doc header area. +It must be a child of += Examples = + + + + + + +Arguments +========= + + +icon (string) +------------- + + +Icon identifier for the button + +title (string) +-------------- + + +Title of the button + +disabled (anySimpleType) +------------------------ + + +Default: false + +Whether the button is disabled + +showLabel (anySimpleType) +------------------------- + + +Default: false + +Defines whether to show the title as a label within the button + +position (string) +----------------- + + +Position of the button (left or right) + +group (integer) +--------------- + + +Button group of the button + +displayName (string) +-------------------- + + +Name for the shortcut + +getVars (anySimpleType) +----------------------- + + +Default: array () + +List of additional GET variables to store. The current id, module and all module arguments will always be stored \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst new file mode 100644 index 0000000..d9f4a9d --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Index.rst @@ -0,0 +1,20 @@ +.. include:: ../../../../Includes.txt + +============ +moduleLayout +============ + + +* 2 ViewHelpers documented +* 1 Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + + */Index + MenuItem + Menu + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst new file mode 100644 index 0000000..37b9c21 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/Menu.rst @@ -0,0 +1,28 @@ +.. include:: ../../../../Includes.txt + +================= +moduleLayout.menu +================= + + +A view helper for adding a menu to the doc header area. +It must be a child of and accepts +only view helpers as children. += Examples = + + + + + + + + +Arguments +========= + + +identifier (string) +------------------- + + +Identifier of the menu \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst new file mode 100644 index 0000000..8aa6f5d --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLayout/MenuItem.rst @@ -0,0 +1,33 @@ +.. include:: ../../../../Includes.txt + +===================== +moduleLayout.menuItem +===================== + + +A view helper for adding a menu item to a doc header menu. +It must be a child of += Examples = + + + + + + + + +Arguments +========= + + +label (string) +-------------- + + +Label of the menu item + +uri (string) +------------ + + +Action uri \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst new file mode 100644 index 0000000..8e137a7 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/ModuleLink.rst @@ -0,0 +1,65 @@ +.. include:: ../../../Includes.txt + +.. _typo3-backend-modulelink: + +========== +moduleLink +========== + + +Create internal link within backend app + +Arguments +========= + + +.. _modulelink_route: +route +----- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + The route to link to + +.. _modulelink_arguments: +arguments +--------- + +:aspect:`DataType` + mixed + +:aspect:`Default` + array () + +:aspect:`Required` + false +:aspect:`Description` + Additional link arguments + +.. _modulelink_query: +query +----- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Additional link arguments as string + +.. _modulelink_currenturlparametername: +currentUrlParameterName +----------------------- + +:aspect:`DataType` + string + +:aspect:`Required` + false +:aspect:`Description` + Add current url as given parameter diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst new file mode 100644 index 0000000..a19bead --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/EditRecord.rst @@ -0,0 +1,40 @@ +.. include:: ../../../../Includes.txt + +============== +uri.editRecord +============== + + +Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + + +Arguments +========= + + +uid (anySimpleType) +------------------- + + +uid of record to be edited, 0 for creation + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst new file mode 100644 index 0000000..b60f674 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../../Includes.txt + +=== +uri +=== + + +* 2 ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + EditRecord + NewRecord + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst new file mode 100644 index 0000000..5512850 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.4/Uri/NewRecord.rst @@ -0,0 +1,72 @@ +.. include:: ../../../../Includes.txt + +============= +uri.newRecord +============= + + +Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + +Arguments +========= + + +uid (anySimpleType) +------------------- + + +uid < 0 will insert the record after the given uid + +pid (anySimpleType) +------------------- + + +the page id where the record will be created + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst new file mode 100644 index 0000000..974eb80 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Avatar.rst @@ -0,0 +1,36 @@ +.. include:: ../../../Includes.txt + +====== +avatar +====== + + +Render the avatar img tag for a given backend user + +Arguments +========= + + +backendUser (anySimpleType) +--------------------------- + + +Default: 0 + +uid of the backend user + +size (anySimpleType) +-------------------- + + +Default: 32 + +width and height of the image + +showIcon (anySimpleType) +------------------------ + + +Default: false + +show the record icon as well \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst new file mode 100644 index 0000000..737adab --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../Includes.txt + +============= +typo3/backend +============= + +* 3 ViewHelpers documented +* 3 Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + + */Index + Avatar + ModuleLayout + ModuleLink + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst new file mode 100644 index 0000000..9e2e3d1 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/EditRecord.rst @@ -0,0 +1,108 @@ +.. include:: ../../../../Includes.txt + +=============== +link.editRecord +=============== + + +Use this ViewHelper to provide edit links to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + + + Edit record + + + +Arguments +========= + + +additionalAttributes (anySimpleType) +------------------------------------ + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + +data (anySimpleType) +-------------------- + + +Additional data-* attributes. They will each be added with a "data-" prefix. + +class (string) +-------------- + + +CSS class(es) for this element + +dir (string) +------------ + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + +id (string) +----------- + + +Unique (in this file) identifier for this HTML element. + +lang (string) +------------- + + +Language for this element. Use short names specified in RFC 1766 + +style (string) +-------------- + + +Individual CSS styles for this element + +title (string) +-------------- + + +Tooltip text of element + +accesskey (string) +------------------ + + +Keyboard shortcut to access this element + +tabindex (integer) +------------------ + + +Specifies the tab order of this element + +onclick (string) +---------------- + + +JavaScript evaluated for the onclick event + +uid (anySimpleType) +------------------- + + +uid of record to be edited + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst new file mode 100644 index 0000000..26e77a8 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../../Includes.txt + +==== +link +==== + + +* 2 ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + EditRecord + NewRecord + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst new file mode 100644 index 0000000..c06e8c6 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Link/NewRecord.rst @@ -0,0 +1,144 @@ +.. include:: ../../../../Includes.txt + +============== +link.newRecord +============== + + +Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + + Edit record + + + + + + + + + Edit record + + + + + + + + + Edit record + + + +Arguments +========= + + +additionalAttributes (anySimpleType) +------------------------------------ + + +Additional tag attributes. They will be added directly to the resulting HTML tag. + +data (anySimpleType) +-------------------- + + +Additional data-* attributes. They will each be added with a "data-" prefix. + +class (string) +-------------- + + +CSS class(es) for this element + +dir (string) +------------ + + +Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left) + +id (string) +----------- + + +Unique (in this file) identifier for this HTML element. + +lang (string) +------------- + + +Language for this element. Use short names specified in RFC 1766 + +style (string) +-------------- + + +Individual CSS styles for this element + +title (string) +-------------- + + +Tooltip text of element + +accesskey (string) +------------------ + + +Keyboard shortcut to access this element + +tabindex (integer) +------------------ + + +Specifies the tab order of this element + +onclick (string) +---------------- + + +JavaScript evaluated for the onclick event + +uid (anySimpleType) +------------------- + + +uid < 0 will insert the record after the given uid + +pid (anySimpleType) +------------------- + + +the page id where the record will be created + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst new file mode 100644 index 0000000..88bde63 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout.rst @@ -0,0 +1,27 @@ +.. include:: ../../../Includes.txt + +============ +moduleLayout +============ + + +A view helper for having properly styled backend modules. +It is recommended to use it in Fluid Layouts. +It will render the required HTML for the doc header. +All module specific output and further configuration of the doc header +must be rendered as children of this view helper. += Examples = + + + + + + + + + +Arguments +========= + + +This ViewHelper has no arguments. \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst new file mode 100644 index 0000000..4efef2f --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../../../Includes.txt + +====== +button +====== + + +* 2 ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + LinkButton + ShortcutButton + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst new file mode 100644 index 0000000..157e057 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/LinkButton.rst @@ -0,0 +1,69 @@ +.. include:: ../../../../../Includes.txt + +============================== +moduleLayout.button.linkButton +============================== + + +A view helper for adding a link button to the doc header area. +It must be a child of += Examples = + + + + + + +Arguments +========= + + +icon (string) +------------- + + +Icon identifier for the button + +title (string) +-------------- + + +Title of the button + +disabled (anySimpleType) +------------------------ + + +Default: false + +Whether the button is disabled + +showLabel (anySimpleType) +------------------------- + + +Default: false + +Defines whether to show the title as a label within the button + +position (string) +----------------- + + +Position of the button (left or right) + +group (integer) +--------------- + + +Button group of the button + +link (string) +------------- + + +Link for the button \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst new file mode 100644 index 0000000..e144150 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Button/ShortcutButton.rst @@ -0,0 +1,73 @@ +.. include:: ../../../../../Includes.txt + +================================== +moduleLayout.button.shortcutButton +================================== + + +A view helper for adding a shortcut button to the doc header area. +It must be a child of += Examples = + + + + + + +Arguments +========= + + +icon (string) +------------- + + +Icon identifier for the button + +title (string) +-------------- + + +Title of the button + +disabled (anySimpleType) +------------------------ + + +Default: false + +Whether the button is disabled + +showLabel (anySimpleType) +------------------------- + + +Default: false + +Defines whether to show the title as a label within the button + +position (string) +----------------- + + +Position of the button (left or right) + +group (integer) +--------------- + + +Button group of the button + +displayName (string) +-------------------- + + +Name for the shortcut + +getVars (anySimpleType) +----------------------- + + +Default: array () + +List of additional GET variables to store. The current id, module and all module arguments will always be stored \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst new file mode 100644 index 0000000..d9f4a9d --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Index.rst @@ -0,0 +1,20 @@ +.. include:: ../../../../Includes.txt + +============ +moduleLayout +============ + + +* 2 ViewHelpers documented +* 1 Sub namespaces + +.. toctree:: + :titlesonly: + :glob: + + */Index + MenuItem + Menu + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst new file mode 100644 index 0000000..37b9c21 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/Menu.rst @@ -0,0 +1,28 @@ +.. include:: ../../../../Includes.txt + +================= +moduleLayout.menu +================= + + +A view helper for adding a menu to the doc header area. +It must be a child of and accepts +only view helpers as children. += Examples = + + + + + + + + +Arguments +========= + + +identifier (string) +------------------- + + +Identifier of the menu \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst new file mode 100644 index 0000000..8aa6f5d --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLayout/MenuItem.rst @@ -0,0 +1,33 @@ +.. include:: ../../../../Includes.txt + +===================== +moduleLayout.menuItem +===================== + + +A view helper for adding a menu item to a doc header menu. +It must be a child of += Examples = + + + + + + + + +Arguments +========= + + +label (string) +-------------- + + +Label of the menu item + +uri (string) +------------ + + +Action uri \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst new file mode 100644 index 0000000..0ebd809 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/ModuleLink.rst @@ -0,0 +1,38 @@ +.. include:: ../../../Includes.txt + +========== +moduleLink +========== + + +Create internal link within backend app + +Arguments +========= + + +route (string) +-------------- + + +The route to link to + +arguments (anySimpleType) +------------------------- + + +Default: array () + +Additional link arguments + +query (string) +-------------- + + +Additional link arguments as string + +currentUrlParameterName (string) +-------------------------------- + + +Add current url as given parameter \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst new file mode 100644 index 0000000..a19bead --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/EditRecord.rst @@ -0,0 +1,40 @@ +.. include:: ../../../../Includes.txt + +============== +uri.editRecord +============== + + +Use this ViewHelper to provide edit links (only the uri) to records. The ViewHelper will +pass the uid and table to FormEngine. + +The uid must be given as a positive integer. +For new records, use the newRecordViewHelper + += Examples = + + + + + +/typo3/index.php?route=/record/edit&edit[a_table][42]=edit&returnUrl=foo/bar + + +Arguments +========= + + +uid (anySimpleType) +------------------- + + +uid of record to be edited, 0 for creation + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst new file mode 100644 index 0000000..b60f674 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/Index.rst @@ -0,0 +1,18 @@ +.. include:: ../../../../Includes.txt + +=== +uri +=== + + +* 2 ViewHelpers documented + +.. toctree:: + :titlesonly: + :glob: + + EditRecord + NewRecord + + + diff --git a/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst new file mode 100644 index 0000000..5512850 --- /dev/null +++ b/tests/Fixtures/rendering/output/Documentation/typo3/backend/9.5/Uri/NewRecord.rst @@ -0,0 +1,72 @@ +.. include:: ../../../../Includes.txt + +============= +uri.newRecord +============= + + +Use this ViewHelper to provide 'create new record' links. +The ViewHelper will pass the command to FormEngine. + +The table argument is mandatory, it decides what record is to be created. + +The pid argument will put the new record on this page, if 0 given it will +be placed to the root page. + +The uid argument accepts only negative values. If this is given, the new +record will be placed (by sorting field) behind the record with the uid. +It will end up on the same pid as this given record, so the pid must not +be given explicitly by pid argument. + +An exception will be thrown, if both uid and pid are given. +An exception will be thrown, if the uid argument is not a negative integer. + +To edit records, use the editRecordViewHelper + += Examples = + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][]=new&returnUrl=foo/bar + + + + + + + /typo3/index.php?route=/record/edit&edit[a_table][-17]=new&returnUrl=foo/bar + + +Arguments +========= + + +uid (anySimpleType) +------------------- + + +uid < 0 will insert the record after the given uid + +pid (anySimpleType) +------------------- + + +the page id where the record will be created + +table (string) +-------------- + + +target database table + +returnUrl (string) +------------------ \ No newline at end of file diff --git a/Tests/Fixtures/schemas/test/test/1.0.0/schema.xsd b/tests/Fixtures/schemas/test/test/1.0.0/schema.xsd similarity index 100% rename from Tests/Fixtures/schemas/test/test/1.0.0/schema.xsd rename to tests/Fixtures/schemas/test/test/1.0.0/schema.xsd diff --git a/Tests/Functional/FileResolvingTest.php b/tests/Functional/FileResolvingTest.php similarity index 100% rename from Tests/Functional/FileResolvingTest.php rename to tests/Functional/FileResolvingTest.php diff --git a/tests/Functional/RstRendering/FileStructureTest.php b/tests/Functional/RstRendering/FileStructureTest.php new file mode 100644 index 0000000..a6a2b4d --- /dev/null +++ b/tests/Functional/RstRendering/FileStructureTest.php @@ -0,0 +1,79 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function compareDirStructure() + { + $expected = $this->directoryToArray($this->fixtureFilePath); + $actual = $this->directoryToArray($this->vfs->getChild('outputDir/public')->url()); + $this->assertSame($expected, $actual); + } + + private function directoryToArray(string $directory): array + { + + $result = []; + + $cdir = scandir($directory); + foreach ($cdir as $key => $value) { + if (!in_array($value, ['.', '..'])) { + if (is_dir($directory . DIRECTORY_SEPARATOR . $value)) { + $result[$value] = $this->directoryToArray($directory . DIRECTORY_SEPARATOR . $value); + } else { + $result[] = $value; + } + } + } + + return $result; + } +} \ No newline at end of file diff --git a/tests/Functional/RstRendering/IndexForSchemaTest.php b/tests/Functional/RstRendering/IndexForSchemaTest.php new file mode 100644 index 0000000..65181b8 --- /dev/null +++ b/tests/Functional/RstRendering/IndexForSchemaTest.php @@ -0,0 +1,141 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('typo3/backend' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function viewHelperCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 6; + $this->assertSame('* 3 ViewHelpers documented' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function subNamespacesCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('* 3 Sub namespaces' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 13; + $this->assertSame(' */Index' . PHP_EOL, $output[$index]); + $this->assertSame(' Avatar' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' ModuleLayout' . PHP_EOL, $output[$index + 2]); + $this->assertSame(' ModuleLink' . PHP_EOL, $output[$index + 3]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), + trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); + } +} diff --git a/tests/Functional/RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php b/tests/Functional/RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php new file mode 100644 index 0000000..d9f3b15 --- /dev/null +++ b/tests/Functional/RstRendering/IndexForViewhelperGroupWithSubGroupsTest.php @@ -0,0 +1,140 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('moduleLayout' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function viewHelperCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('* 2 ViewHelpers documented' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function subNamespacesCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 8; + $this->assertSame('* 1 Sub namespaces' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 14; + $this->assertSame(' */Index' . PHP_EOL, $output[$index]); + $this->assertSame(' MenuItem' . PHP_EOL, $output[$index + 1]); + $this->assertSame(' Menu' . PHP_EOL, $output[$index + 2]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), + trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); + } +} diff --git a/tests/Functional/RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php b/tests/Functional/RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php new file mode 100644 index 0000000..03a45a8 --- /dev/null +++ b/tests/Functional/RstRendering/IndexForViewhelperGroupWithoutSubGroupsTest.php @@ -0,0 +1,129 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 3; + $this->assertSame('link' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 3; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function viewHelperCountIsIntegrated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 7; + $this->assertSame('* 2 ViewHelpers documented' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 13; + $this->assertSame(' EditRecord' . PHP_EOL, $output[$index]); + $this->assertSame(' NewRecord' . PHP_EOL, $output[$index + 1]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(trim(file_get_contents($this->fixtureFilePath)), + trim(file_get_contents($this->vfs->getChild($this->generatedFilePath)->url()))); + } +} diff --git a/tests/Functional/RstRendering/RootIndexFileTest.php b/tests/Functional/RstRendering/RootIndexFileTest.php new file mode 100644 index 0000000..1d78110 --- /dev/null +++ b/tests/Functional/RstRendering/RootIndexFileTest.php @@ -0,0 +1,94 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // include, empty, anchor, empty, upper headline decoration, text, lower headline decoration + $index = 5; + $this->assertSame('Fluid ViewHelper Documentation' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // include, empty, anchor, empty, upper headline decoration, text, lower headline decoration + $headlineTextIndex = 5; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function tocTreeContainsSubDirectoriesAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $output = implode(PHP_EOL, $output); + $this->assertStringContainsString(' typo3/backend/9.4/Index' . PHP_EOL, $output); + $this->assertStringContainsString(' typo3/backend/9.5/Index' . PHP_EOL, $output); + } +} diff --git a/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php b/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php new file mode 100644 index 0000000..86c04f5 --- /dev/null +++ b/tests/Functional/RstRendering/ViewHelperFileFirstLevelTest.php @@ -0,0 +1,129 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 5; + $this->assertSame('moduleLink' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 5; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function descriptionGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 9; + $this->assertSame('Create internal link within backend app' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headerIdentifierGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 2; + $this->assertSame('.. _typo3-backend-modulelink:' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(file_get_contents($this->fixtureFilePath), + file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + } +} diff --git a/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php b/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php new file mode 100644 index 0000000..b78345b --- /dev/null +++ b/tests/Functional/RstRendering/ViewHelperFileSecondLevelTest.php @@ -0,0 +1,129 @@ +vfs = vfsStream::setup('outputDir'); + $this->vfs->addChild(vfsStream::newDirectory('cache')); + $dataFileResolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); + $dataFileResolver->setResourcesDirectory(__DIR__ . '/../../../resources/'); + $dataFileResolver->setSchemasDirectory(__DIR__ . '/../../Fixtures/rendering/input/'); + $schemaDocumentationGenerator = new SchemaDocumentationGenerator( + [ + new RstExporter() + ] + ); + $schemaDocumentationGenerator->generateFilesForRoot(); + foreach ($dataFileResolver->resolveInstalledVendors() as $vendor) { + $schemaDocumentationGenerator->generateFilesForVendor($vendor); + foreach ($vendor->getPackages() as $package) { + $schemaDocumentationGenerator->generateFilesForPackage($package); + foreach ($package->getVersions() as $version) { + $schemaDocumentationGenerator->generateFilesForSchema(new Schema($version)); + } + } + } + } + + /** + * @test + */ + public function fileIsCreated() + { + $this->assertTrue($this->vfs->hasChild($this->generatedFilePath)); + } + + /** + * @test + */ + public function includeClausePointsToSettingsCfg() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $this->assertSame('.. include:: ../../../../Includes.txt' . PHP_EOL, $output[0]); + } + + /** + * @test + */ + public function headlineAsExpected() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text -> fourth line + $index = 5; + $this->assertSame('link.editRecord' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headlineIsProperlyDecorated() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + // first line is include, then empty, then upper headline decoration, then text, then lower headline decoration + $headlineTextIndex = 5; + $lengthOfHeadline = strlen($output[$headlineTextIndex]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex - 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex - 1]); + $this->assertSame($lengthOfHeadline, strlen($output[$headlineTextIndex + 1])); + $this->assertRegExp('/^[=]+$/', $output[$headlineTextIndex + 1]); + } + + /** + * @test + */ + public function descriptionGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 9; + $this->assertSame('Use this ViewHelper to provide edit links to records. The ViewHelper will' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function headerIdentifierGetsRendered() + { + $output = file($this->vfs->getChild($this->generatedFilePath)->url()); + $index = 2; + $this->assertSame('.. _typo3-backend-link-editrecord:' . PHP_EOL, $output[$index]); + } + + /** + * @test + */ + public function generatedFileIsSameAsFixture() + { + $this->assertSame(file_get_contents($this->fixtureFilePath), + file_get_contents($this->vfs->getChild($this->generatedFilePath)->url())); + } +} diff --git a/Tests/Functional/SchemaDocumentationGeneratorTest.php b/tests/Functional/SchemaDocumentationGeneratorTest.php similarity index 67% rename from Tests/Functional/SchemaDocumentationGeneratorTest.php rename to tests/Functional/SchemaDocumentationGeneratorTest.php index f0d159f..0aa041b 100644 --- a/Tests/Functional/SchemaDocumentationGeneratorTest.php +++ b/tests/Functional/SchemaDocumentationGeneratorTest.php @@ -33,16 +33,16 @@ class SchemaDocumentationGeneratorTest extends TestCase protected function setUp() { - $this->vfs = vfsStream::setup('public'); + $this->vfs = vfsStream::setup('outputDir'); $this->vfs->addChild(vfsStream::newDirectory('cache')); - $resolver = DataFileResolver::getInstance(vfsStream::url('public')); + $resolver = DataFileResolver::getInstance(vfsStream::url('outputDir')); $resolver->setResourcesDirectory(__DIR__ . '/../../resources/'); $resolver->setSchemasDirectory(__DIR__ . '/../Fixtures/schemas/'); $this->subject = new SchemaDocumentationGenerator( [ new JsonExporter(''), - new XsdExporter(''), - new HtmlExporter('') + new XsdExporter(vfsStream::url('')), + new HtmlExporter(vfsStream::url('')) ], true ); @@ -51,40 +51,36 @@ protected function setUp() public function testGenerateResourcesForRoot(): void { $this->subject->generateFilesForRoot(); - $folder = $this->vfs->getChild('public'); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/index.html')); } public function testGenerateResourcesForVendor(): void { $this->subject->generateFilesForVendor(new SchemaVendor('test')); - $folder = $this->vfs->getChild('public')->getChild('test'); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/index.html')); } public function testGenerateResourcesForPackage(): void { $this->subject->generateFilesForPackage(new SchemaPackage(new SchemaVendor('test'), 'test')); - $folder = $this->vfs->getChild('public')->getChild('test')->getChild('test'); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/index.html')); } public function testGenerateResourcesForSchema(): void { $schema = new Schema(new SchemaVersion(new SchemaPackage(new SchemaVendor('test'), 'test'), '1.0.0')); $this->subject->generateFilesForSchema($schema); - $folder = $this->vfs->getChild('public')->getChild('test')->getChild('test')->getChild('1.0.0'); - $this->assertSame('tree.json', $folder->getChild('tree.json')->getName()); - $this->assertSame('index.json', $folder->getChild('index.json')->getName()); - $this->assertSame('index.html', $folder->getChild('index.html')->getName()); - $this->assertSame('schema.xsd', $folder->getChild('schema.xsd')->getName()); - $this->assertSame('Format', $folder->getChild('Format')->getName()); - $this->assertSame('Json', $folder->getChild('Format')->getChild('Json')->getName()); - $this->assertSame('Encode.html', $folder->getChild('Format')->getChild('Json')->getChild('Encode.html')->getName()); - $this->assertSame('Decode.html', $folder->getChild('Format')->getChild('Json')->getChild('Decode.html')->getName()); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/tree.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/index.json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/index.html')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/schema.xsd')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format/Json')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format/Json/Encode.html')); + $this->assertTrue($this->vfs->hasChild('outputDir/public/test/test/1.0.0/Format/Json/Decode.html')); } public function testGenerateMachineResourceLinksForSchema(): void @@ -94,8 +90,8 @@ public function testGenerateMachineResourceLinksForSchema(): void [ 'JSON tree' => 'tree.json', 'JSON index' => 'index.json', - 'XSD schema' => 'schema.xsd', - 'HTML overview' => '', + 'XSD schema' => 'vfs://schema.xsd', + 'HTML overview' => 'vfs://', ], $this->subject->generateResourceLinksForSchema($schemaMock) ); @@ -108,7 +104,7 @@ public function testGenerateResourceLinksForViewHelper(): void $this->assertSame( [ 'JSON schema' => 'Root.json', - 'HTML overview' => 'Root.html', + 'HTML overview' => 'vfs://Root.html', ], $this->subject->generateResourceLinksForViewHelper($viewHelper) ); @@ -121,7 +117,7 @@ public function testGenerateMachineResourceLinksForViewHelper(): void $this->assertSame( [ 'json' => 'Root.json', - 'html' => 'Root.html', + 'html' => 'vfs://Root.html', ], $this->subject->generateMachineResourceLinksForViewHelper($viewHelper) ); diff --git a/Tests/Functional/SchemaProcessingTest.php b/tests/Functional/SchemaProcessingTest.php similarity index 67% rename from Tests/Functional/SchemaProcessingTest.php rename to tests/Functional/SchemaProcessingTest.php index e19d438..2bd48d9 100644 --- a/Tests/Functional/SchemaProcessingTest.php +++ b/tests/Functional/SchemaProcessingTest.php @@ -9,8 +9,8 @@ use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVendor; use NamelessCoder\FluidDocumentationGenerator\Entity\SchemaVersion; use org\bovigo\vfs\vfsStream; +use org\bovigo\vfs\vfsStreamDirectory; use PHPUnit\Framework\TestCase; -use TYPO3Fluid\Fluid\Core\ViewHelper\ArgumentDefinition; class SchemaProcessingTest extends TestCase { @@ -33,12 +33,9 @@ protected function setUp() } /** - * @param string $viewHelperName - * @param string $expectedDocumentation - * @param array $expectedArguments - * @dataProvider getDocumentedViewHelperExpectations + * @test */ - public function testViewHelperIsDocumentedCorrectly(string $viewHelperName, string $expectedDocumentation, array $expectedArguments): void + public function viewHelperDocumentationContainsEntriesAsExpected(): void { $vendor = new SchemaVendor('test'); $package = new SchemaPackage($vendor, 'test'); @@ -46,15 +43,8 @@ public function testViewHelperIsDocumentedCorrectly(string $viewHelperName, stri $schema = new Schema($version); $processedSchema = $schema->process(); $documentedViewHelpers = $processedSchema->getDocumentedViewHelpers(); - $this->assertArrayHasKey($viewHelperName, $documentedViewHelpers); - } - - public function getDocumentedViewHelperExpectations(): array - { - return [ - [ - 'format.json.encode', 'foobar', [new ArgumentDefinition('test', 'string', 'foobar', true)] - ] - ]; + $this->assertArrayHasKey('root', $documentedViewHelpers); + $this->assertArrayHasKey('format.json.encode', $documentedViewHelpers); + $this->assertArrayHasKey('format.json.decode', $documentedViewHelpers); } }