File tree 1 file changed +53
-0
lines changed
1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Spatie \Snapshots \Test \Unit \Drivers ;
4
+
5
+ use PHPUnit \Framework \TestCase ;
6
+ use Spatie \Snapshots \Drivers \TextDriver ;
7
+ use Spatie \Snapshots \Exceptions \CantBeSerialized ;
8
+
9
+ class TextDriverTest extends TestCase
10
+ {
11
+ /** @test */
12
+ public function it_can_serialize_laravel_route_list ()
13
+ {
14
+ $ driver = new TextDriver ();
15
+
16
+ $ expected = implode ("\n" , [
17
+ '' ,
18
+ ' GET|HEAD / ..................................................... index ' ,
19
+ '' ,
20
+ ' Showing [1] routes '
21
+ ]);
22
+
23
+ $ this ->assertEquals ($ expected , $ driver ->serialize (<<<EOF
24
+
25
+ GET|HEAD / ..................................................... index
26
+
27
+ Showing [1] routes
28
+ EOF ));
29
+ }
30
+
31
+ /** @test */
32
+ public function it_can_serialize_when_given_windows_line_endings ()
33
+ {
34
+ $ driver = new TextDriver ();
35
+
36
+ $ expected = <<<EOF
37
+
38
+ GET|HEAD / ..................................................... index
39
+
40
+ Showing [1] routes
41
+ EOF ;
42
+ // Due to using PHP_EOL this should fail (conditionally) when run on windows
43
+ $ actual = implode (PHP_EOL , [
44
+ '' ,
45
+ ' GET|HEAD / ..................................................... index ' ,
46
+ '' ,
47
+ ' Showing [1] routes '
48
+ ]);
49
+
50
+ $ this ->assertEquals ($ expected , $ driver ->serialize ($ actual ));
51
+ }
52
+
53
+ }
You can’t perform that action at this time.
0 commit comments