Newer
Older
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
use Piwik\Date;
Thomas Steur
a validé
use Piwik\Tests\Framework\Fixture;
/**
* Adds one site with a non UTC timezone and tracks a couple visits near the end of the day.
*/
class VisitsInDifferentTimezones extends Fixture
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
{
public $idSite = 1;
public $dateTime = '2010-03-06';
public $date;
public function __construct()
{
$this->date = Date::factory($this->dateTime)->toString();
}
public function setUp()
{
$this->setUpWebsitesAndGoals();
$this->trackVisits();
}
public function tearDown()
{
// empty
}
private function setUpWebsitesAndGoals()
{
// tests run in UTC, the Tracker in UTC
if (!self::siteCreated($idSite = 1)) {
self::createWebsite($this->dateTime, $ecommerce = 0, $siteName = false, $siteUrl = false,
$siteSearch = 1, $searchKeywordParameters = null,
$searchCategoryParameters = null, $timezone = 'America/New_York');
}
}
private function trackVisits()
{
$dateTime = Date::factory($this->date)->addHour(27); // tracking a visit that is tomorrow in New York time
$idSite = $this->idSite;
$t = self::getTracker($idSite, $dateTime, $defaultInit = true);
// visit that is 'tomorrow' in UTC
$t->setUrl('http://example.org/index.htm');
self::checkResponse($t->doTrackPageView('incredible title!'));
}
}