Code Duplication    Length = 10-11 lines in 3 locations

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() {

tests/SearchableTest.php 1 location

@@ 759-769 (lines=11) @@
756
	}
757
758
759
	private function getResultsFor($query, $pageLength = 10) {
760
		$es = new ElasticSearcher();
761
		$es->setStart(0);
762
		$es->setPageLength($pageLength);
763
		$es->setClasses('FlickrPhotoTO');
764
		$fields = array('Title' => 1, 'Description' => 1);
765
		$resultList = $es->search($query, $fields)->getList();
766
		$this->assertEquals('SilverStripe\Elastica\ResultList', get_class($resultList));
767
		return $resultList;
768
	}
769
770
}
771

tests/SearchAndIndexingTest.php 1 location

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