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:
Akihito Nakano
2018-04-21 19:13:45 +09:00
committed by William Cheng
parent 856ed05b00
commit 1f0bed2a0c
101 changed files with 810 additions and 638 deletions

View File

@@ -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&param2=value2', $requestContent);
}
}