قرینه از
https://github.com/matomo-org/matomo.git
synced 2025-08-22 06:57:53 +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>
69 خطوط
2.2 KiB
PHP
69 خطوط
2.2 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\Ecommerce\tests\Fixtures;
|
|
|
|
use Piwik\Date;
|
|
use Piwik\Tests\Framework\Fixture;
|
|
use Piwik\Plugins\Goals\API as GoalsAPI;
|
|
|
|
class AbandonedCartWithoutConversions extends Fixture
|
|
{
|
|
public $idSite = 1;
|
|
public $idGoalStandard = 1;
|
|
public $dateTime = '2011-04-05 00:11:42';
|
|
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->setUpWebsitesAndGoals();
|
|
$this->trackVisits();
|
|
}
|
|
|
|
private function setUpWebsitesAndGoals()
|
|
{
|
|
if (!self::siteCreated($this->idSite)) {
|
|
$this->idSite = self::createWebsite($this->dateTime, $ecommerce = 1, 'test site');
|
|
}
|
|
|
|
if (!self::goalExists($this->idSite, $this->idGoalStandard)) {
|
|
GoalsAPI::getInstance()->addGoal(
|
|
$this->idSite,
|
|
'title match, triggered NEVER',
|
|
'title',
|
|
'saldkfjaslkdfjsalkdjf',
|
|
'contains',
|
|
$caseSensitive = false,
|
|
$revenue = 10,
|
|
$allowMultipleConversions = true
|
|
);
|
|
}
|
|
}
|
|
|
|
private function trackVisits()
|
|
{
|
|
// visit without ecommerce
|
|
$t = self::getTracker($this->idSite, $this->dateTime, $defaultInit = true);
|
|
$t->setUrl('http://piwik.net/here/we/go');
|
|
$t->setForceVisitDateTime(Date::factory($this->dateTime)->getDatetime());
|
|
self::checkResponse($t->doTrackPageView('one page visit'));
|
|
|
|
// visit with abandoned cart
|
|
$t = self::getTracker($this->idSite, $this->dateTime, $defaultInit = true);
|
|
$t->setUrl('http://piwik.net/here/we/go');
|
|
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1)->getDatetime());
|
|
self::checkResponse($t->doTrackPageView('one page visit'));
|
|
|
|
$t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour(1.1)->getDatetime());
|
|
$t->addEcommerceItem($sku = 'SKU IN ABANDONED CART ONE', $name = 'PRODUCT ONE LEFT in cart', $category = '', $price = 500.11111112, $quantity = 2);
|
|
self::checkResponse($t->doTrackEcommerceCartUpdate($grandTotal = 1000));
|
|
}
|
|
}
|