Go to the documentation of this file.
3 use Wikimedia\TestingAccessWrapper;
28 $this->
insertPage(
'Redirect test',
'#REDIRECT [[Redirect Test]]' );
30 $this->
insertPage(
'Redirect Test Worse Result' );
31 $this->
insertPage(
'Redirect test2',
'#REDIRECT [[Redirect Test2]]' );
32 $this->
insertPage(
'Redirect TEST2',
'#REDIRECT [[Redirect Test2]]' );
34 $this->
insertPage(
'Redirect Test2 Worse Result' );
50 $this->markTestSkipped(
'Main namespace does not support wikitext.' );
55 'wgSpecialPages' => [],
57 'wgExtraNamespaces' => [ self::NS_NONCAP =>
'NonCap' ],
58 'wgCapitalLinkOverrides' => [ self::NS_NONCAP =>
false ],
61 $this->originalHandlers = TestingAccessWrapper::newFromClass(
'Hooks' )->handlers;
62 TestingAccessWrapper::newFromClass(
'Hooks' )->handlers = [];
80 if ( $results ===
null ) {
84 'PrefixSearchBackend' => [
85 function (
$namespaces, $search, $limit, &$srchres )
use ( $results ) {
102 'Main namespace with title prefix',
115 'Talk namespace prefix',
123 'User namespace prefix',
130 'Special namespace prefix',
131 'query' =>
'Special:',
133 'Special:ActiveUsers',
134 'Special:AllMessages',
135 'Special:AllMyUploads',
143 'Special namespace with prefix',
144 'query' =>
'Special:Un',
147 'Special:UncategorizedCategories',
148 'Special:UncategorizedFiles',
152 'Special:UncategorizedPages',
157 'query' =>
'Special:EditWatchlist',
159 'Special:EditWatchlist',
163 'Special page subpages',
164 'query' =>
'Special:EditWatchlist/',
166 'Special:EditWatchlist/clear',
167 'Special:EditWatchlist/raw',
171 'Special page subpages with prefix',
172 'query' =>
'Special:EditWatchlist/cl',
174 'Special:EditWatchlist/clear',
178 'Namespace with case sensitive first letter',
179 'query' =>
'NonCap:upper',
183 'Multinamespace search',
192 'Multinamespace search with lowercase first letter',
211 $namespaces = isset( $case[
'namespaces'] ) ? $case[
'namespaces'] : [];
215 sort( $case[
'results'], SORT_STRING );
235 $namespaces = isset( $case[
'namespaces'] ) ? $case[
'namespaces'] : [];
242 sort( $case[
'results'], SORT_STRING );
246 array_shift( $case[
'results'] );
248 $expected = isset( $case[
'offsetresult'] ) ?
249 array_merge( $case[
'results'], $case[
'offsetresult'] ) :
276 'Exact match not on top (T72958)',
290 'Exact match missing (T72958)',
304 'Exact match missing and not existing',
318 "Exact match shouldn't override already found match if " .
319 "exact is redirect and found isn't",
322 'Redirect Test Worse Result',
325 'query' =>
'redirect test',
329 'Redirect Test Worse Result',
333 "Exact match shouldn't override already found match if " .
334 "both exact match and found match are redirect",
338 'Redirect Test2 Worse Result',
341 'query' =>
'redirect TEST2',
346 'Redirect Test2 Worse Result',
350 "Exact match should override any already found matches that " .
351 "are redirects to it",
355 'Redirect Test Worse Result',
358 'query' =>
'Redirect Test',
363 'Redirect Test Worse Result',
376 $results = $searcher->
search( $case[
'query'], 3 );
namespace and then decline to actually register it & $namespaces
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
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
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
search( $search, $limit, $namespaces=[], $offset=0)
Do a prefix search of titles and return a list of matching page names.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
testSearchWithOffset(array $case)
provideSearch PrefixSearch::search PrefixSearch::searchBackend
testSearchBackend(array $case)
provideSearchBackend PrefixSearch::searchBackend
static resetList()
Reset the internal list of special pages.
static getCanonicalNamespaces( $rebuild=false)
Returns array of all defined namespaces with their canonical (English) names.
static provideSearchBackend()
static factory( $code)
Get a cached or new language object for a given language code.
Search Database PrefixSearch.
Performs prefix search, returning strings.
the array() calling protocol came about after MediaWiki 1.4rc1.
searchProvision(array $results=null)
testSearch(array $case)
provideSearch PrefixSearch::search PrefixSearch::searchBackend