Skip to content

Commit 4131aed

Browse files
committed
fix tests for older releases
1 parent 3467566 commit 4131aed

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/System/DeviceDetectorCacheTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use Piwik\Plugins\DeviceDetectorCache\tests\Fixtures\SimpleFixtureTrackFewVisits;
1313
use Piwik\Tests\Framework\TestCase\SystemTestCase;
14+
use Piwik\Version;
1415

1516
/**
1617
* @group DeviceDetectorCache
@@ -38,6 +39,18 @@ public function getApiForTesting()
3839
'Live.getLastVisitsDetails',
3940
];
4041

42+
$columnsToHide = [];
43+
44+
if (version_compare(Version::VERSION, '5.2.0-alpha', '<')) {
45+
// In Matomo 5.2 referrer columns had been added to ecommerce actions. For tests with older Matomo releases we therefor ignore those columns
46+
$columnsToHide = array_merge($columnsToHide, ['referrerType', 'referrerName', 'referrerKeyword']);
47+
}
48+
49+
if (version_compare(Version::VERSION, '5.4.0-b5', '<')) {
50+
// In Matomo 5.4 ai referrer had been added
51+
$columnsToHide = array_merge($columnsToHide, ['referrerAIAssistantUrl', 'referrerAIAssistantIcon']);
52+
}
53+
4154
$apiToTest = [];
4255
$apiToTest[] = [
4356
$api,
@@ -47,7 +60,7 @@ public function getApiForTesting()
4760
'periods' => ['day'],
4861
'testSuffix' => '',
4962
// fields were added in Matomo 5.2-alpha, so ignore them as they are not relevant for this plugin anyways
50-
'xmlFieldsToRemove' => ['referrerType', 'referrerName', 'referrerKeyword']
63+
'xmlFieldsToRemove' => $columnsToHide,
5164
],
5265
];
5366

0 commit comments

Comments
 (0)