]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/InstallerTest.php
Merge pull request #6580 from MrPetovan/bug/6575-escaped-field-input-attributes
[friendica.git] / tests / src / Core / InstallerTest.php
index ebbf5037d4b780ff464209ea130536bd92aa4ec7..f7f8f5c7d494834c2e4734d1a6e6c4768217ef52 100644 (file)
@@ -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)
@@ -97,6 +99,8 @@ class InstallerTest extends MockedTest
         */
        public function testCheckKeys()
        {
+               $this->mockL10nT();
+
                $this->setFunctions(['openssl_pkey_new' => false]);
                $install = new Installer();
                $this->assertFalse($install->checkKeys());
@@ -177,6 +181,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,
@@ -184,7 +199,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());
@@ -195,14 +211,16 @@ class InstallerTest extends MockedTest
         */
        public function testCheckLocalIni()
        {
-               $this->assertTrue($this->root->hasChild('config/local.ini.php'));
+               $this->mockL10nT();
+
+               $this->assertTrue($this->root->hasChild('config/local.config.php'));
 
                $install = new Installer();
                $this->assertTrue($install->checkLocalIni());
 
-               $this->delConfigFile('local.ini.php');
+               $this->delConfigFile('local.config.php');
 
-               $this->assertFalse($this->root->hasChild('config/local.ini.php'));
+               $this->assertFalse($this->root->hasChild('config/local.config.php'));
 
                $install = new Installer();
                $this->assertTrue($install->checkLocalIni());
@@ -213,6 +231,8 @@ class InstallerTest extends MockedTest
         */
        public function testCheckHtAccessFail()
        {
+               $this->mockL10nT();
+
                // Mocking the CURL Response
                $curlResult = \Mockery::mock('Friendica\Network\CurlResult');
                $curlResult
@@ -239,9 +259,6 @@ class InstallerTest extends MockedTest
                // Mocking that we can use CURL
                $this->setFunctions(['curl_init' => true]);
 
-               // needed because of "normalise_link"
-               require_once __DIR__ . '/../../../include/text.php';
-
                $install = new Installer();
 
                $this->assertFalse($install->checkHtAccess('https://test'));
@@ -253,6 +270,8 @@ class InstallerTest extends MockedTest
         */
        public function testCheckHtAccessWork()
        {
+               $this->mockL10nT();
+
                // Mocking the failed CURL Response
                $curlResultF = \Mockery::mock('Friendica\Network\CurlResult');
                $curlResultF
@@ -292,6 +311,8 @@ class InstallerTest extends MockedTest
         */
        public function testImagick()
        {
+               $this->mockL10nT();
+
                $imageMock = \Mockery::mock('alias:Friendica\Object\Image');
                $imageMock
                        ->shouldReceive('supportedTypes')
@@ -317,6 +338,8 @@ class InstallerTest extends MockedTest
         */
        public function testImagickNotFound()
        {
+               $this->mockL10nT();
+
                $imageMock = \Mockery::mock('alias:Friendica\Object\Image');
                $imageMock
                        ->shouldReceive('supportedTypes')