@@ -53,10 +53,13 @@ protected function setUp(): void
53
53
/**
54
54
* Test for isGoogleAnalyticsAvailable()
55
55
*
56
+ * @param string $value
57
+ * @param bool $flag
58
+ * @param bool $result
56
59
* @return void
57
60
* @dataProvider gaDataProvider
58
61
*/
59
- public function testIsGoogleAnalyticsAvailable ($ value , $ flag ): void
62
+ public function testIsGoogleAnalyticsAvailable ($ value , $ flag, $ result ): void
60
63
{
61
64
$ this ->scopeConfigMock ->expects ($ this ->once ())
62
65
->method ('getValue ' )
@@ -68,7 +71,7 @@ public function testIsGoogleAnalyticsAvailable($value, $flag): void
68
71
->with (HelperData::XML_PATH_ACTIVE , ScopeInterface::SCOPE_STORE )
69
72
->willReturn ($ flag );
70
73
71
- $ this ->assertEquals (( $ value && $ flag ) , $ this ->helper ->isGoogleAnalyticsAvailable ());
74
+ $ this ->assertEquals ($ result , $ this ->helper ->isGoogleAnalyticsAvailable ());
72
75
}
73
76
74
77
/**
@@ -79,25 +82,27 @@ public function testIsGoogleAnalyticsAvailable($value, $flag): void
79
82
public function gaDataProvider (): array
80
83
{
81
84
return [
82
- ['GA-XXXX ' , true ],
83
- ['GA-XXXX ' , false ],
84
- ['' , true ]
85
+ ['GA-XXXX ' , true , true ],
86
+ ['GA-XXXX ' , false , false ],
87
+ ['' , true , false ]
85
88
];
86
89
}
87
90
88
91
/**
89
92
* Test for isAnonymizedIpActive()
90
93
*
94
+ * @param string $value
95
+ * @param bool $result
91
96
* @return void
92
97
* @dataProvider yesNoDataProvider
93
98
*/
94
- public function testIsAnonymizedIpActive ($ value ): void
99
+ public function testIsAnonymizedIpActive ($ value, $ result ): void
95
100
{
96
101
$ this ->scopeConfigMock ->expects ($ this ->once ())
97
102
->method ('getValue ' )
98
103
->with (HelperData::XML_PATH_ANONYMIZE , ScopeInterface::SCOPE_STORE )
99
104
->willReturn ($ value );
100
- $ this ->assertEquals (( bool ) $ value , $ this ->helper ->isAnonymizedIpActive ());
105
+ $ this ->assertEquals ($ result , $ this ->helper ->isAnonymizedIpActive ());
101
106
}
102
107
103
108
/**
@@ -108,8 +113,8 @@ public function testIsAnonymizedIpActive($value): void
108
113
public function yesNoDataProvider (): array
109
114
{
110
115
return [
111
- ['Yes ' => '1 ' ],
112
- ['No ' => '0 ' ]
116
+ ['Yes ' => '1 ' , ' result ' => true ],
117
+ ['No ' => '0 ' , ' result ' => false ]
113
118
];
114
119
}
115
120
}
0 commit comments