Test Setup Failed
Push — master ( d9a06b...c9d9e0 )
by Chema
03:47
created

NotifyCommandTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTickerTests\Feature\Infrastructure\Command;
6
7
use Chemaclass\StockTicker\Infrastructure\Command\NotifyCommand;
8
use Gacela\Framework\Gacela;
9
use PHPUnit\Framework\TestCase;
10
use Symfony\Component\Console\Command\Command;
11
use Symfony\Component\Console\Input\StringInput;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
final class NotifyCommandTest extends TestCase
15
{
16
    protected function setUp(): void
17
    {
18
        Gacela::bootstrap(__DIR__);
19
    }
20
21
    public function test_existing_ticker(): void
22
    {
23
        $actual = $this->runCommand('GM --channels=fake --maxNews=1 --maxRepetitions=1 --sleepingTime=0');
24
        self::assertSame(Command::SUCCESS, $actual);
25
    }
26
27
    public function test_non_existing_ticker(): void
28
    {
29
        $actual = $this->runCommand('UNKNOWN_TICKER --channels=fake --maxNews=1 --maxRepetitions=1 --sleepingTime=0');
30
        self::assertSame(Command::SUCCESS, $actual);
31
    }
32
33
    private function runCommand(string $inputString): int
34
    {
35
        return (new NotifyCommand())->run(
36
            new StringInput($inputString),
37
            $this->createMock(OutputInterface::class),
38
        );
39
    }
40
}
41