blob: 675ee917d0ee23c95c93fcb3a2c7b8a0957966fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
<?php
/**
* Piwik - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Tests\Fixtures;
use Piwik\Date;
use Piwik\Tests\Framework\Fixture;
/**
* Adds two sites and tracks several visits with possibility to add new visits to the same days
*/
class VisitsTwoWebsitesWithAdditionalVisits extends Fixture
{
public $dateTimeFirstDateWebsite1 = '2010-03-06 01:22:33';
public $dateTimeFirstDateWebsite2 = '2010-01-06 02:22:33';
public $idSite1 = 1;
public $idSite2 = 2;
public function setUp(): void
{
$this->setUpWebsitesAndGoals();
$this->trackVisits();
}
public function tearDown(): void
{
// empty
}
public function setUpWebsitesAndGoals()
{
if (!self::siteCreated($idSite = 1)) {
self::createWebsite($this->dateTimeFirstDateWebsite1);
}
if (!self::siteCreated($idSite = 2)) {
self::createWebsite($this->dateTimeFirstDateWebsite2);
}
}
protected function trackVisits()
{
/**
* Track Visits normal date for the 2 websites
*/
// WEBSITE 1
$t = self::getTracker($this->idSite1, $this->dateTimeFirstDateWebsite1, $defaultInit = true);
$t->setUrl('http://example.org/category/Page1');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page2');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page3');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Home');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact/ThankYou');
self::checkResponse($t->doTrackPageView('Hello'));
// WEBSITE 2
$t = self::getTracker($this->idSite2, $this->dateTimeFirstDateWebsite2, $defaultInit = true);
$t->setIp('156.52.3.22');
$t->setUrl('http://example.org/category/Page1');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page2');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page3');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Home');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact/ThankYou');
self::checkResponse($t->doTrackPageView('Hello'));
}
public function trackMoreVisits($idSite)
{
/**
* Track Visits normal date for the 2 websites
*/
switch ($idSite) {
case $this->idSite1:
$t = self::getTracker($this->idSite1, $this->dateTimeFirstDateWebsite1, $defaultInit = true);
$t->setIp('156.15.13.12');
$t->setUrl('http://example.org/category/Page1');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page2');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/NewPage');
self::checkResponse($t->doTrackPageView('New Page'));
$t->setUrl('http://example.org/Home');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact/ThankYou');
self::checkResponse($t->doTrackPageView('Hello'));
break;
case $this->idSite2:
$t = self::getTracker($this->idSite2, $this->dateTimeFirstDateWebsite2, $defaultInit = true);
$t->setIp('156.5.55.2');
$t->setUrl('http://example.org/category/Page1');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/Page2');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/category/NewPage');
self::checkResponse($t->doTrackPageView('New Page'));
$t->setUrl('http://example.org/Home');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact');
self::checkResponse($t->doTrackPageView('Hello'));
$t->setUrl('http://example.org/Contact/ThankYou');
self::checkResponse($t->doTrackPageView('Hello'));
break;
}
}
}
|