forked from loafle/openapi-generator-original
Php client using guzzle6 & psr7 instead of curl (#5190)
* reimplemented basic requests with httpplug * added returning headers * added query params support * removed constant reference to model class * some extra @throws; form params * form and query params encoding * file upload / form multipart * added missing response headers in WithHttpInfo calls * removed Store test From PetApiTest class * removed configuration overriding test as its now task of client adapters * updated store tests with new client initialization code * updated composer.json template * not using json_decode if response is string * renamed some variables to camelCase * removed ApiClient and Configuration classes * added HeaderSelector template * added ObjectSerializer injection * regenerated all samples * added AuthConfig and readded support for custom api keys * readded support for oauth tokens * readded basic auth; moved auth tests to separate test class * readded header params * readded support for collections in paths * readded config option; readded exception handling * file downloading; readded some Configuration properties removed earlier * readded default headers * made responses and return types work same way as earlier * made all methods static in ObjectSerializer * updated test.php, replaced autoload.php with composer's autoloader * updated api doc template * removed classes used for testing; regenerated Fake_classname_tags123Api * replaced httplug with guzzle6 * updated required php version to 5.5 * clean up * readded missing userAgent feature; removed default headers from Configuration * updated test.php * downgraded phpunit back to 4.8 to work with php5.5; fixed client initialization in some tests
This commit is contained in:
@@ -2,30 +2,29 @@
|
||||
|
||||
namespace Swagger\Client;
|
||||
|
||||
use Swagger\Client\Api\UserApi;
|
||||
|
||||
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()
|
||||
/** @var UserApi*/
|
||||
private $api;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
// for error reporting (need to run with php5.3 to get no warning)
|
||||
//ini_set('display_errors', 1);
|
||||
//error_reporting(~0);
|
||||
$this->api = new Api\UserApi();
|
||||
}
|
||||
|
||||
// test login user
|
||||
// test login use
|
||||
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");
|
||||
$response = $this->api->loginUser('xxxxx', 'yyyyyyyy');
|
||||
|
||||
$this->assertInternalType("string", $response);
|
||||
$this->assertInternalType('string', $response);
|
||||
$this->assertRegExp(
|
||||
"/^logged in user session/",
|
||||
'/^logged in user session/',
|
||||
$response,
|
||||
"response string starts with 'logged in user session'"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user