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