Skip to content

Commit 928f118

Browse files
committed
test: Delete temporary directory in test bench
1 parent 7da5ce0 commit 928f118

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/TestCase.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ protected function setUp(): void
2626
$this->setUpGlobalMiddleware();
2727
}
2828

29+
protected function tearDown(): void
30+
{
31+
parent::tearDown();
32+
33+
$this->deleteDirectory($this->getTempDirectory());
34+
}
35+
2936
protected function initializeDirectory($directory): void
3037
{
3138
if (File::isDirectory($directory)) {
@@ -35,6 +42,13 @@ protected function initializeDirectory($directory): void
3542
File::makeDirectory($directory);
3643
}
3744

45+
protected function deleteDirectory($directory): void
46+
{
47+
if (File::isDirectory($directory)) {
48+
File::deleteDirectory($directory);
49+
}
50+
}
51+
3852
protected function getTempDirectory($suffix = ''): string
3953
{
4054
return __DIR__.'/temp'.($suffix == '' ? '' : $this->uri.$suffix);

0 commit comments

Comments
 (0)