Exemple #1
0
 public function testUpdatePet()
 {
     // initialize the API client
     $config = (new Swagger\Client\Configuration())->setHost('http://petstore.swagger.io/v2');
     $api_client = new Swagger\Client\ApiClient($config);
     $pet_id = 10001;
     // ID of pet that needs to be fetched
     $pet_api = new Swagger\Client\Api\PetApi($api_client);
     // create updated pet object
     $updated_pet = new Swagger\Client\Model\Pet();
     $updated_pet->setId($pet_id);
     $updated_pet->setName('updatePet');
     // new name
     $updated_pet->setStatus('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->getId(), $pet_id);
     $this->assertSame($response->getStatus(), 'pending');
     $this->assertSame($response->getName(), 'updatePet');
 }