MediaWiki REL1_28
Go to the documentation of this file.
3class SpecialSearchText extends \PHPUnit_Framework_TestCase {
4 public function testSubPageRedirect() {
5 $ctx = new RequestContext;
8 Title::newFromText( 'Special:Search/foo_bar' ),
9 $ctx
10 );
11 $url = $ctx->getOutput()->getRedirect();
12 // some older versions of hhvm have a bug that doesn't parse relative
13 // urls with a port, so help it out a little bit.
14 //
15 $url = wfExpandUrl( $url, PROTO_CURRENT );
17 $parts = parse_url( $url );
18 $this->assertEquals( '/w/index.php', $parts['path'] );
19 parse_str( $parts['query'], $query );
20 $this->assertEquals( 'Special:Search', $query['title'] );
21 $this->assertEquals( 'foo bar', $query['search'] );
22 }
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Group all the pieces relevant to the context of a request into one instance.
static executePath(Title &$title, IContextSource &$context, $including=false, LinkRenderer $linkRenderer=null)
Execute a special page path.
Definition Defines.php:226
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1595
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
Definition injection.txt:37