update php api test with SwaggerClient.php

This commit is contained in:
wing328 2015-04-17 00:16:09 +08:00
parent 676c4d0835
commit c30ed059fe

View File

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