File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1568,15 +1568,24 @@ public function testExistingProductWithUrlKeys()
15681568
15691569 /**
15701570 * @magentoDataFixture Magento/Catalog/_files/product_simple_with_url_key.php
1571- * @magentoDbIsolation enabled
1571+ * @magentoDbIsolation disabled
15721572 * @magentoAppIsolation enabled
15731573 */
15741574 public function testImportWithoutUrlKeys ()
15751575 {
1576+ $ productRepository = $ this ->objectManager ->create (\Magento \Catalog \Api \ProductRepositoryInterface::class);
1577+
15761578 /**
15771579 * Products `simple1` and `simple2` are created by fixture so already
15781580 * have a URL Key, whereas `simple3` is a new product so won't have one.
1581+ * Therefore we delete `simple3` to ensure other tests do not impact this.
15791582 */
1583+ try {
1584+ $ productRepository ->deleteById ('simple3 ' );
1585+ } catch (\Exception $ e ) {
1586+ // nothing to do, the product already does not exist
1587+ }
1588+
15801589 $ products = [
15811590 'simple1 ' => 'url-key ' ,
15821591 'simple2 ' => 'url-key2 ' ,
@@ -1601,7 +1610,6 @@ public function testImportWithoutUrlKeys()
16011610 $ this ->assertTrue ($ errors ->getErrorsCount () == 0 );
16021611 $ this ->_model ->importData ();
16031612
1604- $ productRepository = $ this ->objectManager ->create (\Magento \Catalog \Api \ProductRepositoryInterface::class);
16051613 foreach ($ products as $ productSku => $ productUrlKey ) {
16061614 $ this ->assertEquals ($ productUrlKey , $ productRepository ->get ($ productSku )->getUrlKey ());
16071615 }
You can’t perform that action at this time.
0 commit comments