|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © Magento, Inc. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
| 3 | + * Copyright 2020 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */
|
6 | 6 | declare(strict_types=1);
|
7 | 7 |
|
@@ -96,6 +96,41 @@ protected function tearDown(): void
|
96 | 96 | parent::tearDown();
|
97 | 97 | }
|
98 | 98 |
|
| 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 | + |
99 | 134 | /**
|
100 | 135 | * @return void
|
101 | 136 | */
|
|
0 commit comments