public function testGetPetById() { // initialize the API client without host $pet_id = 10005; // ID of pet that needs to be fetched $pet_api = new Swagger\Client\Api\PetAPI(); $pet_api->getApiClient()->getConfig()->setApiKey('api_key', '111222333444555'); // return Pet (model) $response = $pet_api->getPetById($pet_id); $this->assertSame($response->getId(), $pet_id); $this->assertSame($response->getName(), 'PHP Unit Test'); $this->assertSame($response->getCategory()->getId(), $pet_id); $this->assertSame($response->getCategory()->getName(), 'test php category'); $this->assertSame($response->getTags()[0]->getId(), $pet_id); $this->assertSame($response->getTags()[0]->getName(), 'test php tag'); }
public function testGetPetByIdWithHttpInfo() { // initialize the API client without host $pet_id = 10005; // ID of pet that needs to be fetched $pet_api = new Swagger\Client\Api\PetAPI(); $pet_api->getApiClient()->getConfig()->setApiKey('api_key', '111222333444555'); // return Pet (model) list($response, $status_code, $response_headers) = $pet_api->getPetByIdWithHttpInfo($pet_id); $this->assertSame($response->getId(), $pet_id); $this->assertSame($response->getName(), 'PHP Unit Test'); $this->assertSame($response->getCategory()->getId(), $pet_id); $this->assertSame($response->getCategory()->getName(), 'test php category'); $this->assertSame($response->getTags()[0]->getId(), $pet_id); $this->assertSame($response->getTags()[0]->getName(), 'test php tag'); $this->assertSame($status_code, 200); $this->assertSame($response_headers['Content-Type'], 'application/json'); }