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

ConfigTest::testForcedSequence()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
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