Skip to content

Commit

Permalink
Merge pull request #68 from matomo-org/fix-broken-builds
Browse files Browse the repository at this point in the history
Updating expected API responses after recent core change
  • Loading branch information
snake14 authored Jul 7, 2024
2 parents 9cff58e + e020e14 commit 6a2f496
Show file tree
Hide file tree
Showing 5 changed files with 779 additions and 24 deletions.
25 changes: 9 additions & 16 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 @@ -229,27 +237,12 @@ public function getApiForTesting()
'SitesManager.getSiteFromId',
'Goals.getGoals',
'CustomDimensions.getConfiguredCustomDimensions',
'Live.getLastVisitsDetails',
];

// 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', '<')) {
$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 6a2f496

Please sign in to comment.