@@ -24,6 +24,7 @@ final class GeneratorTest extends TestCase
2424 private string $ docsFolder = __DIR__ .'/Fixtures/ ' ;
2525
2626 private string $ docsFile = __DIR__ .'/Fixtures/index.html ' ;
27+ private string $ specificationFile = __DIR__ .'/Fixtures/specification.json ' ;
2728
2829 /** @var Environment|MockObject */
2930 private Environment |MockObject $ twig ;
@@ -41,6 +42,7 @@ protected function setUp(): void
4142 $ this ->parser = $ this ->createMock (ConfigParser::class);
4243 $ this ->filesystem = new Filesystem ();
4344 $ this ->filesystem ->dumpFile ($ this ->docsFile , '' );
45+ $ this ->filesystem ->dumpFile ($ this ->specificationFile , '' );
4446
4547 $ this ->generator = new Generator ($ this ->twig , $ this ->parser , $ this ->docsFolder );
4648 }
@@ -54,11 +56,12 @@ protected function tearDown(): void
5456 );
5557
5658 $ this ->filesystem ->remove ($ this ->docsFile );
59+ $ this ->filesystem ->remove ($ this ->specificationFile );
5760 }
5861
5962 public function testGenerate (): void
6063 {
61- $ swaggerConfig = ['open api config ' ];
64+ $ swaggerConfig = ['open api config ' => ' value ' ];
6265
6366 $ this ->parser
6467 ->expects (self ::once ())
@@ -76,6 +79,13 @@ public function testGenerate(): void
7679
7780 $ this ->generator ->generate ();
7881
82+ $ swaggerConfigAsJson = <<<'EOT'
83+ {
84+ "open api config": "value"
85+ }
86+ EOT;
87+
7988 self ::assertStringEqualsFile ($ this ->docsFolder .'index.html ' , $ docs );
89+ self ::assertStringEqualsFile ($ this ->docsFolder .'specification.json ' , $ swaggerConfigAsJson );
8090 }
8191}
0 commit comments