public function testGetPetByIdWithByteArray()
 {
     // initialize the API client
     $config = new Swagger\Client\Configuration();
     $config->setHost('http://petstore.swagger.io/v2');
     $api_client = new Swagger\Client\APIClient($config);
     $pet_api = new Swagger\Client\Api\PetAPI($api_client);
     // test getPetByIdWithByteArray
     $pet_id = 10005;
     $bytes = $pet_api->getPetByIdWithByteArray($pet_id);
     $json = json_decode(call_user_func_array('pack', array_merge(array('C*'), $bytes)), true);
     $this->assertInternalType("array", $bytes);
     $this->assertSame($json['id'], $pet_id);
     // not testing name as it's tested by addPetUsingByteArray
     //$this->assertSame($json['name'], 'PHP Unit Test');
     $this->assertSame($json['category']['id'], $pet_id);
     $this->assertSame($json['category']['name'], 'test php category');
     $this->assertSame($json['tags'][0]['id'], $pet_id);
     $this->assertSame($json['tags'][0]['name'], 'test php tag');
 }
示例#2
0
 public function testGetInventory()
 {
     // initialize the API client
     $config = new Swagger\Client\Configuration();
     $config->setHost('http://petstore.swagger.io/v2');
     $api_client = new Swagger\Client\APIClient($config);
     $store_api = new Swagger\Client\Api\StoreAPI($api_client);
     // get inventory
     $get_response = $store_api->getInventory();
     $this->assertInternalType("int", $get_response['sold']);
     $this->assertInternalType("int", $get_response['pending']);
 }