MarkdownPipedToSymfonyConsoleFormatterTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testWrite() 0 32 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\MarkdownPipedToSymfonyConsoleFormatter;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * @covers \Roave\BackwardCompatibility\Formatter\MarkdownPipedToSymfonyConsoleFormatter
15
 */
16
final class MarkdownPipedToSymfonyConsoleFormatterTest extends TestCase
17
{
18
    public function testWrite() : void
19
    {
20
        $output = $this->createMock(OutputInterface::class);
21
22
        $changeToExpect = <<<EOF
23
# Added
24
 - [BC] Something added
25
 - Something added
26
27
# Changed
28
 - [BC] Something changed
29
 - Something changed
30
31
# Removed
32
 - [BC] Something removed
33
 - Something removed
34
35
EOF;
36
37
        $output->expects(self::once())
38
            ->method('writeln')
39
            ->willReturnCallback(static function (string $output) use ($changeToExpect) : void {
40
                self::assertStringContainsString($changeToExpect, $output);
41
            });
42
43
        (new MarkdownPipedToSymfonyConsoleFormatter($output))->write(Changes::fromList(
44
            Change::added('Something added', true),
45
            Change::added('Something added', false),
46
            Change::changed('Something changed', true),
47
            Change::changed('Something changed', false),
48
            Change::removed('Something removed', true),
49
            Change::removed('Something removed', false)
50
        ));
51
    }
52
}
53