Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 768d1d7

Browse files
committed
#50: use the assertEqualsSpecificAttributes to check images contain the same name
- when importing files with the same name will now be renamed for this reason we check names are similar now
1 parent 0c6120e commit 768d1d7

File tree

1 file changed

+28
-0
lines changed
  • dev/tests/integration/testsuite/Magento/CatalogImportExport/Model

1 file changed

+28
-0
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/ProductTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,32 @@ public function importReplaceDataProvider()
140140
{
141141
return $this->exportImportDataProvider();
142142
}
143+
144+
/**
145+
* Fixing https://github.com/magento-engcom/import-export-improvements/issues/50 means that during import images
146+
* can now get renamed for this we need to skip the attribute checking and instead check that the images contain
147+
* the right beginning part of the name. When an image is named "magento_image.jpeg" but there is already an image
148+
* with that name it will now become "magento_image_1.jpeg"
149+
*
150+
* @param \Magento\Catalog\Model\Product $expectedProduct
151+
* @param \Magento\Catalog\Model\Product $actualProduct
152+
*/
153+
protected function assertEqualsSpecificAttributes($expectedProduct, $actualProduct)
154+
{
155+
if (!empty($actualProduct->getImage())
156+
&& !empty($expectedProduct->getImage())
157+
) {
158+
$this->assertContains('magento_image', $actualProduct->getImage());
159+
}
160+
if (!empty($actualProduct->getSmallImage())
161+
&& !empty($expectedProduct->getSmallImage())
162+
) {
163+
$this->assertContains('magento_image', $actualProduct->getSmallImage());
164+
}
165+
if (!empty($actualProduct->getThumbnail())
166+
&& !empty($expectedProduct->getThumbnail())
167+
) {
168+
$this->assertContains('magento_image', $actualProduct->getThumbnail());
169+
}
170+
}
143171
}

0 commit comments

Comments
 (0)