Skip to content

Commit 9e1d008

Browse files
committed
ACP2E-3972: Csv product import : Unable to unset a swatch image
1 parent ef621ff commit 9e1d008

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ImportWithSharedImagesTest.php

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2020 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -96,6 +96,41 @@ protected function tearDown(): void
9696
parent::tearDown();
9797
}
9898

99+
/**
100+
* @return void
101+
*/
102+
public function testHideImageWhenColumnContainsEmptyValue(): void
103+
{
104+
$productSku = 'ABC';
105+
$this->moveImages('magento_image.jpg');
106+
$source = $this->prepareFile('catalog_import_products_with_swatch_image.csv');
107+
$this->updateUploader();
108+
$errors = $this->import->setParameters([
109+
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
110+
'entity' => ProductEntity::ENTITY,
111+
])
112+
->setSource($source)->validateData();
113+
$this->assertEmpty($errors->getAllErrors());
114+
$this->import->importData();
115+
$this->createdProductsSkus[] = $productSku;
116+
$this->checkProductsImages('/m/a/magento_image.jpg', $this->createdProductsSkus);
117+
118+
$this->importDataResource->cleanBunches();
119+
$source = $this->prepareFile('catalog_import_products_without_swatch_image.csv');
120+
$this->updateUploader();
121+
$errors = $this->import->setParameters([
122+
'behavior' => Import::BEHAVIOR_ADD_UPDATE,
123+
'entity' => ProductEntity::ENTITY,
124+
])
125+
->setSource($source)->validateData();
126+
$this->assertEmpty($errors->getAllErrors());
127+
$this->import->importData();
128+
$this->productRepository->cleanCache();
129+
$product = $this->productRepository->get($productSku);
130+
$images = $product->getMediaGalleryImages();
131+
$this->assertEmpty($images->getItems());
132+
}
133+
99134
/**
100135
* @return void
101136
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sku,name,swatch_image,swatch_image_label,attribute_set_code,product_type,categories,product_websites
2+
ABC,abc,magento_image.jpg,testing,Default,simple,Default,base
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sku,name,swatch_image,swatch_image_label
2+
ABC,abc,__EMPTY__VALUE__,__EMPTY__VALUE__

0 commit comments

Comments
 (0)