jonnybarnes.uk/tests/TestCase.php
Jonny Barnes d7da42b626
Some checks failed
PHP Unit / PHPUnit test suite (pull_request) Has been cancelled
Laravel Pint / Laravel Pint (pull_request) Has been cancelled
Host images locally
We don’t need the complexity of S3. Sepcifically the complexity of
managing my own AWS account, flysystem made the Laravel side easy.

A command is added to copy the the S3 files over to local storage.
2024-10-25 20:40:52 +01:00

19 lines
445 B
PHP

<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
public function removeDirIfEmpty(string $dir): void
{
// scandir() will always return `.` and `..` so even an “empty”
// directory will have a count of 2
if (is_dir($dir) && count(scandir($dir)) === 2) {
rmdir($dir);
}
}
}