Skip to content

Commit c9d9e38

Browse files
carstenpfeiferdmanners
carstenpfeifer
authored andcommitted
magento-engcom/import-export-improvements#101: Change test case to use two different products with the same URL key to prevent 'SKU already exists' error.
1 parent 9862c00 commit c9d9e38

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

dev/tests/functional/tests/app/Magento/CatalogUrlRewrite/Test/TestCase/CreateDuplicateUrlProductEntity.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function __prepare(Category $category)
6868
* Run create product simple entity test.
6969
*
7070
* @param CatalogProductSimple $product
71+
* @param CatalogProductSimple $product2
7172
* @param Category $category
7273
* @param CatalogProductIndex $productGrid
7374
* @param CatalogProductNew $newProductPage
@@ -77,6 +78,7 @@ public function __prepare(Category $category)
7778
*/
7879
public function testCreate(
7980
CatalogProductSimple $product,
81+
CatalogProductSimple $product2,
8082
Category $category,
8183
CatalogProductIndex $productGrid,
8284
CatalogProductNew $newProductPage,
@@ -92,13 +94,15 @@ public function testCreate(
9294
['configData' => $this->configData, 'flushCache' => $this->flushCache]
9395
)->run();
9496

95-
for ($index = 0; $index < 2; $index++) {
96-
// Duplicate product
97-
$productGrid->open();
98-
$productGrid->getGridPageActionBlock()->addProduct('simple');
99-
$newProductPage->getProductForm()->fill($product, null, $category);
100-
$newProductPage->getFormPageActions()->save();
101-
}
97+
$productGrid->open();
98+
$productGrid->getGridPageActionBlock()->addProduct('simple');
99+
$newProductPage->getProductForm()->fill($product, null, $category);
100+
$newProductPage->getFormPageActions()->save();
101+
102+
$productGrid->open();
103+
$productGrid->getGridPageActionBlock()->addProduct('simple');
104+
$newProductPage->getProductForm()->fill($product2, null, $category);
105+
$newProductPage->getFormPageActions()->save();
102106

103107
return ['product' => $product];
104108
}

dev/tests/functional/tests/app/Magento/CatalogUrlRewrite/Test/TestCase/CreateDuplicateUrlProductEntity.xml

100644100755
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\CatalogUrlRewrite\Test\TestCase\CreateDuplicateUrlProductEntity" summary="Create Simple Product" ticketId="MAGETWO-69427">
1010
<variation name="CreateDuplicateUrlProductEntityTestVariation1" summary="Create Duplicate Url Product">
11-
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, severity:S1, mftf_migrated:yes</data>
12-
<data name="product/data/url_key" xsi:type="string">simple-product-%isolation%</data>
11+
<data name="tag" xsi:type="string">test_type:acceptance_test, test_type:extended_acceptance_test, severity:S1</data>
12+
<data name="product/data/url_key" xsi:type="string">simple-product-samekey</data>
1313
<data name="product/data/name" xsi:type="string">Simple Product %isolation%</data>
1414
<data name="product/data/sku" xsi:type="string">simple_sku_%isolation%</data>
1515
<data name="product/data/price/value" xsi:type="string">10000</data>
1616
<data name="product/data/weight" xsi:type="string">50</data>
1717
<data name="product/data/quantity_and_stock_status/qty" xsi:type="string">657</data>
18+
<data name="product2/data/url_key" xsi:type="string">simple-product-samekey</data>
19+
<data name="product2/data/name" xsi:type="string">Simple Product %isolation%</data>
20+
<data name="product2/data/sku" xsi:type="string">simple_sku_%isolation%</data>
21+
<data name="product2/data/price/value" xsi:type="string">10000</data>
22+
<data name="product2/data/weight" xsi:type="string">50</data>
23+
<data name="product2/data/quantity_and_stock_status/qty" xsi:type="string">657</data>
1824
<constraint name="Magento\CatalogUrlRewrite\Test\Constraint\AssertProductUrlDuplicateErrorMessage" />
1925
</variation>
2026
</testCase>

0 commit comments

Comments
 (0)