Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ManyVisitsWithGeoIPAndEcommerce.php « Fixtures « PHPUnit « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: db094351a5a1e12dd8a76be5d0f25dece7de112f (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
<?php
/**
 * Matomo - free/libre analytics platform
 *
 * @link    http://matomo.org
 * @license http://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 \PiwikTracker $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(\PiwikTracker $t, $fixtureCounter, $visitorCounter, $doBulk, array $params)
    {
        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);
            }
        }
    }
}