The use case is code that uses search internally, but wants to allow a development setup where search is proxied via some public API and the actual querying is performed on a production server, instead of having to set up all the search services + staging content locally. Also fix a small logic error in SearchResultSet::shrink. Change-Id: I83931c1a19c1cb747380e17a4aff3b1fadd5fcf3
24 lines
480 B
PHP
24 lines
480 B
PHP
<?php
|
|
|
|
use MediaWiki\Revision\RevisionRecord;
|
|
|
|
/**
|
|
* A manually constructed search result, for use with FauxSearchResultSet.
|
|
*/
|
|
class FauxSearchResult extends SearchResult {
|
|
|
|
use RevisionSearchResultTrait;
|
|
|
|
public function __construct(
|
|
Title $title,
|
|
RevisionRecord $revision = null,
|
|
File $image = null,
|
|
$text = ''
|
|
) {
|
|
$this->mTitle = $title;
|
|
$this->mRevision = $revision ? new Revision( $revision ) : null;
|
|
$this->mImage = $image;
|
|
$this->mText = $text;
|
|
}
|
|
|
|
}
|