Skip to content

Commit 0fd52fb

Browse files
committed
test: fixup: follow GNU's diff output
Signed-off-by: Jack Cherng <[email protected]>
1 parent f8c08d0 commit 0fd52fb

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

tests/IgnoreWhitespaceTest.php

+21-11
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
use Jfcherng\Diff\Renderer\RendererConstant;
99
use PHPUnit\Framework\TestCase;
1010

11-
class IgnoreWhitespaceTest extends TestCase
11+
/**
12+
* @internal
13+
*
14+
* @coversNothing
15+
*/
16+
final class IgnoreWhitespaceTest extends TestCase
1217
{
13-
1418
public function testIgnoreWhitespaces(): void
1519
{
1620
$old = <<<'PHP'
@@ -24,6 +28,7 @@ function foo(\DateTimeImmutable $date)
2428
echo 'bar';
2529
}
2630
}
31+
2732
PHP;
2833
$new = <<<'PHP'
2934
<?php
@@ -32,24 +37,29 @@ function foo(\DateTimeImmutable $date)
3237
{
3338
echo 'foo';
3439
}
40+
3541
PHP;
3642

37-
$diff = DiffHelper::calculate($old, $new, 'Unified', [
38-
'ignoreWhitespace' => true,
39-
], [
40-
'cliColorization' => RendererConstant::CLI_COLOR_DISABLE,
41-
]);
42-
$this->assertSame(<<<'DIFF'
43+
$expected = <<<'DIFF'
4344
@@ -2,9 +2,5 @@
44-
45+
4546
function foo(\DateTimeImmutable $date)
4647
{
4748
- if ($date) {
48-
echo 'foo';
49+
echo 'foo';
4950
- } else {
5051
- echo 'bar';
5152
- }
5253
}
53-
DIFF, $diff);
54+
55+
DIFF;
56+
57+
$diff = DiffHelper::calculate($old, $new, 'Unified', [
58+
'ignoreWhitespace' => true,
59+
], [
60+
'cliColorization' => RendererConstant::CLI_COLOR_DISABLE,
61+
]);
62+
63+
static::assertSame($expected, $diff);
5464
}
5565
}

0 commit comments

Comments
 (0)