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

CoreTest::testWelcome()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 14
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 Spiral\Console\StaticLocator;
14
use Spiral\Tests\Console\Fixtures\TestCommand;
15
use Symfony\Component\Console\Input\ArrayInput;
16
use Symfony\Component\Console\Output\BufferedOutput;
17
18
class CoreTest extends BaseTest
19
{
20
    public function testWelcome(): void
21
    {
22
        $core = $this->getCore(new StaticLocator([
23
            TestCommand::class
24
        ]));
25
26
        $this->assertSame(
27
            'Hello World - 0',
28
            $core->run('test')->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

28
            $core->run('test')->getOutput()->/** @scrutinizer ignore-call */ fetch()
Loading history...
29
        );
30
31
        $this->assertSame(
32
            'Hello World - 1',
33
            $core->run('test')->getOutput()->fetch()
34
        );
35
    }
36
37
    public function testStart(): void
38
    {
39
        $core = $this->getCore(new StaticLocator([
40
            TestCommand::class
41
        ]));
42
43
        $output = new BufferedOutput();
44
45
        $core->start(new ArrayInput([]), $output);
46
        $output = $output->fetch();
47
48
        $this->assertStringContainsString('Spiral Framework', $output);
49
        $this->assertStringContainsString('Test Command', $output);
50
        $this->assertStringContainsString('test:user', $output);
51
    }
52
}
53