29 $this->
insertPage(
'Redirect test',
'#REDIRECT [[Redirect Test]]' );
31 $this->
insertPage(
'Redirect Test Worse Result' );
32 $this->
insertPage(
'Redirect test2',
'#REDIRECT [[Redirect Test2]]' );
33 $this->
insertPage(
'Redirect TEST2',
'#REDIRECT [[Redirect Test2]]' );
35 $this->
insertPage(
'Redirect Test2 Worse Result' );
47 $this->markTestSkipped(
'Main namespace does not support wikitext.' );
52 'wgSpecialPages' => [],
56 $this->search = MediaWikiServices::getInstance()->newSearchEngine();
57 $this->search->setNamespaces( [] );
74 if ( $results === null ) {
78 'PrefixSearchBackend' => [
96 'Main namespace with title prefix',
109 'Talk namespace prefix',
117 'User namespace prefix',
124 'Special namespace prefix',
125 'query' =>
'Special:',
127 'Special:ActiveUsers',
128 'Special:AllMessages',
129 'Special:AllMyFiles',
133 'Special:AllMyUploads',
137 'Special namespace with prefix',
138 'query' =>
'Special:Un',
141 'Special:UncategorizedCategories',
142 'Special:UncategorizedFiles',
146 'Special:UncategorizedImages',
151 'query' =>
'Special:EditWatchlist',
153 'Special:EditWatchlist',
157 'Special page subpages',
158 'query' =>
'Special:EditWatchlist/',
160 'Special:EditWatchlist/clear',
161 'Special:EditWatchlist/raw',
165 'Special page subpages with prefix',
166 'query' =>
'Special:EditWatchlist/cl',
168 'Special:EditWatchlist/clear',
179 $this->search->setLimitOffset( 3 );
180 $results = $this->search->defaultPrefixSearch( $case[
'query'] );
181 $results = array_map(
function(
Title $t ) {
196 $this->search->setLimitOffset( 3, 1 );
197 $results = $this->search->defaultPrefixSearch( $case[
'query'] );
198 $results = array_map(
function(
Title $t ) {
203 array_shift( $case[
'results'] );
205 $expected = isset( $case[
'offsetresult'] ) ?
206 array_merge( $case[
'results'], $case[
'offsetresult'] ) :
233 'Exact match not on top (bug 70958)',
247 'Exact match missing (bug 70958)',
261 'Exact match missing and not existing',
275 "Exact match shouldn't override already found match if " .
276 "exact is redirect and found isn't",
279 'Redirect Test Worse Result',
282 'query' =>
'redirect test',
286 'Redirect Test Worse Result',
290 "Exact match shouldn't override already found match if " .
291 "both exact match and found match are redirect",
295 'Redirect Test2 Worse Result',
298 'query' =>
'redirect TEST2',
303 'Redirect Test2 Worse Result',
307 "Exact match should override any already found matches that " .
308 "are redirects to it",
312 'Redirect Test Worse Result',
315 'query' =>
'Redirect Test',
320 'Redirect Test Worse Result',
332 $search = $stub = $this->getMockBuilder(
'SearchEngine' )
333 ->setMethods( [
'completionSearchBackend' ] )->getMock();
337 $search->expects( $this->any() )
338 ->method(
'completionSearchBackend' )
339 ->will( $this->returnValue( $return ) );
the array() calling protocol came about after MediaWiki 1.4rc1.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
testSearch(array $case)
provideSearch SearchEngine::defaultPrefixSearch
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
getPrefixedText()
Get the prefixed title with spaces.
static fromStrings(array $titles)
Builds a new set of suggestion based on a string array.
static newFromClass($className)
Allow access to non-public static methods and properties of the class.
testSearchBackend(array $case)
provideSearchBackend PrefixSearch::searchBackend
searchProvision(array $results=null)
getText()
The suggestion text.
setLimitOffset($limit, $offset=0)
Set the maximum number of results to return and how many to skip before returning the first...
static resetList()
Reset the internal list of special pages.
namespace and then decline to actually register it & $namespaces
testSearchWithOffset(array $case)
provideSearch SearchEngine::defaultPrefixSearch
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
completionSearch($search)
Perform a completion search.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
static provideSearchBackend()