Skip to content

Commit 41a583a

Browse files
committed
Expected result added with data provider
1 parent be81804 commit 41a583a

File tree

1 file changed

+14
-9
lines changed
  • app/code/Magento/GoogleAnalytics/Test/Unit/Helper

1 file changed

+14
-9
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,13 @@ protected function setUp(): void
5353
/**
5454
* Test for isGoogleAnalyticsAvailable()
5555
*
56+
* @param string $value
57+
* @param bool $flag
58+
* @param bool $result
5659
* @return void
5760
* @dataProvider gaDataProvider
5861
*/
59-
public function testIsGoogleAnalyticsAvailable($value, $flag): void
62+
public function testIsGoogleAnalyticsAvailable($value, $flag, $result): void
6063
{
6164
$this->scopeConfigMock->expects($this->once())
6265
->method('getValue')
@@ -68,7 +71,7 @@ public function testIsGoogleAnalyticsAvailable($value, $flag): void
6871
->with(HelperData::XML_PATH_ACTIVE, ScopeInterface::SCOPE_STORE)
6972
->willReturn($flag);
7073

71-
$this->assertEquals(($value && $flag), $this->helper->isGoogleAnalyticsAvailable());
74+
$this->assertEquals($result, $this->helper->isGoogleAnalyticsAvailable());
7275
}
7376

7477
/**
@@ -79,25 +82,27 @@ public function testIsGoogleAnalyticsAvailable($value, $flag): void
7982
public function gaDataProvider(): array
8083
{
8184
return [
82-
['GA-XXXX', true],
83-
['GA-XXXX', false],
84-
['', true]
85+
['GA-XXXX', true, true],
86+
['GA-XXXX', false, false],
87+
['', true, false]
8588
];
8689
}
8790

8891
/**
8992
* Test for isAnonymizedIpActive()
9093
*
94+
* @param string $value
95+
* @param bool $result
9196
* @return void
9297
* @dataProvider yesNoDataProvider
9398
*/
94-
public function testIsAnonymizedIpActive($value): void
99+
public function testIsAnonymizedIpActive($value, $result): void
95100
{
96101
$this->scopeConfigMock->expects($this->once())
97102
->method('getValue')
98103
->with(HelperData::XML_PATH_ANONYMIZE, ScopeInterface::SCOPE_STORE)
99104
->willReturn($value);
100-
$this->assertEquals((bool) $value, $this->helper->isAnonymizedIpActive());
105+
$this->assertEquals($result, $this->helper->isAnonymizedIpActive());
101106
}
102107

103108
/**
@@ -108,8 +113,8 @@ public function testIsAnonymizedIpActive($value): void
108113
public function yesNoDataProvider(): array
109114
{
110115
return [
111-
['Yes' => '1'],
112-
['No' => '0']
116+
['Yes' => '1', 'result' => true],
117+
['No' => '0', 'result' => false]
113118
];
114119
}
115120
}

0 commit comments

Comments
 (0)