diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache index 4f701ed1926..e7b73f219bf 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache @@ -7,4 +7,16 @@ is an example of building a PHP Slim server. This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here: -[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/slim/) +[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/php-slim-server/) + +{{#authMethods}} +{{^hasMore}} +## Authentication +{{/hasMore}} +{{/authMethods}} +{{#authMethods}} +{{#isBasic}} +> Important! To make Basic Authentication work you need to implement `authenticator` function in [SlimRouter]({{srcBasePath}}/SlimRouter.php) class. +> Documentation [tuupola/slim-basic-auth](https://github.com/tuupola/slim-basic-auth) +{{/isBasic}} +{{/authMethods}} diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache index 7636cab3e01..11eb61d5ac8 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache @@ -39,6 +39,7 @@ use {{apiPackage}}\{{classname}}; use Slim\App; use Psr\Container\ContainerInterface; use InvalidArgumentException; +use Tuupola\Middleware\HttpBasicAuthentication; /** * SlimRouter Class Doc Comment @@ -66,10 +67,29 @@ class SlimRouter { public function __construct($container = []) { $app = new App($container); + $basicAuth = new HttpBasicAuthentication([ + "secure" => false, + "authenticator" => function ($arguments) { + $user = $arguments["user"]; + $password = $arguments["password"]; + return false; + } + ]); + {{#apis}} {{#operations}} {{#operation}} - $app->{{httpMethod}}('{{{basePathWithoutHost}}}{{{path}}}', {{classname}}::class . ':{{operationId}}'); + $app->{{httpMethod}}( + '{{{basePathWithoutHost}}}{{{path}}}', {{classname}}::class . ':{{operationId}}' +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} + )->add( + $basicAuth +{{/isBasic}} +{{/authMethods}} +{{/hasAuthMethods}} + ); {{/operation}} {{/operations}} {{/apis}} diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache index e3e22cf1485..a27e79ec42f 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache @@ -2,7 +2,8 @@ "minimum-stability": "RC", "require": { "php": ">=5.5", - "slim/slim": "3.*" + "slim/slim": "3.*", + "tuupola/slim-basic-auth": "^3.0.0" }, "require-dev": { "phpunit/phpunit": "^4.8" diff --git a/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION b/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION index dde25ef08e8..0f58aa04141 100644 --- a/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION +++ b/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.1-SNAPSHOT \ No newline at end of file +3.1.2-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore-security-test/php-slim/README.md b/samples/server/petstore-security-test/php-slim/README.md index 4f701ed1926..8a2df551ce7 100644 --- a/samples/server/petstore-security-test/php-slim/README.md +++ b/samples/server/petstore-security-test/php-slim/README.md @@ -7,4 +7,6 @@ is an example of building a PHP Slim server. This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here: -[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/slim/) +[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/php-slim-server/) + +## Authentication diff --git a/samples/server/petstore-security-test/php-slim/composer.json b/samples/server/petstore-security-test/php-slim/composer.json index 7509c8ea95a..ca199179020 100644 --- a/samples/server/petstore-security-test/php-slim/composer.json +++ b/samples/server/petstore-security-test/php-slim/composer.json @@ -2,7 +2,8 @@ "minimum-stability": "RC", "require": { "php": ">=5.5", - "slim/slim": "3.*" + "slim/slim": "3.*", + "tuupola/slim-basic-auth": "^3.0.0" }, "require-dev": { "phpunit/phpunit": "^4.8" diff --git a/samples/server/petstore-security-test/php-slim/index.php b/samples/server/petstore-security-test/php-slim/index.php index 434e9dd8015..9cc64c94863 100644 --- a/samples/server/petstore-security-test/php-slim/index.php +++ b/samples/server/petstore-security-test/php-slim/index.php @@ -1,7 +1,7 @@ PUT('/ ' \" =end -- \\r\\n \\n \\r/v2 ' \" =end -- \\r\\n \\n \\r/fake', FakeApi::class . ':testCodeInjectEndRnNR'); + $basicAuth = new HttpBasicAuthentication([ + "secure" => false, + "authenticator" => function ($arguments) { + $user = $arguments["user"]; + $password = $arguments["password"]; + return false; + } + ]); + + $app->PUT( + '/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r/fake', FakeApi::class . ':testCodeInjectEndRnNR' + ); $this->slimApp = $app; } diff --git a/samples/server/petstore-security-test/php-slim/phpunit.xml.dist b/samples/server/petstore-security-test/php-slim/phpunit.xml.dist index a9fd1a3ad4f..93af3ee9b13 100644 --- a/samples/server/petstore-security-test/php-slim/phpunit.xml.dist +++ b/samples/server/petstore-security-test/php-slim/phpunit.xml.dist @@ -11,16 +11,16 @@ > - .\test\Api + ./test/Api - .\test\Model + ./test/Model - .\lib\Api - .\lib\Model + ./lib//Api + ./lib//Model \ No newline at end of file diff --git a/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php b/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php index 8a920bba2f3..3205216ec96 100644 --- a/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php +++ b/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php @@ -10,11 +10,11 @@ */ /** - * OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r + * OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end -- - * OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r - * Contact: something@something.abc ' \" =end -- \\r\\n \\n \\r + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/openapitools/openapi-generator.git */ @@ -70,7 +70,7 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { /** * Test case for testCodeInjectEndRnNR * - * To test code injection ' \" =end -- \\r\\n \\n \\r. + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r. * @covers ::testCodeInjectEndRnNR */ public function testTestCodeInjectEndRnNR() { diff --git a/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php b/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php index 87f2cf6abf4..d535c902fc2 100644 --- a/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php +++ b/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php @@ -10,11 +10,11 @@ */ /** - * OpenAPI Petstore ' \" =end -- \\r\\n \\n \\r + * OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ ' \" =end -- - * OpenAPI spec version: 1.0.0 ' \" =end -- \\r\\n \\n \\r - * Contact: something@something.abc ' \" =end -- \\r\\n \\n \\r + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- + * OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r + * Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r * Generated by: https://github.com/openapitools/openapi-generator.git */ @@ -31,7 +31,7 @@ use OpenAPIServer\Model\ModelReturn; * ModelReturnTest Class Doc Comment * * @category Class - * @description Model for testing reserved words ' \" =end -- \\r\\n \\n \\r + * @description Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r * @package OpenAPIServer\Model * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator diff --git a/samples/server/petstore/php-slim/README.md b/samples/server/petstore/php-slim/README.md index 4f701ed1926..9847411dd75 100644 --- a/samples/server/petstore/php-slim/README.md +++ b/samples/server/petstore/php-slim/README.md @@ -7,4 +7,8 @@ is an example of building a PHP Slim server. This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here: -[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/slim/) +[TEMPLATES](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/php-slim-server/) + +## Authentication +> Important! To make Basic Authentication work you need to implement `authenticator` function in [SlimRouter](lib/SlimRouter.php) class. +> Documentation [tuupola/slim-basic-auth](https://github.com/tuupola/slim-basic-auth) diff --git a/samples/server/petstore/php-slim/composer.json b/samples/server/petstore/php-slim/composer.json index 7509c8ea95a..ca199179020 100644 --- a/samples/server/petstore/php-slim/composer.json +++ b/samples/server/petstore/php-slim/composer.json @@ -2,7 +2,8 @@ "minimum-stability": "RC", "require": { "php": ">=5.5", - "slim/slim": "3.*" + "slim/slim": "3.*", + "tuupola/slim-basic-auth": "^3.0.0" }, "require-dev": { "phpunit/phpunit": "^4.8" diff --git a/samples/server/petstore/php-slim/composer.lock b/samples/server/petstore/php-slim/composer.lock index 24e93daec4d..75bac6e27ba 100644 --- a/samples/server/petstore/php-slim/composer.lock +++ b/samples/server/petstore/php-slim/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "dd09324f4c42e91ef9a7865e277effe6", + "content-hash": "7abeaa62669cac171aa0692df2e1943b", "packages": [ { "name": "container-interop/container-interop", @@ -37,6 +37,58 @@ "homepage": "https://github.com/container-interop/container-interop", "time": "2017-02-14T19:40:03+00:00" }, + { + "name": "http-interop/http-factory", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/http-interop/http-factory.git", + "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/http-interop/http-factory/zipball/c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", + "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Interop\\Http\\Factory\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "time": "2017-03-24T14:48:51+00:00" + }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -232,6 +284,112 @@ ], "time": "2016-08-06T14:39:51+00:00" }, + { + "name": "psr/http-server-handler", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "439d92054dc06097f2406ec074a2627839955a02" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/439d92054dc06097f2406ec074a2627839955a02", + "reference": "439d92054dc06097f2406ec074a2627839955a02", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side request handler", + "keywords": [ + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" + ], + "time": "2018-01-22T17:04:15+00:00" + }, + { + "name": "psr/http-server-middleware", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "ea17eb1fb2c8df6db919cc578451a8013c6a0ae5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/ea17eb1fb2c8df6db919cc578451a8013c6a0ae5", + "reference": "ea17eb1fb2c8df6db919cc578451a8013c6a0ae5", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0", + "psr/http-server-handler": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" + ], + "time": "2018-01-22T17:08:31+00:00" + }, { "name": "slim/slim", "version": "3.10.0", @@ -302,6 +460,167 @@ "router" ], "time": "2018-04-19T19:29:08+00:00" + }, + { + "name": "tuupola/callable-handler", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/tuupola/callable-handler.git", + "reference": "5141efa1e974687a3fa53338811a988198f50662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tuupola/callable-handler/zipball/5141efa1e974687a3fa53338811a988198f50662", + "reference": "5141efa1e974687a3fa53338811a988198f50662", + "shasum": "" + }, + "require": { + "php": "^7.0", + "psr/http-server-middleware": "^1.0" + }, + "require-dev": { + "codedungeon/phpunit-result-printer": "^0.4.4", + "overtrue/phplint": "^1.0", + "phpunit/phpunit": "^6.5", + "squizlabs/php_codesniffer": "^3.2", + "tuupola/http-factory": "^0.3.0", + "zendframework/zend-diactoros": "^1.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Tuupola\\Middleware\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mika Tuupola", + "email": "tuupola@appelsiini.net", + "homepage": "https://appelsiini.net/", + "role": "Developer" + } + ], + "description": "Compatibility layer for PSR-7 double pass and PSR-15 middlewares.", + "homepage": "https://github.com/tuupola/callable-handler", + "keywords": [ + "middleware", + "psr-15", + "psr-7" + ], + "time": "2018-01-23T04:07:25+00:00" + }, + { + "name": "tuupola/http-factory", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/tuupola/http-factory.git", + "reference": "57b2e19ff3f4af0bbee4e31fd282689be351f1ad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tuupola/http-factory/zipball/57b2e19ff3f4af0bbee4e31fd282689be351f1ad", + "reference": "57b2e19ff3f4af0bbee4e31fd282689be351f1ad", + "shasum": "" + }, + "require": { + "http-interop/http-factory": "^0.3.0" + }, + "require-dev": { + "http-interop/http-factory-tests": "^0.3.0", + "overtrue/phplint": "^0.2.1", + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Tuupola\\Http\\Factory\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mika Tuupola", + "email": "tuupola@appelsiini.net", + "homepage": "http://www.appelsiini.net/", + "role": "Developer" + } + ], + "description": "Lightweight autodiscovering PSR-17 HTTP factories", + "homepage": "https://github.com/tuupola/http-factory", + "keywords": [ + "http", + "psr-17", + "psr-7" + ], + "time": "2017-07-15T22:03:15+00:00" + }, + { + "name": "tuupola/slim-basic-auth", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/tuupola/slim-basic-auth.git", + "reference": "b169fba3113059548e3a2ac4096b1b08616b070e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tuupola/slim-basic-auth/zipball/b169fba3113059548e3a2ac4096b1b08616b070e", + "reference": "b169fba3113059548e3a2ac4096b1b08616b070e", + "shasum": "" + }, + "require": { + "http-interop/http-factory": "^0.3.0", + "php": "^7.1", + "psr/http-message": "^1.0", + "psr/http-server-middleware": "^1.0", + "tuupola/callable-handler": "^0.3.0", + "tuupola/http-factory": "^0.3.0" + }, + "require-dev": { + "codedungeon/phpunit-result-printer": "^0.6.0", + "equip/dispatch": "^2.0", + "overtrue/phplint": "^0.2.4", + "phpstan/phpstan": "^0.9.2", + "phpunit/phpunit": "^7.0", + "squizlabs/php_codesniffer": "^3.2", + "zendframework/zend-diactoros": "^1.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Tuupola\\Middleware\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mika Tuupola", + "email": "tuupola@appelsiini.net", + "homepage": "https://appelsiini.net/" + } + ], + "description": "PSR-7 and PSR-15 HTTP Basic Authentication Middleware", + "homepage": "https://appelsiini.net/projects/slim-basic-auth", + "keywords": [ + "auth", + "middleware", + "psr-15", + "psr-7" + ], + "time": "2018-05-06T05:41:44+00:00" } ], "packages-dev": [ @@ -1379,7 +1698,7 @@ }, { "name": "symfony/yaml", - "version": "v3.4.12", + "version": "v3.4.13", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/samples/server/petstore/php-slim/lib/SlimRouter.php b/samples/server/petstore/php-slim/lib/SlimRouter.php index af592d76565..bd624e4da04 100644 --- a/samples/server/petstore/php-slim/lib/SlimRouter.php +++ b/samples/server/petstore/php-slim/lib/SlimRouter.php @@ -34,6 +34,7 @@ use OpenAPIServer\Api\UserApi; use Slim\App; use Psr\Container\ContainerInterface; use InvalidArgumentException; +use Tuupola\Middleware\HttpBasicAuthentication; /** * SlimRouter Class Doc Comment @@ -61,40 +62,119 @@ class SlimRouter { public function __construct($container = []) { $app = new App($container); - $app->PATCH('/v2/another-fake/dummy', AnotherFakeApi::class . ':testSpecialTags'); - $app->POST('/v2/fake/outer/boolean', FakeApi::class . ':fakeOuterBooleanSerialize'); - $app->POST('/v2/fake/outer/composite', FakeApi::class . ':fakeOuterCompositeSerialize'); - $app->POST('/v2/fake/outer/number', FakeApi::class . ':fakeOuterNumberSerialize'); - $app->POST('/v2/fake/outer/string', FakeApi::class . ':fakeOuterStringSerialize'); - $app->PUT('/v2/fake/body-with-file-schema', FakeApi::class . ':testBodyWithFileSchema'); - $app->PUT('/v2/fake/body-with-query-params', FakeApi::class . ':testBodyWithQueryParams'); - $app->PATCH('/v2/fake', FakeApi::class . ':testClientModel'); - $app->POST('/v2/fake', FakeApi::class . ':testEndpointParameters'); - $app->GET('/v2/fake', FakeApi::class . ':testEnumParameters'); - $app->POST('/v2/fake/inline-additionalProperties', FakeApi::class . ':testInlineAdditionalProperties'); - $app->GET('/v2/fake/jsonFormData', FakeApi::class . ':testJsonFormData'); - $app->PATCH('/v2/fake_classname_test', FakeClassnameTags123Api::class . ':testClassname'); - $app->POST('/v2/pet', PetApi::class . ':addPet'); - $app->GET('/v2/pet/findByStatus', PetApi::class . ':findPetsByStatus'); - $app->GET('/v2/pet/findByTags', PetApi::class . ':findPetsByTags'); - $app->PUT('/v2/pet', PetApi::class . ':updatePet'); - $app->DELETE('/v2/pet/{petId}', PetApi::class . ':deletePet'); - $app->GET('/v2/pet/{petId}', PetApi::class . ':getPetById'); - $app->POST('/v2/pet/{petId}', PetApi::class . ':updatePetWithForm'); - $app->POST('/v2/pet/{petId}/uploadImage', PetApi::class . ':uploadFile'); - $app->POST('/v2/fake/{petId}/uploadImageWithRequiredFile', PetApi::class . ':uploadFileWithRequiredFile'); - $app->GET('/v2/store/inventory', StoreApi::class . ':getInventory'); - $app->POST('/v2/store/order', StoreApi::class . ':placeOrder'); - $app->DELETE('/v2/store/order/{order_id}', StoreApi::class . ':deleteOrder'); - $app->GET('/v2/store/order/{order_id}', StoreApi::class . ':getOrderById'); - $app->POST('/v2/user', UserApi::class . ':createUser'); - $app->POST('/v2/user/createWithArray', UserApi::class . ':createUsersWithArrayInput'); - $app->POST('/v2/user/createWithList', UserApi::class . ':createUsersWithListInput'); - $app->GET('/v2/user/login', UserApi::class . ':loginUser'); - $app->GET('/v2/user/logout', UserApi::class . ':logoutUser'); - $app->DELETE('/v2/user/{username}', UserApi::class . ':deleteUser'); - $app->GET('/v2/user/{username}', UserApi::class . ':getUserByName'); - $app->PUT('/v2/user/{username}', UserApi::class . ':updateUser'); + $basicAuth = new HttpBasicAuthentication([ + "secure" => false, + "authenticator" => function ($arguments) { + $user = $arguments["user"]; + $password = $arguments["password"]; + return false; + } + ]); + + $app->PATCH( + '/v2/another-fake/dummy', AnotherFakeApi::class . ':testSpecialTags' + ); + $app->POST( + '/v2/fake/outer/boolean', FakeApi::class . ':fakeOuterBooleanSerialize' + ); + $app->POST( + '/v2/fake/outer/composite', FakeApi::class . ':fakeOuterCompositeSerialize' + ); + $app->POST( + '/v2/fake/outer/number', FakeApi::class . ':fakeOuterNumberSerialize' + ); + $app->POST( + '/v2/fake/outer/string', FakeApi::class . ':fakeOuterStringSerialize' + ); + $app->PUT( + '/v2/fake/body-with-file-schema', FakeApi::class . ':testBodyWithFileSchema' + ); + $app->PUT( + '/v2/fake/body-with-query-params', FakeApi::class . ':testBodyWithQueryParams' + ); + $app->PATCH( + '/v2/fake', FakeApi::class . ':testClientModel' + ); + $app->POST( + '/v2/fake', FakeApi::class . ':testEndpointParameters' + )->add( + $basicAuth + ); + $app->GET( + '/v2/fake', FakeApi::class . ':testEnumParameters' + ); + $app->POST( + '/v2/fake/inline-additionalProperties', FakeApi::class . ':testInlineAdditionalProperties' + ); + $app->GET( + '/v2/fake/jsonFormData', FakeApi::class . ':testJsonFormData' + ); + $app->PATCH( + '/v2/fake_classname_test', FakeClassnameTags123Api::class . ':testClassname' + ); + $app->POST( + '/v2/pet', PetApi::class . ':addPet' + ); + $app->GET( + '/v2/pet/findByStatus', PetApi::class . ':findPetsByStatus' + ); + $app->GET( + '/v2/pet/findByTags', PetApi::class . ':findPetsByTags' + ); + $app->PUT( + '/v2/pet', PetApi::class . ':updatePet' + ); + $app->DELETE( + '/v2/pet/{petId}', PetApi::class . ':deletePet' + ); + $app->GET( + '/v2/pet/{petId}', PetApi::class . ':getPetById' + ); + $app->POST( + '/v2/pet/{petId}', PetApi::class . ':updatePetWithForm' + ); + $app->POST( + '/v2/pet/{petId}/uploadImage', PetApi::class . ':uploadFile' + ); + $app->POST( + '/v2/fake/{petId}/uploadImageWithRequiredFile', PetApi::class . ':uploadFileWithRequiredFile' + ); + $app->GET( + '/v2/store/inventory', StoreApi::class . ':getInventory' + ); + $app->POST( + '/v2/store/order', StoreApi::class . ':placeOrder' + ); + $app->DELETE( + '/v2/store/order/{order_id}', StoreApi::class . ':deleteOrder' + ); + $app->GET( + '/v2/store/order/{order_id}', StoreApi::class . ':getOrderById' + ); + $app->POST( + '/v2/user', UserApi::class . ':createUser' + ); + $app->POST( + '/v2/user/createWithArray', UserApi::class . ':createUsersWithArrayInput' + ); + $app->POST( + '/v2/user/createWithList', UserApi::class . ':createUsersWithListInput' + ); + $app->GET( + '/v2/user/login', UserApi::class . ':loginUser' + ); + $app->GET( + '/v2/user/logout', UserApi::class . ':logoutUser' + ); + $app->DELETE( + '/v2/user/{username}', UserApi::class . ':deleteUser' + ); + $app->GET( + '/v2/user/{username}', UserApi::class . ':getUserByName' + ); + $app->PUT( + '/v2/user/{username}', UserApi::class . ':updateUser' + ); $this->slimApp = $app; } diff --git a/samples/server/petstore/php-slim/phpunit.xml.dist b/samples/server/petstore/php-slim/phpunit.xml.dist index 4a44f5ac146..93af3ee9b13 100644 --- a/samples/server/petstore/php-slim/phpunit.xml.dist +++ b/samples/server/petstore/php-slim/phpunit.xml.dist @@ -19,8 +19,8 @@ - ./lib/Api - ./lib/Model + ./lib//Api + ./lib//Model \ No newline at end of file diff --git a/samples/server/petstore/php-slim/test/Api/FakeApiTest.php b/samples/server/petstore/php-slim/test/Api/FakeApiTest.php index 8c1dee7833b..f020953e05b 100644 --- a/samples/server/petstore/php-slim/test/Api/FakeApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/FakeApiTest.php @@ -139,7 +139,7 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { /** * Test case for testEndpointParameters * - * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 . + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트. * @covers ::testEndpointParameters */ public function testTestEndpointParameters() {