forked from loafle/openapi-generator-original
add back php unit testing and readme to PHP SwaggerClient sample code
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user