Code Duplication    Length = 30-31 lines in 2 locations

tests/model/HierarchyTest.php 2 locations

@@ 216-245 (lines=30) @@
213
		);
214
	}
215
216
	public function testGetChildrenAsULMinNodeCount() {
217
		$obj1 = $this->objFromFixture('HierarchyTest_Object', 'obj1');
218
		$obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2');
219
		$obj2a = $this->objFromFixture('HierarchyTest_Object', 'obj2a');
220
221
		// Set low enough that it should be fulfilled by root only elements
222
		$nodeCountThreshold = 3;
223
224
		$root = new HierarchyTest_Object();
225
		$root->markPartialTree($nodeCountThreshold);
226
		$html = $root->getChildrenAsUL(
227
			"",
228
			'"<li id=\"" . $child->ID . "\">" . $child->Title',
229
			null,
230
			false,
231
			"AllChildrenIncludingDeleted",
232
			"numChildren",
233
			true,
234
			$nodeCountThreshold
235
		);
236
		$this->assertTreeContains($html, array($obj1),
237
			'Contains root elements'
238
		);
239
		$this->assertTreeContains($html, array($obj2),
240
			'Contains root elements'
241
		);
242
		$this->assertTreeNotContains($html, array($obj2, $obj2a),
243
			'Does not contains child elements because they exceed minNodeCount'
244
		);
245
	}
246
247
	public function testGetChildrenAsULMinNodeCountWithMarkToExpose() {
248
		$obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2');
@@ 247-277 (lines=31) @@
244
		);
245
	}
246
247
	public function testGetChildrenAsULMinNodeCountWithMarkToExpose() {
248
		$obj2 = $this->objFromFixture('HierarchyTest_Object', 'obj2');
249
		$obj2a = $this->objFromFixture('HierarchyTest_Object', 'obj2a');
250
		$obj2aa = $this->objFromFixture('HierarchyTest_Object', 'obj2aa');
251
252
		// Set low enough that it should be fulfilled by root only elements
253
		$nodeCountThreshold = 3;
254
255
		$root = new HierarchyTest_Object();
256
		$root->markPartialTree($nodeCountThreshold);
257
258
		// Mark certain node which should be included regardless of minNodeCount restrictions
259
		$root->markToExpose($obj2aa);
260
261
		$html = $root->getChildrenAsUL(
262
			"",
263
			'"<li id=\"" . $child->ID . "\">" . $child->Title',
264
			null,
265
			false,
266
			"AllChildrenIncludingDeleted",
267
			"numChildren",
268
			true,
269
			$nodeCountThreshold
270
		);
271
		$this->assertTreeContains($html, array($obj2),
272
			'Contains root elements'
273
		);
274
		$this->assertTreeContains($html, array($obj2, $obj2a, $obj2aa),
275
			'Does contain marked children nodes regardless of configured threshold'
276
		);
277
	}
278
279
	public function testGetChildrenAsULMinNodeCountWithFilters() {
280
		$obj1 = $this->objFromFixture('HierarchyTest_Object', 'obj1');