99class LocalDriverTest extends TestCase
1010{
1111 protected static LocalDriver $ localDriverClass ;
12+ protected static string $ documentationDirectory ;
1213 protected static string $ productionFilePath ;
1314 protected static string $ tmpDocumentationFilePath ;
1415 protected static array $ tmpData ;
@@ -17,8 +18,9 @@ public function setUp(): void
1718 {
1819 parent ::setUp ();
1920
20- self ::$ productionFilePath ??= __DIR__ . '/../storage/documentation.json ' ;
21- self ::$ tmpDocumentationFilePath ??= __DIR__ . '/../storage/temp_documentation.json ' ;
21+ self ::$ documentationDirectory ??= config ('auto-doc.documentation_directory ' ).DIRECTORY_SEPARATOR ;
22+ self ::$ productionFilePath ??= 'documentation.json ' ;
23+ self ::$ tmpDocumentationFilePath ??= 'temp_documentation.json ' ;
2224
2325 self ::$ tmpData ??= $ this ->getJsonFixture ('tmp_data ' );
2426
@@ -31,13 +33,13 @@ public function testSaveTmpData()
3133 {
3234 self ::$ localDriverClass ->saveTmpData (self ::$ tmpData );
3335
34- $ this ->assertFileExists (self ::$ tmpDocumentationFilePath );
35- $ this ->assertFileEquals ($ this ->generateFixturePath ('tmp_data_non_formatted.json ' ), self ::$ tmpDocumentationFilePath );
36+ $ this ->assertFileExists (self ::$ documentationDirectory . self :: $ tmpDocumentationFilePath );
37+ $ this ->assertFileEquals ($ this ->generateFixturePath ('tmp_data_non_formatted.json ' ), self ::$ documentationDirectory . self :: $ tmpDocumentationFilePath );
3638 }
3739
3840 public function testGetTmpData ()
3941 {
40- file_put_contents (self ::$ tmpDocumentationFilePath , json_encode (self ::$ tmpData ));
42+ file_put_contents (self ::$ documentationDirectory . self :: $ tmpDocumentationFilePath , json_encode (self ::$ tmpData ));
4143
4244 $ result = self ::$ localDriverClass ->getTmpData ();
4345
@@ -69,19 +71,19 @@ public function testGetAndSaveTmpData()
6971
7072 public function testSaveData ()
7173 {
72- file_put_contents (self ::$ tmpDocumentationFilePath , json_encode (self ::$ tmpData ));
74+ file_put_contents (self ::$ documentationDirectory . self :: $ tmpDocumentationFilePath , json_encode (self ::$ tmpData ));
7375
7476 self ::$ localDriverClass ->saveData ();
7577
76- $ this ->assertFileExists (self ::$ productionFilePath );
77- $ this ->assertFileEquals ($ this ->generateFixturePath ('tmp_data_non_formatted.json ' ), self ::$ productionFilePath );
78+ $ this ->assertFileExists (self ::$ documentationDirectory . self :: $ productionFilePath );
79+ $ this ->assertFileEquals ($ this ->generateFixturePath ('tmp_data_non_formatted.json ' ), self ::$ documentationDirectory . self :: $ productionFilePath );
7880
79- $ this ->assertFileDoesNotExist (self ::$ tmpDocumentationFilePath );
81+ $ this ->assertFileDoesNotExist (self ::$ documentationDirectory . self :: $ tmpDocumentationFilePath );
8082 }
8183
8284 public function testGetDocumentation ()
8385 {
84- file_put_contents (self ::$ productionFilePath , json_encode (self ::$ tmpData ));
86+ file_put_contents (self ::$ documentationDirectory . self :: $ productionFilePath , json_encode (self ::$ tmpData ));
8587
8688 $ documentation = self ::$ localDriverClass ->getDocumentation ();
8789
@@ -92,7 +94,7 @@ public function testGetDocumentationFileNotExists()
9294 {
9395 $ this ->expectException (FileNotFoundException::class);
9496
95- config (['auto-doc.drivers.local.production_path ' => 'not_exists_file ' ]);
97+ config (['auto-doc.drivers.local.production_path ' => 'not_exists_file.json ' ]);
9698
9799 (new LocalDriver ())->getDocumentation ();
98100 }
0 commit comments