@@ -97,10 +97,16 @@ public function exportImportDataProvider()
97
97
'simple-product-image ' => [
98
98
[
99
99
'Magento/CatalogImportExport/Model/Import/_files/media_import_image.php ' ,
100
- 'Magento/Catalog/_files/product_with_image.php '
100
+ 'Magento/Catalog/_files/product_with_image.php ' ,
101
101
],
102
102
[
103
103
'simple ' ,
104
+ ],
105
+ [
106
+ "image " ,
107
+ "small_image " ,
108
+ "thumbnail " ,
109
+ "media_gallery "
104
110
]
105
111
],
106
112
'simple-product-crosssell ' => [
@@ -134,4 +140,32 @@ public function importReplaceDataProvider()
134
140
{
135
141
return $ this ->exportImportDataProvider ();
136
142
}
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
+ }
137
171
}
0 commit comments