Passed
Push — master ( ed42e4...b3b06a )
by Kirill
04:44
created

ConfigTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testForcedSequence() 0 9 1
A testBadSequence() 0 11 1
1
<?php
2
3
/**
4
 * Spiral Framework, SpiralScout LLC.
5
 *
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
9
declare(strict_types=1);
10
11
namespace Spiral\Tests\Console;
12
13
use PHPUnit\Framework\TestCase;
14
use Spiral\Console\Config\ConsoleConfig;
15
use Spiral\Console\Exception\ConfigException;
16
use Spiral\Console\Sequence\CallableSequence;
17
18
class ConfigTest extends TestCase
19
{
20
    public function testBadSequence(): void
21
    {
22
        $this->expectException(ConfigException::class);
23
24
        $config = new ConsoleConfig([
25
            'updateSequence' => [
26
                $this,
27
            ],
28
        ]);
29
30
        iterator_to_array($config->updateSequence());
31
    }
32
33
    public function testForcedSequence(): void
34
    {
35
        $config = new ConsoleConfig([
36
            'updateSequence' => [
37
                new CallableSequence('test'),
38
            ],
39
        ]);
40
41
        $this->assertCount(1, iterator_to_array($config->updateSequence()));
42
    }
43
}
44