diff options
Diffstat (limited to 'tests/PHPUnit/Fixtures/EmptySiteWithSiteContentDetectionGTM.php')
-rw-r--r-- | tests/PHPUnit/Fixtures/EmptySiteWithSiteContentDetectionGTM.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/PHPUnit/Fixtures/EmptySiteWithSiteContentDetectionGTM.php b/tests/PHPUnit/Fixtures/EmptySiteWithSiteContentDetectionGTM.php new file mode 100644 index 0000000000..cdadb7b7e7 --- /dev/null +++ b/tests/PHPUnit/Fixtures/EmptySiteWithSiteContentDetectionGTM.php @@ -0,0 +1,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 GTM will be + * detected on the site. + */ +class EmptySiteWithSiteContentDetectionGTM extends Fixture +{ + public $idSite = 1; + + public function provideContainerConfig() + { + $mockData = [ + 'consentManagerId' => null, + 'consentManagerName' => null, + 'consentManagerUrl' => null, + 'isConnected' => false, + 'ga3' => false, + 'ga4' => false, + 'gtm' => true + ]; + + 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'); + } + } + +} |