Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ public function testDefaultValues()
$this->assertSame('red', $animal->getColor());
}

/**
* test invalid argument
*
* @expectedException \InvalidArgumentException
*/
public function testInvalidArgument()
{
// the argument is required, and we must specify one or some from 'available', 'pending', 'sold'
$this->api->findPetsByStatus([]);
}

// Disabled as currently we don't have any endpoint that would return file
// For testing I just replaced url and return type in Api method.
// public function testDownloadingLargeFile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,7 @@ public function testGetInventory()
{
$result = $this->api->getInventory();

$this->assertInternalType("array", $result);
$this->assertInternalType("int", $result['available']);
$this->assertInternalType('array', $result);
$this->assertInternalType('int', $result['available']);
}

/*
* comment out as we've removed invalid endpoints from the spec, we'll introduce something
* similar in the future when we've time to update the petstore server
*
// test get inventory
public function testGetInventoryInObject()
{
$result = $this->api->getInventoryInObject();

$this->assertInternalType("array", $result);
$this->assertInternalType("int", $result['available']);
}
*/

/**
* test empty array response
*
* Make sure empty arrays from a producer is actually returned as
* an empty array and not some other value. At some point it was
* returned as null because the code stumbled on PHP loose type
* checking (not on empty array is true, same thing could happen
* with careless use of empty()).
*/
// public function testEmptyArrayResponse()
// {
// // this call returns and empty array
// $response = $this->api->findPetsByStatus(array());
//
// // make sure this is an array as we want it to be
// $this->assertInternalType("array", $response);
//
// // make sure the array is empty just in case the petstore
// // server changes its output
// $this->assertEmpty($response);
// }
}