add back php unit testing and readme to PHP SwaggerClient sample code

This commit is contained in:
wing328
2015-04-17 00:10:27 +08:00
parent 4c717829b3
commit 676c4d0835
2 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<?php
require_once('SwaggerPetstore.php');
class PetApiTest extends \PHPUnit_Framework_TestCase
{
public function testGetPetById()
{
// initialize the API client
$api_client = new SwaggerPetstore\APIClient('http://petstore.swagger.io/v2');
$petId = 10005; // ID of pet that needs to be fetched
$pet_api = new SwaggerPetstore\PetAPI($api_client);
// return Pet (model)
$response = $pet_api->getPetById($petId);
$this->assertSame($response->id, $petId);
}
}
?>