قرینه از
https://github.com/matomo-org/matomo.git
synced 2025-08-24 16:07:37 +00:00

* [Coding Style] Enable rule PSR12.Files.FileHeader * Apply CS * Replace Piwik with Matomo in file headers * Unify file headers (position, no. of lines, https links) * Rebuild dist files * Apply CS * Fix system test that relies on line numbers in a file that had the file header updated --------- Co-authored-by: Stefan Giehl <stefan@matomo.org>
70 خطوط
1.7 KiB
PHP
70 خطوط
1.7 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Matomo - free/libre analytics platform
|
|
*
|
|
* @link https://matomo.org
|
|
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
|
*/
|
|
|
|
namespace Piwik\Plugins\UserLanguage\tests\Fixtures;
|
|
|
|
use Piwik\Tests\Framework\Fixture;
|
|
use Piwik\Date;
|
|
|
|
class LanguageFixture extends Fixture
|
|
{
|
|
public $dateTime = '2014-09-04 00:00:00';
|
|
public $idSite = 1;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->setUpWebsite();
|
|
$this->trackVisits();
|
|
}
|
|
|
|
public function tearDown(): void
|
|
{
|
|
}
|
|
|
|
private function setUpWebsite()
|
|
{
|
|
if (!self::siteCreated($this->idSite)) {
|
|
$idSite = self::createWebsite($this->dateTime);
|
|
$this->assertSame($this->idSite, $idSite);
|
|
}
|
|
}
|
|
|
|
private function getBrowserLangs()
|
|
{
|
|
return array(
|
|
'fr-be', 'ar_QA', 'fr-ch', 'pl', 'pl', 'th_TH', 'zh_SG', 'eu_ES',
|
|
'sr_RS', 'el,fi', 'fr,en-us,en;q=', 'fr-be', 'en,en-us,en;q=',
|
|
'de,en-us,en;q=', 'cs_CZ', 'pl,en-us,en;q=',
|
|
'kpe_LR', 'en,en-us,en;q=',
|
|
);
|
|
}
|
|
|
|
private function trackVisits()
|
|
{
|
|
|
|
$tracker = self::getTracker(
|
|
$this->idSite,
|
|
$this->dateTime,
|
|
$defaultInit = false
|
|
);
|
|
$tracker->setTokenAuth(self::getTokenAuth());
|
|
|
|
$hour = 1;
|
|
foreach ($this->getBrowserLangs() as $browserLang) {
|
|
$tracker->setForceVisitDateTime(
|
|
Date::factory($this->dateTime)->addHour($hour++)->getDatetime()
|
|
);
|
|
|
|
$tracker->setBrowserLanguage($browserLang);
|
|
|
|
self::checkResponse($tracker->doTrackPageView("Viewing homepage"));
|
|
}
|
|
}
|
|
}
|