Skip to content

Commit 7b36981

Browse files
kalinichamkalinicham
authored andcommitted
Fix Unit test
1 parent 9a7dc51 commit 7b36981

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

app/code/Magento/Translation/Test/Unit/Model/Js/DataProviderTest.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\Phrase\Renderer\Translate;
1616

1717
/**
18-
* Class DataProviderTest
18+
* Verify data provider translation
1919
*
2020
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2121
*/
@@ -107,11 +107,6 @@ public function testGetData(array $config)
107107
[$areaCode, $themePath, '*', '*', [$filePaths[3]]]
108108
];
109109

110-
$patterns = $config['patterns'];
111-
$expectedResult = $config['expectedResult'];
112-
$contentsMap = $config['contentsMap'];
113-
$translateMap = $config['translateMap'];
114-
115110
$this->appStateMock->expects($this->once())
116111
->method('getAreaCode')
117112
->willReturn($areaCode);
@@ -122,23 +117,23 @@ public function testGetData(array $config)
122117
->method('getStaticHtmlFiles')
123118
->willReturnMap($staticFilesMap);
124119

125-
foreach ($contentsMap as $index => $content) {
120+
foreach ($config['contentsMap'] as $index => $content) {
126121
$this->fileReadMock->expects($this->at($index))
127122
->method('readAll')
128123
->willReturn($content);
129124
}
130125

131126
$this->configMock->expects($this->any())
132127
->method('getPatterns')
133-
->willReturn($patterns);
128+
->willReturn($config['patterns']);
134129
$this->translateMock->expects($this->any())
135130
->method('render')
136-
->willReturnMap($translateMap);
131+
->willReturnMap($config['translateMap']);
137132

138133
$actualResult = $this->model->getData($themePath);
139-
$this->assertEquals($expectedResult, $actualResult);
134+
$this->assertEquals($config['expectedResult'], $actualResult);
140135
$this->assertEquals(
141-
json_encode($expectedResult),
136+
json_encode($config['expectedResult']),
142137
json_encode($actualResult),
143138
"Translations should be sorted by key"
144139
);

0 commit comments

Comments
 (0)