5
5
* Copyright © Magento, Inc. All rights reserved.
6
6
* See COPYING.txt for license details.
7
7
*/
8
+
8
9
namespace Magento \Customer \Test \Unit \Model \Metadata \Form ;
9
10
11
+ use Magento \Customer \Api \Data \ValidationRuleInterface ;
10
12
use Magento \Customer \Model \Metadata \Form \Text ;
11
13
12
14
class TextTest extends AbstractFormTestCase
@@ -111,7 +113,7 @@ public function validateValueRequiredDataProvider()
111
113
*/
112
114
public function testValidateValueLength ($ value , $ expected )
113
115
{
114
- $ minTextLengthRule = $ this ->getMockBuilder (\ Magento \ Customer \ Api \ Data \ ValidationRuleInterface::class)
116
+ $ minTextLengthRule = $ this ->getMockBuilder (ValidationRuleInterface::class)
115
117
->disableOriginalConstructor ()
116
118
->setMethods (['getName ' , 'getValue ' ])
117
119
->getMockForAbstractClass ();
@@ -122,7 +124,7 @@ public function testValidateValueLength($value, $expected)
122
124
->method ('getValue ' )
123
125
->will ($ this ->returnValue (4 ));
124
126
125
- $ maxTextLengthRule = $ this ->getMockBuilder (\ Magento \ Customer \ Api \ Data \ ValidationRuleInterface::class)
127
+ $ maxTextLengthRule = $ this ->getMockBuilder (ValidationRuleInterface::class)
126
128
->disableOriginalConstructor ()
127
129
->setMethods (['getName ' , 'getValue ' ])
128
130
->getMockForAbstractClass ();
@@ -133,7 +135,19 @@ public function testValidateValueLength($value, $expected)
133
135
->method ('getValue ' )
134
136
->will ($ this ->returnValue (8 ));
135
137
138
+ $ inputValidationRule = $ this ->getMockBuilder (ValidationRuleInterface::class)
139
+ ->disableOriginalConstructor ()
140
+ ->setMethods (['getName ' , 'getValue ' ])
141
+ ->getMockForAbstractClass ();
142
+ $ inputValidationRule ->expects ($ this ->any ())
143
+ ->method ('getName ' )
144
+ ->will ($ this ->returnValue ('input_validation ' ));
145
+ $ inputValidationRule ->expects ($ this ->any ())
146
+ ->method ('getValue ' )
147
+ ->will ($ this ->returnValue ('other ' ));
148
+
136
149
$ validationRules = [
150
+ 'input_validation ' => $ inputValidationRule ,
137
151
'min_text_length ' => $ minTextLengthRule ,
138
152
'max_text_length ' => $ maxTextLengthRule ,
139
153
];
0 commit comments