Skip to content

Commit c7b9635

Browse files
committed
add test cases for byte array (body)
1 parent f54185c commit c7b9635

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ public function testUpdatePetWithForm()
206206
}
207207

208208
// test addPet and verify by the "id" and "name" of the response
209-
public function testAddPet()
209+
public function testAddPetUsingByteArray()
210210
{
211211
// initialize the API client
212212
$config = (new Swagger\Client\Configuration())->setHost('http://petstore.swagger.io/v2');
@@ -217,14 +217,16 @@ public function testAddPet()
217217
$new_pet->setName("PHP Unit Test");
218218
$pet_api = new Swagger\Client\Api\PetAPI($api_client);
219219
// add a new pet (model)
220-
$add_response = $pet_api->addPet($new_pet);
220+
$add_response = $pet_api->addPetUsingByteArray(unpack('C*', $new_pet));
221221
// return nothing (void)
222222
$this->assertSame($add_response, NULL);
223223
// verify added Pet
224224
$response = $pet_api->getPetById($new_pet_id);
225225
$this->assertSame($response->getId(), $new_pet_id);
226226
$this->assertSame($response->getName(), 'PHP Unit Test');
227227
}
228+
229+
228230

229231
// test upload file
230232
public function testUploadFile()

0 commit comments

Comments
 (0)