@@ 22-32 (lines=11) @@ | ||
19 | $this->assertTrue($validator->isValid("[email protected]", $validation)); |
|
20 | } |
|
21 | ||
22 | public function testMultipleValidation() |
|
23 | { |
|
24 | $validator = new EmailValidator(); |
|
25 | $validation = $this->getMockBuilder("Egulias\\EmailValidator\\Validation\\EmailValidation")->getMock(); |
|
26 | $validation->expects($this->once())->method("isValid")->willReturn(true); |
|
27 | $validation->expects($this->once())->method("getWarnings")->willReturn([]); |
|
28 | $validation->expects($this->once())->method("getError")->willReturn(null); |
|
29 | $multiple = new MultipleValidationWithAnd([$validation]); |
|
30 | ||
31 | $this->assertTrue($validator->isValid("[email protected]", $multiple)); |
|
32 | } |
|
33 | } |
|
34 |
@@ 39-50 (lines=12) @@ | ||
36 | new MultipleValidationWithAnd([]); |
|
37 | } |
|
38 | ||
39 | public function testValidationIsValid() |
|
40 | { |
|
41 | $lexer = $this->getMockBuilder("Egulias\\EmailValidator\\EmailLexer")->getMock(); |
|
42 | ||
43 | $validation = $this->getMockBuilder("Egulias\\EmailValidator\\Validation\\EmailValidation")->getMock(); |
|
44 | $validation->expects($this->any())->method("isValid")->willReturn(true); |
|
45 | $validation->expects($this->once())->method("getWarnings")->willReturn([]); |
|
46 | ||
47 | $multipleValidation = new MultipleValidationWithAnd([$validation]); |
|
48 | $this->assertTrue($multipleValidation->isValid("[email protected]", $lexer)); |
|
49 | $this->assertNull($multipleValidation->getError()); |
|
50 | } |
|
51 | ||
52 | public function testAccumulatesWarnings() |
|
53 | { |