Skip to content

Commit 2876e4a

Browse files
committed
Finish the test
1 parent 0c532a7 commit 2876e4a

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

tests/WriterTest.php

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testWriteEmptySecurityPartYaml()
195195

196196
public function testSecurity()
197197
{
198-
$openapi = new OpenApi([
198+
$openapi = $this->createOpenAPI([
199199
'components' => new Components([
200200
'securitySchemes' => [
201201
'BearerAuth' => new SecurityScheme([
@@ -216,7 +216,29 @@ public function testSecurity()
216216
]
217217
]);
218218

219-
$result = json_decode(json_encode($openapi->getSerializableData()), true);
220-
$this->assertTrue($result);
219+
$yaml = \cebe\openapi\Writer::writeToYaml($openapi);
220+
221+
222+
$this->assertEquals(preg_replace('~\R~', "\n", <<<YAML
223+
openapi: 3.0.0
224+
info:
225+
title: 'Test API'
226+
version: 1.0.0
227+
paths:
228+
/test:
229+
get:
230+
security:
231+
BearerAuth: { }
232+
components:
233+
securitySchemes:
234+
BearerAuth:
235+
type: http
236+
scheme: bearer
237+
bearerFormat: 'AuthToken and JWT Format'
238+
239+
YAML
240+
),
241+
$yaml
242+
);
221243
}
222244
}

0 commit comments

Comments
 (0)