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

BaseTest::getFactory()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 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