forked from loafle/openapi-generator-original
* [PHP] Honor Swagger/OpenAPI 'date' format Per spec (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types), DateTime instances defined as 'date' datatype need to be serialized as defined by full-date - RFC3339, which has the format: full-date = date-fullyear "-" date-month "-" date-mday ref: https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 see #5531 fixes #5607 * [PHP] Add `date` and `date-time` serializer tests See #5531 See #5607 * [PHP] Improve codestyle of generated code * [PHP] Regenerate PHP Petstore sample * [PHP] Regenerate PHP Security sample
34 lines
989 B
PHP
34 lines
989 B
PHP
<?php
|
|
|
|
namespace Swagger\Client;
|
|
|
|
class UserApiTest 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()
|
|
{
|
|
// for error reporting (need to run with php5.3 to get no warning)
|
|
//ini_set('display_errors', 1);
|
|
//error_reporting(~0);
|
|
}
|
|
|
|
// test login user
|
|
public function testLoginUser()
|
|
{
|
|
// initialize the API client
|
|
$config = (new Configuration())->setHost('http://petstore.swagger.io/v2');
|
|
$api_client = new ApiClient($config);
|
|
$user_api = new Api\UserApi($api_client);
|
|
// login
|
|
$response = $user_api->loginUser("xxxxx", "yyyyyyyy");
|
|
|
|
$this->assertInternalType("string", $response);
|
|
$this->assertRegExp(
|
|
"/^logged in user session/",
|
|
$response,
|
|
"response string starts with 'logged in user session'"
|
|
);
|
|
}
|
|
}
|