JimChenWYU /
composer-config-plugin
| 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\readers\EnvReader; |
||
| 15 | use hiqdev\composer\config\readers\JsonReader; |
||
| 16 | use hiqdev\composer\config\readers\PhpReader; |
||
| 17 | use hiqdev\composer\config\readers\ReaderFactory; |
||
| 18 | use hiqdev\composer\config\readers\YamlReader; |
||
| 19 | use hiqdev\composer\config\tests\unit\TestCase; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * ReaderFactoryTest. |
||
| 23 | */ |
||
| 24 | class ReaderFactoryTest extends TestCase |
||
| 25 | { |
||
| 26 | protected $builder; |
||
| 27 | |||
| 28 | public function testCreate() |
||
| 29 | { |
||
| 30 | $this->builder = new Builder(); |
||
| 31 | |||
| 32 | $env = $this->checkGet('.env', EnvReader::class); |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 33 | $json = $this->checkGet('.json', JsonReader::class); |
||
|
0 ignored issues
–
show
|
|||
| 34 | $yml = $this->checkGet('.yml', YamlReader::class); |
||
| 35 | $yaml = $this->checkGet('.yaml', YamlReader::class); |
||
| 36 | $php = $this->checkGet('.php', PhpReader::class); |
||
| 37 | $php2 = $this->checkGet('.php', PhpReader::class); |
||
| 38 | |||
| 39 | $this->assertSame($php, $php2); |
||
| 40 | $this->assertSame($yml, $yaml); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function checkGet($name, $class) |
||
| 44 | { |
||
| 45 | $reader = ReaderFactory::get($this->builder, $name); |
||
| 46 | $this->assertInstanceOf($class, $reader); |
||
| 47 | $this->assertSame($this->builder, $reader->getBuilder()); |
||
| 48 | |||
| 49 | return $reader; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |