]> git.mxchange.org Git - friendica.git/blobdiff - tests/functional/DependencyCheckTest.php
Merge pull request #10479 from MrPetovan/task/9378-merge-share-template
[friendica.git] / tests / functional / DependencyCheckTest.php
index fcb16e14ccfca28577e2e93533e014574210ca32..a7b45ccebeffa9ce1362436e524a77fbeb9bc5aa 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -45,7 +45,7 @@ class DependencyCheckTest extends TestCase
         */
        private $dice;
 
-       protected function setUp()
+       protected function setUp() : void
        {
                parent::setUp();
 
@@ -115,26 +115,43 @@ class DependencyCheckTest extends TestCase
 
        public function testDatabase()
        {
+               // PDO needs to be disabled for PHP 7.2, see https://jira.mariadb.org/browse/MDEV-24121
+               if (version_compare(PHP_VERSION, '7.3') < 0) {
+                       $configCache = $this->dice->create(Cache::class);
+                       $configCache->set('database', 'disable_pdo', true);
+               }
+
                /** @var Database $database */
                $database = $this->dice->create(Database::class);
 
                self::assertInstanceOf(Database::class, $database);
                self::assertContains($database->getDriver(), [Database::PDO, Database::MYSQLI], 'The driver returns an unexpected value');
                self::assertNotNull($database->getConnection(), 'There is no database connection');
+
+               $result = $database->p("SELECT 1");
+               self::assertEquals('', $database->errorMessage(), 'There had been a database error message');
+               self::assertEquals(0, $database->errorNo(), 'There had been a database error number');
+
                self::assertTrue($database->connected(), 'The database is not connected');
        }
 
        public function testAppMode()
        {
+               // PDO needs to be disabled for PHP 7.2, see https://jira.mariadb.org/browse/MDEV-24121
+               if (version_compare(PHP_VERSION, '7.3') < 0) {
+                       $configCache = $this->dice->create(Cache::class);
+                       $configCache->set('database', 'disable_pdo', true);
+               }
+
                /** @var App\Mode $mode */
                $mode = $this->dice->create(App\Mode::class);
 
                self::assertInstanceOf(App\Mode::class, $mode);
 
-               self::assertTrue($mode->has((App\Mode::LOCALCONFIGPRESENT)), 'No local config present');
-               self::assertTrue($mode->has((App\Mode::DBAVAILABLE)), 'Database is not available');
-               self::assertTrue($mode->has((App\Mode::DBCONFIGAVAILABLE)), 'Database config is not available');
-               self::assertTrue($mode->has((App\Mode::MAINTENANCEDISABLED)), 'In maintenance mode');
+               self::assertTrue($mode->has(App\Mode::LOCALCONFIGPRESENT), 'No local config present');
+               self::assertTrue($mode->has(App\Mode::DBAVAILABLE), 'Database is not available');
+               self::assertTrue($mode->has(App\Mode::DBCONFIGAVAILABLE), 'Database config is not available');
+               self::assertTrue($mode->has(App\Mode::MAINTENANCEDISABLED), 'In maintenance mode');
 
                self::assertTrue($mode->isNormal(), 'Not in normal mode');
        }