File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
app/code/Magento/Eav/Model/Entity/Attribute/Backend
api-functional/testsuite/Magento/Customer/Api
integration/testsuite/Magento/Catalog/Controller/Adminhtml Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -231,13 +231,13 @@ public function validate($object)
231
231
$ attribute = $ this ->getAttribute ();
232
232
$ attrCode = $ attribute ->getAttributeCode ();
233
233
$ value = $ object ->getData ($ attrCode );
234
- $ label = $ attribute ->getFrontend ()->getLabel ();
235
234
236
235
if ($ attribute ->getIsVisible ()
237
236
&& $ attribute ->getIsRequired ()
238
237
&& $ attribute ->isValueEmpty ($ value )
239
238
&& $ attribute ->isValueEmpty ($ attribute ->getDefaultValue ())
240
239
) {
240
+ $ label = $ attribute ->getFrontend ()->getLabel ();
241
241
throw new LocalizedException (__ ('The value of attribute "%1" must be set ' , $ label ));
242
242
}
243
243
@@ -249,7 +249,8 @@ public function validate($object)
249
249
}
250
250
251
251
if ($ attribute ->getIsUnique ()) {
252
- if (!$ attribute ->getEntity ()->checkAttributeUniqueValue ($ attribute , $ object )) {
252
+ if (!$ attribute ->getEntity ()->checkAttributeUniqueValue ($ attribute , $ object )) {
253
+ $ label = $ attribute ->getFrontend ()->getLabel ();
253
254
throw new LocalizedException (__ ('The value of attribute "%1" must be unique ' , $ label ));
254
255
}
255
256
}
Original file line number Diff line number Diff line change @@ -579,8 +579,8 @@ public function testValidateCustomerData()
579
579
$ validationResponse = $ this ->_webApiCall ($ serviceInfo , $ requestData );
580
580
$ this ->assertFalse ($ validationResponse ['valid ' ]);
581
581
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 ]);
584
584
}
585
585
586
586
public function testIsReadonly ()
Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ public function testSaveActionCategoryWithDangerRequest()
339
339
);
340
340
$ this ->dispatch ('backend/catalog/category/save ' );
341
341
$ this ->assertSessionMessages (
342
- $ this ->equalTo (['The value of attribute "name " must be set ' ]),
342
+ $ this ->equalTo (['The value of attribute "Name " must be set ' ]),
343
343
\Magento \Framework \Message \MessageInterface::TYPE_ERROR
344
344
);
345
345
}
You can’t perform that action at this time.
0 commit comments