Passed
Push — master ( abee1f...edc958 )
by Kirill
03:08
created

BaseTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 6
dl 0
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A getFactory() 0 7 2
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Config;
13
14
use PHPUnit\Framework\TestCase;
15
use Spiral\Config\ConfigManager;
16
use Spiral\Config\Loader\DirectoryLoader;
17
use Spiral\Core\Container;
18
19
abstract class BaseTest extends TestCase
20
{
21
    /**
22
     * @var Container
23
     */
24
    protected $container;
25
26
    public function setUp(): void
27
    {
28
        $this->container = new Container();
29
    }
30
31
    protected function getFactory(string $directory = null, bool $strict = true): ConfigManager
32
    {
33
        if (is_null($directory)) {
34
            $directory = __DIR__ . '/fixtures';
35
        }
36
37
        return new ConfigManager(new DirectoryLoader($directory, $this->container), $strict);
38
    }
39
}
40