Code Duplication    Length = 27-27 lines in 2 locations

tests/forms/CheckboxSetFieldTest.php 1 location

@@ 57-83 (lines=27) @@
54
	/**
55
	 * Test different data sources
56
	 */
57
	public function testSources() {
58
		// Array
59
		$items = array('a' => 'Apple', 'b' => 'Banana', 'c' => 'Cranberry');
60
		$field = new CheckboxSetField('Field', null, $items);
61
		$this->assertEquals($items, $field->getSource());
62
63
		// SS_List
64
		$list = new ArrayList(array(
65
			new ArrayData(array(
66
				'ID' => 'a',
67
				'Title' => 'Apple'
68
			)),
69
			new ArrayData(array(
70
				'ID' => 'b',
71
				'Title' => 'Banana'
72
			)),
73
			new ArrayData(array(
74
				'ID' => 'c',
75
				'Title' => 'Cranberry'
76
			))
77
		));
78
		$field2 = new CheckboxSetField('Field', null, $list);
79
		$this->assertEquals($items, $field2->getSource());
80
81
		$field3 = new CheckboxSetField('Field', null, $list->map());
82
		$this->assertEquals($items, $field3->getSource());
83
	}
84
85
	public function testSaveWithNothingSelected() {
86
		$article = $this->objFromFixture('CheckboxSetFieldTest_Article', 'articlewithouttags');

tests/forms/DropdownFieldTest.php 1 location

@@ 22-48 (lines=27) @@
19
	/**
20
	 * Test different data sources
21
	 */
22
	public function testSources() {
23
		// Array
24
		$items = array('a' => 'Apple', 'b' => 'Banana', 'c' => 'Cranberry');
25
		$field = new DropdownField('Field', null, $items);
26
		$this->assertEquals($items, $field->getSource());
27
28
		// SS_List
29
		$list = new ArrayList(array(
30
			new ArrayData(array(
31
				'ID' => 'a',
32
				'Title' => 'Apple'
33
			)),
34
			new ArrayData(array(
35
				'ID' => 'b',
36
				'Title' => 'Banana'
37
			)),
38
			new ArrayData(array(
39
				'ID' => 'c',
40
				'Title' => 'Cranberry'
41
			))
42
		));
43
		$field2 = new DropdownField('Field', null, $list);
44
		$this->assertEquals($items, $field2->getSource());
45
46
		$field3 = new DropdownField('Field', null, $list->map());
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'));