File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-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 \Renderer \Text ;
6
+
7
+ use PHPUnit \Framework \TestCase ;
8
+ use jblond \Diff ;
9
+ use jblond \Diff \Renderer \Text \Json ;
10
+
11
+ class JsonTest extends TestCase
12
+ {
13
+ public function testJsonRendererProducesValidJson ()
14
+ {
15
+ $ diff = new Diff ("foo " , "bar " );
16
+ $ output = $ diff ->render (new Json ());
17
+ $ decoded = json_decode ($ output , true );
18
+
19
+ $ this ->assertIsArray ($ decoded );
20
+ $ this ->assertNotEmpty ($ decoded );
21
+ $ this ->assertIsArray ($ decoded [0 ]);
22
+ }
23
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Tests \Diff \Renderer \Text ;
6
+
7
+ use jblond \Diff ;
8
+ use jblond \Diff \Renderer \Text \Unified ;
9
+ use PHPUnit \Framework \TestCase ;
10
+
11
+ class UnifiedTest extends TestCase
12
+ {
13
+ public function testUnifiedRendererShowsChanges ()
14
+ {
15
+ $ diff = new Diff ("foo " , "bar " );
16
+ $ output = $ diff ->render (new Unified ());
17
+ $ this ->assertStringContainsString ("-foo " , $ output );
18
+ $ this ->assertStringContainsString ("+bar " , $ output );
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments