File tree Expand file tree Collapse file tree 4 files changed +17
-17
lines changed
Model/Entity/Attribute/Frontend
Test/Unit/Model/Entity/Attribute/Frontend
api-functional/testsuite/Magento/Customer/Api
integration/testsuite/Magento/Customer/Helper Expand file tree Collapse file tree 4 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ public function getClass()
161
161
$ out [] = implode (' ' , $ textLengthValidateClasses );
162
162
}
163
163
164
- $ out = !empty ($ out ) ? implode (' ' , $ out ) : '' ;
164
+ $ out = !empty ($ out ) ? trim ( implode (' ' , $ out) ) : '' ;
165
165
return $ out ;
166
166
}
167
167
@@ -208,15 +208,17 @@ private function getTextLengthValidateClasses()
208
208
{
209
209
$ classes = [];
210
210
211
- $ validateRules = $ this ->getAttribute ()->getValidateRules ();
212
- if (!empty ($ validateRules ['min_text_length ' ])) {
213
- $ classes [] = 'minimum-length- ' . $ validateRules ['min_text_length ' ];
214
- }
215
- if (!empty ($ validateRules ['max_text_length ' ])) {
216
- $ classes [] = 'maximum-length- ' . $ validateRules ['max_text_length ' ];
217
- }
218
- if (!empty ($ classes )) {
219
- $ classes [] = 'validate-length ' ;
211
+ if ($ this ->_getInputValidateClass ()) {
212
+ $ validateRules = $ this ->getAttribute ()->getValidateRules ();
213
+ if (!empty ($ validateRules ['min_text_length ' ])) {
214
+ $ classes [] = 'minimum-length- ' . $ validateRules ['min_text_length ' ];
215
+ }
216
+ if (!empty ($ validateRules ['max_text_length ' ])) {
217
+ $ classes [] = 'maximum-length- ' . $ validateRules ['max_text_length ' ];
218
+ }
219
+ if (!empty ($ classes )) {
220
+ $ classes [] = 'validate-length ' ;
221
+ }
220
222
}
221
223
222
224
return $ classes ;
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ protected function setUp()
32
32
33
33
public function testGetClassEmpty ()
34
34
{
35
- /** @var \PHPUnit_Framework_MockObject_MockObject $attributeMock */
36
35
$ attributeMock = $ this ->getMockBuilder ('Magento\Eav\Model\Entity\Attribute\AbstractAttribute ' )
37
36
->disableOriginalConstructor ()
38
37
->setMethods ([
@@ -57,7 +56,6 @@ public function testGetClassEmpty()
57
56
58
57
public function testGetClass ()
59
58
{
60
- /** @var \PHPUnit_Framework_MockObject_MockObject $attributeMock */
61
59
$ attributeMock = $ this ->getMockBuilder ('Magento\Eav\Model\Entity\Attribute\AbstractAttribute ' )
62
60
->disableOriginalConstructor ()
63
61
->setMethods ([
@@ -72,7 +70,7 @@ public function testGetClass()
72
70
$ attributeMock ->expects ($ this ->once ())
73
71
->method ('getFrontendClass ' )
74
72
->willReturn ('' );
75
- $ attributeMock ->expects ($ this ->exactly (2 ))
73
+ $ attributeMock ->expects ($ this ->exactly (3 ))
76
74
->method ('getValidateRules ' )
77
75
->willReturn ([
78
76
'input_validation ' => 'alphanumeric ' ,
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public function getAttributeMetadataDataProvider()
74
74
AttributeMetadata::REQUIRED => true ,
75
75
AttributeMetadata::DATA_MODEL => '' ,
76
76
AttributeMetadata::OPTIONS => [],
77
- AttributeMetadata::FRONTEND_CLASS => ' required-entry ' ,
77
+ AttributeMetadata::FRONTEND_CLASS => 'required-entry ' ,
78
78
AttributeMetadata::USER_DEFINED => false ,
79
79
AttributeMetadata::SORT_ORDER => 40 ,
80
80
AttributeMetadata::FRONTEND_LABEL => 'First Name ' ,
@@ -134,7 +134,7 @@ public function getAttributeMetadataDataProvider()
134
134
AttributeMetadata::OPTIONS => [
135
135
['label ' => 'Main Website ' , 'value ' => '1 ' ],
136
136
],
137
- AttributeMetadata::FRONTEND_CLASS => ' required-entry ' ,
137
+ AttributeMetadata::FRONTEND_CLASS => 'required-entry ' ,
138
138
AttributeMetadata::USER_DEFINED => false ,
139
139
AttributeMetadata::SORT_ORDER => 10 ,
140
140
AttributeMetadata::FRONTEND_LABEL => 'Associate to Website ' ,
Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ public function getAttributeValidationClass()
30
30
{
31
31
return [
32
32
['bad-code ' , '' ],
33
- ['city ' , ' required-entry ' ],
33
+ ['city ' , 'required-entry ' ],
34
34
['company ' , '' ],
35
- ['country_id ' , ' required-entry ' ],
35
+ ['country_id ' , 'required-entry ' ],
36
36
['fax ' , '' ],
37
37
['firstname ' , 'required-entry ' ],
38
38
['lastname ' , 'required-entry ' ],
You can’t perform that action at this time.
0 commit comments