Passed
Push — master ( 3d7573...185723 )
by Caen
03:55 queued 13s
created

UnitTestCase::needsKernel()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Testing;
6
7
use Hyde\Foundation\HydeKernel;
8
use PHPUnit\Framework\TestCase as BaseTestCase;
9
10
abstract class UnitTestCase extends BaseTestCase
11
{
12
    protected static bool $hasSetUpKernel = false;
13
14
    protected function needsKernel(): void
15
    {
16
        if (! self::$hasSetUpKernel) {
17
            $this->setupKernel();
18
        }
19
    }
20
21
    protected function setupKernel(): void
22
    {
23
        HydeKernel::setInstance(new HydeKernel());
24
        self::$hasSetUpKernel = true;
25
    }
26
}
27