Merge pull request #6671 from nupplaphil/6667-installer-fileinfo

Installer needs to check fileinfo module
This commit is contained in:
Hypolite Petovan 2019-02-16 17:25:23 -05:00 committed by GitHub
commit 35de5fb537
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -357,6 +357,7 @@ class Installer
* - mb_string * - mb_string
* - XML * - XML
* - iconv * - iconv
* - fileinfo
* - POSIX * - POSIX
* *
* @return bool false if something required failed * @return bool false if something required failed
@ -452,6 +453,13 @@ class Installer
); );
$returnVal = $returnVal ? $status : false; $returnVal = $returnVal ? $status : false;
$status = $this->checkFunction('finfo_open',
L10n::t('File Information PHP module'),
L10n::t('Error: File Information PHP module required but not installed.'),
true
);
$returnVal = $returnVal ? $status : false;
return $returnVal; return $returnVal;
} }

View File

@ -45,6 +45,8 @@ class InstallerTest extends MockedTest
$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('JSON PHP module', 1);
$this->mockL10nT('Error: JSON PHP module required but not installed.', 1); $this->mockL10nT('Error: JSON PHP module required but not installed.', 1);
$this->mockL10nT('File Information PHP module', 1);
$this->mockL10nT('Error: File Information 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)
@ -192,6 +194,17 @@ class InstallerTest extends MockedTest
true, true,
$install->getChecks()); $install->getChecks());
$this->mockFunctionL10TCalls();
$this->setFunctions(['finfo_open' => false]);
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(10,
'File Information PHP module',
'Error: File Information PHP module required but not installed.',
false,
true,
$install->getChecks());
$this->mockFunctionL10TCalls(); $this->mockFunctionL10TCalls();
$this->setFunctions([ $this->setFunctions([
'curl_init' => true, 'curl_init' => true,
@ -200,7 +213,8 @@ class InstallerTest extends MockedTest
'mb_strlen' => true, 'mb_strlen' => true,
'iconv_strlen' => true, 'iconv_strlen' => true,
'posix_kill' => true, 'posix_kill' => true,
'json_encode' => true 'json_encode' => true,
'finfo_open' => true,
]); ]);
$install = new Installer(); $install = new Installer();
$this->assertTrue($install->checkFunctions()); $this->assertTrue($install->checkFunctions());