Merge "Drop cache interwiki"
[mediawiki.git] / tests / phpunit / includes / specials / SpecialSearchTestMockResultSet.php
blob74f92c2ac8dd6b7815e42b2817f1371650873f41
1 <?php
3 class SpecialSearchTestMockResultSet extends SearchResultSet {
4 /** @var array */
5 protected $results;
6 /** @var string|null */
7 protected $suggestion;
8 /** @var string|null */
9 protected $rewrittenQuery;
10 /** @var bool */
11 protected $containedSyntax;
13 public function __construct(
14 $suggestion = null,
15 $rewrittenQuery = null,
16 array $results = [],
17 $containedSyntax = false
18 ) {
19 $this->suggestion = $suggestion;
20 $this->rewrittenQuery = $rewrittenQuery;
21 $this->results = $results;
22 $this->containedSyntax = $containedSyntax;
25 public function expandResults() {
26 return $this->results;
29 public function getTotalHits() {
30 return $this->numRows();
33 public function hasSuggestion() {
34 return $this->suggestion !== null;
37 public function getSuggestionQuery() {
38 return $this->suggestion;
41 public function getSuggestionSnippet() {
42 return $this->suggestion;
45 public function hasRewrittenQuery() {
46 return $this->rewrittenQuery !== null;
49 public function getQueryAfterRewrite() {
50 return $this->rewrittenQuery;
53 public function getQueryAfterRewriteSnippet() {
54 return htmlspecialchars( $this->rewrittenQuery );
57 public function getFirstResult() {
58 if ( count( $this->results ) === 0 ) {
59 return null;
61 return $this->results[0]->getTitle();