Code Duplication    Length = 13-14 lines in 2 locations

tests/FormSpamProtectionExtensionTest.php 2 locations

@@ 88-100 (lines=13) @@
85
        $this->assertEquals('Foo', $form->Fields()->fieldByName($field_name)->Title());
86
    }
87
    
88
    public function testInsertBefore()
89
    {
90
        $form = $this->form->enableSpamProtection(array(
91
            'protector' => 'FormSpamProtectionExtensionTest_FooProtector',
92
            'insertBefore' => 'URL'
93
        ));
94
        
95
        $fields = $form->Fields();
96
        $this->assertEquals('Title', $fields[0]->Title());
97
        $this->assertEquals('Comment', $fields[1]->Title());
98
        $this->assertEquals('Foo', $fields[2]->Title());
99
        $this->assertEquals('URL', $fields[3]->Title());
100
    }
101
    
102
    public function testInsertBeforeMissing()
103
    {
@@ 102-115 (lines=14) @@
99
        $this->assertEquals('URL', $fields[3]->Title());
100
    }
101
    
102
    public function testInsertBeforeMissing()
103
    {
104
        $form = $this->form->enableSpamProtection(array(
105
            'protector' => 'FormSpamProtectionExtensionTest_FooProtector',
106
            'insertBefore' => 'NotAField'
107
        ));
108
        
109
        // field should default to the end instead
110
        $fields = $form->Fields();
111
        $this->assertEquals('Title', $fields[0]->Title());
112
        $this->assertEquals('Comment', $fields[1]->Title());
113
        $this->assertEquals('URL', $fields[2]->Title());
114
        $this->assertEquals('Foo', $fields[3]->Title());
115
    }
116
}
117
118
/**