From 7e37f3294af3e4f2f93b0d974a8c6f0209a97249 Mon Sep 17 00:00:00 2001 From: wing328 Date: Fri, 17 Apr 2015 20:01:58 +0800 Subject: [PATCH 1/3] bug fix for post (model) and update php test cases --- .gitignore | 3 + .../src/main/resources/php/APIClient.mustache | 6 +- .../src/main/resources/php/api.mustache | 8 +- .../php/SwaggerClient-php/lib/APIClient.php | 6 +- .../php/SwaggerClient-php/lib/PetApi.php | 64 ++++------- .../php/SwaggerClient-php/lib/StoreApi.php | 32 ++---- .../php/SwaggerClient-php/lib/UserApi.php | 64 ++++------- .../petstore/php/SwaggerClient-php/pom.xml | 60 ++++++++++ .../SwaggerClient-php/tests/PetApiTest.php | 108 +++++++++++++++++- 9 files changed, 241 insertions(+), 110 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/pom.xml diff --git a/.gitignore b/.gitignore index b17bf46aa10..210834c6a85 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ target .lib atlassian-ide-plugin.xml .DS_Store + +samples/client/petstore/php/SwaggerClient-php/composer.lock +samples/client/petstore/php/SwaggerClient-php/vendor/ diff --git a/modules/swagger-codegen/src/main/resources/php/APIClient.mustache b/modules/swagger-codegen/src/main/resources/php/APIClient.mustache index 5cfb953002b..a750daff12d 100644 --- a/modules/swagger-codegen/src/main/resources/php/APIClient.mustache +++ b/modules/swagger-codegen/src/main/resources/php/APIClient.mustache @@ -94,7 +94,11 @@ class APIClient { $headers[] = $this->headerName . ": " . $this->headerValue; } - if ((isset($headerName['Content-Type']) and strpos($headerName['Content-Type'], "multipart/form-data") === FALSE) and (is_object($postData) or is_array($postData))) { + // form data + if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { + $postData = http_build_query($postData); + } + else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model $postData = json_encode($this->sanitizeForSerialization($postData)); } diff --git a/modules/swagger-codegen/src/main/resources/php/api.mustache b/modules/swagger-codegen/src/main/resources/php/api.mustache index a434699f90a..34cf1d989f7 100644 --- a/modules/swagger-codegen/src/main/resources/php/api.mustache +++ b/modules/swagger-codegen/src/main/resources/php/api.mustache @@ -81,11 +81,9 @@ class {{classname}} { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php index f69675c1e9b..d3fe07aa911 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php @@ -94,7 +94,11 @@ class APIClient { $headers[] = $this->headerName . ": " . $this->headerValue; } - if ((isset($headerName['Content-Type']) and strpos($headerName['Content-Type'], "multipart/form-data") === FALSE) and (is_object($postData) or is_array($postData))) { + // form data + if ($postData and in_array('Content-Type: application/x-www-form-urlencoded', $headers)) { + $postData = http_build_query($postData); + } + else if ((is_object($postData) or is_array($postData)) and !in_array('Content-Type: multipart/form-data', $headers)) { // json model $postData = json_encode($this->sanitizeForSerialization($postData)); } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php index 80d9c040d1e..5a6dece6f85 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php @@ -67,11 +67,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -120,11 +118,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -172,11 +168,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -230,11 +224,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -289,11 +281,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -356,11 +346,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -413,11 +401,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -474,11 +460,9 @@ class PetApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/StoreApi.php index 4e40ed983b9..4c3563451b6 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/StoreApi.php @@ -62,11 +62,9 @@ class StoreApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -121,11 +119,9 @@ class StoreApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -180,11 +176,9 @@ class StoreApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -239,11 +233,9 @@ class StoreApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/UserApi.php index f3e9e7f4cc6..c531e5a9d97 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/UserApi.php @@ -67,11 +67,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -120,11 +118,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -173,11 +169,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -229,11 +223,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -283,11 +275,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -336,11 +326,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -400,11 +388,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call @@ -453,11 +439,9 @@ class UserApi { // for model (json/xml) if (isset($_tempBody)) { $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } - - // for HTTP post (form) - if (strpos($headerParams['Content-Type'], "application/x-www-form-urlencoded") !== FALSE) { - $httpBody = http_build_query($formParams); + } else if (count($formParams) > 0) { + // for HTTP post (form) + $httpBody = $formParams; } // make the API Call diff --git a/samples/client/petstore/php/SwaggerClient-php/pom.xml b/samples/client/petstore/php/SwaggerClient-php/pom.xml new file mode 100644 index 00000000000..b1aeddcf7ea --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + com.wordnik + PhpPetstoreClientTests + pom + 1.0-SNAPSHOT + PHP Swagger Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + bundle-install + pre-integration-test + + exec + + + composer + + install + + + + + bundle-test + integration-test + + exec + + + vendor/bin/phpunit + + tests + + + + + + + + + diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 3286208ec56..f50fd1a8fc4 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -1,16 +1,118 @@ id = $new_pet_id; + $new_pet->name = "PHP Unit Test"; + $pet_api = new SwaggerClient\PetAPI($api_client); + // add a new pet (model) + $add_response = $pet_api->addPet($new_pet); + // return nothing (void) + //$this->assertSame($add_response, NULL); + } + + // test getPetById with a Pet object (id 10005) public function testGetPetById() { // initialize the API client $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); - $petId = 10005; // ID of pet that needs to be fetched + $pet_id = 10005; // ID of pet that needs to be fetched $pet_api = new SwaggerClient\PetAPI($api_client); // return Pet (model) - $response = $pet_api->getPetById($petId); - $this->assertSame($response->id, $petId); + $response = $pet_api->getPetById($pet_id); + $this->assertSame($response->id, $pet_id); + $this->assertSame($response->name, 'PHP Unit Test'); } + + // test getPetByStatus and verify by the "id" of the response + public function testFindPetByStatus() + { + // initialize the API client + $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); + $pet_api = new SwaggerClient\PetAPI($api_client); + // return Pet (model) + $response = $pet_api->findPetsByStatus("available"); + $this->assertGreaterThan(0, count($response)); // at least one object returned + $this->assertSame(get_class($response[0]), "SwaggerClient\models\Pet"); // verify the object is Pet + // loop through result to ensure status is "available" + foreach ($response as $_pet) { + $this->assertSame($_pet['status'], "available"); + } + // test invalid status + $response = $pet_api->findPetsByStatus("unknown_and_incorrect_status"); + $this->assertSame(count($response), 0); // confirm no object returned + } + + // test updatePet (model/json)and verify by the "id" of the response + public function testUpdatePet() + { + // initialize the API client + $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); + $pet_id = 10001; // ID of pet that needs to be fetched + $pet_api = new SwaggerClient\PetAPI($api_client); + // create updated pet object + $updated_pet = new SwaggerClient\models\Pet; + $updated_pet->id = $pet_id; + $updated_pet->status = "pending"; // new status + // update Pet (model/json) + $update_response = $pet_api->updatePet($updated_pet); + // return nothing (void) + $this->assertSame($update_response, NULL); + // verify updated Pet + $response = $pet_api->getPetById($pet_id); + $this->assertSame($response->id, $pet_id); + $this->assertSame($response->status, 'pending'); + } + + // test updatePet and verify by the "id" of the response + public function testUpdatePetWithForm() + { + // initialize the API client + $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); + $pet_id = 10001; // ID of pet that needs to be fetched + $pet_api = new SwaggerClient\PetAPI($api_client); + // update Pet (form) + $update_response = $pet_api->updatePetWithForm($pet_id, null, 'sold'); + // return nothing (void) + $this->assertSame($update_response, NULL); + // TODO commented out for the time being since it's broken + // https://github.com/swagger-api/swagger-codegen/issues/656 + // verify updated Pet + //$response = $pet_api->getPetById($pet_id); + //$this->assertSame($response->id, $pet_id); + //$this->assertSame($response->status, 'sold'); + } + + // test addPet and verify by the "id" and "name" of the response + public function testAddPet() + { + // initialize the API client + $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); + $new_pet_id = 10001; + $new_pet = new SwaggerClient\models\Pet; + $new_pet->id = $new_pet_id; + $new_pet->name = "PHP Unit Test"; + $pet_api = new SwaggerClient\PetAPI($api_client); + // add a new pet (model) + $add_response = $pet_api->addPet($new_pet); + // return nothing (void) + $this->assertSame($add_response, NULL); + // verify added Pet + $response = $pet_api->getPetById($new_pet_id); + $this->assertSame($response->id, $new_pet_id); + $this->assertSame($response->name, 'PHP Unit Test'); + } + } + ?> + From 070a6203e06acf177fecfc9f286db676f22a6500 Mon Sep 17 00:00:00 2001 From: wing328 Date: Thu, 7 May 2015 13:35:19 +0800 Subject: [PATCH 2/3] remove php comment --- .../swagger-codegen/src/main/resources/php/require.mustache | 3 --- .../client/petstore/php/SwaggerClient-php/SwaggerClient.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/php/require.mustache b/modules/swagger-codegen/src/main/resources/php/require.mustache index 058aa169504..3c02d861ef1 100644 --- a/modules/swagger-codegen/src/main/resources/php/require.mustache +++ b/modules/swagger-codegen/src/main/resources/php/require.mustache @@ -1,7 +1,4 @@ Date: Fri, 15 May 2015 11:08:33 +0800 Subject: [PATCH 3/3] add test case for upload file, improve error handling --- .../php/SwaggerClient-php/lib/APIClient.php | 11 +++---- .../SwaggerClient-php/tests/PetApiTest.php | 32 +++++++++++++++++-- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php index d3fe07aa911..d6d14c72527 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php @@ -142,21 +142,20 @@ class APIClient { $response_info = curl_getinfo($curl); // Handle the response - if ($response_info['http_code'] == 0) { - throw new APIClientException("TIMEOUT: api call to " . $url . - " took more than 5s to return", 0, $response_info, $response); + if ($response === false) { // error, likely in the client side + throw new APIClientException("API Error ($url): ".curl_error($curl), 0, $response_info, $response); } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { $data = json_decode($response); if (json_last_error() > 0) { // if response is a string $data = $response; } - } else if ($response_info['http_code'] == 401) { + } else if ($response_info['http_code'] == 401) { // server returns 401 throw new APIClientException("Unauthorized API request to " . $url . ": " . serialize($response), 0, $response_info, $response); - } else if ($response_info['http_code'] == 404) { + } else if ($response_info['http_code'] == 404) { // server returns 404 $data = null; } else { - throw new APIClientException("Can't connect to the api: " . $url . + throw new APIClientException("Can't connect to the API: " . $url . " response code: " . $response_info['http_code'], 0, $response_info, $response); } diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index f50fd1a8fc4..d2d398ae140 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -9,15 +9,26 @@ class PetApiTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { // initialize the API client $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); + // new pet $new_pet_id = 10005; $new_pet = new SwaggerClient\models\Pet; $new_pet->id = $new_pet_id; $new_pet->name = "PHP Unit Test"; + // new tag + $tag= new SwaggerClient\models\Tag; + $tag->id = $new_pet_id; // use the same id as pet + $tag->name = "test php tag"; + // new category + $category = new SwaggerClient\models\Category; + $category->id = $new_pet_id; // use the same id as pet + $category->name = "test php category"; + + $new_pet->tags = [$tag]; + $new_pet->category = $category; + $pet_api = new SwaggerClient\PetAPI($api_client); // add a new pet (model) $add_response = $pet_api->addPet($new_pet); - // return nothing (void) - //$this->assertSame($add_response, NULL); } // test getPetById with a Pet object (id 10005) @@ -31,6 +42,10 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $response = $pet_api->getPetById($pet_id); $this->assertSame($response->id, $pet_id); $this->assertSame($response->name, 'PHP Unit Test'); + $this->assertSame($response->category->id, $pet_id); + $this->assertSame($response->category->name, 'test php category'); + $this->assertSame($response->tags[0]->id, $pet_id); + $this->assertSame($response->tags[0]->name, 'test php tag'); } // test getPetByStatus and verify by the "id" of the response @@ -112,6 +127,19 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->name, 'PHP Unit Test'); } + // test + public function testUploadFile() + { + // initialize the API client + $api_client = new SwaggerClient\APIClient('http://petstore.swagger.io/v2'); + $pet_api = new SwaggerClient\PetAPI($api_client); + // upload file + $pet_id = 10001; + $add_response = $pet_api->uploadFile($pet_id, "test meta", "./composer.json"); + // return nothing (void) + $this->assertSame($add_response, NULL); + } + } ?>