1
0
Fork 0

Fix tests for autocrlf=true checkouts, fixes #4049

pull/4081/head
Jordi Boggiano 2015-05-28 14:42:19 +01:00
parent ac17e4a32f
commit 27aac31970
3 changed files with 24 additions and 6 deletions

View File

@ -1201,4 +1201,22 @@ EOF;
$b = $dir.'/autoload_'.$type.'.php';
$this->assertFileEquals($a, $b);
}
public static function assertFileEquals($expected, $actual, $message = '', $canonicalize = false, $ignoreCase = false)
{
return self::assertEquals(
file_get_contents($expected),
file_get_contents($actual),
$message ?: $expected.' equals '.$actual,
0,
10,
$canonicalize,
$ignoreCase
);
}
public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
{
return parent::assertEquals(str_replace("\r", '', $expected), str_replace("\r", '', $actual), $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
}
}

View File

@ -220,6 +220,7 @@ class JsonFileTest extends \PHPUnit_Framework_TestCase
{
$file = new JsonFile('composer.json');
$json = str_replace("\r", '', $json);
if (null === $options) {
$this->assertEquals($json, $file->encode($data));
} else {

View File

@ -34,12 +34,11 @@ class JsonManipulatorTest extends \PHPUnit_Framework_TestCase
'require',
'vendor/baz',
'qux',
'{
"require": {
"vendor/baz": "qux"
}
}
'
"{\n".
" \"require\": {\n".
" \"vendor/baz\": \"qux\"\n".
" }\n".
"}\n"
),
array(
'{