ConfigFactoryTest::testCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
use hiqdev\composer\config\tests\unit\TestCase;
20
21
/**
22
 * ConfigFactoryTest.
23
 */
24
class ConfigFactoryTest extends TestCase
25
{
26
    protected $builder;
27
28
    public function testCreate()
29
    {
30
        $this->builder = new Builder();
31
32
        $this->checkCreate('common',    Config::class);
33
        $this->checkCreate('defines',   Defines::class);
34
        $this->checkCreate('params',    Params::class);
35
        $this->checkCreate('__files',   System::class);
36
    }
37
38
    public function checkCreate($name, $class)
39
    {
40
        $config = ConfigFactory::create($this->builder, $name);
41
        $this->assertInstanceOf($class, $config);
42
        $this->assertSame($this->builder, $config->getBuilder());
43
        $this->assertSame($name, $config->getName());
44
    }
45
}
46