revert petstore json, fixed test case

This commit is contained in:
wing328 2015-06-27 23:26:59 +08:00
parent 2258a4632d
commit 38149173ff
3 changed files with 9 additions and 7 deletions

View File

@ -235,7 +235,7 @@
"200": {
"description": "successful operation",
"schema": {
"type": "file"
"$ref": "#/definitions/Pet"
}
},
"400": {

View File

@ -329,7 +329,7 @@ class PetApi {
* Find pet by ID
*
* @param int $pet_id ID of pet that needs to be fetched (required)
* @return \SplFileObject
* @return \Swagger\Client\Model\Pet
* @throws \Swagger\Client\ApiException on non-2xx response
*/
public function getPetById($pet_id) {
@ -387,11 +387,11 @@ class PetApi {
try {
list($response, $httpHeader) = $this->apiClient->callApi($resourcePath, $method,
$queryParams, $httpBody,
$headerParams, '\SplFileObject');
$headerParams, '\Swagger\Client\Model\Pet');
} catch (ApiException $e) {
switch ($e->getCode()) {
case 200:
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\SplFileObject', $httpHeader);
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $httpHeader);
$e->setResponseObject($data);
break;
}
@ -403,7 +403,7 @@ class PetApi {
return null;
}
return $this->apiClient->getSerializer()->deserialize($response,'\SplFileObject');
return $this->apiClient->getSerializer()->deserialize($response,'\Swagger\Client\Model\Pet');
}

View File

@ -70,9 +70,11 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
$this->assertFalse(isset($defaultHeader['test2']));
$pet_api2 = new Swagger\Client\Api\PetAPI();
$apiClient3 = new Swagger\Client\ApiClient();
$config3 = new Swagger\Client\Configuration();
$apiClient3 = new Swagger\Client\ApiClient($config3);
$apiClient3->getConfig()->setUserAgent('api client 3');
$apiClient4 = new Swagger\Client\ApiClient();
$config4 = new Swagger\Client\Configuration();
$apiClient4 = new Swagger\Client\ApiClient($config4);
$apiClient4->getConfig()->setUserAgent('api client 4');
$pet_api3 = new Swagger\Client\Api\PetAPI($apiClient3);