1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 15:07:44 +00:00
Files
matomo/tests/PHPUnit/Fixtures/ManyVisitsWithGeoIPAndEcommerce.php
Michal Kleiner 9a3ef94df6 [Coding Style] Enable rule PSR12.Files.FileHeader + unify file headers (#22132)
* [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>
2024-04-20 20:50:47 +02:00

43 خطوط
1.6 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\Tests\Fixtures;
class ManyVisitsWithGeoIPAndEcommerce extends ManyVisitsWithGeoIP
{
/**
* Insert a new visit into the database.
* @param \MatomoTracker $t The tracker to record the visits on
* @param int $fixtureCounter Number of times this fixture has been run
* @param int $visitorCounter Visitor counter within this execution of the fixture
* @param boolean $doBulk Should this visit be left for bulk insert later, or processed now?
* @param array $params Other params as required to set up the visit
*/
protected function trackVisit(\MatomoTracker $t, $fixtureCounter, $visitorCounter, $doBulk, array $params)
{
// Add some ecommerce views
if (($visitorCounter % 3) == 1) {
$t->setEcommerceView('Custom SKU', 'MyName', ['Category1', 'Category2', 'Category3', 'Category' . $visitorCounter], 17.4);
}
parent::trackVisit($t, $fixtureCounter, $visitorCounter, $doBulk, $params);
// Add a few ecommerce orders
if (($visitorCounter % 3) == 0) {
$orderId = $fixtureCounter * 1000 + $visitorCounter + 1;
$t->addEcommerceItem('ABCD1234', 'My Product', 'My Category', 100, 1);
$r = $t->doTrackEcommerceOrder($orderId, 111.11, 100, 11);
if (!$doBulk) {
self::checkResponse($r);
}
}
}
}