Skip to content
Snippets Groups Projects
Unverified Commit 9d00f367 authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

Compare arrays not json strings

In php 7.1 the pretty print json output changed. Thus now we compare
arrays.
parent 1b2021a2
No related branches found
No related tags found
No related merge requests found
...@@ -102,8 +102,13 @@ class CheckerTest extends TestCase { ...@@ -102,8 +102,13 @@ class CheckerTest extends TestCase {
->expects($this->once()) ->expects($this->once())
->method('file_put_contents') ->method('file_put_contents')
->with( ->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json', $this->equalTo(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'),
$expectedSignatureFileData $this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
); );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt'); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/SomeApp.crt');
...@@ -456,7 +461,12 @@ class CheckerTest extends TestCase { ...@@ -456,7 +461,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents') ->method('file_put_contents')
->with( ->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json', \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json',
$expectedSignatureFileData $this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
); );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
...@@ -486,7 +496,12 @@ class CheckerTest extends TestCase { ...@@ -486,7 +496,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents') ->method('file_put_contents')
->with( ->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json', \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
$expectedSignatureFileData $this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
); );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
...@@ -511,7 +526,12 @@ class CheckerTest extends TestCase { ...@@ -511,7 +526,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents') ->method('file_put_contents')
->with( ->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json', \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
$expectedSignatureFileData $this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
); );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
...@@ -542,7 +562,12 @@ class CheckerTest extends TestCase { ...@@ -542,7 +562,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents') ->method('file_put_contents')
->with( ->with(
\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json', \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
$expectedSignatureFileData $this->callback(function($signature) use ($expectedSignatureFileData) {
$expectedArray = json_decode($expectedSignatureFileData, true);
$actualArray = json_decode($signature, true);
$this->assertEquals($expectedArray, $actualArray);
return true;
})
); );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt'); $keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment