Skip to content

Commit fda664a

Browse files
Updated testImportWithoutUrlKeys() to create new simple in CSV for third product, to prevent other tests interfering
1 parent 2fb7183 commit fda664a

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,19 +1578,13 @@ public function testImportWithoutUrlKeys()
15781578

15791579
/**
15801580
* Products `simple1` and `simple2` are created by fixture so already
1581-
* have a URL Key, whereas `simple3` is a new product so won't have one.
1582-
* Therefore we delete `simple3` to ensure other tests do not impact this.
1581+
* have a URL Key, whereas `new-simple` is a new product so the import
1582+
* will generate it's URL Key from the name provided in the CSV.
15831583
*/
1584-
try {
1585-
$productRepository->deleteById('simple3');
1586-
} catch (\Exception $e) {
1587-
// nothing to do, the product already does not exist
1588-
}
1589-
15901584
$products = [
1591-
'simple1' => 'url-key',
1592-
'simple2' => 'url-key2',
1593-
'simple3' => 'simple-3',
1585+
'simple1' => 'url-key',
1586+
'simple2' => 'url-key2',
1587+
'new-simple' => 'new-simple',
15941588
];
15951589
$filesystem = $this->objectManager->create(\Magento\Framework\Filesystem::class);
15961590
$directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/_files/products_to_import_without_url_keys.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ sku,product_type,store_view_code,name,price,attribute_set_code,url_key
22
simple1,simple,,"simple 1",25,Default,""
33
simple2,simple,,"simple 2",34,Default,""
44
simple3,simple,,"simple 3",58,Default,""
5+
new-simple,simple,,"new simple",25,Default,""

0 commit comments

Comments
 (0)