Skip to content

Commit

Permalink
magento-engcom/import-export-improvements#50: use the assertEqualsSpe…
Browse files Browse the repository at this point in the history
…cificAttributes 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
  • Loading branch information
dmanners committed Feb 22, 2018
1 parent 0c6120e commit 768d1d7
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,32 @@ public function importReplaceDataProvider()
{
return $this->exportImportDataProvider();
}

/**
* Fixing https://github.com/magento-engcom/import-export-improvements/issues/50 means that during import images
* can now get renamed for this we need to skip the attribute checking and instead check that the images contain
* the right beginning part of the name. When an image is named "magento_image.jpeg" but there is already an image
* with that name it will now become "magento_image_1.jpeg"
*
* @param \Magento\Catalog\Model\Product $expectedProduct
* @param \Magento\Catalog\Model\Product $actualProduct
*/
protected function assertEqualsSpecificAttributes($expectedProduct, $actualProduct)
{
if (!empty($actualProduct->getImage())
&& !empty($expectedProduct->getImage())
) {
$this->assertContains('magento_image', $actualProduct->getImage());
}
if (!empty($actualProduct->getSmallImage())
&& !empty($expectedProduct->getSmallImage())
) {
$this->assertContains('magento_image', $actualProduct->getSmallImage());
}
if (!empty($actualProduct->getThumbnail())
&& !empty($expectedProduct->getThumbnail())
) {
$this->assertContains('magento_image', $actualProduct->getThumbnail());
}
}
}

0 comments on commit 768d1d7

Please sign in to comment.