1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +12:00

Merge branch '0.9.x' into feat-sb-collection

This commit is contained in:
Damodar Lohani 2021-06-14 17:06:59 +05:45
commit 0b4a840161

View file

@ -94,33 +94,33 @@ class HTTPTest extends Scope
$this->assertStringContainsString('# robotstxt.org/', $response['body']); $this->assertStringContainsString('# robotstxt.org/', $response['body']);
} }
public function testSpecSwagger2() // public function testSpecSwagger2()
{ // {
$response = $this->client->call(Client::METHOD_GET, '/specs/swagger2?platform=client', [ // $response = $this->client->call(Client::METHOD_GET, '/specs/swagger2?platform=client', [
'content-type' => 'application/json', // 'content-type' => 'application/json',
], []); // ], []);
if(!file_put_contents(__DIR__ . '/../../resources/swagger2.json', json_encode($response['body']))) { // if(!file_put_contents(__DIR__ . '/../../resources/swagger2.json', json_encode($response['body']))) {
throw new Exception('Failed to save spec file'); // throw new Exception('Failed to save spec file');
} // }
$client = new Client(); // $client = new Client();
$client->setEndpoint('https://validator.swagger.io'); // $client->setEndpoint('https://validator.swagger.io');
/** // /**
* Test for SUCCESS // * Test for SUCCESS
*/ // */
$response = $client->call(Client::METHOD_POST, '/validator/debug', [ // $response = $client->call(Client::METHOD_POST, '/validator/debug', [
'content-type' => 'application/json', // 'content-type' => 'application/json',
], json_decode(file_get_contents(realpath(__DIR__ . '/../../resources/swagger2.json')), true)); // ], json_decode(file_get_contents(realpath(__DIR__ . '/../../resources/swagger2.json')), true));
$response['body'] = json_decode($response['body'], true); // $response['body'] = json_decode($response['body'], true);
$this->assertEquals(200, $response['headers']['status-code']); // $this->assertEquals(200, $response['headers']['status-code']);
$this->assertTrue(empty($response['body'])); // $this->assertTrue(empty($response['body']));
unlink(realpath(__DIR__ . '/../../resources/swagger2.json')); // unlink(realpath(__DIR__ . '/../../resources/swagger2.json'));
} // }
public function testSpecOpenAPI3() public function testSpecOpenAPI3()
{ {
@ -209,4 +209,4 @@ class HTTPTest extends Scope
$this->assertIsString($body['server-ruby']); $this->assertIsString($body['server-ruby']);
$this->assertIsString($body['server-cli']); $this->assertIsString($body['server-cli']);
} }
} }