Skip to content

Commit

Permalink
Merge pull request #168 from matomo-org/fix-tests-on-mariadb
Browse files Browse the repository at this point in the history
Fixes failing system tests on MariaDB
  • Loading branch information
AltamashShaikh authored Dec 12, 2024
2 parents 29d3edf + 0e50a83 commit 513cde7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/System/TrackSeveralCampaignsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Piwik\Plugins\MarketingCampaignsReporting\tests\System;

use Piwik\Cache;
use Piwik\Db;
use Piwik\Plugin\Manager;
use Piwik\Plugins\MarketingCampaignsReporting\tests\Fixtures\TrackAdvancedCampaigns;
use Piwik\Tests\Framework\TestCase\SystemTestCase;
Expand All @@ -29,6 +30,15 @@ class TrackSeveralCampaignsTest extends SystemTestCase
*/
public static $fixture = null; // initialized below class definition

public static $isMariaDB = false;

public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
$version = strtolower(Db::fetchOne("SELECT VERSION()"));
self::$isMariaDB = strpos($version, "mariadb") !== false;
}

public static function getOutputPrefix()
{
return '';
Expand Down Expand Up @@ -70,7 +80,7 @@ public function getApiForTesting()
{
$dateWithPluginEnabled = self::$fixture->dateTimeWithPluginEnabled;
$dateTime = self::$fixture->dateTime;
$phpVersionPrefix = version_compare(PHP_VERSION, 8.3, '<') ? 'min_php_' : '';
$phpVersionPrefix = version_compare(PHP_VERSION, 8.2, '<') && !self::$isMariaDB ? 'min_php_' : '';

$apiToTest[] = [
'API.get',
Expand Down Expand Up @@ -216,7 +226,7 @@ public function getReferrerApiForTesting()
'Referrers.getCampaigns',
];

$phpVersionPrefix = version_compare(PHP_VERSION, 8.3, '<') ? 'min_php_' : '';
$phpVersionPrefix = version_compare(PHP_VERSION, 8.2, '<') && !self::$isMariaDB ? 'min_php_' : '';

$apiToTest[] = [
$api,
Expand Down

0 comments on commit 513cde7

Please sign in to comment.