Skip to content

Commit

Permalink
Fixing issue for old Matomo versions
Browse files Browse the repository at this point in the history
  • Loading branch information
snake14 committed Jul 7, 2024
1 parent 807f284 commit ebc7693
Show file tree
Hide file tree
Showing 3 changed files with 759 additions and 12 deletions.
21 changes: 9 additions & 12 deletions tests/System/Commands/MigrateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ public function testApi($api, $params)
{
FakeAccess::clearAccess(true);
$this->disableArchiving();

if ('Live.getLastVisitsDetails' === $api && version_compare(Version::VERSION, '5.2.0-alpha', '<')) {
$params['testSuffix'] = '5-2a';
}
$this->runApiTests($api, $params);
}

Expand All @@ -161,6 +165,10 @@ public function testApi_migrated($api, $params)
$this->disableArchiving();

FakeAccess::clearAccess($superUser = true);

if ('Live.getLastVisitsDetails' === $api && version_compare(Version::VERSION, '5.2.0-alpha', '<')) {
$params['testSuffix'] = '5-2a';
}
try {
$this->runApiTests($api, $params);
} catch (\Exception $e) {
Expand Down Expand Up @@ -232,24 +240,13 @@ public function getApiForTesting()
];

// This one doesn't play nice with PHP 8 and earlier versions of Matomo. So, only include it for newer versions
if (version_compare(Version::VERSION, '4.13.0-b1', '>=') || version_compare(PHP_VERSION, '8.0.0', '<')) {
if (version_compare(PHP_VERSION, '8.0.0', '<')) {
$apis[] = 'Live.getLastVisitsDetails';
}

$apiToTest = [];
foreach ($apis as $api) {
$testSuffix = '';
if (in_array($api, [
'Actions.getPageUrls',
'SitesManager.getSiteFromId',
'CustomDimensions.getConfiguredCustomDimensions',
'Live.getLastVisitsDetails',
])) {
$testSuffix = version_compare(Version::VERSION, '4.13.0-b1', '<=') ? 'Old' : '';
}
if ($api === 'API.get') {
$testSuffix = version_compare(Version::VERSION, '4.14.2-b1', '<=') ? 'Old' : '';
}
$api = [$api];
$apiToTest[] = [$api,
[
Expand Down
Loading

0 comments on commit ebc7693

Please sign in to comment.