Passed
Push — master ( c0f32c...e879f4 )
by Chema
04:17 queued 41s
created

NotifyCommandTest::testExistingTicker()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
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 PHPUnit\Framework\TestCase;
9
use Symfony\Component\Console\Command\Command;
10
use Symfony\Component\Console\Input\StringInput;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
final class NotifyCommandTest extends TestCase
14
{
15
    public function testExistingTicker(): void
16
    {
17
        $actual = $this->runCommand('GM --channels=fake --maxNews=1 --maxRepetitions=1 --sleepingTime=0');
18
        self::assertSame(Command::SUCCESS, $actual);
19
    }
20
21
    public function testNonExistingTicker(): void
22
    {
23
        $actual = $this->runCommand('UNKNOWN_TICKER --channels=fake --maxNews=1 --maxRepetitions=1 --sleepingTime=0');
24
        self::assertSame(Command::SUCCESS, $actual);
25
    }
26
27
    private function runCommand(string $inputString): int
28
    {
29
        return (new NotifyCommand())->run(
30
            new StringInput($inputString),
31
            $this->createMock(OutputInterface::class)
32
        );
33
    }
34
}
35