Code Duplication    Length = 25-25 lines in 2 locations

Tests/EmailValidator/Validation/MailboxCheckValidationTest.php 2 locations

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