Code Duplication    Length = 8-9 lines in 2 locations

tests/forms/OptionsetFieldTest.php 1 location

@@ 57-65 (lines=9) @@
54
		$this->assertFalse($field->validate($validator));
55
	}
56
57
	public function testReadonlyField() {
58
		$sourceArray = array(0 => 'No', 1 => 'Yes');
59
		$field = new OptionsetField('FeelingOk', 'are you feeling ok?', $sourceArray, 1);
60
		$field->setEmptyString('(Select one)');
61
		$field->setValue(1);
62
		$readonlyField = $field->performReadonlyTransformation();
63
		preg_match('/Yes/', $field->Field(), $matches);
64
		$this->assertEquals($matches[0], 'Yes');
65
	}
66
}
67

tests/forms/DropdownFieldTest.php 1 location

@@ 50-57 (lines=8) @@
47
		$this->assertEquals($items, $field3->getSource());
48
	}
49
50
	public function testReadonlyField() {
51
		$field = new DropdownField('FeelingOk', 'Are you feeling ok?', array(0 => 'No', 1 => 'Yes'));
52
		$field->setEmptyString('(Select one)');
53
		$field->setValue(1);
54
		$readonlyField = $field->performReadonlyTransformation();
55
		preg_match('/Yes/', $field->Field(), $matches);
56
		$this->assertEquals($matches[0], 'Yes');
57
	}
58
59
	public function testHasEmptyDefault() {
60
		$source = array(1 => 'one');