jonnybarnes.uk/tests/TestCase.php

27 lines
596 B
PHP
Raw Normal View History

2016-05-19 15:01:28 +01:00
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Facades\Http;
abstract class TestCase extends BaseTestCase
2016-05-19 15:01:28 +01:00
{
use CreatesApplication;
protected function setUp(): void
{
parent::setUp();
Http::preventStrayRequests();
}
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);
}
}
2016-05-19 15:01:28 +01:00
}