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

EmptySiteWithSiteContentDetection.php « Fixtures « PHPUnit « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 93ab523cabc7600d9475c405a190a21c73063203 (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
59
60
<?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 the
 * 'Osano' consent manager will be detected on the site.
 */
class EmptySiteWithSiteContentDetection extends Fixture
{
    public $idSite = 1;

    public function provideContainerConfig()
    {

        $mockData = [
            'consentManagerId' => 'osano',
            'consentManagerName' => 'Osano',
            'consentManagerUrl' => 'https://matomo.org/faq/how-to/using-osano-consent-manager-with-matomo',
            'isConnected' => true,
            'ga3' => false,
            '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');
        }
    }

}