Completed
Push — master ( 41ae82...437c90 )
by Dave
13s queued 11s
created

assertSameAllowingExtraNewLine()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 11
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DaveLiddament\StaticAnalysisResultsBaseliner\Tests\Helpers;
6
7
use PHPUnit\Framework\Assert;
8
9
trait StringAssertionsTrait
10
{
11
    private function assertSameAllowingExtraNewLine(string $expectedValue, string $actualValue): void
12
    {
13
        // Depending on version of Command/CommandTester a PHP_EOL is added.
14
        // In this context and extra PHP_EOL make no difference. Benefit of allowing both is a greater range of
15
        // supported versions of Symfony/Command.
16
        $validResults = [
17
            $expectedValue,
18
            $expectedValue.\PHP_EOL,
19
        ];
20
21
        Assert::assertTrue(in_array($actualValue, $validResults, true));
22
    }
23
}
24