File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,11 @@ public function __construct()
1616
1717 $ this ->config = config ('auto-doc.drivers.local ' );
1818
19- $ directory = str_ends_with ($ this ->config ['directory ' ], DIRECTORY_SEPARATOR )
19+ $ directory = ( str_ends_with ($ this ->config ['directory ' ], DIRECTORY_SEPARATOR ) )
2020 ? $ this ->config ['directory ' ]
2121 : $ this ->config ['directory ' ] . DIRECTORY_SEPARATOR ;
2222
23- $ this ->mainFilePath = storage_path ("$ directory {$ this ->config ['base_file_name ' ]}.json " );
23+ $ this ->mainFilePath = storage_path ("{ $ directory} {$ this ->config ['base_file_name ' ]}.json " );
2424
2525 if (empty ($ this ->config ['base_file_name ' ]) || !str_ends_with ($ this ->mainFilePath , '.json ' )) {
2626 throw new MissedProductionFilePathException ();
@@ -30,6 +30,7 @@ public function __construct()
3030 public function saveData (): void
3131 {
3232 $ documentationDirectory = storage_path ($ this ->config ['directory ' ]);
33+
3334 if (!is_dir ($ documentationDirectory )) {
3435 mkdir ($ documentationDirectory );
3536 }
Original file line number Diff line number Diff line change @@ -20,13 +20,13 @@ public function __construct()
2020 $ this ->config = config ('auto-doc.drivers.storage ' );
2121 $ this ->disk = Storage::disk ($ this ->config ['disk ' ]);
2222
23- $ directory = str_ends_with ($ this ->config ['directory ' ], DIRECTORY_SEPARATOR )
23+ $ directory = ( str_ends_with ($ this ->config ['directory ' ], DIRECTORY_SEPARATOR ) )
2424 ? $ this ->config ['directory ' ]
2525 : $ this ->config ['directory ' ] . DIRECTORY_SEPARATOR ;
2626
27- $ this ->mainFilePath = "$ directory {$ this ->config ['base_file_name ' ]}.json " ;
27+ $ this ->mainFilePath = "{ $ directory} {$ this ->config ['base_file_name ' ]}.json " ;
2828
29- if (! preg_match ( ' /\/[\w]+\.json/ms ' , $ this ->mainFilePath )) {
29+ if (empty ( $ this -> config [ ' base_file_name ' ]) || ! str_ends_with ( $ this ->mainFilePath , ' .json ' )) {
3030 throw new MissedProductionFilePathException ();
3131 }
3232 }
Original file line number Diff line number Diff line change @@ -12,22 +12,18 @@ class AutoDocControllerTest extends TestCase
1212 use PHPMock;
1313
1414 protected static array $ documentation ;
15- protected static string $ baseFile ;
1615
1716 public function setUp (): void
1817 {
1918 parent ::setUp ();
2019
21- $ documentationDirectory = config ('auto-doc.drivers.local.directory ' );
22-
23- self ::$ baseFile ??= $ documentationDirectory .'/documentation.json ' ;
2420 self ::$ documentation ??= $ this ->getJsonFixture ('tmp_data ' );
2521
26- if (!is_dir (storage_path ($ documentationDirectory ))) {
27- mkdir (storage_path ($ documentationDirectory ));
22+ if (!is_dir (storage_path (' documentations ' ))) {
23+ mkdir (storage_path (' documentations ' ));
2824 }
2925
30- file_put_contents (storage_path (self :: $ baseFile ), json_encode (self ::$ documentation ));
26+ file_put_contents (storage_path (' documentations/documentation.json ' ), json_encode (self ::$ documentation ));
3127
3228 config (['auto-doc.drivers.local.base_file_name ' => 'documentation ' ]);
3329 }
You can’t perform that action at this time.
0 commit comments