Skip to content

Commit

Permalink
test: Delete temporary directory in test bench
Browse files Browse the repository at this point in the history
  • Loading branch information
DevDavido committed Jan 2, 2024
1 parent 7da5ce0 commit 928f118
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ protected function setUp(): void
$this->setUpGlobalMiddleware();
}

protected function tearDown(): void
{
parent::tearDown();

$this->deleteDirectory($this->getTempDirectory());
}

protected function initializeDirectory($directory): void
{
if (File::isDirectory($directory)) {
Expand All @@ -35,6 +42,13 @@ protected function initializeDirectory($directory): void
File::makeDirectory($directory);
}

protected function deleteDirectory($directory): void
{
if (File::isDirectory($directory)) {
File::deleteDirectory($directory);
}
}

protected function getTempDirectory($suffix = ''): string
{
return __DIR__.'/temp'.($suffix == '' ? '' : $this->uri.$suffix);
Expand Down

0 comments on commit 928f118

Please sign in to comment.