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

OptionsTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testOptions() 0 19 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 Spiral\Console\StaticLocator;
14
use Spiral\Tests\Console\Fixtures\OptionalCommand;
15
16
class OptionsTest extends BaseTest
17
{
18
    public function testOptions(): void
19
    {
20
        $core = $this->getCore(new StaticLocator([
21
            OptionalCommand::class
22
        ]));
23
24
        $this->assertSame(
25
            'no option',
26
            $core->run('optional')->getOutput()->fetch()
0 ignored issues
show
Bug introduced by
The method fetch() does not exist on Symfony\Component\Console\Output\OutputInterface. It seems like you code against a sub-type of Symfony\Component\Console\Output\OutputInterface such as Symfony\Component\Console\Output\BufferedOutput. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
            $core->run('optional')->getOutput()->/** @scrutinizer ignore-call */ fetch()
Loading history...
27
        );
28
29
        $this->assertSame(
30
            'hello',
31
            $core->run('optional', ['-o' => true, 'arg' => 'hello'])->getOutput()->fetch()
32
        );
33
34
        $this->assertSame(
35
            0,
36
            $core->run('optional', ['-o' => true, 'arg' => 'hello'])->getCode()
37
        );
38
    }
39
}
40