From e282a052bf9efb72057458359c0717555a1abc08 Mon Sep 17 00:00:00 2001 From: Yuriy Belenko Date: Sun, 14 Jun 2020 17:40:06 +0300 Subject: [PATCH] [php-slim4] Set required PHP version to 7.2 (#6530) * Bump required PHP version to 7.2 * Update rest dependencies to meet php 7.2 Latest phpunit 9 requires PHP 7.3, so I've set phpunit 8 as a fallback. * Fix TestCase inheritance * Add phpunit cache file to gitignore * Put license @phpdoc into separate mustache * Bump readme PHP version to 7.2 * Bump @phpdoc PHP version to 7.2 * Update Zend Diactoros with suggested package * Refresh samples * Remove broken tests These tests will be fixed in next PR which moves Mock feature to external repo. * Point root Travis CI environment to PHP 7.3 --- .travis.yml | 2 +- .../php-slim4-server/README.mustache | 4 +- .../php-slim4-server/SlimRouter.mustache | 28 +------- .../abstract_authenticator.mustache | 28 +------- .../resources/php-slim4-server/api.mustache | 27 +------- .../php-slim4-server/api_test.mustache | 37 ++--------- .../php-slim4-server/composer.mustache | 18 +++--- .../main/resources/php-slim4-server/gitignore | 1 + .../resources/php-slim4-server/index.mustache | 16 ++--- .../json_body_parser_middleware.mustache | 28 +------- .../php-slim4-server/licenseInfo.mustache | 23 +++++++ .../resources/php-slim4-server/model.mustache | 12 +--- .../php-slim4-server/model_interface.mustache | 28 +------- .../php-slim4-server/model_test.mustache | 40 ++---------- .../model_utils_trait.mustache | 28 +------- .../model_utils_trait_test.mustache | 28 +------- .../openapi_data_mocker.mustache | 28 +------- .../openapi_data_mocker_interface.mustache | 29 +-------- .../openapi_data_mocker_middleware.mustache | 28 +------- ...enapi_data_mocker_middleware_test.mustache | 28 +------- .../openapi_data_mocker_test.mustache | 28 +------- .../php-slim4-server/phpunit.xml.mustache | 8 --- .../string_utils_trait.mustache | 28 +------- .../string_utils_trait_test.mustache | 28 +------- samples/server/petstore/php-slim4/.gitignore | 1 + .../php-slim4/.openapi-generator/FILES | 54 ---------------- samples/server/petstore/php-slim4/README.md | 2 +- .../server/petstore/php-slim4/composer.json | 12 ++-- samples/server/petstore/php-slim4/index.php | 17 +++-- .../lib/Api/AbstractAnotherFakeApi.php | 9 +-- .../php-slim4/lib/Api/AbstractFakeApi.php | 9 +-- .../Api/AbstractFakeClassnameTags123Api.php | 9 +-- .../php-slim4/lib/Api/AbstractPetApi.php | 9 +-- .../php-slim4/lib/Api/AbstractStoreApi.php | 9 +-- .../php-slim4/lib/Api/AbstractUserApi.php | 9 +-- .../lib/Auth/AbstractAuthenticator.php | 7 +- .../lib/Interfaces/ModelInterface.php | 7 +- .../Middleware/JsonBodyParserMiddleware.php | 7 +- .../php-slim4/lib/Mock/OpenApiDataMocker.php | 7 +- .../lib/Mock/OpenApiDataMockerInterface.php | 8 +-- .../lib/Mock/OpenApiDataMockerMiddleware.php | 7 +- .../lib/Model/AdditionalPropertiesAnyType.php | 13 ++-- .../lib/Model/AdditionalPropertiesArray.php | 13 ++-- .../lib/Model/AdditionalPropertiesBoolean.php | 13 ++-- .../lib/Model/AdditionalPropertiesClass.php | 13 ++-- .../lib/Model/AdditionalPropertiesInteger.php | 13 ++-- .../lib/Model/AdditionalPropertiesNumber.php | 13 ++-- .../lib/Model/AdditionalPropertiesObject.php | 13 ++-- .../lib/Model/AdditionalPropertiesString.php | 13 ++-- .../petstore/php-slim4/lib/Model/Animal.php | 13 ++-- .../php-slim4/lib/Model/ApiResponse.php | 13 ++-- .../lib/Model/ArrayOfArrayOfNumberOnly.php | 13 ++-- .../php-slim4/lib/Model/ArrayOfNumberOnly.php | 13 ++-- .../php-slim4/lib/Model/ArrayTest.php | 13 ++-- .../petstore/php-slim4/lib/Model/BigCat.php | 13 ++-- .../php-slim4/lib/Model/BigCatAllOf.php | 13 ++-- .../php-slim4/lib/Model/Capitalization.php | 13 ++-- .../petstore/php-slim4/lib/Model/Cat.php | 13 ++-- .../petstore/php-slim4/lib/Model/CatAllOf.php | 13 ++-- .../petstore/php-slim4/lib/Model/Category.php | 13 ++-- .../php-slim4/lib/Model/ClassModel.php | 13 ++-- .../petstore/php-slim4/lib/Model/Client.php | 13 ++-- .../petstore/php-slim4/lib/Model/Dog.php | 13 ++-- .../petstore/php-slim4/lib/Model/DogAllOf.php | 13 ++-- .../php-slim4/lib/Model/EnumArrays.php | 13 ++-- .../php-slim4/lib/Model/EnumClass.php | 13 ++-- .../petstore/php-slim4/lib/Model/EnumTest.php | 13 ++-- .../petstore/php-slim4/lib/Model/File.php | 13 ++-- .../lib/Model/FileSchemaTestClass.php | 13 ++-- .../php-slim4/lib/Model/FormatTest.php | 13 ++-- .../php-slim4/lib/Model/HasOnlyReadOnly.php | 13 ++-- .../php-slim4/lib/Model/InlineObject.php | 63 ------------------ .../php-slim4/lib/Model/InlineObject1.php | 64 ------------------- .../petstore/php-slim4/lib/Model/MapTest.php | 13 ++-- ...PropertiesAndAdditionalPropertiesClass.php | 13 ++-- .../php-slim4/lib/Model/Model200Response.php | 13 ++-- .../php-slim4/lib/Model/ModelList.php | 13 ++-- .../php-slim4/lib/Model/ModelReturn.php | 13 ++-- .../petstore/php-slim4/lib/Model/Name.php | 13 ++-- .../php-slim4/lib/Model/NumberOnly.php | 13 ++-- .../petstore/php-slim4/lib/Model/Order.php | 13 ++-- .../php-slim4/lib/Model/OuterComposite.php | 13 ++-- .../php-slim4/lib/Model/OuterEnum.php | 13 ++-- .../petstore/php-slim4/lib/Model/Pet.php | 13 ++-- .../php-slim4/lib/Model/ReadOnlyFirst.php | 13 ++-- .../php-slim4/lib/Model/SpecialModelName.php | 13 ++-- .../petstore/php-slim4/lib/Model/Tag.php | 13 ++-- .../php-slim4/lib/Model/TypeHolderDefault.php | 13 ++-- .../php-slim4/lib/Model/TypeHolderExample.php | 13 ++-- .../petstore/php-slim4/lib/Model/User.php | 13 ++-- .../petstore/php-slim4/lib/Model/XmlItem.php | 13 ++-- .../petstore/php-slim4/lib/SlimRouter.php | 59 ++++++++--------- .../php-slim4/lib/Utils/ModelUtilsTrait.php | 7 +- .../php-slim4/lib/Utils/StringUtilsTrait.php | 7 +- .../petstore/php-slim4/phpunit.xml.dist | 8 --- .../php-slim4/test/Api/AnotherFakeApiTest.php | 17 ++--- .../php-slim4/test/Api/FakeApiTest.php | 17 ++--- .../test/Api/FakeClassnameTags123ApiTest.php | 17 ++--- .../php-slim4/test/Api/PetApiTest.php | 17 ++--- .../php-slim4/test/Api/StoreApiTest.php | 17 ++--- .../php-slim4/test/Api/UserApiTest.php | 17 ++--- .../Mock/OpenApiDataMockerMiddlewareTest.php | 7 +- .../test/Mock/OpenApiDataMockerTest.php | 7 +- .../Model/AdditionalPropertiesAnyTypeTest.php | 17 ++--- .../Model/AdditionalPropertiesArrayTest.php | 17 ++--- .../Model/AdditionalPropertiesBooleanTest.php | 17 ++--- .../Model/AdditionalPropertiesClassTest.php | 17 ++--- .../Model/AdditionalPropertiesIntegerTest.php | 17 ++--- .../Model/AdditionalPropertiesNumberTest.php | 17 ++--- .../Model/AdditionalPropertiesObjectTest.php | 17 ++--- .../Model/AdditionalPropertiesStringTest.php | 17 ++--- .../php-slim4/test/Model/AnimalTest.php | 17 ++--- .../php-slim4/test/Model/ApiResponseTest.php | 17 ++--- .../Model/ArrayOfArrayOfNumberOnlyTest.php | 17 ++--- .../test/Model/ArrayOfNumberOnlyTest.php | 17 ++--- .../php-slim4/test/Model/ArrayTestTest.php | 17 ++--- .../php-slim4/test/Model/BigCatAllOfTest.php | 17 ++--- .../php-slim4/test/Model/BigCatTest.php | 17 ++--- .../test/Model/CapitalizationTest.php | 17 ++--- .../php-slim4/test/Model/CatAllOfTest.php | 17 ++--- .../petstore/php-slim4/test/Model/CatTest.php | 17 ++--- .../php-slim4/test/Model/CategoryTest.php | 17 ++--- .../php-slim4/test/Model/ClassModelTest.php | 17 ++--- .../php-slim4/test/Model/ClientTest.php | 17 ++--- .../php-slim4/test/Model/DogAllOfTest.php | 17 ++--- .../petstore/php-slim4/test/Model/DogTest.php | 17 ++--- .../php-slim4/test/Model/EnumArraysTest.php | 17 ++--- .../php-slim4/test/Model/EnumClassTest.php | 17 ++--- .../php-slim4/test/Model/EnumTestTest.php | 17 ++--- .../test/Model/FileSchemaTestClassTest.php | 17 ++--- .../php-slim4/test/Model/FileTest.php | 17 ++--- .../php-slim4/test/Model/FormatTestTest.php | 17 ++--- .../test/Model/HasOnlyReadOnlyTest.php | 17 ++--- .../php-slim4/test/Model/MapTestTest.php | 17 ++--- ...ertiesAndAdditionalPropertiesClassTest.php | 17 ++--- .../test/Model/Model200ResponseTest.php | 17 ++--- .../php-slim4/test/Model/ModelListTest.php | 17 ++--- .../php-slim4/test/Model/ModelReturnTest.php | 17 ++--- .../php-slim4/test/Model/NameTest.php | 17 ++--- .../php-slim4/test/Model/NumberOnlyTest.php | 17 ++--- .../php-slim4/test/Model/OrderTest.php | 17 ++--- .../test/Model/OuterCompositeTest.php | 17 ++--- .../php-slim4/test/Model/OuterEnumTest.php | 17 ++--- .../petstore/php-slim4/test/Model/PetTest.php | 17 ++--- .../test/Model/ReadOnlyFirstTest.php | 17 ++--- .../test/Model/SpecialModelNameTest.php | 17 ++--- .../petstore/php-slim4/test/Model/TagTest.php | 17 ++--- .../test/Model/TypeHolderDefaultTest.php | 17 ++--- .../test/Model/TypeHolderExampleTest.php | 17 ++--- .../php-slim4/test/Model/UserTest.php | 17 ++--- .../php-slim4/test/Model/XmlItemTest.php | 17 ++--- .../test/Utils/ModelUtilsTraitTest.php | 7 +- .../test/Utils/StringUtilsTraitTest.php | 7 +- 153 files changed, 983 insertions(+), 1531 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache delete mode 100644 samples/server/petstore/php-slim4/lib/Model/InlineObject.php delete mode 100644 samples/server/petstore/php-slim4/lib/Model/InlineObject1.php diff --git a/.travis.yml b/.travis.yml index d8493d013f5..70b7f54a160 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,7 +85,7 @@ before_install: #- sudo apt-get update #- sudo apt-get install dart # switch to php7 - - phpenv global 7.1 + - phpenv global 7.3 - php -v # install perl module #- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache index 99317cce997..d96d2c46cb4 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/README.mustache @@ -13,13 +13,13 @@ This server has been generated with [Nyholm PSR-7](https://github.com/Nyholm/psr This server has been generated with [Guzzle PSR-7](https://github.com/guzzle/psr7) implementation and [Guzzle HTTP Factory](https://github.com/http-interop/http-factory-guzzle). {{/isGuzzlePsr7}} {{#isZendDiactoros}} -This server has been generated with [Zend Diactoros](https://github.com/zendframework/zend-diactoros). +This server has been generated with [Laminas (Zend) PSR-7 implementation](https://github.com/laminas/laminas-diactoros). {{/isZendDiactoros}} ## Requirements * Web server with URL rewriting -* PHP 7.1 or newer +* PHP 7.2 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache index 7b077c8dd76..68433fc3402 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/SlimRouter.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{invokerPackage}}; use Slim\Factory\AppFactory; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/abstract_authenticator.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/abstract_authenticator.mustache index 40e9aee2780..82fd8f648ea 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/abstract_authenticator.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/abstract_authenticator.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{authPackage}}; use Psr\Container\ContainerInterface; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/api.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/api.mustache index ff90a276a00..f2a4a686f53 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/api.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/api.mustache @@ -1,31 +1,6 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/api_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/api_test.mustache index eabddfa16cd..fb17fbe2f67 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/api_test.mustache @@ -1,37 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Please update the test case below to test the endpoint. - */ + */{{#operations}} namespace {{apiPackage}}; use PHPUnit\Framework\TestCase; @@ -52,28 +27,28 @@ class {{userClassname}}Test extends TestCase /** * Setup before running any test cases */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { } /** * Setup before running each test case */ - public function setUp() + public function setUp(): void { } /** * Clean up after running each test case */ - public function tearDown() + public function tearDown(): void { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { } {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache index 10b4ec4a10c..ad746666cb2 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/composer.mustache @@ -8,27 +8,27 @@ } ], "require": { - "php": "^7.1", - "slim/slim": "^4.0", + "php": "^7.2", + "slim/slim": "^4.5.0", "dyorg/slim-token-authentication": "dev-slim4", {{#isSlimPsr7}} - "slim/psr7": "^0.4.0" + "slim/psr7": "^1.1.0" {{/isSlimPsr7}} {{#isNyholmPsr7}} - "nyholm/psr7": "^1.1.0", - "nyholm/psr7-server": "^0.3.0" + "nyholm/psr7": "^1.3.0", + "nyholm/psr7-server": "^0.4.1" {{/isNyholmPsr7}} {{#isGuzzlePsr7}} "guzzlehttp/psr7": "^1.6.1", "http-interop/http-factory-guzzle": "^1.0.0" {{/isGuzzlePsr7}} {{#isZendDiactoros}} - "zendframework/zend-diactoros": "^2.1.3" + "laminas/laminas-diactoros": "^2.3.0" {{/isZendDiactoros}} }, "require-dev": { - "phpunit/phpunit": "^6.0 || ^7.0", - "overtrue/phplint": "^1.0", + "phpunit/phpunit": "^8.0 || ^9.0", + "overtrue/phplint": "^2.0.2", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { @@ -46,8 +46,6 @@ ], "test-apis": "phpunit --testsuite Apis", "test-models": "phpunit --testsuite Models", - "test-mock": "phpunit --testsuite Mock", - "test-utils": "phpunit --testsuite Utils", "phpcs": "phpcs", "phplint": "phplint ./ --exclude=vendor" } diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/gitignore b/modules/openapi-generator/src/main/resources/php-slim4-server/gitignore index 3203d7d7814..2424ad0dc92 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/gitignore +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/gitignore @@ -12,6 +12,7 @@ composer.lock # Do not commit local PHPUnit config /phpunit.xml +/.phpunit.result.cache # Do not commit local PHP_CodeSniffer config /phpcs.xml \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/index.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/index.mustache index cb98beb8f30..01c9049226d 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/index.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/index.mustache @@ -1,15 +1,11 @@ licenseInfo}} + +/** + * NOTE: This class is auto generated by the openapi generator program. + * https://github.com/openapitools/openapi-generator + */{{#apiInfo}} require_once __DIR__ . '/vendor/autoload.php'; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/json_body_parser_middleware.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/json_body_parser_middleware.mustache index 55ad7b637fd..509ec7247c9 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/json_body_parser_middleware.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/json_body_parser_middleware.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{invokerPackage}}\Middleware; use Psr\Http\Message\ResponseInterface; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache new file mode 100644 index 00000000000..cf26381b5f5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/licenseInfo.mustache @@ -0,0 +1,23 @@ +/** + {{#appName}} + * {{{appName}}} + {{/appName}} + * PHP version 7.2 + * + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://github.com/openapitools/openapi-generator + */ + +/** + {{#appDescription}} + * {{{appDescription}}} + {{/appDescription}} + {{#version}} + * The version of the OpenAPI document: {{{version}}} + {{/version}} + {{#infoEmail}} + * Contact: {{{infoEmail}}} + {{/infoEmail}} + * Generated by: https://github.com/openapitools/openapi-generator.git + */ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model.mustache index 67112c85227..e9ec40e4b6e 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model.mustache @@ -1,19 +1,11 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator - */ + */{{#models}}{{#model}} namespace {{modelPackage}}; use {{interfacesPackage}}\{{interfaceNamePrefix}}Model{{interfaceNameSuffix}}; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model_interface.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model_interface.mustache index eb440ee5598..07b75f7d558 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/model_interface.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model_interface.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{interfacesPackage}}; /** diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model_test.mustache index 1b762f228fd..7aa842baef3 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model_test.mustache @@ -1,39 +1,13 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Please update the test case below to test the model. - */ + */{{#models}} +{{#model}} namespace {{modelPackage}}; use PHPUnit\Framework\TestCase; @@ -54,28 +28,28 @@ class {{classname}}Test extends TestCase /** * Setup before running any test cases */ - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { } /** * Setup before running each test case */ - public function setUp() + public function setUp(): void { } /** * Clean up after running each test case */ - public function tearDown() + public function tearDown(): void { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { } diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache index 7f068fa1c77..2c29d3ae820 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{utilsPackage}}; use {{utilsPackage}}\{{traitNamePrefix}}StringUtils{{traitNameSuffix}}; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache index f3d365eba67..123d9cf648b 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/model_utils_trait_test.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{utilsPackage}}; use {{utilsPackage}}\{{traitNamePrefix}}ModelUtils{{traitNameSuffix}} as ModelUtils; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache index 5cb7ec947f4..a432434d924 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{mockPackage}}; use {{mockPackage}}\{{interfaceNamePrefix}}OpenApiDataMocker{{interfaceNameSuffix}} as IMocker; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache index eaa28ba2b42..72920c76812 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_interface.mustache @@ -1,37 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{mockPackage}}; use InvalidArgumentException; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware.mustache index c7c6192f768..d710ec6c24e 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{mockPackage}}; use Slim\Factory\AppFactory; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware_test.mustache index 2ea22728930..b341a98ed4c 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_middleware_test.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{mockPackage}}; use {{mockPackage}}\OpenApiDataMockerMiddleware; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache index e02fa3ed3c9..51e50bc16f2 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/openapi_data_mocker_test.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{mockPackage}}; use {{mockPackage}}\OpenApiDataMocker; diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache index 82f86439083..b8852944a12 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/phpunit.xml.mustache @@ -17,19 +17,11 @@ {{modelTestPath}} - - {{mockTestPath}} - - - {{utilsTestPath}} - {{apiSrcPath}} {{modelSrcPath}} - {{mockSrcPath}} - {{utilsSrcPath}} diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache index 6d5d15feff6..f303bd7cc95 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{utilsPackage}}; /** diff --git a/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache index 9698d6bcf6c..d54c6bbee38 100644 --- a/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim4-server/string_utils_trait_test.mustache @@ -1,36 +1,12 @@ licenseInfo}} /** * NOTE: This class is auto generated by the openapi generator program. * https://github.com/openapitools/openapi-generator * Do not edit the class manually. - */ + */{{#apiInfo}} namespace {{utilsPackage}}; use {{utilsPackage}}\{{traitNamePrefix}}StringUtils{{traitNameSuffix}} as StringUtils; diff --git a/samples/server/petstore/php-slim4/.gitignore b/samples/server/petstore/php-slim4/.gitignore index 3203d7d7814..2424ad0dc92 100644 --- a/samples/server/petstore/php-slim4/.gitignore +++ b/samples/server/petstore/php-slim4/.gitignore @@ -12,6 +12,7 @@ composer.lock # Do not commit local PHPUnit config /phpunit.xml +/.phpunit.result.cache # Do not commit local PHP_CodeSniffer config /phpcs.xml \ No newline at end of file diff --git a/samples/server/petstore/php-slim4/.openapi-generator/FILES b/samples/server/petstore/php-slim4/.openapi-generator/FILES index 08d44362bcf..ba22c031220 100644 --- a/samples/server/petstore/php-slim4/.openapi-generator/FILES +++ b/samples/server/petstore/php-slim4/.openapi-generator/FILES @@ -81,61 +81,7 @@ lib/Utils/ModelUtilsTrait.php lib/Utils/StringUtilsTrait.php phpcs.xml.dist phpunit.xml.dist -test/Api/AnotherFakeApiTest.php -test/Api/FakeApiTest.php -test/Api/FakeClassnameTags123ApiTest.php -test/Api/PetApiTest.php -test/Api/StoreApiTest.php -test/Api/UserApiTest.php test/Mock/OpenApiDataMockerMiddlewareTest.php test/Mock/OpenApiDataMockerTest.php -test/Model/AdditionalPropertiesAnyTypeTest.php -test/Model/AdditionalPropertiesArrayTest.php -test/Model/AdditionalPropertiesBooleanTest.php -test/Model/AdditionalPropertiesClassTest.php -test/Model/AdditionalPropertiesIntegerTest.php -test/Model/AdditionalPropertiesNumberTest.php -test/Model/AdditionalPropertiesObjectTest.php -test/Model/AdditionalPropertiesStringTest.php -test/Model/AnimalTest.php -test/Model/ApiResponseTest.php -test/Model/ArrayOfArrayOfNumberOnlyTest.php -test/Model/ArrayOfNumberOnlyTest.php -test/Model/ArrayTestTest.php -test/Model/BigCatAllOfTest.php -test/Model/BigCatTest.php -test/Model/CapitalizationTest.php -test/Model/CatAllOfTest.php -test/Model/CatTest.php -test/Model/CategoryTest.php -test/Model/ClassModelTest.php -test/Model/ClientTest.php -test/Model/DogAllOfTest.php -test/Model/DogTest.php -test/Model/EnumArraysTest.php -test/Model/EnumClassTest.php -test/Model/EnumTestTest.php -test/Model/FileSchemaTestClassTest.php -test/Model/FileTest.php -test/Model/FormatTestTest.php -test/Model/HasOnlyReadOnlyTest.php -test/Model/MapTestTest.php -test/Model/MixedPropertiesAndAdditionalPropertiesClassTest.php -test/Model/Model200ResponseTest.php -test/Model/ModelListTest.php -test/Model/ModelReturnTest.php -test/Model/NameTest.php -test/Model/NumberOnlyTest.php -test/Model/OrderTest.php -test/Model/OuterCompositeTest.php -test/Model/OuterEnumTest.php -test/Model/PetTest.php -test/Model/ReadOnlyFirstTest.php -test/Model/SpecialModelNameTest.php -test/Model/TagTest.php -test/Model/TypeHolderDefaultTest.php -test/Model/TypeHolderExampleTest.php -test/Model/UserTest.php -test/Model/XmlItemTest.php test/Utils/ModelUtilsTraitTest.php test/Utils/StringUtilsTraitTest.php diff --git a/samples/server/petstore/php-slim4/README.md b/samples/server/petstore/php-slim4/README.md index 325111aa624..7c550d25424 100644 --- a/samples/server/petstore/php-slim4/README.md +++ b/samples/server/petstore/php-slim4/README.md @@ -8,7 +8,7 @@ This server has been generated with [Slim PSR-7](https://github.com/slimphp/Slim ## Requirements * Web server with URL rewriting -* PHP 7.1 or newer +* PHP 7.2 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. diff --git a/samples/server/petstore/php-slim4/composer.json b/samples/server/petstore/php-slim4/composer.json index c1afb518ef1..0bc4d34e177 100644 --- a/samples/server/petstore/php-slim4/composer.json +++ b/samples/server/petstore/php-slim4/composer.json @@ -8,14 +8,14 @@ } ], "require": { - "php": "^7.1", - "slim/slim": "^4.0", + "php": "^7.2", + "slim/slim": "^4.5.0", "dyorg/slim-token-authentication": "dev-slim4", - "slim/psr7": "^0.4.0" + "slim/psr7": "^1.1.0" }, "require-dev": { - "phpunit/phpunit": "^6.0 || ^7.0", - "overtrue/phplint": "^1.0", + "phpunit/phpunit": "^8.0 || ^9.0", + "overtrue/phplint": "^2.0.2", "squizlabs/php_codesniffer": "^3.5" }, "autoload": { @@ -33,8 +33,6 @@ ], "test-apis": "phpunit --testsuite Apis", "test-models": "phpunit --testsuite Models", - "test-mock": "phpunit --testsuite Mock", - "test-utils": "phpunit --testsuite Utils", "phpcs": "phpcs", "phplint": "phplint ./ --exclude=vendor" } diff --git a/samples/server/petstore/php-slim4/index.php b/samples/server/petstore/php-slim4/index.php index 8baabc9b139..ffeb1b88200 100644 --- a/samples/server/petstore/php-slim4/index.php +++ b/samples/server/petstore/php-slim4/index.php @@ -2,15 +2,24 @@ /** * OpenAPI Petstore + * PHP version 7.2 * - * PHP version 7.1 - * - * @package OpenAPIServer\Api + * @package OpenAPIServer * @author OpenAPI Generator team - * @version 1.0.0 * @link https://github.com/openapitools/openapi-generator */ +/** + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +/** + * NOTE: This class is auto generated by the openapi generator program. + * https://github.com/openapitools/openapi-generator + */ + require_once __DIR__ . '/vendor/autoload.php'; use OpenAPIServer\SlimRouter; diff --git a/samples/server/petstore/php-slim4/lib/Api/AbstractAnotherFakeApi.php b/samples/server/petstore/php-slim4/lib/Api/AbstractAnotherFakeApi.php index 14cf312d692..64347eabd0b 100644 --- a/samples/server/petstore/php-slim4/lib/Api/AbstractAnotherFakeApi.php +++ b/samples/server/petstore/php-slim4/lib/Api/AbstractAnotherFakeApi.php @@ -1,18 +1,15 @@ 'AnotherFakeApi', 'operationId' => 'call123TestSpecialTags', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -89,7 +86,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'createXmlItem', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -110,7 +107,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterBooleanSerialize', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Output boolean', 'jsonSchema' => '{ @@ -137,7 +134,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterCompositeSerialize', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Output composite', 'jsonSchema' => '{ @@ -164,7 +161,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterNumberSerialize', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Output number', 'jsonSchema' => '{ @@ -191,7 +188,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'fakeOuterStringSerialize', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Output string', 'jsonSchema' => '{ @@ -218,7 +215,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'testBodyWithFileSchema', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Success', 'jsonSchema' => '{ @@ -239,7 +236,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'testBodyWithQueryParams', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Success', 'jsonSchema' => '{ @@ -260,7 +257,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'testClientModel', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -374,7 +371,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'testInlineAdditionalProperties', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -395,7 +392,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'testJsonFormData', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -416,7 +413,7 @@ class SlimRouter 'userClassname' => 'FakeApi', 'operationId' => 'testQueryParameterCollectionFormat', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'Success', 'jsonSchema' => '{ @@ -437,7 +434,7 @@ class SlimRouter 'userClassname' => 'FakeClassnameTags123Api', 'operationId' => 'testClassname', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -476,7 +473,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'addPet', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -517,7 +514,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'findPetsByStatus', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -575,7 +572,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'findPetsByTags', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -635,7 +632,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'updatePet', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -692,7 +689,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'deletePet', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -733,7 +730,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'getPetById', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -826,7 +823,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'uploadFile', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -865,7 +862,7 @@ class SlimRouter 'userClassname' => 'PetApi', 'operationId' => 'uploadFileWithRequiredFile', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -904,7 +901,7 @@ class SlimRouter 'userClassname' => 'StoreApi', 'operationId' => 'getInventory', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -947,7 +944,7 @@ class SlimRouter 'userClassname' => 'StoreApi', 'operationId' => 'placeOrder', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -1016,7 +1013,7 @@ class SlimRouter 'userClassname' => 'StoreApi', 'operationId' => 'getOrderById', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -1127,7 +1124,7 @@ class SlimRouter 'userClassname' => 'UserApi', 'operationId' => 'loginUser', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ @@ -1233,7 +1230,7 @@ class SlimRouter 'userClassname' => 'UserApi', 'operationId' => 'getUserByName', 'responses' => [ - 'default' => [ + '200' => [ 'code' => 200, 'message' => 'successful operation', 'jsonSchema' => '{ diff --git a/samples/server/petstore/php-slim4/lib/Utils/ModelUtilsTrait.php b/samples/server/petstore/php-slim4/lib/Utils/ModelUtilsTrait.php index 97bb2ae884a..5eb771b9484 100644 --- a/samples/server/petstore/php-slim4/lib/Utils/ModelUtilsTrait.php +++ b/samples/server/petstore/php-slim4/lib/Utils/ModelUtilsTrait.php @@ -1,9 +1,8 @@ ./test/Model - - ./test/Mock - - - ./test/Utils - ./lib/Api ./lib/Model - ./lib/Mock - ./lib/Utils diff --git a/samples/server/petstore/php-slim4/test/Api/AnotherFakeApiTest.php b/samples/server/petstore/php-slim4/test/Api/AnotherFakeApiTest.php index 25bca78aa0f..14b6cf86da4 100644 --- a/samples/server/petstore/php-slim4/test/Api/AnotherFakeApiTest.php +++ b/samples/server/petstore/php-slim4/test/Api/AnotherFakeApiTest.php @@ -1,18 +1,15 @@