Code Duplication    Length = 25-25 lines in 3 locations

Tests/JFormHelperTest.php 3 locations

@@ 26-50 (lines=25) @@
23
	 *
24
	 * @return void
25
	 */
26
	public function testAddFieldPath()
27
	{
28
		// Check the default behaviour.
29
		$paths = FormHelper::addFieldPath();
30
31
		// The default path is the class file folder/forms
32
		// use of realpath to ensure test works for on all platforms
33
		$valid = dirname(__DIR__) . '/field';
34
35
		$this->assertThat(
36
			in_array($valid, $paths),
37
			$this->isTrue(),
38
			'Line:' . __LINE__ . ' The libraries fields path should be included by default.'
39
		);
40
41
		// Test adding a custom folder.
42
		FormHelper::addFieldPath(__DIR__);
43
		$paths = FormHelper::addFieldPath();
44
45
		$this->assertThat(
46
			in_array(__DIR__, $paths),
47
			$this->isTrue(),
48
			'Line:' . __LINE__ . ' An added path should be in the returned array.'
49
		);
50
	}
51
52
	/**
53
	 * Tests the Form::addFormPath method.
@@ 59-83 (lines=25) @@
56
	 *
57
	 * @return void
58
	 */
59
	public function testAddFormPath()
60
	{
61
		// Check the default behaviour.
62
		$paths = FormHelper::addFormPath();
63
64
		// The default path is the class file folder/forms
65
		// use of realpath to ensure test works for on all platforms
66
		$valid = dirname(__DIR__) . '/form';
67
68
		$this->assertThat(
69
			in_array($valid, $paths),
70
			$this->isTrue(),
71
			'Line:' . __LINE__ . ' The libraries forms path should be included by default.'
72
		);
73
74
		// Test adding a custom folder.
75
		FormHelper::addFormPath(__DIR__);
76
		$paths = FormHelper::addFormPath();
77
78
		$this->assertThat(
79
			in_array(__DIR__, $paths),
80
			$this->isTrue(),
81
			'Line:' . __LINE__ . ' An added path should be in the returned array.'
82
		);
83
	}
84
85
	/**
86
	 * Tests the Form::addRulePath method.
@@ 92-116 (lines=25) @@
89
	 *
90
	 * @return void
91
	 */
92
	public function testAddRulePath()
93
	{
94
		// Check the default behaviour.
95
		$paths = FormHelper::addRulePath();
96
97
		// The default path is the class file folder/rules
98
		// use of realpath to ensure test works for on all platforms
99
		$valid = dirname(__DIR__) . '/rule';
100
101
		$this->assertThat(
102
			in_array($valid, $paths),
103
			$this->isTrue(),
104
			'Line:' . __LINE__ . ' The libraries rule path should be included by default.'
105
		);
106
107
		// Test adding a custom folder.
108
		FormHelper::addRulePath(__DIR__);
109
		$paths = FormHelper::addRulePath();
110
111
		$this->assertThat(
112
			in_array(__DIR__, $paths),
113
			$this->isTrue(),
114
			'Line:' . __LINE__ . ' An added path should be in the returned array.'
115
		);
116
	}
117
118
	/**
119
	 * Test the Form::loadFieldType method.