Passed
Pull Request — master (#15)
by Dmitriy
13:06
created

PluginTestCase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
eloc 7
c 4
b 0
f 0
dl 0
loc 17
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFromConfig() 0 3 1
A registerConfig() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Composer\Config\Tests\Integration\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Composer\Config\Builder;
9
10
abstract class PluginTestCase extends TestCase
11
{
12
    private const BASE_DIRECTORY = __DIR__ . '/../Environment';
13
14
    private static array $configs = [];
15
16
    protected function registerConfig(string $name): void
17
    {
18
        if ((self::$configs[$name] ?? []) !== []) {
19
            return;
20
        }
21
        self::$configs[$name] = require Builder::path($name, self::BASE_DIRECTORY);
22
    }
23
24
    protected function getFromConfig(string $config, string $name)
25
    {
26
        return self::$configs[$config][$name];
27
    }
28
}
29