Code Duplication    Length = 23-23 lines in 2 locations

tests/php/Forms/CheckboxFieldTest.php 2 locations

@@ 87-109 (lines=23) @@
84
        $this->assertEquals($field->Value(), 0, 'Value() returns a 0');
85
    }
86
87
    public function testSavingChecked()
88
    {
89
        /* Create a new test data record */
90
        $article = new Article();
91
92
        /* Create a field, with a value of 1 */
93
        $field = new CheckboxField('IsChecked', 'Checked', 1);
94
95
        /* Save the field into our Article object */
96
        $field->saveInto($article);
97
98
        /* Write the record to the test database */
99
        $article->write();
100
101
        /* Check that IsChecked column contains a 1 */
102
        $this->assertEquals(
103
            DB::query("SELECT \"IsChecked\" FROM \"CheckboxFieldTest_Article\"")->value(),
104
            1,
105
            'We have a 1 set in the database, because the field saved into as a 1'
106
        );
107
108
        /* Delete the record we tested */
109
        $article->delete();
110
    }
111
112
    public function testSavingUnchecked()
@@ 112-134 (lines=23) @@
109
        $article->delete();
110
    }
111
112
    public function testSavingUnchecked()
113
    {
114
        /* Create a new test data record */
115
        $article = new Article();
116
117
        /* Create a field, with no value */
118
        $field = new CheckboxField('IsChecked', 'Checked');
119
120
        /* Save the field into our Article object */
121
        $field->saveInto($article);
122
123
        /* Write the record to the test database */
124
        $article->write();
125
126
        /* Check that IsChecked column contains a 0 */
127
        $this->assertEquals(
128
            DB::query("SELECT \"IsChecked\" FROM \"CheckboxFieldTest_Article\"")->value(),
129
            0,
130
            'We have a 0 set in the database, because the field saved into as a 0'
131
        );
132
133
        /* Delete the record we tested */
134
        $article->delete();
135
    }
136
137
    public function testReadonlyCheckboxField()