-
Notifications
You must be signed in to change notification settings - Fork 82
IBX-6107: REST API ref tester #1901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
adriendupuis
wants to merge
40
commits into
5.0
Choose a base branch
from
rest-api-ref-tester
base: 5.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 16 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
176cfe3
Update raml2html's README.md
adriendupuis 648bb8d
tools/raml2html/README.md: Update dir paths
adriendupuis 79e058e
mv rest_api_reference_test.php to `raml2html.php test`
adriendupuis 62ff107
TestCommand.php: Enh. output
adriendupuis 44fa866
TestCommand.php: clean-up
adriendupuis d22ef9b
ReferenceTester.php: Fix DOMElement namespace
adriendupuis 97bc053
update the REST API Reference tester for 4.4.0-beta1
adriendupuis 227d9ca
ReferenceTester.php: Fix exclusion of /api/datebasedpublisher/v1
adriendupuis 909d0ba
ReferenceTester.php: Also test (deprecated) and (removed) flags
adriendupuis 17a3691
Upgrade raml2html/composer.json to PHP 7.4
adriendupuis 52cffaa
ReferenceTester.php: Use extension's yaml_parse_file
adriendupuis 7c3feee
composer.json: add required PHP extensions
adriendupuis 0d4e4e5
README.md: Update to PHP 7.4
adriendupuis ae740b9
raml2html/README.md: Remove late note about PHP 7.4
adriendupuis d58efc8
Update tools/raml2html/src/Command/TestCommand.php
adriendupuis adb0644
ReferenceTester.php: Remove path testing already done by TestCommand
adriendupuis 7a01b0a
Merge branch 'master' into rest-api-ref-tester
adriendupuis 6d91570
raml2html TestCommand: set a default path to reference
adriendupuis b7da863
ReferenceTester.php: Update route config files for 4.5
adriendupuis 85b00b3
Merge branch 'master' into rest-api-ref-tester
adriendupuis 9b34b69
Update raml2html/README.md
adriendupuis 69e9fd8
Merge branch 'master' into rest-api-ref-tester
adriendupuis 3d84c42
Merge branch 'master' into rest-api-ref-tester
adriendupuis cb66155
TestTypeUsageCommand.php
adriendupuis e636c0f
ReferenceTester.php: Update conf file list
adriendupuis dee8083
TestCommand.php → TestCompareCommand.php
adriendupuis 2a85d7d
ReferenceTester.php: Sort prefixes
adriendupuis ee761d9
ReferenceTester.php: Skip some prefixed routes
adriendupuis 4239e12
REST TestLogicCommand
adriendupuis 76e1aa9
TestLogicCommand.php: Tune down the header checking
adriendupuis 1e7e61f
TestLogicCommand::checkAcceptHeaderAgainstBody
adriendupuis e91a1eb
Enhance TestLogicCommand headers VS bodies checking
adriendupuis cdb1f73
TestTypeUsageCommand.php: Fix recursion
adriendupuis 6f078eb
Merge branch 'master' into rest-api-ref-tester
adriendupuis ca4cf8d
tools/raml2html/README.md: Update test:compare example
adriendupuis ea9fbf4
ReferenceTester.php: add connector-qualifio
adriendupuis ad1a184
ReferenceTester.php: inc. code readability
adriendupuis b976ef5
ReferenceTester.php: Exclude few bundles when using debug:router
adriendupuis 9a5db0a
raml2html/README.md: enh. test:compare doc
adriendupuis 622df54
test:type:usage: handle arrays of objects
adriendupuis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace EzSystems\Raml2Html\Command; | ||
|
|
||
| use EzSystems\Raml2Html\Test\ReferenceTester; | ||
| use Symfony\Component\Console\Command\Command; | ||
| use Symfony\Component\Console\Input\InputInterface; | ||
| use Symfony\Component\Console\Input\InputArgument; | ||
| use Symfony\Component\Console\Input\InputOption; | ||
| use Symfony\Component\Console\Output\OutputInterface; | ||
|
|
||
| final class TestCommand extends Command | ||
| { | ||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| protected function configure(): void | ||
| { | ||
| $this->setName('test') | ||
| ->setDescription('Compare REST API Reference documentation with Ibexa DXP routing configuration under /api/ibexa/v2 prefix') | ||
| ->setHelp('It is recommended to not use --console-path and --routing-file options while testing the Rest API Reference HTML file against configuration. Those options are used to test that the default configuration file list is up-to-date and other subtleties.') | ||
| ->addArgument('rest-api-reference', InputArgument::REQUIRED, 'Path to the REST API Reference HTML file') | ||
| ->addArgument('ibexa-dxp-root', InputArgument::REQUIRED, 'Path to an Ibexa DXP root directory') | ||
| ->addOption('console-path', 'c', InputOption::VALUE_OPTIONAL, 'Path to the console relative to Ibexa DXP root directory (if no value, use `bin/console`)', false) | ||
| ->addOption('routing-file', 'f', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Path to a routing configuration YAML file relative to Ibexa DXP root directory', ReferenceTester::DEFAULT_FILE_LIST) | ||
| ->addOption('tested-routes', 't', InputOption::VALUE_OPTIONAL, | ||
| "ref: Test if reference routes are found in the configuration file;\n | ||
| conf: Test if configuration routes are found in the reference file;\n | ||
| both: Test both.", 'both'); | ||
| } | ||
|
|
||
| /** | ||
| * {@inheritdoc} | ||
| */ | ||
| protected function execute(InputInterface $input, OutputInterface $output): int | ||
| { | ||
| $restApiReference = $input->getArgument('rest-api-reference'); | ||
| if (!is_file($restApiReference)) { | ||
| $output->writeln("<error>$restApiReference doesn't exist or is not a file.</error>"); | ||
| return 1; | ||
| } | ||
|
|
||
| $dxpRoot = $input->getArgument('ibexa-dxp-root'); | ||
| if (!is_dir($dxpRoot)) { | ||
| $output->writeln("<error>$dxpRoot doesn't exist or is not a directory.</error>"); | ||
| return 2; | ||
| } | ||
|
|
||
| $consolePath = $input->getOption('console-path'); | ||
| if (null === $consolePath) { | ||
| $consolePath = 'bin/console'; | ||
| } | ||
|
|
||
| $routingFiles = $input->getOption('routing-file'); | ||
|
|
||
| $referenceTester = new ReferenceTester($restApiReference, $dxpRoot, $consolePath, $routingFiles, $output); | ||
|
|
||
| $testedRoutes = [ | ||
| 'ref' => ReferenceTester::TEST_REFERENCE_ROUTES, | ||
| 'conf' => ReferenceTester::TEST_CONFIG_ROUTES, | ||
| 'both' => ReferenceTester::TEST_ALL_ROUTES, | ||
| ][$input->getOption('tested-routes')] ?? ReferenceTester::TEST_ALL_ROUTES; | ||
|
|
||
| $referenceTester->run($testedRoutes); | ||
|
|
||
| return 0; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to use a temporary location.