Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UserValidationRulesTest.php
Go to the documentation of this file.
1 <?php
7 
9 
10 class UserValidationRulesTest extends \PHPUnit\Framework\TestCase
11 {
15  private $validator;
16 
20  private $rules;
21 
22  protected function setUp()
23  {
24  $this->validator = $this->createMock(\Magento\Framework\Validator\DataObject::class);
25  $this->rules = new UserValidationRules();
26  }
27 
28  public function testAddUserInfoRules()
29  {
30  $this->validator->expects($this->exactly(4))->method('addRule')->willReturn($this->validator);
31  $this->assertSame($this->validator, $this->rules->addUserInfoRules($this->validator));
32  }
33 
34  public function testAddPasswordRules()
35  {
36  $this->validator->expects($this->exactly(3))->method('addRule')->willReturn($this->validator);
37  $this->assertSame($this->validator, $this->rules->addPasswordRules($this->validator));
38  }
39 
41  {
42  $this->validator->expects($this->once())->method('addRule')->willReturn($this->validator);
43  $this->assertSame($this->validator, $this->rules->addPasswordConfirmationRule($this->validator, ''));
44  }
45 }