Fix tests for autocrlf=true checkouts, fixes #4049
parent
ac17e4a32f
commit
27aac31970
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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(
|
||||
'{
|
||||
|
|
Loading…
Reference in New Issue