Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Giehl <stefan@matomo.org>2020-07-29 00:32:05 +0300
committerGitHub <noreply@github.com>2020-07-29 00:32:05 +0300
commit844c7ac05789beb583467390ff7c66aa44e69012 (patch)
tree7a4b92ed6852bde6fff3552f88d1f4ad22cced78 /tests
parent8ca34b2b517810db2e35d8e3c7d4e33007af3faf (diff)
Use new tracker mehtod to set a custom dimension (#16245)
Diffstat (limited to 'tests')
-rw-r--r--tests/LocalTracker.php7
-rw-r--r--tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php2
-rw-r--r--tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php2
-rw-r--r--tests/PHPUnit/System/TrackerResponseTest.php5
4 files changed, 13 insertions, 3 deletions
diff --git a/tests/LocalTracker.php b/tests/LocalTracker.php
index 1510b15b74..f4a4bf5da2 100644
--- a/tests/LocalTracker.php
+++ b/tests/LocalTracker.php
@@ -20,6 +20,8 @@ class Matomo_LocalTracker extends MatomoTracker
{
protected function sendRequest($url, $method = 'GET', $data = null, $force = false)
{
+ self::$DEBUG_LAST_REQUESTED_URL = $url;
+
if ($this->DEBUG_APPEND_URL) {
$url .= $this->DEBUG_APPEND_URL;
}
@@ -39,6 +41,11 @@ class Matomo_LocalTracker extends MatomoTracker
$testEnvironmentArgs = array();
} else {
$testEnvironmentArgs = $this->parseUrl($url);
+
+ if (!empty($this->token_auth)) {
+ $testEnvironmentArgs['token_auth'] = $this->token_auth;
+ }
+
$requests = array($testEnvironmentArgs);
}
diff --git a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php
index 27602998dd..78d691438e 100644
--- a/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php
+++ b/tests/PHPUnit/Fixtures/ManySitesImportedLogsWithXssAttempts.php
@@ -175,7 +175,7 @@ class ManySitesImportedLogsWithXssAttempts extends ManySitesImportedLogs
$t = self::getTracker($this->idSite, $dateTime, $defaultInit= true);
$t->setUrl('http://example.org/' . urlencode($urlXss));
$t->setUrlReferrer($referrerUrlXss);
- $t->setCustomTrackingParameter('dimension1', $xssTesting->$type('customdimension'));
+ $t->setCustomDimension('1', $xssTesting->$type('customdimension'));
$t->setCustomVariable(1, $xssTesting->$type('customvarname'), $xssTesting->$type('customvarval'));
$t->setUserId($xssTesting->$type('userid'));
$t->setBrowserLanguage($xssTesting->$type('lang'));
diff --git a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
index 3a7a73d844..99a9dcf717 100644
--- a/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
+++ b/tests/PHPUnit/Fixtures/ManyVisitsWithMockLocationProvider.php
@@ -156,7 +156,7 @@ class ManyVisitsWithMockLocationProvider extends Fixture
$t->setUrl("http://piwik.net/$visitorCounter/");
$t->setUrlReferrer(null);
$t->setForceVisitDateTime($visitDate->getDatetime());
- $t->setCustomTrackingParameter('dimension' . $this->customDimensionId, $i * 5);
+ $t->setCustomDimension('' . $this->customDimensionId, $i * 5);
$this->trackAction($t, $actionType, $visitorCounter, null);
for ($j = 0; $j != 4; ++$j) {
diff --git a/tests/PHPUnit/System/TrackerResponseTest.php b/tests/PHPUnit/System/TrackerResponseTest.php
index f081ffcc16..74c9c05cdd 100644
--- a/tests/PHPUnit/System/TrackerResponseTest.php
+++ b/tests/PHPUnit/System/TrackerResponseTest.php
@@ -58,7 +58,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldSend200ResponseCode_IfImageIsEnabled()
{
$url = $this->tracker->getUrlTrackPageView('Test');
-
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$response = $this->sendHttpRequest($url);
$this->assertEquals(200, $response['status']);
$this->assertArrayHasKey('Cache-Control', $response['headers']);
@@ -68,6 +68,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldSend204ResponseCode_IfImageIsDisabled()
{
$url = $this->tracker->getUrlTrackPageView('Test');
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$url .= '&send_image=0';
$response = $this->sendHttpRequest($url);
@@ -115,6 +116,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldSend400ResponseCode_IfInvalidRequestParameterIsGiven()
{
$url = $this->tracker->getUrlTrackPageView('Test');
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$url .= '&cid=' . str_pad('1', 16, '1');
$response = $this->sendHttpRequest($url);
@@ -152,6 +154,7 @@ class TrackerResponseTest extends SystemTestCase
public function test_response_ShouldReturnPiwikMessageWithHttp503_InCaseOfMaintenanceMode()
{
$url = $this->tracker->getUrlTrackPageView('Test');
+ $url .= '&token_auth=' . Fixture::getTokenAuth();
$response = $this->sendHttpRequest($url);
$this->assertEquals(200, $response['status']);