Skip to content

Commit fb40804

Browse files
committed
AC-2574 updated variable scope as used in google tag manager module
1 parent c331d93 commit fb40804

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

app/code/Magento/GoogleGtag/Model/Config/GtagConfig.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class GtagConfig
1616
/**
1717
* Config paths for using throughout the code
1818
*/
19-
protected const XML_PATH_ACTIVE = 'google/gtag/analytics4/active';
19+
private const XML_PATH_ACTIVE = 'google/gtag/analytics4/active';
2020

21-
protected const XML_PATH_MEASUREMENT_ID = 'google/gtag/analytics4/measurement_id';
21+
private const XML_PATH_MEASUREMENT_ID = 'google/gtag/analytics4/measurement_id';
2222

2323
/**
2424
* Google AdWords conversion src
@@ -37,7 +37,7 @@ class GtagConfig
3737
/**
3838
* @var ScopeConfigInterface
3939
*/
40-
protected $scopeConfig;
40+
private $scopeConfig;
4141

4242
/**
4343
* @param ScopeConfigInterface $scopeConfig

app/code/Magento/GoogleGtag/Test/Unit/Block/GaTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class GaTest extends TestCase
5353
private $storeMock;
5454

5555
/**
56-
* @var MockObject
56+
* @var GtagConfiguration|mixed|MockObject
5757
*/
58-
private $googleAnalyticsDataMock;
58+
private $googleGtagConfig;
5959

6060
/**
6161
* @var SearchCriteriaBuilder|mixed|MockObject

app/code/Magento/GoogleGtag/Test/Unit/Observer/SetGoogleAnalyticsOnOrderSuccessPageViewObserverTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ class SetGoogleAnalyticsOnOrderSuccessPageViewObserverTest extends TestCase
3030
*/
3131
private $observerMock;
3232

33-
/**
34-
* @var GaDataHelper|MockObject
35-
*/
36-
private $googleAnalyticsDataMock;
37-
3833
/**
3934
* @var LayoutInterface|MockObject
4035
*/
4136
private $layoutMock;
4237

43-
/**
44-
* @var StoreManagerInterface|MockObject
45-
*/
46-
private $storeManagerMock;
47-
4838
/**
4939
* @var SetGoogleAnalyticsOnOrderSuccessPageViewObserver
5040
*/

app/code/Magento/GoogleGtag/registration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
use Magento\Framework\Component\ComponentRegistrar;
89

app/code/Magento/GoogleOptimizer/Helper/Data.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
/**
3-
* Google Optimizer Data Helper
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
@@ -15,8 +13,6 @@
1513
use Magento\Store\Model\ScopeInterface;
1614

1715
/**
18-
* Class Data
19-
*
2016
* @api
2117
* @since 100.0.2
2218
*/
@@ -25,12 +21,12 @@ class Data extends AbstractHelper
2521
/**
2622
* Xml path google experiments enabled
2723
*/
28-
public const XML_PATH_ENABLED = 'google/analytics/experiments';
24+
private const XML_PATH_ENABLED = 'google/analytics/experiments';
2925

3026
/**
3127
* Xml path google experiments enabled for GA4
3228
*/
33-
public const XML_PATH_ENABLED_GA4 = 'google/gtag/analytics4/experiments';
29+
private const XML_PATH_ENABLED_GA4 = 'google/gtag/analytics4/experiments';
3430

3531
/**
3632
* @var bool
@@ -89,7 +85,7 @@ public function isGoogleExperimentEnabled($store = null)
8985
* @param string $store
9086
* @return bool
9187
*/
92-
public function isGoogleExperimentActive($store = null): bool
88+
public function isGoogleExperimentActive($store = null)
9389
{
9490
return $this->isGoogleExperimentEnabled($store) &&
9591
(

app/code/Magento/GoogleOptimizer/Test/Unit/Helper/DataTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
*/
2121
class DataTest extends TestCase
2222
{
23+
/**
24+
* Xml path google experiments enabled
25+
*/
26+
private const XML_PATH_ENABLED = 'google/analytics/experiments';
27+
28+
/**
29+
* Xml path google experiments enabled for GA4
30+
*/
31+
private const XML_PATH_ENABLED_GA4 = 'google/gtag/analytics4/experiments';
32+
2333
/**
2434
* @var MockObject
2535
*/
@@ -99,12 +109,12 @@ public function testGoogleExperimentIsActive($isExperimentsEnabled, $isAnalytics
99109
'isSetFlag'
100110
)->withConsecutive(
101111
[
102-
Data::XML_PATH_ENABLED,
112+
self::XML_PATH_ENABLED,
103113
ScopeInterface::SCOPE_STORE,
104114
$store
105115
],
106116
[
107-
Data::XML_PATH_ENABLED_GA4,
117+
self::XML_PATH_ENABLED_GA4,
108118
ScopeInterface::SCOPE_STORE,
109119
$store
110120
]

0 commit comments

Comments
 (0)