From a0c55693dcbfe191f62a944e3bc10feecc6106cd Mon Sep 17 00:00:00 2001 From: wing328 Date: Wed, 10 Jun 2015 21:59:48 +0800 Subject: [PATCH] add test case for loginUser, separate test cases into different files --- .../SwaggerClient-php/tests/PetApiTest.php | 5 +-- .../SwaggerClient-php/tests/StoreApiTest.php | 32 +++++++++++++++++++ .../SwaggerClient-php/tests/UserApiTest.php | 32 +++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php create mode 100644 samples/client/petstore/php/SwaggerClient-php/tests/UserApiTest.php diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index d463243accc3..69536879d7d7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -7,8 +7,9 @@ class PetApiTest extends \PHPUnit_Framework_TestCase // add a new pet (id 10005) to ensure the pet object is available for all the tests public static function setUpBeforeClass() { - ini_set('display_errors', 1); - error_reporting(~0); + // for error reporting (need to run with php5.3 to get no warning) + //ini_set('display_errors', 1); + //error_reporting(~0); // enable debugging //SwaggerClient\Configuration::$debug = true; diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php new file mode 100644 index 000000000000..a92149fbaf3c --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php @@ -0,0 +1,32 @@ +getInventory(); + + $this->assertInternalType("int", $get_response['sold']); + $this->assertInternalType("int", $get_response['pending']); + + } + +} + +?> + diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/UserApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/UserApiTest.php new file mode 100644 index 000000000000..181e8a1249ea --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/tests/UserApiTest.php @@ -0,0 +1,32 @@ +loginUser("xxxxx", "yyyyyyyy"); + + $this->assertInternalType("string", $response); + $this->assertRegExp("/^logged in user session/", $response, "response string starts with 'logged in user session'"); + + } + +} + +?> +