Skip to content

Commit dcf455e

Browse files
Indrani SonawaneIndrani Sonawane
Indrani Sonawane
authored and
Indrani Sonawane
committed
Merge remote-tracking branch '38050/wip_36667' into community_prs_march
2 parents 4d987d2 + ad5548a commit dcf455e

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

app/code/Magento/CatalogInventory/Model/Plugin/ProductLinks.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,22 @@
1313

1414
class ProductLinks
1515
{
16-
/**
17-
* @var Configuration
18-
*/
19-
private $configuration;
20-
21-
/**
22-
* @var Stock
23-
*/
24-
private $stockHelper;
2516

2617
/**
2718
* ProductLinks constructor.
2819
*
2920
* @param Configuration $configuration
3021
* @param Stock $stockHelper
3122
*/
32-
public function __construct(Configuration $configuration, Stock $stockHelper)
33-
{
34-
$this->configuration = $configuration;
35-
$this->stockHelper = $stockHelper;
23+
public function __construct(
24+
private readonly Configuration $configuration,
25+
private readonly Stock $stockHelper
26+
) {
3627
}
3728

3829
/**
30+
* Fixes simple products are shown as associated in grouped when set out of stock
31+
*
3932
* @param Link $subject
4033
* @param Collection $collection
4134
* @return Collection
@@ -44,7 +37,7 @@ public function __construct(Configuration $configuration, Stock $stockHelper)
4437
public function afterGetProductCollection(Link $subject, Collection $collection)
4538
{
4639
if ($this->configuration->isShowOutOfStock() != 1) {
47-
$this->stockHelper->addInStockFilterToCollection($collection);
40+
$this->stockHelper->addIsInStockFilterToCollection($collection);
4841
}
4942
return $collection;
5043
}

app/code/Magento/CatalogInventory/Test/Unit/Model/Plugin/ProductLinksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testAfterGetProductCollectionShow($status, $callCount)
5252
$this->configMock->expects($this->once())->method('isShowOutOfStock')->willReturn($status);
5353
$this->stockHelperMock
5454
->expects($this->exactly($callCount))
55-
->method('addInStockFilterToCollection')
55+
->method('addIsInStockFilterToCollection')
5656
->with($collectionMock);
5757

5858
$this->assertEquals($collectionMock, $this->model->afterGetProductCollection($subjectMock, $collectionMock));

0 commit comments

Comments
 (0)