diff --git a/config/auto-doc.php b/config/auto-doc.php index 3dbda2b7..6a43b1fc 100644 --- a/config/auto-doc.php +++ b/config/auto-doc.php @@ -47,7 +47,7 @@ 'title' => env('APP_NAME', 'Name of Your Application'), 'termsOfService' => '', 'contact' => [ - 'email' => null + 'email' => null, ], 'license' => [ 'name' => '', @@ -208,7 +208,7 @@ | The waiting time between attempts to write to the temporary documentation file while the file is locked */ 'wait_time' => 500, - ] + ], ], 'config_version' => '2.9', diff --git a/tests/LocalDriverTest.php b/tests/LocalDriverTest.php index 8178a325..07c183b1 100755 --- a/tests/LocalDriverTest.php +++ b/tests/LocalDriverTest.php @@ -2,7 +2,6 @@ namespace RonasIT\AutoDoc\Tests; -use Illuminate\Support\Facades\ParallelTesting; use RonasIT\AutoDoc\Drivers\LocalDriver; use Illuminate\Contracts\Filesystem\FileNotFoundException; use RonasIT\AutoDoc\Exceptions\MissedProductionFilePathException; @@ -38,11 +37,9 @@ public function testSaveProcessTmpData() public function testSaveProcessTmpDataCheckTokenBasedPath() { - $token = 'workerID'; + $this->mockParallelTestingToken(); - ParallelTesting::resolveTokenUsing(fn () => $token); - - $processTempFilePath = __DIR__ . "/../storage/temp_documentation_{$token}.json"; + $processTempFilePath = __DIR__ . '/../storage/temp_documentation_workerID.json'; app(LocalDriver::class)->saveProcessTmpData(self::$tmpData); diff --git a/tests/SwaggerServiceTest.php b/tests/SwaggerServiceTest.php index 1b9f4926..51ed48f4 100644 --- a/tests/SwaggerServiceTest.php +++ b/tests/SwaggerServiceTest.php @@ -3,7 +3,6 @@ namespace RonasIT\AutoDoc\Tests; use Illuminate\Http\Testing\File; -use Illuminate\Support\Facades\ParallelTesting; use PHPUnit\Framework\Attributes\DataProvider; use RonasIT\AutoDoc\Exceptions\EmptyContactEmailException; use RonasIT\AutoDoc\Exceptions\InvalidDriverClassException; @@ -923,9 +922,7 @@ public function testAddDataDescriptionForRouteConditionals() public function testMergeTempDocumentation() { - $token = 'workerID'; - - ParallelTesting::resolveTokenUsing(fn () => $token); + $this->mockParallelTestingToken(); $tempFilePath = __DIR__ . '/../storage/temp_documentation.json'; diff --git a/tests/TestCase.php b/tests/TestCase.php index a72c09ea..91706921 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,6 +5,7 @@ use Illuminate\Filesystem\Filesystem; use Illuminate\Http\Request; use Illuminate\Support\Arr; +use Illuminate\Support\Facades\ParallelTesting; use Illuminate\Support\Facades\Route; use Illuminate\Testing\TestResponse; use Orchestra\Testbench\TestCase as BaseTest; @@ -198,4 +199,9 @@ protected function addGlobalPrefix($prefix = '/global') $this->setUp(); } + + protected function mockParallelTestingToken(string $token = 'workerID'): void + { + ParallelTesting::resolveTokenUsing(fn () => $token); + } }