Merge pull request #6312 from annando/check-json
Checks if JSON is enabled
This commit is contained in:
@@ -440,6 +440,13 @@ class Installer
|
|||||||
);
|
);
|
||||||
$returnVal = $returnVal ? $status : false;
|
$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;
|
return $returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ class InstallerTest extends MockedTest
|
|||||||
$this->mockL10nT('Error: iconv PHP module required but not installed.', 1);
|
$this->mockL10nT('Error: iconv PHP module required but not installed.', 1);
|
||||||
$this->mockL10nT('POSIX PHP module', 1);
|
$this->mockL10nT('POSIX PHP module', 1);
|
||||||
$this->mockL10nT('Error: POSIX PHP module required but not installed.', 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)
|
private function assertCheckExist($position, $title, $help, $status, $required, $assertionArray)
|
||||||
@@ -177,6 +179,17 @@ class InstallerTest extends MockedTest
|
|||||||
true,
|
true,
|
||||||
$install->getChecks());
|
$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->mockFunctionL10TCalls();
|
||||||
$this->setFunctions([
|
$this->setFunctions([
|
||||||
'curl_init' => true,
|
'curl_init' => true,
|
||||||
@@ -184,7 +197,8 @@ class InstallerTest extends MockedTest
|
|||||||
'openssl_public_encrypt' => true,
|
'openssl_public_encrypt' => true,
|
||||||
'mb_strlen' => true,
|
'mb_strlen' => true,
|
||||||
'iconv_strlen' => true,
|
'iconv_strlen' => true,
|
||||||
'posix_kill' => true
|
'posix_kill' => true,
|
||||||
|
'json_encode' => true
|
||||||
]);
|
]);
|
||||||
$install = new Installer();
|
$install = new Installer();
|
||||||
$this->assertTrue($install->checkFunctions());
|
$this->assertTrue($install->checkFunctions());
|
||||||
|
|||||||
Reference in New Issue
Block a user