Refactoring Installation

- centralized installation
- renamed Core\Install to Core\Installer
- avoid using $a->data[] for states
- removed unnecessary code
This commit is contained in:
Philipp Holzer 2018-10-29 18:44:39 +01:00
parent 64149c41b4
commit f0382ab919
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
8 changed files with 185 additions and 205 deletions

View file

@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
*/
class InstallTest extends TestCase
class InstallerTest extends TestCase
{
use VFSTrait;
@ -74,11 +74,11 @@ class InstallTest extends TestCase
public function testCheckKeys()
{
$this->setFunctions(['openssl_pkey_new' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkKeys());
$this->setFunctions(['openssl_pkey_new' => true]);
$install = new Install();
$install = new Installer();
$this->assertTrue($install->checkKeys());
}
@ -88,7 +88,7 @@ class InstallTest extends TestCase
public function testCheckFunctions()
{
$this->setFunctions(['curl_init' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(3,
L10n::t('libCurl PHP module'),
@ -98,7 +98,7 @@ class InstallTest extends TestCase
$install->getChecks());
$this->setFunctions(['imagecreatefromjpeg' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(4,
L10n::t('GD graphics PHP module'),
@ -108,7 +108,7 @@ class InstallTest extends TestCase
$install->getChecks());
$this->setFunctions(['openssl_public_encrypt' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(5,
L10n::t('OpenSSL PHP module'),
@ -118,7 +118,7 @@ class InstallTest extends TestCase
$install->getChecks());
$this->setFunctions(['mb_strlen' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(6,
L10n::t('mb_string PHP module'),
@ -128,7 +128,7 @@ class InstallTest extends TestCase
$install->getChecks());
$this->setFunctions(['iconv_strlen' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(7,
L10n::t('iconv PHP module'),
@ -138,7 +138,7 @@ class InstallTest extends TestCase
$install->getChecks());
$this->setFunctions(['posix_kill' => false]);
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkFunctions());
$this->assertCheckExist(8,
L10n::t('POSIX PHP module'),
@ -155,7 +155,7 @@ class InstallTest extends TestCase
'iconv_strlen' => true,
'posix_kill' => true
]);
$install = new Install();
$install = new Installer();
$this->assertTrue($install->checkFunctions());
}
@ -166,14 +166,14 @@ class InstallTest extends TestCase
{
$this->assertTrue($this->root->hasChild('config/local.ini.php'));
$install = new Install();
$install = new Installer();
$this->assertTrue($install->checkLocalIni());
$this->delConfigFile('local.ini.php');
$this->assertFalse($this->root->hasChild('config/local.ini.php'));
$install = new Install();
$install = new Installer();
$this->assertTrue($install->checkLocalIni());
}
@ -211,7 +211,7 @@ class InstallTest extends TestCase
// needed because of "normalise_link"
require_once __DIR__ . '/../../../include/text.php';
$install = new Install();
$install = new Installer();
$this->assertFalse($install->checkHtAccess('https://test'));
$this->assertSame('test Error', $install->getChecks()[0]['error_msg']['msg']);
@ -251,7 +251,7 @@ class InstallTest extends TestCase
// needed because of "normalise_link"
require_once __DIR__ . '/../../../include/text.php';
$install = new Install();
$install = new Installer();
$this->assertTrue($install->checkHtAccess('https://test'));
}
@ -268,7 +268,7 @@ class InstallTest extends TestCase
$this->setClasses(['Imagick' => true]);
$install = new Install();
$install = new Installer();
// even there is no supported type, Imagick should return true (because it is not required)
$this->assertTrue($install->checkImagick());
@ -293,7 +293,7 @@ class InstallTest extends TestCase
$this->setClasses(['Imagick' => true]);
$install = new Install();
$install = new Installer();
// even there is no supported type, Imagick should return true (because it is not required)
$this->assertTrue($install->checkImagick());
@ -309,7 +309,7 @@ class InstallTest extends TestCase
{
$this->setClasses(['Imagick' => false]);
$install = new Install();
$install = new Installer();
// even there is no supported type, Imagick should return true (because it is not required)
$this->assertTrue($install->checkImagick());