File tree Expand file tree Collapse file tree 4 files changed +86
-7
lines changed Expand file tree Collapse file tree 4 files changed +86
-7
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " chrisboulton/php-diff" ,
3
- "type" : " library" ,
3
+ "type" : " library" ,
4
4
"description" : " A comprehensive library for generating differences between two hashable objects (strings or arrays)." ,
5
5
"authors" : [
6
6
{
7
7
"name" : " Chris Boulton" ,
8
8
"email" : " @chrisboulton"
9
9
}
10
10
],
11
- "autoload" : {
12
- "psr-0" : {
13
- "Diff" : " lib/"
14
- }
15
- }
16
- }
11
+ "autoload" : {
12
+ "psr-0" : {
13
+ "Diff" : " lib/"
14
+ }
15
+ },
16
+ "require-dev" : {
17
+ "phpunit/phpunit" : " ~5.5"
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ <phpunit bootstrap =" vendor/autoload.php" >
2
+ <testsuites >
3
+ <testsuite name =" unit" >
4
+ <directory >tests</directory >
5
+ </testsuite >
6
+ </testsuites >
7
+ </phpunit >
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Diff \Renderer \Html ;
4
+
5
+ class ArrayTest extends \PHPUnit_Framework_TestCase
6
+ {
7
+ public function testRenderSimpleDelete ()
8
+ {
9
+ $ htmlRenderer = new \Diff_Renderer_Html_Array ();
10
+ $ htmlRenderer ->diff = new \Diff (
11
+ array ('a ' ),
12
+ array ()
13
+ );
14
+
15
+ $ result = $ htmlRenderer ->render ();
16
+
17
+ static ::assertEquals (array (
18
+ array (
19
+ array (
20
+ 'tag ' => 'delete ' ,
21
+ 'base ' => array (
22
+ 'offset ' => 0 ,
23
+ 'lines ' => array (
24
+ 'a '
25
+ )
26
+ ),
27
+ 'changed ' => array (
28
+ 'offset ' => 0 ,
29
+ 'lines ' => array ()
30
+ )
31
+ )
32
+ )
33
+ ), $ result );
34
+ }
35
+
36
+ public function testRenderFixesSpaces ()
37
+ {
38
+ $ htmlRenderer = new \Diff_Renderer_Html_Array ();
39
+ $ htmlRenderer ->diff = new \Diff (
40
+ array (' a ' ),
41
+ array ('a ' )
42
+ );
43
+
44
+ $ result = $ htmlRenderer ->render ();
45
+
46
+ static ::assertEquals (array (
47
+ array (
48
+ array (
49
+ 'tag ' => 'replace ' ,
50
+ 'base ' => array (
51
+ 'offset ' => 0 ,
52
+ 'lines ' => array (
53
+ '<del> </del>a ' ,
54
+ )
55
+ ),
56
+ 'changed ' => array (
57
+ 'offset ' => 0 ,
58
+ 'lines ' => array (
59
+ '<ins></ins>a '
60
+ )
61
+ )
62
+ )
63
+ )
64
+ ), $ result );
65
+ }
66
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ require_once __DIR__ . '/../vendor/autoload.php ' ;
You can’t perform that action at this time.
0 commit comments