Code Duplication    Length = 10-11 lines in 3 locations

tests/SearchAndIndexingTest.php 1 location

@@ 440-449 (lines=10) @@
437
	}
438
439
440
	private function getResultsFor($query, $pageLength = 10, $fields = array('Title' => 1, 'Description' => 1)) {
441
		$es = new ElasticSearcher();
442
		$es->setStart(0);
443
		$es->setPageLength($pageLength);
444
		$es->setClasses('FlickrPhotoTO');
445
		$resultList = $es->search($query, $fields)->getList();
446
		$this->assertEquals('SilverStripe\Elastica\ResultList', get_class($resultList));
447
		return $resultList;
448
	}
449
}
450

tests/SearchableTest.php 1 location

@@ 772-782 (lines=11) @@
769
	}
770
771
772
	private function getResultsFor($query, $pageLength = 10) {
773
		$es = new ElasticSearcher();
774
		$es->setStart(0);
775
		$es->setPageLength($pageLength);
776
		$es->setClasses('FlickrPhotoTO');
777
		$fields = array('Title' => 1, 'Description' => 1);
778
		$resultList = $es->search($query, $fields)->getList();
779
		$this->assertEquals('SilverStripe\Elastica\ResultList', get_class($resultList));
780
		return $resultList;
781
	}
782
783
}
784

tests/ElasticSearcherUnitTest.php 1 location

@@ 18-27 (lines=10) @@
15
	}
16
17
18
	public function testSuggested() {
19
		$es = new ElasticSearcher();
20
		$locale = \i18n::default_locale();
21
		$es->setLocale($locale);
22
		$es->setClasses('FlickrPhotoTO');
23
		$fields = array('Title' => 1, 'Description' => 1);
24
		$results = $es->search('New Zealind', $fields, true);
25
		$this->assertEquals(100, $results->getTotalItems());
26
		$this->assertEquals('New Zealand', $es->getSuggestedQuery());
27
	}
28
29
30
	public function testResultsForEmptySearch() {