Skip to content

Commit e53ad73

Browse files
committed
Merge remote-tracking branch '37868/fix-for-issue-37864' into comm_247beta3
2 parents 4b3db2d + f983a0e commit e53ad73

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
6666
*/
6767
protected $instancesById = [];
6868

69-
/**
70-
* @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
71-
*/
72-
protected $initializationHelper;
73-
7469
/**
7570
* @var \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory
7671
*/
@@ -195,7 +190,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
195190
/**
196191
* ProductRepository constructor.
197192
* @param ProductFactory $productFactory
198-
* @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper
199193
* @param \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory
200194
* @param ResourceModel\Product\CollectionFactory $collectionFactory
201195
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
@@ -225,7 +219,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
225219
*/
226220
public function __construct(
227221
ProductFactory $productFactory,
228-
\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
229222
\Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory,
230223
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
231224
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
@@ -253,7 +246,6 @@ public function __construct(
253246
) {
254247
$this->productFactory = $productFactory;
255248
$this->collectionFactory = $collectionFactory;
256-
$this->initializationHelper = $initializationHelper;
257249
$this->searchResultsFactory = $searchResultsFactory;
258250
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
259251
$this->resourceModel = $resourceModel;
@@ -940,7 +932,7 @@ private function joinPositionField(
940932
foreach ($filterGroup->getFilters() as $filter) {
941933
if ($filter->getField() === 'category_id') {
942934
$filterValue = $filter->getValue();
943-
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue ?? '');
935+
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue);
944936
}
945937
}
946938
}

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ class ProductRepositoryTest extends TestCase
7777
*/
7878
private $model;
7979

80-
/**
81-
* @var Helper|MockObject
82-
*/
83-
private $initializationHelper;
84-
8580
/**
8681
* @var Product|MockObject
8782
*/
@@ -255,7 +250,6 @@ protected function setUp(): void
255250
->method('hasGalleryAttribute')
256251
->willReturn(true);
257252
$this->filterBuilder = $this->createMock(FilterBuilder::class);
258-
$this->initializationHelper = $this->createMock(Helper::class);
259253
$this->collectionFactory = $this->createPartialMock(CollectionFactory::class, ['create']);
260254
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
261255
$this->metadataService = $this->getMockForAbstractClass(ProductAttributeRepositoryInterface::class);
@@ -342,7 +336,6 @@ function ($value) {
342336
ProductRepository::class,
343337
[
344338
'productFactory' => $this->productFactory,
345-
'initializationHelper' => $this->initializationHelper,
346339
'resourceModel' => $this->resourceModel,
347340
'filterBuilder' => $this->filterBuilder,
348341
'collectionFactory' => $this->collectionFactory,
@@ -723,7 +716,6 @@ public function testSaveExisting(): void
723716
$this->productFactory->expects($this->any())
724717
->method('create')
725718
->willReturn($this->product);
726-
$this->initializationHelper->expects($this->never())->method('initialize');
727719
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
728720
->willReturn(true);
729721
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
@@ -748,7 +740,6 @@ public function testSaveNew(): void
748740
$this->productFactory->expects($this->any())
749741
->method('create')
750742
->willReturn($this->product);
751-
$this->initializationHelper->expects($this->never())->method('initialize');
752743
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
753744
->willReturn(true);
754745
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
@@ -774,7 +765,6 @@ public function testSaveUnableToSaveException(): void
774765
$this->productFactory->expects($this->exactly(2))
775766
->method('create')
776767
->willReturn($this->product);
777-
$this->initializationHelper->expects($this->never())->method('initialize');
778768
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
779769
->willReturn(true);
780770
$this->resourceModel->expects($this->once())->method('save')->with($this->product)
@@ -800,7 +790,6 @@ public function testSaveException(): void
800790
$this->productFactory->expects($this->exactly(2))
801791
->method('create')
802792
->willReturn($this->product);
803-
$this->initializationHelper->expects($this->never())->method('initialize');
804793
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
805794
->willReturn(true);
806795

@@ -830,7 +819,6 @@ public function testSaveInvalidProductException(): void
830819
$this->productFactory->expects($this->exactly(2))
831820
->method('create')
832821
->willReturn($this->product);
833-
$this->initializationHelper->expects($this->never())->method('initialize');
834822
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
835823
->willReturn(['error1', 'error2']);
836824
$this->product->expects($this->once())->method('getId')->willReturn(null);
@@ -854,8 +842,6 @@ public function testSaveThrowsTemporaryStateExceptionIfDatabaseConnectionErrorOc
854842
$this->productFactory->expects($this->any())
855843
->method('create')
856844
->willReturn($this->product);
857-
$this->initializationHelper->expects($this->never())
858-
->method('initialize');
859845
$this->resourceModel->expects($this->once())
860846
->method('validate')
861847
->with($this->product)
@@ -1018,7 +1004,6 @@ public function testSaveExistingWithOptions(array $newOptions): void
10181004
$this->productFactory->expects($this->any())
10191005
->method('create')
10201006
->willReturn($this->initializedProduct);
1021-
$this->initializationHelper->expects($this->never())->method('initialize');
10221007
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
10231008
->willReturn(true);
10241009
$this->resourceModel->expects($this->once())->method('save')
@@ -1184,7 +1169,6 @@ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $
11841169
$this->productFactory->expects($this->any())
11851170
->method('create')
11861171
->willReturn($this->initializedProduct);
1187-
$this->initializationHelper->expects($this->never())->method('initialize');
11881172
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
11891173
->willReturn(true);
11901174
$this->resourceModel->expects($this->once())->method('save')
@@ -1354,7 +1338,6 @@ protected function setupProductMocksForSave(): void
13541338
$this->productFactory->expects($this->any())
13551339
->method('create')
13561340
->willReturn($this->initializedProduct);
1357-
$this->initializationHelper->expects($this->never())->method('initialize');
13581341
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
13591342
->willReturn(true);
13601343
$this->resourceModel->expects($this->once())->method('save')
@@ -1475,7 +1458,6 @@ public function testSaveWithDifferentWebsites(): void
14751458
$this->productFactory->expects($this->any())
14761459
->method('create')
14771460
->willReturn($this->product);
1478-
$this->initializationHelper->expects($this->never())->method('initialize');
14791461
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
14801462
->willReturn(true);
14811463
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);

0 commit comments

Comments
 (0)