Passed
Pull Request — master (#50)
by Marco
02:46
created

SymfonyConsoleTextFormatterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWrite() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace RoaveTest\BackwardCompatibility\Formatter;
6
7
use PHPUnit\Framework\TestCase;
8
use Roave\BackwardCompatibility\Change;
9
use Roave\BackwardCompatibility\Changes;
10
use Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter;
11
use Symfony\Component\Console\Output\OutputInterface;
12
use function sprintf;
13
use function uniqid;
14
15
/**
16
 * @covers \Roave\BackwardCompatibility\Formatter\SymfonyConsoleTextFormatter
17
 */
18
final class SymfonyConsoleTextFormatterTest extends TestCase
19
{
20
    /**
21
     * @throws \ReflectionException
22
     */
23
    public function testWrite() : void
24
    {
25
        $change1Text = uniqid('change1', true);
26
        $change2Text = uniqid('change2', true);
27
28
        $output = $this->createMock(OutputInterface::class);
29
        $output->expects(self::at(0))
30
            ->method('writeln')
31
            ->with(sprintf('[BC] REMOVED: %s', $change1Text));
32
        $output->expects(self::at(1))
33
            ->method('writeln')
34
            ->with(sprintf('     ADDED: %s', $change2Text));
35
36
        (new SymfonyConsoleTextFormatter($output))->write(Changes::fromList(
37
            Change::removed($change1Text, true),
38
            Change::added($change2Text, false)
39
        ));
40
    }
41
}
42