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 |
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
|
|
|
|