forked from loafle/openapi-generator-original
* 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
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Swagger\Client;
|
|
|
|
use Swagger\Client\Api\FakeApi;
|
|
use Swagger\Client\Api\UserApi;
|
|
|
|
require_once __DIR__ . '/FakeHttpClient.php';
|
|
|
|
class ParametersTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/** @var FakeHttpClient */
|
|
private $fakeHttpClient;
|
|
/** @var FakeApi */
|
|
private $fakeApi;
|
|
/** @var UserApi */
|
|
private $userApi;
|
|
|
|
public function setUp()
|
|
{
|
|
$this->fakeHttpClient = new FakeHttpClient();
|
|
$this->fakeApi = new Api\FakeApi($this->fakeHttpClient);
|
|
$this->userApi = new Api\UserApi($this->fakeHttpClient);
|
|
}
|
|
|
|
public function testHeaderParam()
|
|
{
|
|
$this->fakeApi->testEnumParameters([], [], [], 'something');
|
|
|
|
$request = $this->fakeHttpClient->getLastRequest();
|
|
$headers = $request->getHeaders();
|
|
|
|
$this->assertArrayHasKey('enum_header_string', $headers);
|
|
$this->assertEquals(['something'], $headers['enum_header_string']);
|
|
}
|
|
|
|
public function testHeaderParamCollection()
|
|
{
|
|
$this->fakeApi->testEnumParameters([], [], ['string1', 'string2']);
|
|
|
|
$request = $this->fakeHttpClient->getLastRequest();
|
|
$headers = $request->getHeaders();
|
|
|
|
$this->assertArrayHasKey('enum_header_string_array', $headers);
|
|
$this->assertEquals(['string1,string2'], $headers['enum_header_string_array']);
|
|
}
|
|
|
|
// missing example for collection path param in config
|
|
// public function testPathParamCollection()
|
|
// {
|
|
// $this->userApi->getUserByNameWithHttpInfo(['aa', 'bb']);
|
|
// $request = $this->fakeHttpClient->getLastRequest();
|
|
// $this->assertEquals('user/aa,bb', urldecode($request->getUri()->getPath()));
|
|
// }
|
|
}
|