Skip to content

Commit ee90fc7

Browse files
committed
Set empty directory in AutoDocControllerTest;
Force set documentation directory as empty for AutoDocControllerTest;
1 parent ebef239 commit ee90fc7

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tests/AutoDocControllerTest.php

+14-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ public function setUp(): void
1919

2020
self::$documentation ??= $this->getJsonFixture('tmp_data');
2121

22-
if (!is_dir(storage_path('documentations'))) {
23-
mkdir(storage_path('documentations'));
24-
}
25-
26-
file_put_contents(storage_path('documentations/documentation.json'), json_encode(self::$documentation));
22+
file_put_contents(storage_path('documentation.json'), json_encode(self::$documentation));
2723

24+
config(['auto-doc.drivers.local.directory' => '']);
2825
config(['auto-doc.drivers.local.base_file_name' => 'documentation']);
2926
}
3027

@@ -44,6 +41,18 @@ public function testGetJSONDocumentation()
4441
$response->assertJson(self::$documentation);
4542
}
4643

44+
public function testGetJSONDocumentationWithFilledDirectory()
45+
{
46+
file_put_contents(storage_path('documentations/documentation.json'), json_encode(self::$documentation));
47+
config(['auto-doc.drivers.local.directory' => 'documentations']);
48+
49+
$response = $this->json('get', '/auto-doc/documentation');
50+
51+
$response->assertStatus(Response::HTTP_OK);
52+
53+
$response->assertJson(self::$documentation);
54+
}
55+
4756
public function testGetJSONDocumentationWithAdditionalPaths()
4857
{
4958
config([

0 commit comments

Comments
 (0)