From 439afc89b6c3b075568ae4f37f1dc62b11ca7b24 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Dec 2018 20:40:00 +0000 Subject: [PATCH 1/4] Checks if JSON is enabled --- src/Core/Installer.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Core/Installer.php b/src/Core/Installer.php index b84bcd916e..912406a298 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -405,6 +405,13 @@ class Installer ); $returnVal = $returnVal ? $status : false; + $status = $this->checkFunction('json_encode', + L10n::t('JSON PHP module'), + L10n::t('Error: JSON PHP module required but not installed.'), + true + ); + $returnVal = $returnVal ? $status : false; + $status = $this->checkFunction('imagecreatefromjpeg', L10n::t('GD graphics PHP module'), L10n::t('Error: GD graphics PHP module with JPEG support required but not installed.'), From 732308ce6d1157355090f3b6864fd6ac04a8567f Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Dec 2018 22:04:47 +0000 Subject: [PATCH 2/4] Hopefully this fixes the tests again --- src/Core/Installer.php | 14 +++++++------- tests/src/Core/InstallerTest.php | 11 +++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Core/Installer.php b/src/Core/Installer.php index 912406a298..74d6114f16 100644 --- a/src/Core/Installer.php +++ b/src/Core/Installer.php @@ -405,13 +405,6 @@ class Installer ); $returnVal = $returnVal ? $status : false; - $status = $this->checkFunction('json_encode', - L10n::t('JSON PHP module'), - L10n::t('Error: JSON PHP module required but not installed.'), - true - ); - $returnVal = $returnVal ? $status : false; - $status = $this->checkFunction('imagecreatefromjpeg', L10n::t('GD graphics PHP module'), L10n::t('Error: GD graphics PHP module with JPEG support required but not installed.'), @@ -447,6 +440,13 @@ class Installer ); $returnVal = $returnVal ? $status : false; + $status = $this->checkFunction('json_encode', + L10n::t('JSON PHP module'), + L10n::t('Error: JSON PHP module required but not installed.'), + true + ); + $returnVal = $returnVal ? $status : false; + return $returnVal; } diff --git a/tests/src/Core/InstallerTest.php b/tests/src/Core/InstallerTest.php index 32a80a77e0..d860321d43 100644 --- a/tests/src/Core/InstallerTest.php +++ b/tests/src/Core/InstallerTest.php @@ -177,6 +177,17 @@ class InstallerTest extends MockedTest true, $install->getChecks()); + $this->mockFunctionL10TCalls(); + $this->setFunctions(['json_encode' => false]); + $install = new Installer(); + $this->assertFalse($install->checkFunctions()); + $this->assertCheckExist(9, + 'JSON PHP module', + 'Error: JSON PHP module required but not installed.', + false, + true, + $install->getChecks()); + $this->mockFunctionL10TCalls(); $this->setFunctions([ 'curl_init' => true, From 6a501d99afeb0f517b1f31748ccdb29ec686cbf2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Dec 2018 22:36:53 +0000 Subject: [PATCH 3/4] And again tests ... --- tests/src/Core/InstallerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/src/Core/InstallerTest.php b/tests/src/Core/InstallerTest.php index d860321d43..2f9ad1646c 100644 --- a/tests/src/Core/InstallerTest.php +++ b/tests/src/Core/InstallerTest.php @@ -195,7 +195,8 @@ class InstallerTest extends MockedTest 'openssl_public_encrypt' => true, 'mb_strlen' => true, 'iconv_strlen' => true, - 'posix_kill' => true + 'posix_kill' => true, + 'json_encode' => true ]); $install = new Installer(); $this->assertTrue($install->checkFunctions()); From 75e63212d1a94c008a55871d65b252ab0677842a Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Dec 2018 22:56:57 +0000 Subject: [PATCH 4/4] Bite by bite ... --- tests/src/Core/InstallerTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/Core/InstallerTest.php b/tests/src/Core/InstallerTest.php index 2f9ad1646c..3d7effe52b 100644 --- a/tests/src/Core/InstallerTest.php +++ b/tests/src/Core/InstallerTest.php @@ -43,6 +43,8 @@ class InstallerTest extends MockedTest $this->mockL10nT('Error: iconv PHP module required but not installed.', 1); $this->mockL10nT('POSIX PHP module', 1); $this->mockL10nT('Error: POSIX PHP module required but not installed.', 1); + $this->mockL10nT('JSON PHP module', 1); + $this->mockL10nT('Error: JSON PHP module required but not installed.', 1); } private function assertCheckExist($position, $title, $help, $status, $required, $assertionArray)