Code Duplication    Length = 22-22 lines in 2 locations

Tests/EmailValidator/Validation/MailboxCheckValidationTest.php 2 locations

@@ 14-35 (lines=22) @@
11
12
class MailboxCheckValidationTest extends TestCase
13
{
14
    public function testValidMailbox()
15
    {
16
        $socketHelperMock = $this->getMockBuilder(SmtpSocketHelper::class)
17
            ->disableOriginalConstructor()
18
            ->getMock();
19
20
        $socketHelperMock
21
            ->expects($this->any())
22
            ->method('isResource')
23
            ->willReturn(true)
24
        ;
25
26
        $socketHelperMock
27
            ->expects($this->any())
28
            ->method('getResponseCode')
29
            ->willReturnOnConsecutiveCalls(220, 250, 250, 250)
30
        ;
31
32
        $validation = new MailboxCheckValidation($socketHelperMock, '[email protected]');
33
34
        $this->assertTrue($validation->isValid('[email protected]', new EmailLexer()));
35
    }
36
37
    public function testDNSWarnings()
38
    {
@@ 45-66 (lines=22) @@
42
        $this->assertEquals($expectedWarnings, $validation->getWarnings());
43
    }
44
45
    public function testIllegalMailboxError()
46
    {
47
        $socketHelperMock = $this->getMockBuilder(SmtpSocketHelper::class)
48
            ->disableOriginalConstructor()
49
            ->getMock();
50
51
        $socketHelperMock
52
            ->expects($this->any())
53
            ->method('isResource')
54
            ->willReturn(true)
55
        ;
56
57
        $socketHelperMock
58
            ->expects($this->any())
59
            ->method('getResponseCode')
60
            ->willReturnOnConsecutiveCalls(220, 250, 250, 550)
61
        ;
62
63
        $validation = new MailboxCheckValidation($socketHelperMock, '[email protected]');
64
        $validation->isValid('[email protected]', new EmailLexer());
65
        $this->assertEquals(new IllegalMailbox(550), $validation->getError());
66
    }
67
}
68