Skip to content

Commit bb69f64

Browse files
committed
Update VTTPreviewThumbnailsGeneratorTest.php
1 parent 78dd7d4 commit bb69f64

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/VTTPreviewThumbnailsGeneratorTest.php

+15-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ class VTTPreviewThumbnailsGeneratorTest extends TestCase
1010
{
1111
use MatchesSnapshots;
1212

13+
private function updateWindowsNewLines($content)
14+
{
15+
if (!windows_os()) {
16+
return $content;
17+
}
18+
19+
$content = str_replace("\r\n", "\n", $content);
20+
$content = str_replace("\n", "\r\n", $content);
21+
22+
return $content;
23+
}
24+
1325
/** @test */
1426
public function it_can_generate_a_vtt_file()
1527
{
@@ -22,7 +34,7 @@ public function it_can_generate_a_vtt_file()
2234

2335
$generator = new VTTPreviewThumbnailsGenerator($tile, 250, fn () => "sprite_%d.jpg");
2436

25-
$this->assertMatchesTextSnapshot($generator->getContents());
37+
$this->assertMatchesTextSnapshot($this->updateWindowsNewLines($generator->getContents()));
2638
}
2739

2840
/** @test */
@@ -39,7 +51,7 @@ public function it_can_generate_a_vtt_file_with_a_non_sqaure_grid()
3951
return "sprite_{$i}.jpg";
4052
});
4153

42-
$this->assertMatchesTextSnapshot($generator->getContents());
54+
$this->assertMatchesTextSnapshot($this->updateWindowsNewLines($generator->getContents()));
4355
}
4456

4557
/** @test */
@@ -58,6 +70,6 @@ public function it_can_generate_a_vtt_file_and_keep_the_margin_and_padding_in_ac
5870
return "sprite_{$i}.jpg";
5971
});
6072

61-
$this->assertMatchesTextSnapshot($generator->getContents());
73+
$this->assertMatchesTextSnapshot($this->updateWindowsNewLines($generator->getContents()));
6274
}
6375
}

0 commit comments

Comments
 (0)