Code Duplication    Length = 17-20 lines in 2 locations

tests/EditableSpamProtectionFieldTest.php 2 locations

@@ 35-51 (lines=17) @@
32
        );
33
    }
34
35
    public function testValidateFieldDoesntAddErrorOnSuccess()
36
    {
37
        $formMock = $this->getFormMock();
38
        $formFieldMock = $this->getEditableFormFieldMock();
39
40
        $formFieldMock
41
            ->getFormField() // mock
42
            ->expects($this->once())
43
            ->method('validate')
44
            ->will($this->returnValue(true));
45
46
        $formMock
47
            ->expects($this->never())
48
            ->method('sessionMessage');
49
50
        $formFieldMock->validateField(array('MyField' => null), $formMock);
51
    }
52
53
    public function testValidateFieldAddsErrorFromField()
54
    {
@@ 74-93 (lines=20) @@
71
        $formFieldMock->validateField(array('MyField' => null), $formMock);
72
    }
73
74
    public function testValidateFieldAddsDefaultError()
75
    {
76
        $formMock = $this->getFormMock();
77
        $formFieldMock = $this->getEditableFormFieldMock();
78
79
        $formFieldMock
80
            ->getFormField() // mock
81
            ->expects($this->once())
82
            ->method('validate')
83
            ->will($this->returnValue(false));
84
85
        // field doesn't set any validation errors here
86
87
        $formMock
88
            ->expects($this->once())
89
            ->method('sessionError')
90
            ->with($this->stringContains('default error message'));
91
92
        $formFieldMock->validateField(array('MyField' => null), $formMock);
93
    }
94
95
    public function testSpamConfigurationShowsInCms()
96
    {