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

EmptySiteWithSiteContentDetectionGA3.php « Fixtures « PHPUnit « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fb94ce6e6efeb8d6bb241965429caa18ced273d3 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
 * Matomo - free/libre analytics platform
 *
 * @link https://matomo.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
namespace Piwik\Tests\Fixtures;

use Piwik\Tests\Framework\Fixture;
use Piwik\SiteContentDetector;
use Piwik\Tests\Framework\Mock\FakeSiteContentDetector;

/**
 * Fixture that adds one site with no visits and configures site content detection test data so that GA3 will be
 * detected on the site.
 */
class EmptySiteWithSiteContentDetectionGA3 extends Fixture
{
    public $idSite = 1;

    public function provideContainerConfig()
    {
        $mockData = [
            'consentManagerId' => null,
            'consentManagerName' => null,
            'consentManagerUrl' => null,
            'isConnected' => false,
            'ga3' => true,
            'ga4' => false,
            'gtm' => false
        ];

        return [
            SiteContentDetector::class => \DI\autowire(FakeSiteContentDetector::class)
                 ->constructorParameter('mockData', $mockData)
        ];
    }

    public function setUp(): void
    {
        Fixture::createSuperUser();
        $this->setUpWebsites();
    }

    public function tearDown(): void
    {
        // empty
    }

    private function setUpWebsites()
    {
        if (!self::siteCreated($idSite = 1)) {
            self::createWebsite('2021-01-01');
        }
    }

}