| Total Complexity | 9 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | abstract class TestCase extends BaseTestCase |
||
| 15 | { |
||
| 16 | use CreatesApplication; |
||
| 17 | use ResetsApplication; |
||
| 18 | |||
| 19 | protected static bool $booted = false; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Setup the test environment. |
||
| 23 | * |
||
| 24 | * @return void |
||
| 25 | */ |
||
| 26 | protected function setUp(): void |
||
| 27 | { |
||
| 28 | parent::setUp(); |
||
| 29 | |||
| 30 | if (! static::$booted) { |
||
| 31 | $this->resetApplication(); |
||
| 32 | |||
| 33 | Hyde::macro('touch', function (string|array $path) { |
||
| 34 | if (is_array($path)) { |
||
|
|
|||
| 35 | foreach ($path as $p) { |
||
| 36 | touch(Hyde::path($p)); |
||
| 37 | } |
||
| 38 | } else { |
||
| 39 | return touch(Hyde::path($path)); |
||
| 40 | } |
||
| 41 | }); |
||
| 42 | |||
| 43 | Hyde::macro('unlink', function (string|array $path) { |
||
| 44 | if (is_array($path)) { |
||
| 45 | foreach ($path as $p) { |
||
| 46 | unlink(Hyde::path($p)); |
||
| 47 | } |
||
| 48 | } else { |
||
| 49 | return unlink(Hyde::path($path)); |
||
| 50 | } |
||
| 51 | }); |
||
| 52 | |||
| 53 | static::$booted = true; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Clean up the testing environment before the next test. |
||
| 59 | * |
||
| 60 | * @return void |
||
| 61 | */ |
||
| 62 | protected function tearDown(): void |
||
| 63 | { |
||
| 64 | parent::tearDown(); |
||
| 65 | } |
||
| 66 | |||
| 67 | /** @internal */ |
||
| 68 | protected function mockRoute(?Route $route = null) |
||
| 71 | } |
||
| 72 | |||
| 73 | /** @internal */ |
||
| 74 | protected function mockPage(?PageContract $page = null, ?string $currentPage = null) |
||
| 78 | } |
||
| 79 | } |
||
| 80 |