10 $this->setExpectedException( MWException::class,
'bogus data' );
18 $this->setExpectedException( MWException::class,
'bogus session' );
26 $session = SessionManager::singleton()->getEmptySession(
new FauxRequest( [] ) );
27 $this->assertInstanceOf(
38 $this->assertEquals(
'Value',
$req->getText(
'x' ) );
39 $this->assertEquals(
'',
$req->getText(
'z' ) );
45 $this->assertSame(
"A\r\nb",
$req->getVal(
'crlf' ),
'CRLF' );
55 $this->assertSame(
'Value',
$req->getRawVal(
'x' ) );
56 $this->assertSame(
null,
$req->getRawVal(
'z' ),
'Not found' );
57 $this->assertSame(
null,
$req->getRawVal(
'y' ),
'Array is ignored' );
58 $this->assertSame(
"A\r\nb",
$req->getRawVal(
'crlf' ),
'CRLF' );
65 $values = [
'x' =>
'Value',
'y' =>
'' ];
67 $this->assertEquals( $values,
$req->getValues() );
74 $values = [
'x' =>
'Value',
'y' =>
'' ];
77 $this->assertEquals( $values,
$req->getQueryValues() );
79 $this->assertEquals( [],
$req->getQueryValues() );
87 $this->assertEquals(
'GET',
$req->getMethod() );
89 $this->assertEquals(
'POST',
$req->getMethod() );
97 $this->assertFalse(
$req->wasPosted() );
99 $this->assertTrue(
$req->wasPosted() );
109 $this->assertSame(
null,
$req->getCookie(
'z',
'' ) );
111 $req->setCookie(
'x',
'Value',
'' );
112 $this->assertEquals(
'Value',
$req->getCookie(
'x',
'' ) );
114 $req->setCookies( [
'x' =>
'One',
'y' =>
'Two' ],
'' );
115 $this->assertEquals(
'One',
$req->getCookie(
'x',
'' ) );
116 $this->assertEquals(
'Two',
$req->getCookie(
'y',
'' ) );
130 $this->assertSame(
null,
$req->getCookie(
'z' ) );
132 $req->setCookie(
'x',
'Value' );
133 $this->assertEquals(
'Value',
$req->getCookie(
'x' ) );
143 $this->setExpectedException( MWException::class );
144 $req->getRequestURL();
153 $req->setRequestURL(
'https://example.org' );
154 $this->assertEquals(
'https://example.org',
$req->getRequestURL() );
163 $this->assertEquals(
'http',
$req->getProtocol() );
165 $this->assertEquals(
'http',
$req->getProtocol() );
167 $this->assertEquals(
'https',
$req->getProtocol() );
176 $value =
'text/plain, text/html';
181 $this->assertEquals(
$request->getHeader(
'Nonexistent' ),
false );
186 $request->getHeader(
'Accept', WebRequest::GETHEADER_LIST ),
187 [
'text/plain',
'text/html' ]
195 $_SERVER[
'HTTP_TEST'] =
'Example';
215 $values = [
'x' =>
'Value',
'y' =>
'' ];
218 $this->assertEquals( $values,
$req->getSessionArray() );
221 $this->assertSame(
null,
$req->getSessionArray() );
231 $this->assertEquals(
'',
$req->getRawQueryString() );
232 $this->assertEquals(
'',
$req->getRawPostString() );
233 $this->assertEquals(
'',
$req->getRawInput() );
$wgCookiePrefix
Cookies generated by MediaWiki have names starting with this prefix.
testGetRequestURL()
FauxRequest::getRequestURL.
testDummies()
FauxRequest::getRawQueryString FauxRequest::getRawPostString FauxRequest::getRawInput.
testConstructInvalidSession()
FauxRequest::__construct.
testSetRequestURL()
FauxRequest::setRequestURL FauxRequest::getRequestURL.
testWasPosted()
FauxRequest::wasPosted.
testProtocol()
FauxRequest::__construct FauxRequest::getProtocol.
testGetText()
FauxRequest::getText.
testConstructInvalidData()
FauxRequest::__construct.
testSessionData()
FauxRequest::__construct FauxRequest::getSessionArray.
testCookies()
FauxRequest::getCookie FauxRequest::setCookie FauxRequest::setCookies.
testCookiesDefaultPrefix()
FauxRequest::getCookie FauxRequest::setCookie FauxRequest::setCookies.
testConstructWithSession()
FauxRequest::__construct.
testGetMethod()
FauxRequest::getMethod.
testGetSetHeader()
FauxRequest::setHeader FauxRequest::setHeaders FauxRequest::getHeader.
testGetValues()
FauxRequest::getValues.
testGetQueryValues()
FauxRequest::getQueryValues.
testGetAllHeaders()
FauxRequest::initHeaders.
WebRequest clone which takes values from a provided array.
this hook is for auditing only $req
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request