Download the PHP package kent013/artisan-command-spectator-test without Composer
On this page you can find all versions of the php package kent013/artisan-command-spectator-test. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package artisan-command-spectator-test
artisan-command-spectator-test
Artisan make command to generate HTTP testcases with OpenAPI and spectator.
Disclaimer
This command generate only a scaffold. You need further implementation to test your API.
I'm using api blueprint for API specification. Generating OpenAPI json with using apib2swagger.
While I'm not writing OpenAPI directly, some data such as operation ID is not natural. Perhaps it will cause a problem on this command.
Installation
Generate config file
Configuration
Default namespace
If you want to change test namespaces, please add following line in your .env
file and change the values.
OpenAPI file path
You can set default open api path with adding following line in your .env
file and change the values.
This value is able to overide with openapi-path
option.
Command line arguments
Where APIMethodPath
goes like
Will be generate all HTTP methods corresponds on the path. If you want to select HTTP methods to generate test, prefix the path with comma-separated http methods as following.
Also you can pass multiple APIMethodPath
to command as following.
For example,
Using tag
If you using tag to group API paths, then you can use --tags
argument as following.
Command line options
--openapi-path
Path to Open API specification. You can specify Json or Yaml path or URL.
--force
Overrite class file or not;
--tags
Generate test methods matched with tags. With no --tags
option, arguments will be processed as a path.
You cannot select HTTP methods with tags.
--test-name-with-path
Generate test method name from path like testApiV1OrganizationProjectsPut204
.
By default command will use operationId like testProjects200
Example Test
All versions of artisan-command-spectator-test with dependencies
laravel/framework Version ^10.0 || ^11.0
hotmeteor/spectator Version ^2.0
devizzent/cebe-php-openapi Version ^1.0