summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-09-07 23:06:18 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-09-07 23:06:18 +0200
commit9d00f367f9a00722cf64ee519397c8ed66769af2 (patch)
treea22cc0c8b44e7d68b3995d9590f3298acc750264 /tests
parent1b2021a24346e6cd5bc436de68df5b68bc7ac899 (diff)
downloadnextcloud-server-9d00f367f9a00722cf64ee519397c8ed66769af2.tar.gz
nextcloud-server-9d00f367f9a00722cf64ee519397c8ed66769af2.zip
Compare arrays not json strings
In php 7.1 the pretty print json output changed. Thus now we compare arrays.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php37
1 files changed, 31 insertions, 6 deletions
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index d67f1382dc9..5823ac0f25c 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -102,8 +102,13 @@ class CheckerTest extends TestCase {
->expects($this->once())
->method('file_put_contents')
->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json',
- $expectedSignatureFileData
+ $this->equalTo(\OC::$SERVERROOT . '/tests/data/integritycheck/app//appinfo/signature.json'),
+ $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');
@@ -456,7 +461,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\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');
@@ -486,7 +496,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\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');
@@ -511,7 +526,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\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');
@@ -542,7 +562,12 @@ class CheckerTest extends TestCase {
->method('file_put_contents')
->with(
\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');