Skip to content

Commit 5a7cb64

Browse files
Merge branch 'MAGETWO-51754' of https://github.corp.magento.com/magento-tango/magento2ce into MAGETWO-52212
2 parents 7b30075 + 661a49a commit 5a7cb64

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

dev/tests/functional/tests/app/Magento/Catalog/Test/Constraint/AssertProductAttributeIsRequired.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,27 @@ class AssertProductAttributeIsRequired extends AbstractConstraint
2929
* @param CatalogProductEdit $catalogProductEdit
3030
* @param CatalogProductAttribute $attribute
3131
* @param InjectableFixture $product
32+
* @param string $sectionName
3233
* @return void
3334
*/
3435
public function processAssert(
3536
CatalogProductIndex $catalogProductIndex,
3637
CatalogProductEdit $catalogProductEdit,
3738
CatalogProductAttribute $attribute,
38-
InjectableFixture $product
39+
InjectableFixture $product,
40+
$sectionName
3941
) {
4042
$catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
4143
$productForm = $catalogProductEdit->getProductForm();
4244
if (!$productForm->checkAttributeLabel($attribute)) {
43-
$productForm->openSection('attributes');
45+
$productForm->openSection($sectionName);
4446
}
4547
$productForm->getAttributeElement($attribute)->setValue('');
4648
$catalogProductEdit->getFormPageActions()->save();
47-
$failedFields = $productForm->getRequireNoticeFields($product);
48-
$actualMessage = $failedFields['attributes'][$attribute->getFrontendLabel()];
49+
$validationErrors = $productForm->getSection($sectionName)->getValidationErrors();
50+
$actualMessage = isset($validationErrors[$attribute->getFrontendLabel()])
51+
? $validationErrors[$attribute->getFrontendLabel()]
52+
: '';
4953

5054
\PHPUnit_Framework_Assert::assertEquals(
5155
self::REQUIRE_MESSAGE,

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityFromProductPageTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<data name="attribute/data/is_required" xsi:type="string">Yes</data>
5656
<data name="attribute/data/attribute_code" xsi:type="string">attr_text_%isolation%</data>
5757
<data name="attribute/data/default_value_text" xsi:type="string">default_value_text%isolation%</data>
58+
<data name="sectionName" xsi:type="string">attributes</data>
5859
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsRequired" />
5960
</variation>
6061
<variation name="CreateProductAttributeEntityFromProductPageTestVariation4">

dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<data name="productAttribute/data/is_searchable" xsi:type="string">Yes</data>
3333
<data name="productAttribute/data/is_visible_in_advanced_search" xsi:type="string">Yes</data>
3434
<data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data>
35+
<data name="sectionName" xsi:type="string">product-details</data>
3536
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" />
3637
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
3738
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />
@@ -130,6 +131,7 @@
130131
<data name="assertProduct/data/name" xsi:type="string">Product name</data>
131132
<data name="assertProduct/data/sku" xsi:type="string">product-sku</data>
132133
<data name="assertProduct/data/price" xsi:type="string">35</data>
134+
<data name="sectionName" xsi:type="string">product-details</data>
133135
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeInGrid" />
134136
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
135137
<constraint name="Magento\Catalog\Test\Constraint\AssertAddedProductAttributeOnProductForm" />

0 commit comments

Comments
 (0)