mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-10-14 08:23:45 +00:00
Test PHP clients in Github workflow (#21643)
* test php clients in github workflow * trigger build failure * update workflow * Revert "trigger build failure" This reverts commit 572a69f6bcbab426103c77de55c069bd74b5e7fb. * update tests * update tests * update test * fix tests * fix async test * update tests
This commit is contained in:
parent
a60d3d4f81
commit
3453c7ba10
45
.github/workflows/samples-php-client.yaml
vendored
Normal file
45
.github/workflows/samples-php-client.yaml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
name: Samples PHP clients
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- samples/client/petstore/php/OpenAPIClient-php/**
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- samples/client/petstore/php/OpenAPIClient-php/**
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build PHP projects
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
php:
|
||||||
|
- "8.1"
|
||||||
|
- "8.2"
|
||||||
|
- "8.3"
|
||||||
|
- "8.4"
|
||||||
|
sample:
|
||||||
|
# clients
|
||||||
|
- samples/client/petstore/php/OpenAPIClient-php/
|
||||||
|
services:
|
||||||
|
petstore-api:
|
||||||
|
image: swaggerapi/petstore
|
||||||
|
ports:
|
||||||
|
- 80:8080
|
||||||
|
env:
|
||||||
|
SWAGGER_HOST: http://petstore.swagger.io
|
||||||
|
SWAGGER_BASE_PATH: /v2
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup PHP with tools
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: "${{ matrix.php }}"
|
||||||
|
tools: php-cs-fixer, phpunit
|
||||||
|
- name: composer install
|
||||||
|
working-directory: ${{ matrix.sample }}
|
||||||
|
run: composer install
|
||||||
|
- name: phpunit
|
||||||
|
working-directory: ${{ matrix.sample }}
|
||||||
|
run: vendor/bin/phpunit tests
|
@ -31,6 +31,7 @@ paths:
|
|||||||
$ref: '#/components/schemas/Foo'
|
$ref: '#/components/schemas/Foo'
|
||||||
/pet:
|
/pet:
|
||||||
servers:
|
servers:
|
||||||
|
- url: 'http://localhost/v2'
|
||||||
- url: 'http://petstore.swagger.io/v2'
|
- url: 'http://petstore.swagger.io/v2'
|
||||||
- url: 'http://path-server-test.petstore.local/v2'
|
- url: 'http://path-server-test.petstore.local/v2'
|
||||||
- url: 'http://{server}.swagger.io:{port}/v2'
|
- url: 'http://{server}.swagger.io:{port}/v2'
|
||||||
|
@ -31,6 +31,7 @@ paths:
|
|||||||
$ref: '#/components/schemas/Foo'
|
$ref: '#/components/schemas/Foo'
|
||||||
/pet:
|
/pet:
|
||||||
servers:
|
servers:
|
||||||
|
- url: 'http://localhost/v2'
|
||||||
- url: 'http://petstore.swagger.io/v2'
|
- url: 'http://petstore.swagger.io/v2'
|
||||||
- url: 'http://path-server-test.petstore.local/v2'
|
- url: 'http://path-server-test.petstore.local/v2'
|
||||||
- url: 'http://{server}.swagger.io:{port}/v2'
|
- url: 'http://{server}.swagger.io:{port}/v2'
|
||||||
|
@ -21,7 +21,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati
|
|||||||
addPet($pet)
|
addPet($pet)
|
||||||
```
|
```
|
||||||
### URI(s):
|
### URI(s):
|
||||||
- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
||||||
- Variables:
|
- Variables:
|
||||||
- server: target server
|
- server: target server
|
||||||
- Allowed values:
|
- Allowed values:
|
||||||
@ -80,6 +80,7 @@ try {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
void (empty response body)
|
void (empty response body)
|
||||||
@ -346,7 +347,7 @@ try {
|
|||||||
updatePet($pet)
|
updatePet($pet)
|
||||||
```
|
```
|
||||||
### URI(s):
|
### URI(s):
|
||||||
- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
||||||
- Variables:
|
- Variables:
|
||||||
- server: target server
|
- server: target server
|
||||||
- Allowed values:
|
- Allowed values:
|
||||||
@ -405,6 +406,7 @@ try {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
void (empty response body)
|
void (empty response body)
|
||||||
|
@ -158,6 +158,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -198,6 +199,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -269,6 +271,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -313,6 +316,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -373,6 +377,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -504,6 +509,10 @@ class PetApi
|
|||||||
protected function getHostSettingsForaddPet(): array
|
protected function getHostSettingsForaddPet(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
[
|
||||||
|
"url" => "http://localhost/v2",
|
||||||
|
"description" => "No description provided",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"url" => "http://petstore.swagger.io/v2",
|
"url" => "http://petstore.swagger.io/v2",
|
||||||
"description" => "No description provided",
|
"description" => "No description provided",
|
||||||
@ -1656,6 +1665,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1696,6 +1706,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1767,6 +1778,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1811,6 +1823,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1871,6 +1884,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -2002,6 +2016,10 @@ class PetApi
|
|||||||
protected function getHostSettingsForupdatePet(): array
|
protected function getHostSettingsForupdatePet(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
[
|
||||||
|
"url" => "http://localhost/v2",
|
||||||
|
"description" => "No description provided",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"url" => "http://petstore.swagger.io/v2",
|
"url" => "http://petstore.swagger.io/v2",
|
||||||
"description" => "No description provided",
|
"description" => "No description provided",
|
||||||
|
@ -23,7 +23,7 @@ All URIs are relative to http://petstore.swagger.io:80/v2, except if the operati
|
|||||||
addPet($pet)
|
addPet($pet)
|
||||||
```
|
```
|
||||||
### URI(s):
|
### URI(s):
|
||||||
- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
||||||
- Variables:
|
- Variables:
|
||||||
- server: target server
|
- server: target server
|
||||||
- Allowed values:
|
- Allowed values:
|
||||||
@ -82,6 +82,7 @@ try {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
void (empty response body)
|
void (empty response body)
|
||||||
@ -348,7 +349,7 @@ try {
|
|||||||
updatePet($pet)
|
updatePet($pet)
|
||||||
```
|
```
|
||||||
### URI(s):
|
### URI(s):
|
||||||
- http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
- http://localhost/v2 - http://petstore.swagger.io/v2 - http://path-server-test.petstore.local/v2 - http://{server}.swagger.io:{port}/v2 test server with variables
|
||||||
- Variables:
|
- Variables:
|
||||||
- server: target server
|
- server: target server
|
||||||
- Allowed values:
|
- Allowed values:
|
||||||
@ -407,6 +408,7 @@ try {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Return type
|
### Return type
|
||||||
|
|
||||||
void (empty response body)
|
void (empty response body)
|
||||||
|
@ -164,6 +164,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -199,6 +200,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -266,6 +268,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -305,6 +308,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -360,6 +364,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -486,6 +491,10 @@ class PetApi
|
|||||||
protected function getHostSettingsForaddPet(): array
|
protected function getHostSettingsForaddPet(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
[
|
||||||
|
"url" => "http://localhost/v2",
|
||||||
|
"description" => "No description provided",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"url" => "http://petstore.swagger.io/v2",
|
"url" => "http://petstore.swagger.io/v2",
|
||||||
"description" => "No description provided",
|
"description" => "No description provided",
|
||||||
@ -1583,6 +1592,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1618,6 +1628,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1685,6 +1696,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1724,6 +1736,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1779,6 +1792,7 @@ class PetApi
|
|||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host.
|
||||||
* if needed, use the 'variables' parameter to pass variables to the host.
|
* if needed, use the 'variables' parameter to pass variables to the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1905,6 +1919,10 @@ class PetApi
|
|||||||
protected function getHostSettingsForupdatePet(): array
|
protected function getHostSettingsForupdatePet(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
[
|
||||||
|
"url" => "http://localhost/v2",
|
||||||
|
"description" => "No description provided",
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"url" => "http://petstore.swagger.io/v2",
|
"url" => "http://petstore.swagger.io/v2",
|
||||||
"description" => "No description provided",
|
"description" => "No description provided",
|
||||||
|
@ -16,7 +16,8 @@ class AsyncTest extends TestCase
|
|||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->api = new Api\PetApi();
|
$config = (new Configuration())->setHost('http://localhost/v2');
|
||||||
|
$this->api = new Api\PetApi(null, $config);
|
||||||
|
|
||||||
$this->petId = 10005;
|
$this->petId = 10005;
|
||||||
$pet = new Model\Pet;
|
$pet = new Model\Pet;
|
||||||
|
@ -12,14 +12,15 @@ class DebugTest extends TestCase
|
|||||||
$newPet = new Model\Pet;
|
$newPet = new Model\Pet;
|
||||||
$newPet->setId(1);
|
$newPet->setId(1);
|
||||||
$newPet->setName("PHP Unit Test");
|
$newPet->setName("PHP Unit Test");
|
||||||
(new Api\PetApi())->addPetWithHttpInfo($newPet);
|
$config = (new Configuration())->setHost('http://localhost/v2');
|
||||||
|
(new Api\PetApi(null, $config))->addPetWithHttpInfo($newPet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEnableDebugOutput()
|
public function testEnableDebugOutput()
|
||||||
{
|
{
|
||||||
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
|
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
|
||||||
|
|
||||||
$config = new Configuration();
|
$config = (new Configuration())->setHost('http://localhost/v2');
|
||||||
$config->setDebug(true);
|
$config->setDebug(true);
|
||||||
$api = new Api\PetApi(null, $config);
|
$api = new Api\PetApi(null, $config);
|
||||||
$api->getPetById(1);
|
$api->getPetById(1);
|
||||||
@ -29,7 +30,7 @@ class DebugTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
|
$this->expectOutputRegex('#GET /v2/pet/1 HTTP/1.1#');
|
||||||
|
|
||||||
$config = new Configuration();
|
$config = (new Configuration())->setHost('http://localhost/v2');
|
||||||
$config->setDebug(true);
|
$config->setDebug(true);
|
||||||
$api = new Api\PetApi(null, $config);
|
$api = new Api\PetApi(null, $config);
|
||||||
$promise = $api->getPetByIdAsync(1);
|
$promise = $api->getPetByIdAsync(1);
|
||||||
|
@ -41,15 +41,12 @@ class PetApiTest extends TestCase
|
|||||||
|
|
||||||
$newPet->setTags(array($tag));
|
$newPet->setTags(array($tag));
|
||||||
$newPet->setCategory($category);
|
$newPet->setCategory($category);
|
||||||
|
|
||||||
$config = new Configuration();
|
|
||||||
$petApi = new Api\PetApi(null, $config);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
$this->api = new Api\PetApi();
|
$config = (new Configuration())->setHost('http://localhost/v2');
|
||||||
|
$this->api = new Api\PetApi(null, $config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetPetById()
|
public function testGetPetById()
|
||||||
|
@ -30,10 +30,10 @@ class ServerVariablesInOperationTest extends TestCase
|
|||||||
$this->api->addPet($this->pet, 2);
|
$this->api->addPet($this->pet, 2);
|
||||||
$request = $this->fakeHttpClient->getLastRequest();
|
$request = $this->fakeHttpClient->getLastRequest();
|
||||||
|
|
||||||
$this->assertEquals('petstore.swagger.io', $request->getUri()->getHost(), 'Server variable set to default value.');
|
$this->assertEquals('path-server-test.petstore.local', $request->getUri()->getHost(), 'Server variable set to default value.');
|
||||||
|
|
||||||
# Test variables substitution
|
# Test variables substitution
|
||||||
$this->api->addPet($this->pet, 2, [ 'server' => 'qa-petstore', 'port' => '8080']);
|
$this->api->addPet($this->pet, 3, [ 'server' => 'qa-petstore', 'port' => '8080']);
|
||||||
$request = $this->fakeHttpClient->getLastRequest();
|
$request = $this->fakeHttpClient->getLastRequest();
|
||||||
|
|
||||||
$this->assertEquals('qa-petstore.swagger.io', $request->getUri()->getHost(), 'Server set to "qa-petstore"');
|
$this->assertEquals('qa-petstore.swagger.io', $request->getUri()->getHost(), 'Server set to "qa-petstore"');
|
||||||
@ -43,7 +43,7 @@ class ServerVariablesInOperationTest extends TestCase
|
|||||||
public function testLegacyServerChoiceInOperation(): void
|
public function testLegacyServerChoiceInOperation(): void
|
||||||
{
|
{
|
||||||
# Test legacy behavior (set server using api->setHostIndex()
|
# Test legacy behavior (set server using api->setHostIndex()
|
||||||
$this->api->setHostIndex(1);
|
$this->api->setHostIndex(2);
|
||||||
$this->api->addPet($this->pet);
|
$this->api->addPet($this->pet);
|
||||||
$request = $this->fakeHttpClient->getLastRequest();
|
$request = $this->fakeHttpClient->getLastRequest();
|
||||||
|
|
||||||
@ -53,6 +53,6 @@ class ServerVariablesInOperationTest extends TestCase
|
|||||||
public function testInvalidVariableValueInOperation(): void
|
public function testInvalidVariableValueInOperation(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidArgumentException::class);
|
$this->expectException(InvalidArgumentException::class);
|
||||||
$this->api->addPet($this->pet, 2,['server' => 'invalid-value']);
|
$this->api->addPet($this->pet, 3,['server' => 'invalid-value']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,7 @@ class PetApi
|
|||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -201,6 +202,7 @@ class PetApi
|
|||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -258,6 +260,7 @@ class PetApi
|
|||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -283,6 +286,7 @@ class PetApi
|
|||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -323,6 +327,7 @@ class PetApi
|
|||||||
* Create request for operation 'addPet'
|
* Create request for operation 'addPet'
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -405,7 +410,7 @@ class PetApi
|
|||||||
$headers
|
$headers
|
||||||
);
|
);
|
||||||
|
|
||||||
$operationHosts = ["http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"];
|
$operationHosts = ["http://localhost/v2", "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"];
|
||||||
if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) {
|
if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) {
|
||||||
throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts));
|
throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts));
|
||||||
}
|
}
|
||||||
@ -1432,6 +1437,7 @@ class PetApi
|
|||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1453,6 +1459,7 @@ class PetApi
|
|||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1510,6 +1517,7 @@ class PetApi
|
|||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1535,6 +1543,7 @@ class PetApi
|
|||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1575,6 +1584,7 @@ class PetApi
|
|||||||
* Create request for operation 'updatePet'
|
* Create request for operation 'updatePet'
|
||||||
*
|
*
|
||||||
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
* This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host.
|
||||||
|
* URL: http://localhost/v2
|
||||||
* URL: http://petstore.swagger.io/v2
|
* URL: http://petstore.swagger.io/v2
|
||||||
* URL: http://path-server-test.petstore.local/v2
|
* URL: http://path-server-test.petstore.local/v2
|
||||||
* URL: http://{server}.swagger.io:{port}/v2
|
* URL: http://{server}.swagger.io:{port}/v2
|
||||||
@ -1657,7 +1667,7 @@ class PetApi
|
|||||||
$headers
|
$headers
|
||||||
);
|
);
|
||||||
|
|
||||||
$operationHosts = ["http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"];
|
$operationHosts = ["http://localhost/v2", "http://petstore.swagger.io/v2", "http://path-server-test.petstore.local/v2", "http://{server}.swagger.io:{port}/v2"];
|
||||||
if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) {
|
if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) {
|
||||||
throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts));
|
throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user