| @@ 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 | ||
| @@ 36-47 (lines=12) @@ | ||
| 33 | new MultipleValidationWithAnd([]); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function testValidationIsValid() |
|
| 37 | { |
|
| 38 | $lexer = $this->getMockBuilder("Egulias\\EmailValidator\\EmailLexer")->getMock(); |
|
| 39 | ||
| 40 | $validation = $this->getMockBuilder("Egulias\\EmailValidator\\Validation\\EmailValidation")->getMock(); |
|
| 41 | $validation->expects($this->any())->method("isValid")->willReturn(true); |
|
| 42 | $validation->expects($this->once())->method("getWarnings")->willReturn([]); |
|
| 43 | ||
| 44 | $multipleValidation = new MultipleValidationWithAnd([$validation]); |
|
| 45 | $this->assertTrue($multipleValidation->isValid("[email protected]", $lexer)); |
|
| 46 | $this->assertNull($multipleValidation->getError()); |
|
| 47 | } |
|
| 48 | ||
| 49 | public function testAccumulatesWarnings() |
|
| 50 | { |
|