mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-17 15:54:36 +00:00
Update php client with OAS2 (#149)
* Update php client with petstore OpenAPI v2 spec bin/php-petstore.sh * Change order of arguments according to the changes that auto-generated codes * Fix 'FakeHttpClient not found' error It has occured when run the test case separately like below. "vendor/bin/phpunit tests/RequestTest.php" * Update assertion according to a change on spec * Update assertion
This commit is contained in:
committed by
William Cheng
parent
856ed05b00
commit
1f0bed2a0c
@@ -4,6 +4,8 @@ namespace Swagger\Client;
|
||||
|
||||
use Swagger\Client\Api\FakeApi;
|
||||
|
||||
require_once __DIR__ . '/FakeHttpClient.php';
|
||||
|
||||
class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
@@ -24,11 +26,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$request = $this->fakeClient->getLastRequest();
|
||||
$contentType = $request->getHeader('Content-Type');
|
||||
$this->assertEquals(['application/json'], $contentType);
|
||||
$this->assertEquals(['application/x-www-form-urlencoded'], $contentType);
|
||||
|
||||
$requestContent = $request->getBody()->getContents();
|
||||
|
||||
$expected = json_encode(['param' => 'value', 'param2' => 'value2']);
|
||||
$this->assertEquals($expected, $requestContent);
|
||||
// JSON serialization of form data is not supported
|
||||
$this->assertEquals('param=value¶m2=value2', $requestContent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user