Skip to content

Commit 829f071

Browse files
committed
MTA-552: Re-factor Test for Create Product with New Category
- Added check for the old fixture - Fixed test variation
1 parent 4e39ad9 commit 829f071

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\ProductTab;
1616
use Magento\Mtf\Client\Element;
1717
use Magento\Mtf\Client\Locator;
18+
use Magento\Mtf\Fixture\DataFixture;
1819
use Magento\Mtf\Fixture\FixtureInterface;
1920
use Magento\Mtf\Fixture\InjectableFixture;
2021
use Magento\Catalog\Test\Fixture\Category;
@@ -112,6 +113,12 @@ public function fill(FixtureInterface $product, SimpleElement $element = null, F
112113
} else {
113114
$tabs = $this->getFieldsByTabs($product);
114115

116+
//TODO: Remove after old product fixture will be deleted
117+
if (null === $category && $product instanceof DataFixture) {
118+
$categories = $product->getCategories();
119+
$category = reset($categories);
120+
}
121+
115122
$this->showAdvancedSettings();
116123
$this->fillTabs($tabs, $element);
117124

@@ -120,7 +127,8 @@ public function fill(FixtureInterface $product, SimpleElement $element = null, F
120127
}
121128
}
122129

123-
$category = $product->hasData('category_ids')
130+
//TODO: Remove "!($product instanceof DataFixture)" after old product fixture will be deleted
131+
$category = !($product instanceof DataFixture) && $product->hasData('category_ids')
124132
? $product->getDataFieldConfig('category_ids')['source']->getCategories()
125133
: [$category];
126134
if ($category[0]) {

dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/CategoryIds.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(
5858
$presets = explode(',', $data['presets']);
5959
foreach ($presets as $preset) {
6060
$category = $fixtureFactory->createByCode('category', ['dataSet' => $preset]);
61-
if ($data['persist'] !== 'no') {
61+
if (!isset($data['persist']) || $data['persist'] !== 'no') {
6262
$category->persist();
6363
}
6464

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/CreateSimpleProductEntityTest/testCreate.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"Create product with up-sell products";"-";"-";"-";"simple-product-%isolation%";"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10019";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"59";"75";"In Stock";"-";"-";"-";"-";"-";"-";"-";"-";"catalogProductSimple::default, configurableProductInjectable::default";"-";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductUpSells";""
2222
"Create product with related products";"-";"-";"-";"simple-product-%isolation%";"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10020";"-";"Simple Product short_description %isolation%";"Simple Product description %isolation%";"59";"75";"In Stock";"-";"-";"-";"-";"-";"-";"-";"-";"-";"catalogProductSimple::default, configurableProductInjectable::default";"assertProductSaveMessage, assertProductInGrid, assertProductForm, assertProductRelatedProducts";""
2323
"MAGETWO-12423: Can't Add Out of Stock Products to Shopping Cart";"display_out_of_stock";"-";"-";"simple-product-%isolation%";"Simple Product %isolation%";"simple_sku_%isolation%";"-";"10021";"-";"-";"-";"68";"0";"Out of Stock";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertAddToCartButtonAbsent";"test_type:acceptance_test"
24-
"MAGETWO-13345: Create Simple Product with Creating New Category (Required Fields Only)";"-";"no";"default_subcategory";"simple%isolation%";"simple%isolation%";"simple%isolation%";"-";"10";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInCategory, assertProductPage";"test_type:acceptance_test"
24+
"MAGETWO-13345: Create Simple Product with Creating New Category (Required Fields Only)";"-";"no";"default_subcategory";"simple%isolation%";"simple%isolation%";"simple%isolation%";"-";"10";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"-";"assertProductSaveMessage, assertProductInCategory, assertProductPage";"test_type:acceptance_test"

0 commit comments

Comments
 (0)