Passed
Push — master ( 14a42b...4e4f6b )
by Andrii
02:16
created

ConfigFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkCreate() 0 6 1
A testCreate() 0 8 1
1
<?php
2
/**
3
 * Composer plugin for config assembling
4
 *
5
 * @link      https://github.com/hiqdev/composer-config-plugin
6
 * @package   composer-config-plugin
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\composer\config\tests\unit\configs;
12
13
use hiqdev\composer\config\Builder;
14
use hiqdev\composer\config\configs\Config;
15
use hiqdev\composer\config\configs\ConfigFactory;
16
use hiqdev\composer\config\configs\Defines;
17
use hiqdev\composer\config\configs\Params;
18
use hiqdev\composer\config\configs\System;
19
20
/**
21
 * ConfigFactoryTest.
22
 */
23
class ConfigFactoryTest extends \PHPUnit\Framework\TestCase
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
{
25
    protected $builder;
26
27
    public function testCreate()
28
    {
29
        $this->builder = new Builder();
30
31
        $this->checkCreate('common',    Config::class);
32
        $this->checkCreate('defines',   Defines::class);
33
        $this->checkCreate('params',    Params::class);
34
        $this->checkCreate('__files',   System::class);
35
    }
36
37
    public function checkCreate(string $name, string $class)
38
    {
39
        $config = ConfigFactory::create($this->builder, $name);
40
        $this->assertInstanceOf($class, $config);
41
        $this->assertSame($this->builder, $config->getBuilder());
42
        $this->assertSame($name, $config->getName());
43
    }
44
}
45