2013-01-14 03:26:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author Matthew Flaschen
|
|
|
|
|
*
|
|
|
|
|
* @group Output
|
|
|
|
|
*
|
2013-10-24 19:35:04 +00:00
|
|
|
* @todo factor tests in this class into providers and test methods
|
|
|
|
|
*
|
2013-01-14 03:26:15 +00:00
|
|
|
*/
|
|
|
|
|
class OutputPageTest extends MediaWikiTestCase {
|
|
|
|
|
const SCREEN_MEDIA_QUERY = 'screen and (min-width: 982px)';
|
|
|
|
|
const SCREEN_ONLY_MEDIA_QUERY = 'only screen and (min-width: 982px)';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests a particular case of transformCssMedia, using the given input, globals,
|
|
|
|
|
* expected return, and message
|
|
|
|
|
*
|
|
|
|
|
* Asserts that $expectedReturn is returned.
|
|
|
|
|
*
|
|
|
|
|
* options['printableQuery'] - value of query string for printable, or omitted for none
|
|
|
|
|
* options['handheldQuery'] - value of query string for handheld, or omitted for none
|
|
|
|
|
* options['media'] - passed into the method under the same name
|
|
|
|
|
* options['expectedReturn'] - expected return value
|
|
|
|
|
* options['message'] - PHPUnit message for assertion
|
|
|
|
|
*
|
2014-07-24 12:55:43 +00:00
|
|
|
* @param array $args Key-value array of arguments as shown above
|
2013-01-14 03:26:15 +00:00
|
|
|
*/
|
2013-02-14 11:22:13 +00:00
|
|
|
protected function assertTransformCssMediaCase( $args ) {
|
2013-01-14 03:26:15 +00:00
|
|
|
$queryData = array();
|
|
|
|
|
if ( isset( $args['printableQuery'] ) ) {
|
|
|
|
|
$queryData['printable'] = $args['printableQuery'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset( $args['handheldQuery'] ) ) {
|
|
|
|
|
$queryData['handheld'] = $args['handheldQuery'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$fauxRequest = new FauxRequest( $queryData, false );
|
2014-07-20 19:50:34 +00:00
|
|
|
$this->setMwGlobals( array(
|
2013-02-14 11:22:13 +00:00
|
|
|
'wgRequest' => $fauxRequest,
|
2013-01-14 03:26:15 +00:00
|
|
|
) );
|
|
|
|
|
|
|
|
|
|
$actualReturn = OutputPage::transformCssMedia( $args['media'] );
|
2013-02-14 11:22:13 +00:00
|
|
|
$this->assertSame( $args['expectedReturn'], $actualReturn, $args['message'] );
|
2013-01-14 03:26:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests print requests
|
2013-10-24 19:35:04 +00:00
|
|
|
* @covers OutputPage::transformCssMedia
|
2013-01-14 03:26:15 +00:00
|
|
|
*/
|
|
|
|
|
public function testPrintRequests() {
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'printableQuery' => '1',
|
|
|
|
|
'media' => 'screen',
|
|
|
|
|
'expectedReturn' => null,
|
|
|
|
|
'message' => 'On printable request, screen returns null'
|
|
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'printableQuery' => '1',
|
|
|
|
|
'media' => self::SCREEN_MEDIA_QUERY,
|
|
|
|
|
'expectedReturn' => null,
|
|
|
|
|
'message' => 'On printable request, screen media query returns null'
|
|
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'printableQuery' => '1',
|
|
|
|
|
'media' => self::SCREEN_ONLY_MEDIA_QUERY,
|
|
|
|
|
'expectedReturn' => null,
|
|
|
|
|
'message' => 'On printable request, screen media query with only returns null'
|
|
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'printableQuery' => '1',
|
|
|
|
|
'media' => 'print',
|
|
|
|
|
'expectedReturn' => '',
|
|
|
|
|
'message' => 'On printable request, media print returns empty string'
|
|
|
|
|
) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Tests screen requests, without either query parameter set
|
2013-10-24 19:35:04 +00:00
|
|
|
* @covers OutputPage::transformCssMedia
|
2013-01-14 03:26:15 +00:00
|
|
|
*/
|
|
|
|
|
public function testScreenRequests() {
|
|
|
|
|
$this->assertTransformCssMediaCase( array(
|
|
|
|
|
'media' => 'screen',
|
|
|
|
|
'expectedReturn' => 'screen',
|
2013-05-11 19:05:43 +00:00
|
|
|
'message' => 'On screen request, screen media type is preserved'
|
|
|
|
|
) );
|
|
|
|
|
|
|
|
|
|
$this->assertTransformCssMediaCase( array(
|
|
|
|
|
'media' => 'handheld',
|
|
|
|
|
'expectedReturn' => 'handheld',
|
|
|
|
|
'message' => 'On screen request, handheld media type is preserved'
|
2013-01-14 03:26:15 +00:00
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'media' => self::SCREEN_MEDIA_QUERY,
|
|
|
|
|
'expectedReturn' => self::SCREEN_MEDIA_QUERY,
|
|
|
|
|
'message' => 'On screen request, screen media query is preserved.'
|
|
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'media' => self::SCREEN_ONLY_MEDIA_QUERY,
|
|
|
|
|
'expectedReturn' => self::SCREEN_ONLY_MEDIA_QUERY,
|
|
|
|
|
'message' => 'On screen request, screen media query with only is preserved.'
|
|
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'media' => 'print',
|
|
|
|
|
'expectedReturn' => 'print',
|
|
|
|
|
'message' => 'On screen request, print media type is preserved'
|
|
|
|
|
) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2013-05-11 19:05:43 +00:00
|
|
|
* Tests handheld behavior
|
2013-10-24 19:35:04 +00:00
|
|
|
* @covers OutputPage::transformCssMedia
|
2013-01-14 03:26:15 +00:00
|
|
|
*/
|
|
|
|
|
public function testHandheld() {
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'handheldQuery' => '1',
|
|
|
|
|
'media' => 'handheld',
|
|
|
|
|
'expectedReturn' => '',
|
|
|
|
|
'message' => 'On request with handheld querystring and media is handheld, returns empty string'
|
|
|
|
|
) );
|
|
|
|
|
|
2013-05-11 19:05:43 +00:00
|
|
|
$this->assertTransformCssMediaCase( array(
|
2013-01-14 03:26:15 +00:00
|
|
|
'handheldQuery' => '1',
|
|
|
|
|
'media' => 'screen',
|
|
|
|
|
'expectedReturn' => null,
|
|
|
|
|
'message' => 'On request with handheld querystring and media is screen, returns null'
|
|
|
|
|
) );
|
|
|
|
|
}
|
2014-06-28 20:40:22 +00:00
|
|
|
|
|
|
|
|
public static function provideMakeResourceLoaderLink() {
|
2015-10-01 20:13:34 +00:00
|
|
|
// @codingStandardsIgnoreStart Generic.Files.LineLength
|
2014-06-28 20:40:22 +00:00
|
|
|
return array(
|
|
|
|
|
// Load module script only
|
|
|
|
|
array(
|
|
|
|
|
array( 'test.foo', ResourceLoaderModule::TYPE_SCRIPTS ),
|
2015-08-04 23:07:45 +00:00
|
|
|
"<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
|
2015-08-28 12:00:58 +00:00
|
|
|
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.foo\u0026only=scripts\u0026skin=fallback");'
|
2015-07-31 00:13:04 +00:00
|
|
|
. "\n} );</script>"
|
2014-09-08 16:31:54 +00:00
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
// Don't condition wrap raw modules (like the startup module)
|
|
|
|
|
array( 'test.raw', ResourceLoaderModule::TYPE_SCRIPTS ),
|
2015-08-28 12:00:58 +00:00
|
|
|
'<script async src="http://127.0.0.1:8080/w/load.php?debug=false&lang=en&modules=test.raw&only=scripts&skin=fallback"></script>'
|
2014-06-28 20:40:22 +00:00
|
|
|
),
|
|
|
|
|
// Load module styles only
|
|
|
|
|
// This also tests the order the modules are put into the url
|
|
|
|
|
array(
|
|
|
|
|
array( array( 'test.baz', 'test.foo', 'test.bar' ), ResourceLoaderModule::TYPE_STYLES ),
|
2015-07-27 23:40:52 +00:00
|
|
|
|
2015-08-28 12:00:58 +00:00
|
|
|
'<link rel=stylesheet href="http://127.0.0.1:8080/w/load.php?debug=false&lang=en&modules=test.bar%2Cbaz%2Cfoo&only=styles&skin=fallback">'
|
2014-08-13 18:06:10 +00:00
|
|
|
),
|
OutputPage: Restore ResourceLoader condition wrap for embedded modules
Follows-up 9272bc6c47, 03c503da22.
* In 9272bc6c47, the condition wrap was removed from
OutputPage for no reason. This went unnnoticed as I had also
accidentally made the cond wrap in makeModuleResponse apply
to both only=scripts and regular (faux) responses, such as by
OutputPage embedding private modules.
* In 03c503da22, the latter bug was fixed, thus exposing the former.
This wrapper belongs in OutputPage, not in ResourceLoader. It's
OutputPage making the loader request. And just like in other places,
it's the "client"'s responsibility to ensure the request is either not
made or wrapped appropriately.
The test for "private module (only=scripts)" could be removed but
I'll keep it so we can see how this changes in the future. It's
a case that can't ever happen, but if it would, it currently gets
a double condition wrapper, which is fine.
Change-Id: Id333e4958ed769831fabca02164c1e8505962d57
2014-09-02 01:25:13 +00:00
|
|
|
// Load private module (only=scripts)
|
2014-08-13 18:06:10 +00:00
|
|
|
array(
|
|
|
|
|
array( 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ),
|
2015-08-04 23:07:45 +00:00
|
|
|
"<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
|
2015-07-27 23:40:52 +00:00
|
|
|
. "mw.test.baz({token:123});mw.loader.state({\"test.quux\":\"ready\"});\n"
|
2015-08-11 16:24:03 +00:00
|
|
|
. "} );</script>"
|
2014-06-28 20:40:22 +00:00
|
|
|
),
|
|
|
|
|
// Load private module (combined)
|
|
|
|
|
array(
|
|
|
|
|
array( 'test.quux', ResourceLoaderModule::TYPE_COMBINED ),
|
2015-08-04 23:07:45 +00:00
|
|
|
"<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
|
2015-07-27 23:40:52 +00:00
|
|
|
. "mw.loader.implement(\"test.quux\",function($,jQuery){"
|
2015-08-11 16:24:03 +00:00
|
|
|
. "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}"
|
|
|
|
|
. "\"]});\n} );</script>"
|
2014-06-28 20:40:22 +00:00
|
|
|
),
|
2014-08-24 03:26:48 +00:00
|
|
|
// Load no modules
|
|
|
|
|
array(
|
|
|
|
|
array( array(), ResourceLoaderModule::TYPE_COMBINED ),
|
|
|
|
|
'',
|
|
|
|
|
),
|
|
|
|
|
// noscript group
|
|
|
|
|
array(
|
|
|
|
|
array( 'test.noscript', ResourceLoaderModule::TYPE_STYLES ),
|
2015-08-28 12:00:58 +00:00
|
|
|
'<noscript><link rel=stylesheet href="http://127.0.0.1:8080/w/load.php?debug=false&lang=en&modules=test.noscript&only=styles&skin=fallback"></noscript>'
|
2014-08-24 03:26:48 +00:00
|
|
|
),
|
|
|
|
|
// Load two modules in separate groups
|
|
|
|
|
array(
|
|
|
|
|
array( array( 'test.group.foo', 'test.group.bar' ), ResourceLoaderModule::TYPE_COMBINED ),
|
2015-08-04 23:07:45 +00:00
|
|
|
"<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
|
2015-08-28 12:00:58 +00:00
|
|
|
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.group.bar\u0026skin=fallback");'
|
2015-07-27 23:40:52 +00:00
|
|
|
. "\n} );</script>\n"
|
2015-08-04 23:07:45 +00:00
|
|
|
. "<script>window.RLQ = window.RLQ || []; window.RLQ.push( function () {\n"
|
2015-08-28 12:00:58 +00:00
|
|
|
. 'mw.loader.load("http://127.0.0.1:8080/w/load.php?debug=false\u0026lang=en\u0026modules=test.group.foo\u0026skin=fallback");'
|
2015-07-31 00:13:04 +00:00
|
|
|
. "\n} );</script>"
|
2014-06-28 20:40:22 +00:00
|
|
|
),
|
|
|
|
|
);
|
2015-10-01 20:13:34 +00:00
|
|
|
// @codingStandardsIgnoreEnd
|
2014-06-28 20:40:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideMakeResourceLoaderLink
|
|
|
|
|
* @covers OutputPage::makeResourceLoaderLink
|
2015-03-23 03:57:45 +00:00
|
|
|
* @covers ResourceLoader::makeLoaderImplementScript
|
|
|
|
|
* @covers ResourceLoader::makeModuleResponse
|
|
|
|
|
* @covers ResourceLoader::makeInlineScript
|
|
|
|
|
* @covers ResourceLoader::makeLoaderStateScript
|
|
|
|
|
* @covers ResourceLoader::createLoaderURL
|
2014-06-28 20:40:22 +00:00
|
|
|
*/
|
2014-07-19 21:12:10 +00:00
|
|
|
public function testMakeResourceLoaderLink( $args, $expectedHtml ) {
|
2014-06-28 20:40:22 +00:00
|
|
|
$this->setMwGlobals( array(
|
2014-07-11 14:35:14 +00:00
|
|
|
'wgResourceLoaderDebug' => false,
|
2014-06-28 20:40:22 +00:00
|
|
|
'wgLoadScript' => 'http://127.0.0.1:8080/w/load.php',
|
|
|
|
|
// Affects whether CDATA is inserted
|
|
|
|
|
'wgWellFormedXml' => false,
|
|
|
|
|
) );
|
|
|
|
|
$class = new ReflectionClass( 'OutputPage' );
|
|
|
|
|
$method = $class->getMethod( 'makeResourceLoaderLink' );
|
|
|
|
|
$method->setAccessible( true );
|
|
|
|
|
$ctx = new RequestContext();
|
2014-08-09 12:36:35 +00:00
|
|
|
$ctx->setSkin( SkinFactory::getDefaultInstance()->makeSkin( 'fallback' ) );
|
2014-07-11 14:35:14 +00:00
|
|
|
$ctx->setLanguage( 'en' );
|
2014-06-28 20:40:22 +00:00
|
|
|
$out = new OutputPage( $ctx );
|
|
|
|
|
$rl = $out->getResourceLoader();
|
2015-03-29 04:24:31 +00:00
|
|
|
$rl->setMessageBlobStore( new NullMessageBlobStore() );
|
2014-06-28 20:40:22 +00:00
|
|
|
$rl->register( array(
|
2014-07-19 21:12:10 +00:00
|
|
|
'test.foo' => new ResourceLoaderTestModule( array(
|
2014-06-28 20:40:22 +00:00
|
|
|
'script' => 'mw.test.foo( { a: true } );',
|
|
|
|
|
'styles' => '.mw-test-foo { content: "style"; }',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-07-19 21:12:10 +00:00
|
|
|
'test.bar' => new ResourceLoaderTestModule( array(
|
2014-06-28 20:40:22 +00:00
|
|
|
'script' => 'mw.test.bar( { a: true } );',
|
|
|
|
|
'styles' => '.mw-test-bar { content: "style"; }',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-07-19 21:12:10 +00:00
|
|
|
'test.baz' => new ResourceLoaderTestModule( array(
|
2014-06-28 20:40:22 +00:00
|
|
|
'script' => 'mw.test.baz( { a: true } );',
|
|
|
|
|
'styles' => '.mw-test-baz { content: "style"; }',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-07-19 21:12:10 +00:00
|
|
|
'test.quux' => new ResourceLoaderTestModule( array(
|
2014-06-28 20:40:22 +00:00
|
|
|
'script' => 'mw.test.baz( { token: 123 } );',
|
|
|
|
|
'styles' => '/* pref-animate=off */ .mw-icon { transition: none; }',
|
|
|
|
|
'group' => 'private',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-09-08 16:31:54 +00:00
|
|
|
'test.raw' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'script' => 'mw.test.baz( { token: 123 } );',
|
|
|
|
|
'isRaw' => true,
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-08-24 03:26:48 +00:00
|
|
|
'test.noscript' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'styles' => '.mw-test-noscript { content: "style"; }',
|
|
|
|
|
'group' => 'noscript',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-08-24 03:26:48 +00:00
|
|
|
'test.group.bar' => new ResourceLoaderTestModule( array(
|
2014-09-08 16:31:54 +00:00
|
|
|
'styles' => '.mw-group-bar { content: "style"; }',
|
|
|
|
|
'group' => 'bar',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-08-24 03:26:48 +00:00
|
|
|
'test.group.foo' => new ResourceLoaderTestModule( array(
|
2014-09-08 16:31:54 +00:00
|
|
|
'styles' => '.mw-group-foo { content: "style"; }',
|
|
|
|
|
'group' => 'foo',
|
2015-06-16 19:06:19 +00:00
|
|
|
) ),
|
2014-06-28 20:40:22 +00:00
|
|
|
) );
|
|
|
|
|
$links = $method->invokeArgs( $out, $args );
|
2015-08-21 14:52:09 +00:00
|
|
|
$actualHtml = implode( "\n", $links['html'] );
|
2014-08-06 15:54:22 +00:00
|
|
|
$this->assertEquals( $expectedHtml, $actualHtml );
|
2014-06-28 20:40:22 +00:00
|
|
|
}
|
2015-09-08 21:59:45 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideVaryHeaders
|
|
|
|
|
* @covers OutputPage::addVaryHeader
|
|
|
|
|
* @covers OutputPage::getVaryHeader
|
|
|
|
|
* @covers OutputPage::getXVO
|
|
|
|
|
*/
|
|
|
|
|
public function testVaryHeaders( $calls, $vary, $xvo ) {
|
|
|
|
|
// get rid of default Vary fields
|
|
|
|
|
$outputPage = $this->getMockBuilder( 'OutputPage' )
|
|
|
|
|
->setConstructorArgs( array( new RequestContext() ) )
|
|
|
|
|
->setMethods( array( 'getCacheVaryCookies' ) )
|
|
|
|
|
->getMock();
|
|
|
|
|
$outputPage->expects( $this->any() )
|
|
|
|
|
->method( 'getCacheVaryCookies' )
|
|
|
|
|
->will( $this->returnValue( array() ) );
|
|
|
|
|
TestingAccessWrapper::newFromObject( $outputPage )->mVaryHeader = array();
|
|
|
|
|
|
|
|
|
|
foreach ( $calls as $call ) {
|
|
|
|
|
call_user_func_array( array( $outputPage, 'addVaryHeader' ), $call );
|
|
|
|
|
}
|
|
|
|
|
$this->assertEquals( $vary, $outputPage->getVaryHeader(), 'Vary:' );
|
|
|
|
|
$this->assertEquals( $xvo, $outputPage->getXVO(), 'X-Vary-Options:' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function provideVaryHeaders() {
|
|
|
|
|
// note: getXVO() automatically adds Vary: Cookie
|
|
|
|
|
return array(
|
|
|
|
|
array( // single header
|
|
|
|
|
array(
|
|
|
|
|
array( 'Cookie' ),
|
|
|
|
|
),
|
|
|
|
|
'Vary: Cookie',
|
|
|
|
|
'X-Vary-Options: Cookie',
|
|
|
|
|
),
|
|
|
|
|
array( // non-unique headers
|
|
|
|
|
array(
|
|
|
|
|
array( 'Cookie' ),
|
|
|
|
|
array( 'Accept-Language' ),
|
|
|
|
|
array( 'Cookie' ),
|
|
|
|
|
),
|
|
|
|
|
'Vary: Cookie, Accept-Language',
|
|
|
|
|
'X-Vary-Options: Cookie,Accept-Language',
|
|
|
|
|
),
|
|
|
|
|
array( // two headers with single options
|
|
|
|
|
array(
|
|
|
|
|
array( 'Cookie', array( 'string-contains=phpsessid' ) ),
|
|
|
|
|
array( 'Accept-Language', array( 'string-contains=en' ) ),
|
|
|
|
|
),
|
|
|
|
|
'Vary: Cookie, Accept-Language',
|
|
|
|
|
'X-Vary-Options: Cookie;string-contains=phpsessid,Accept-Language;string-contains=en',
|
|
|
|
|
),
|
|
|
|
|
array( // one header with multiple options
|
|
|
|
|
array(
|
|
|
|
|
array( 'Cookie', array( 'string-contains=phpsessid', 'string-contains=userId' ) ),
|
|
|
|
|
),
|
|
|
|
|
'Vary: Cookie',
|
|
|
|
|
'X-Vary-Options: Cookie;string-contains=phpsessid;string-contains=userId',
|
|
|
|
|
),
|
|
|
|
|
array( // Duplicate option
|
|
|
|
|
array(
|
|
|
|
|
array( 'Cookie', array( 'string-contains=phpsessid' ) ),
|
|
|
|
|
array( 'Cookie', array( 'string-contains=phpsessid' ) ),
|
|
|
|
|
array( 'Accept-Language', array( 'string-contains=en', 'string-contains=en' ) ),
|
|
|
|
|
),
|
|
|
|
|
'Vary: Cookie, Accept-Language',
|
|
|
|
|
'X-Vary-Options: Cookie;string-contains=phpsessid,Accept-Language;string-contains=en',
|
|
|
|
|
),
|
|
|
|
|
array( // Same header, different options
|
|
|
|
|
array(
|
|
|
|
|
array( 'Cookie', array( 'string-contains=phpsessid' ) ),
|
|
|
|
|
array( 'Cookie', array( 'string-contains=userId' ) ),
|
|
|
|
|
),
|
|
|
|
|
'Vary: Cookie',
|
|
|
|
|
'X-Vary-Options: Cookie;string-contains=phpsessid;string-contains=userId',
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2013-01-14 03:26:15 +00:00
|
|
|
}
|
2015-03-29 04:24:31 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MessageBlobStore that doesn't do anything
|
|
|
|
|
*/
|
|
|
|
|
class NullMessageBlobStore extends MessageBlobStore {
|
2015-06-16 19:06:19 +00:00
|
|
|
public function get( ResourceLoader $resourceLoader, $modules, $lang ) {
|
2015-03-29 04:24:31 +00:00
|
|
|
return array();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-16 19:06:19 +00:00
|
|
|
public function insertMessageBlob( $name, ResourceLoaderModule $module, $lang ) {
|
2015-03-29 04:24:31 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-16 19:06:19 +00:00
|
|
|
public function updateModule( $name, ResourceLoaderModule $module, $lang ) {
|
2015-03-29 04:24:31 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-16 19:06:19 +00:00
|
|
|
public function updateMessage( $key ) {
|
2015-03-29 04:24:31 +00:00
|
|
|
}
|
2015-09-26 15:00:56 +00:00
|
|
|
|
2015-03-29 04:24:31 +00:00
|
|
|
public function clear() {
|
|
|
|
|
}
|
|
|
|
|
}
|