@@ -101,7 +101,7 @@ protected function setUp()
101
101
$ this ->productRepository ->cleanCache ();
102
102
$ this ->productResource =$ this ->objectManager ->get (ProductResource::class);
103
103
$ this ->productAttributeRepository = $ this ->objectManager ->create (ProductAttributeRepositoryInterface::class);
104
- $ this ->jsonSerializer = $ this ->objectManager ->create (SerializerInterface::class);
104
+ $ this ->jsonSerializer = $ this ->objectManager ->get (SerializerInterface::class);
105
105
$ this ->searchCriteriaBuilder = $ this ->objectManager ->get (SearchCriteriaBuilder::class);
106
106
$ this ->config = $ this ->objectManager ->get (Config::class);
107
107
$ this ->mediaDirectory = $ this ->objectManager ->get (Filesystem::class)->getDirectoryWrite (DirectoryList::MEDIA );
@@ -130,12 +130,12 @@ public function testInitialize(array $childProducts, array $expectedImages): voi
130
130
*
131
131
* @magentoDataFixture Magento/Catalog/_files/product_image.php
132
132
* @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
133
- * @dataProvider initializeWithExistChildImagesDataProvider
133
+ * @dataProvider initializeWithExistingChildImagesDataProvider
134
134
* @param array $childProducts
135
135
* @param array $expectedImages
136
136
* @return void
137
137
*/
138
- public function testInitializeWithExistChildImages (array $ childProducts , array $ expectedImages ): void
138
+ public function testInitializeWithExistingChildImages (array $ childProducts , array $ expectedImages ): void
139
139
{
140
140
$ this ->updateChildProductsImages (
141
141
[
@@ -248,7 +248,7 @@ public function initializeDataProvider(): array
248
248
/**
249
249
* @return array
250
250
*/
251
- public function initializeWithExistChildImagesDataProvider (): array
251
+ public function initializeWithExistingChildImagesDataProvider (): array
252
252
{
253
253
$ dataProvider = $ this ->initializeDataProvider ();
254
254
unset($ dataProvider ['children_with_different_images ' ], $ dataProvider ['children_with_different_image_roles ' ]);
@@ -348,7 +348,8 @@ private function updateChildProductsImages(array $imageNames): void
348
348
{
349
349
$ simpleIds = $ this ->configurableProduct ->getExtensionAttributes ()->getConfigurableProductLinks ();
350
350
$ criteria = $ this ->searchCriteriaBuilder ->addFilter ('entity_id ' , $ simpleIds , 'in ' )->create ();
351
- foreach ($ this ->productRepository ->getList ($ criteria )->getItems () as $ simpleProduct ) {
351
+ $ products = $ this ->productRepository ->getList ($ criteria )->getItems ();
352
+ foreach ($ products as $ simpleProduct ) {
352
353
$ simpleProduct ->setStoreId (Store::DEFAULT_STORE_ID )
353
354
->setImage ($ imageNames [$ simpleProduct ->getSku ()])
354
355
->setSmallImage ($ imageNames [$ simpleProduct ->getSku ()])
0 commit comments