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

StringAssertionsTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertSameAllowingExtraNewLine() 0 11 1
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