| Total Complexity | 3 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class Assert |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Asserts that two strings equality ignoring line endings. |
||
| 14 | * |
||
| 15 | * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException |
||
| 16 | * @throws ExpectationFailedException |
||
| 17 | */ |
||
| 18 | 12 | public static function assertEqualStringsIgnoringLineEndings( |
|
| 19 | string $expected, |
||
| 20 | string $actual, |
||
| 21 | string $message = '' |
||
| 22 | ): void { |
||
| 23 | 12 | $expected = self::normalizeLineEndings($expected); |
|
| 24 | 12 | $actual = self::normalizeLineEndings($actual); |
|
| 25 | |||
| 26 | 12 | PhpUnitAssert::assertEquals($expected, $actual, $message); |
|
| 27 | 9 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException |
||
| 31 | * @throws ExpectationFailedException |
||
| 32 | */ |
||
| 33 | 3 | public static function assertStringContainsStringIgnoringLineEndings( |
|
| 34 | string $needle, |
||
| 35 | string $haystack, |
||
| 36 | string $message = '' |
||
| 37 | ): void { |
||
| 38 | 3 | $needle = self::normalizeLineEndings($needle); |
|
| 39 | 3 | $haystack = self::normalizeLineEndings($haystack); |
|
| 40 | |||
| 41 | 3 | PhpUnitAssert::assertStringContainsString($needle, $haystack, $message); |
|
| 42 | 2 | } |
|
| 43 | |||
| 44 | 15 | private static function normalizeLineEndings(string $value): string |
|
| 49 | ]); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |