Skip to content

Commit f37eb05

Browse files
committed
Add more cases to test
1 parent 4cd5cd2 commit f37eb05

File tree

1 file changed

+27
-2
lines changed
  • app/code/Magento/Catalog/Test/Unit/Controller/Category

1 file changed

+27
-2
lines changed

app/code/Magento/Catalog/Test/Unit/Controller/Category/ViewTest.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ public function testApplyCustomLayoutUpdate(array $expectedData): void
205205
\Magento\Framework\DataObject::class,
206206
['getPageLayout', 'getLayoutUpdates']
207207
);
208+
$this->category->expects($this->at(1))
209+
->method('hasChildren')
210+
->willReturn(true);
211+
$this->category->expects($this->at(2))
212+
->method('hasChildren')
213+
->willReturn($expectedData[1][0]['type'] === 'default' ? true : false);
214+
$this->category->expects($this->once())
215+
->method('getDisplayMode')
216+
->willReturn($expectedData[2][0]['displaymode']);
208217
$this->expectationForPageLayoutHandles($expectedData);
209218
$settings->expects($this->atLeastOnce())->method('getPageLayout')->will($this->returnValue($pageLayout));
210219
$settings->expects($this->once())->method('getLayoutUpdates')->willReturn(['update1', 'update2']);
@@ -221,7 +230,8 @@ public function testApplyCustomLayoutUpdate(array $expectedData): void
221230
*/
222231
private function expectationForPageLayoutHandles($data): void
223232
{
224-
$index = 2;
233+
$index = 1;
234+
225235
foreach ($data as $expectedData) {
226236
$this->page->expects($this->at($index))
227237
->method('addPageLayoutHandles')
@@ -240,8 +250,23 @@ public function getInvocationData(): array
240250
return [
241251
[
242252
'layoutHandles' => [
253+
[['type' => 'default'], null, false],
254+
[['type' => 'default_without_children'], null, false],
255+
[['displaymode' => 'products'], null, false]
256+
]
257+
],
258+
[
259+
'layoutHandles' => [
260+
[['type' => 'default'], null, false],
243261
[['type' => 'default_without_children'], null, false],
244-
[['displaymode' => ''], null, false]
262+
[['displaymode' => 'page'], null, false]
263+
]
264+
],
265+
[
266+
'layoutHandles' => [
267+
[['type' => 'default'], null, false],
268+
[['type' => 'default'], null, false],
269+
[['displaymode' => 'poducts_and_page'], null, false]
245270
]
246271
]
247272
];

0 commit comments

Comments
 (0)