Skip to content

Commit 9165dd9

Browse files
author
Oleksii Korshenko
committed
MAGETWO-84272: Update AbstractBackend.php magento#12120
- fixed failed tests
1 parent 65bd2f9 commit 9165dd9

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

app/code/Magento/Eav/Model/Entity/Attribute/Backend/AbstractBackend.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ public function validate($object)
231231
$attribute = $this->getAttribute();
232232
$attrCode = $attribute->getAttributeCode();
233233
$value = $object->getData($attrCode);
234-
$label = $attribute->getFrontend()->getLabel();
235234

236235
if ($attribute->getIsVisible()
237236
&& $attribute->getIsRequired()
238237
&& $attribute->isValueEmpty($value)
239238
&& $attribute->isValueEmpty($attribute->getDefaultValue())
240239
) {
240+
$label = $attribute->getFrontend()->getLabel();
241241
throw new LocalizedException(__('The value of attribute "%1" must be set', $label));
242242
}
243243

@@ -249,7 +249,8 @@ public function validate($object)
249249
}
250250

251251
if ($attribute->getIsUnique()) {
252-
if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) {
252+
if (!$attribute->getEntity()->checkAttributeUniqueValue($attribute, $object)) {
253+
$label = $attribute->getFrontend()->getLabel();
253254
throw new LocalizedException(__('The value of attribute "%1" must be unique', $label));
254255
}
255256
}

dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,8 @@ public function testValidateCustomerData()
579579
$validationResponse = $this->_webApiCall($serviceInfo, $requestData);
580580
$this->assertFalse($validationResponse['valid']);
581581

582-
$this->assertEquals('The value of attribute "firstname" must be set', $validationResponse['messages'][0]);
583-
$this->assertEquals('The value of attribute "lastname" must be set', $validationResponse['messages'][1]);
582+
$this->assertEquals('The value of attribute "First Name" must be set', $validationResponse['messages'][0]);
583+
$this->assertEquals('The value of attribute "Last Name" must be set', $validationResponse['messages'][1]);
584584
}
585585

586586
public function testIsReadonly()

dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/CategoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public function testSaveActionCategoryWithDangerRequest()
339339
);
340340
$this->dispatch('backend/catalog/category/save');
341341
$this->assertSessionMessages(
342-
$this->equalTo(['The value of attribute "name" must be set']),
342+
$this->equalTo(['The value of attribute "Name" must be set']),
343343
\Magento\Framework\Message\MessageInterface::TYPE_ERROR
344344
);
345345
}

0 commit comments

Comments
 (0)