Skip to content

Commit

Permalink
Safe unlink to avoid warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomohass committed Feb 7, 2023
1 parent d7b325b commit 4cb09b4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
9 changes: 7 additions & 2 deletions tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ public function setUp(): void

public function tearDown(): void
{
unlink(static::$in);
unlink(static::$ou);
// Make sure we clean up after ourselves:
if (file_exists(static::$in)) {
unlink(static::$in);
}
if (file_exists(static::$ou)) {
unlink(static::$ou);
}
}

public function test_new()
Expand Down
5 changes: 4 additions & 1 deletion tests/CliTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public function tearDown(): void

public static function tearDownAfterClass(): void
{
unlink(static::$ou);
// Make sure we clean up after ourselves:
if (file_exists(static::$ou)) {
unlink(static::$ou);
}
}

public function buffer()
Expand Down
5 changes: 4 additions & 1 deletion tests/Helper/OutputHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public function setUp(): void

public static function tearDownAfterClass(): void
{
unlink(static::$ou);
// Make sure we clean up after ourselves:
if (file_exists(static::$ou)) {
unlink(static::$ou);
}
}

public function test_show_arguments()
Expand Down
9 changes: 7 additions & 2 deletions tests/IO/InteractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ public function setUp(): void

public function tearDown(): void
{
unlink(static::$in);
unlink(static::$ou);
// Make sure we clean up after ourselves:
if (file_exists(static::$in)) {
unlink(static::$in);
}
if (file_exists(static::$ou)) {
unlink(static::$ou);
}
}

public function test_components()
Expand Down
5 changes: 4 additions & 1 deletion tests/Input/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public function setUp(): void

public static function tearDownAfterClass(): void
{
unlink(static::$in);
// Make sure we clean up after ourselves:
if (file_exists(static::$in)) {
unlink(static::$in);
}
}

public function test_default()
Expand Down

0 comments on commit 4cb09b4

Please sign in to comment.