Code Duplication    Length = 21-22 lines in 2 locations

tests/forms/DropdownFieldTest.php 2 locations

@@ 128-148 (lines=21) @@
125
		);
126
	}
127
128
	public function testStringZeroValueSelectedOptionBehaviour() {
129
		$field = new DropdownField('Field', null, array(
130
			'-1' => 'some negative',
131
			'0' => 'none',
132
			'1' => 'one',
133
			'2+' => 'two or more'
134
		), '0');
135
136
		$selectedOptions = $this->findSelectedOptionElements($field->Field());
137
		$this->assertEquals((string) $selectedOptions[0], 'none', 'The selected option is "none"');
138
139
		$field = new DropdownField('Field', null, array(
140
			'-1' => 'some negative',
141
			'0' => 'none',
142
			'1' => 'one',
143
			'2+' => 'two or more'
144
		), 0);
145
146
		$selectedOptions = $this->findSelectedOptionElements($field->Field());
147
		$this->assertEquals((string) $selectedOptions[0], 'none', 'The selected option is "none"');
148
	}
149
150
	public function testStringOneValueSelectedOptionBehaviour() {
151
		$field = new DropdownField('Field', null, array(
@@ 150-171 (lines=22) @@
147
		$this->assertEquals((string) $selectedOptions[0], 'none', 'The selected option is "none"');
148
	}
149
150
	public function testStringOneValueSelectedOptionBehaviour() {
151
		$field = new DropdownField('Field', null, array(
152
			'-1' => 'some negative',
153
			'0' => 'none',
154
			'1' => 'one',
155
			'2+' => 'two or more'
156
		), '1');
157
158
159
		$selectedOptions = $this->findSelectedOptionElements($field->Field());
160
		$this->assertEquals((string) $selectedOptions[0], 'one', 'The selected option is "one"');
161
162
		$field = new DropdownField('Field', null, array(
163
			'-1' => 'some negative',
164
			'0' => 'none',
165
			'1' => 'one',
166
			'2+' => 'two or more'
167
		), 1);
168
169
		$selectedOptions = $this->findSelectedOptionElements($field->Field());
170
		$this->assertEquals((string) $selectedOptions[0], 'one', 'The selected option is "one"');
171
	}
172
173
	public function testNumberOfSelectOptionsAvailable() {
174
		/* Create a field with a blank value */