Skip to content

Commit

Permalink
test: tidy codes
Browse files Browse the repository at this point in the history
Signed-off-by: Jack Cherng <[email protected]>
  • Loading branch information
jfcherng committed Mar 11, 2023
1 parent 25d344b commit 77d4dbb
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions tests/IgnoreLineEndingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,16 @@ final class IgnoreLineEndingTest extends TestCase
/**
* @return string[][]
*/
public function provideIgnoreLineEndingTrue(): array
public function provideIgnoreLineEnding(): array
{
return [
[
file_get_contents(__DIR__ . '/data/ignore_line_ending/old_1.txt'),
file_get_contents(__DIR__ . '/data/ignore_line_ending/new_1.txt'),
<<<'DIFF'
DIFF,
true,
],
];
}

/**
* @return string[][]
*/
public function provideIgnoreLineEndingFalse(): array
{
return [
[
file_get_contents(__DIR__ . '/data/ignore_line_ending/old_1.txt'),
file_get_contents(__DIR__ . '/data/ignore_line_ending/new_1.txt'),
Expand All @@ -47,31 +39,22 @@ public function provideIgnoreLineEndingFalse(): array
+line 2
DIFF,
false,
],
];
}

/**
* @dataProvider provideIgnoreLineEndingTrue
*/
public function testIgnoreLineEndingTrue(string $old, string $new, string $expectedDiff): void
{
$diff = DiffHelper::calculate($old, $new, 'Unified', [
'ignoreLineEnding' => true,
], [
'cliColorization' => RendererConstant::CLI_COLOR_DISABLE,
]);

static::assertSame($expectedDiff, $diff);
}

/**
* @dataProvider provideIgnoreLineEndingFalse
* @dataProvider provideIgnoreLineEnding
*/
public function testIgnoreLineEndingFalse(string $old, string $new, string $expectedDiff): void
{
public function testIgnoreLineEnding(
string $old,
string $new,
string $expectedDiff,
bool $gnoreLineEnding
): void {
$diff = DiffHelper::calculate($old, $new, 'Unified', [
'ignoreLineEnding' => false,
'ignoreLineEnding' => $gnoreLineEnding,
], [
'cliColorization' => RendererConstant::CLI_COLOR_DISABLE,
]);
Expand Down

0 comments on commit 77d4dbb

Please sign in to comment.