File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Tests \Diff ;
6
+
7
+ use PHPUnit \Framework \TestCase ;
8
+ use jblond \Diff ;
9
+
10
+ class DiffOptionsTest extends TestCase
11
+ {
12
+ public function testIgnoreWhitespace ()
13
+ {
14
+ $ diff = new Diff ("Hello World " , "Hello World " , ['ignoreWhitespace ' => true ]);
15
+ $ this ->assertTrue ($ diff ->isIdentical ());
16
+ }
17
+
18
+ public function testIgnoreCase ()
19
+ {
20
+ $ diff = new Diff ("Hello " , "hello " , ['ignoreCase ' => true ]);
21
+ $ this ->assertTrue ($ diff ->isIdentical ());
22
+ }
23
+
24
+ public function testIgnoreLines ()
25
+ {
26
+ $ a = "line1 \n// comment \nline2 " ;
27
+ $ b = "line1 \n// comment \nline2 " ;
28
+
29
+ $ diff = new Diff ($ a , $ b , ['ignoreLines ' => ['// comment ' ]]);
30
+
31
+ $ this ->assertTrue ($ diff ->isIdentical ());
32
+ }
33
+
34
+
35
+ public function testContextOption ()
36
+ {
37
+ $ a = "A \nB \nC \nD " ;
38
+ $ b = "A \nX \nC \nD " ;
39
+ $ diff = new Diff ($ a , $ b , ['context ' => 0 ]);
40
+ $ this ->assertFalse ($ diff ->isIdentical ());
41
+ }
42
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Diff \Renderer \Cli ;
4
+
5
+ use PHPUnit \Framework \TestCase ;
6
+ use jblond \Diff ;
7
+
8
+ class CliTest extends TestCase
9
+ {
10
+ public function testCliRendererWithColors (): void
11
+ {
12
+ $ diff = new Diff ("foo " , "bar " );
13
+ $ renderer = new Diff \Renderer \Text \UnifiedCli (['cliColor ' => true ]);
14
+ $ output = $ diff ->render ($ renderer );
15
+ $ this ->assertStringContainsString ("\033[ " , $ output ); // ANSI escape
16
+ }
17
+ }
You can’t perform that action at this time.
0 commit comments