Skip to content

Commit a85f3e2

Browse files
ENGCOM-8906: Update ListProduct.php #32389
2 parents 19916b6 + 47fff39 commit a85f3e2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ private function initializeProductCollection()
461461
// if the product is associated with any category
462462
if ($categories->count()) {
463463
// show products from this category
464-
$this->setCategoryId(current($categories->getIterator())->getId());
464+
$this->setCategoryId($categories->getIterator()->current()->getId());
465465
}
466466
}
467467

app/code/Magento/Catalog/Test/Unit/Block/Product/ListProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public function testGetIdentities()
195195

196196
$this->catCollectionMock->expects($this->once())
197197
->method('getIterator')
198-
->willReturn([$currentCategory]);
198+
->willReturn(new \ArrayIterator([$currentCategory]));
199199

200200
$this->prodCollectionMock->expects($this->any())
201201
->method('getIterator')

0 commit comments

Comments
 (0)