Skip to content

Commit b394255

Browse files
committed
Removed duplicated logic with data provider
1 parent 9b18834 commit b394255

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

app/code/Magento/Contact/Test/Unit/Model/ConfigTest.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,29 @@ protected function setUp(): void
5454
* Test isEnabled()
5555
*
5656
* @return void
57+
* @dataProvider isEnabledDataProvider
5758
*/
58-
public function testIsEnabled(): void
59+
public function testIsEnabled($isSetFlag, $result): void
5960
{
6061
$this->scopeConfigMock->expects($this->once())
6162
->method('isSetFlag')
6263
->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)
63-
->willReturn(true);
64+
->willReturn($isSetFlag);
6465

65-
$this->assertTrue($this->model->isEnabled());
66+
$this->assertEquals($result, $this->model->isEnabled());
6667
}
6768

6869
/**
69-
* Test isNotEnabled()
70+
* Data provider for isEnabled()
7071
*
71-
* @return void
72+
* @return array
7273
*/
73-
public function testIsNotEnabled(): void
74+
public function isEnabledDataProvider(): array
7475
{
75-
$this->scopeConfigMock->expects($this->once())
76-
->method('isSetFlag')
77-
->with(config::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)
78-
->willReturn(false);
79-
80-
$this->assertFalse($this->model->isEnabled());
76+
return [
77+
[true, true],
78+
[false, false]
79+
];
8180
}
8281

8382
/**

0 commit comments

Comments
 (0)