Skip to content

Commit 33a0018

Browse files
committed
update diff lib
1 parent c463fef commit 33a0018

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor
22
composer.lock
3+
.phpunit.result.cache

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
],
1010
"require": {
1111
"php": "^5.6 || ^7.0",
12-
"sebastian/diff": "^1.4"
12+
"sebastian/diff": ">=1.4 <4.0"
1313
},
1414
"require-dev": {
15-
"phpunit/phpunit": "^5.5",
15+
"phpunit/phpunit": ">=5.5",
1616
"satooshi/php-coveralls": ">=0.7.1 <2.0"
1717
},
1818
"autoload": {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
2-
<phpunit colors="true" bootstrap="../vendor/autoload.php">
2+
<phpunit colors="true" bootstrap="vendor/autoload.php">
33
<testsuites>
44
<testsuite name="AllTests">
5-
<directory>./</directory>
5+
<directory>./tests</directory>
66
</testsuite>
77
</testsuites>
88
<filter>
99
<whitelist processUncoveredFilesFromWhitelist="true">
10-
<directory suffix=".php">../src</directory>
10+
<directory suffix=".php">./src</directory>
1111
</whitelist>
1212
</filter>
1313
</phpunit>

src/Renderer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public function render(Change $change)
114114

115115
// render diff
116116
foreach ($diff as &$line) {
117+
$line[0] = trim($line[0]);
118+
117119
switch ($line[1]) {
118120
case 0: // NOT CHANGED
119121
$line = $line[0];

tests/RendererTest.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,21 @@ public function testRender_ChangeValueHasStringType(
119119
$this->assertEquals($expectedDiff, $actualDiff);
120120
}
121121

122-
/**
123-
* @expectedException \InvalidArgumentException
124-
* @expectedExceptionMessage Invalid format specified
125-
*/
126122
public function testSetFormatWithInvalidType()
127123
{
124+
$this->expectException('\InvalidArgumentException');
125+
$this->expectExceptionMessage('Invalid format specified');
126+
128127
$diffRenderer = new Renderer([]);
129128

130129
$diffRenderer->setFormat('not_array_type');
131130
}
132131

133-
/**
134-
* @expectedException \InvalidArgumentException
135-
* @expectedExceptionMessage Invalid format specified
136-
*/
137132
public function testSetFormatWithInvalidDefinedFormats()
138133
{
134+
$this->expectException('\InvalidArgumentException');
135+
$this->expectExceptionMessage('Invalid format specified');
136+
139137
$diffRenderer = new Renderer([]);
140138

141139
$diffRenderer->setFormat(1000);

0 commit comments

Comments
 (0)