Phuedx has uploaded a new change for review. https://gerrit.wikimedia.org/r/315240
Change subject: Hygiene: Update $wgMFMobileHeader default value ...................................................................... Hygiene: Update $wgMFMobileHeader default value $wgMFMobileHeader was changed from X-WAP to X-Subdomain for all mobile Wikipedias on 12th March 2014 <If519b3ec>. Change-Id: I81774ed34c86fa607b5e8d4613af16a4b5f68f45 --- M README.md M extension.json M tests/phpunit/MobileContextTest.php M tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php 4 files changed, 17 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/40/315240/1 diff --git a/README.md b/README.md index 37cca1a..6439c3b 100644 --- a/README.md +++ b/README.md @@ -242,12 +242,10 @@ #### $wgMFMobileHeader Requests containing header with this name will be considered as coming from -mobile devices. The default value is for backwards compatibility. - -Set to `false` to explicitly disable this way of detection. +mobile devices. * Type: `String` -* Default: `'X-WAP'` +* Default: `'X-Subdomain'` #### $wgMinervaBottomLanguageButton diff --git a/extension.json b/extension.json index c356b50..bd92ff4 100644 --- a/extension.json +++ b/extension.json @@ -1970,7 +1970,7 @@ "MFSpecialCaseMainPage": false, "MinervaEnableSiteNotice": false, "MFTidyMobileViewSections": true, - "MFMobileHeader": "X-WAP", + "MFMobileHeader": "X-Subdomain", "MFRemovableClasses": { "beta": [], "base": [] diff --git a/tests/phpunit/MobileContextTest.php b/tests/phpunit/MobileContextTest.php index 15a87e2..2f4008f 100644 --- a/tests/phpunit/MobileContextTest.php +++ b/tests/phpunit/MobileContextTest.php @@ -80,7 +80,7 @@ */ public function testGetMobileUrl() { $this->setMwGlobals( [ - 'wgMFMobileHeader' => 'X-WAP', + 'wgMFMobileHeader' => 'X-Subdomain', 'wgMobileUrlTemplate' => '%h0.m.%h1.%h2', 'wgServer' => '//en.wikipedia.org', ] ); @@ -97,7 +97,7 @@ $invokes++; } ] ] ); - $context->getRequest()->setHeader( 'X-WAP', 'no' ); + $context->getRequest()->setHeader( 'X-Subdomain', 'M' ); $this->assertEquals( 'http://en.m.wikipedia.org/wiki/Article', $context->getMobileUrl( 'http://en.wikipedia.org/wiki/Article' ) @@ -171,12 +171,12 @@ */ public function testUsingMobileDomain() { $this->setMwGlobals( [ - 'wgMFMobileHeader' => 'X-WAP', + 'wgMFMobileHeader' => 'X-Subdomain', 'wgMobileUrlTemplate' => '%h0.m.%h1.%h2', ] ); $context = $this->makeContext(); $this->assertFalse( $context->usingMobileDomain() ); - $context->getRequest()->setHeader( 'X-WAP', '1' ); + $context->getRequest()->setHeader( 'X-Subdomain', 'M' ); $this->assertTrue( $context->usingMobileDomain() ); } @@ -297,13 +297,15 @@ * @dataProvider shouldDisplayMobileViewProvider * @covers MobileContext::shouldDisplayMobileView */ - public function testShouldDisplayMobileView( $shouldDisplay, $xWap = null, - $requestVal = [], $msg = null + public function testShouldDisplayMobileView( + $shouldDisplay, + $customHeader = null, + $requestVal = [] ) { $testMethod = ( $shouldDisplay ) ? 'assertTrue' : 'assertFalse'; $this->setMwGlobals( [ - 'wgMFMobileHeader' => 'X-WAP', + 'wgMFMobileHeader' => 'X-Subdomain', 'wgMobileUrlTemplate' => '%h0.m.%h1.%h2', ] ); $context = $this->makeContext(); @@ -318,11 +320,11 @@ } } - if ( !is_null( $xWap ) ) { - $request->setHeader( 'X-WAP', $xWap ); + if ( !is_null( $customHeader ) ) { + $request->setHeader( 'X-Subdomain', $customHeader ); } - $this->$testMethod( $context->shouldDisplayMobileView(), $msg ); + $this->$testMethod( $context->shouldDisplayMobileView() ); } public function shouldDisplayMobileViewProvider() { diff --git a/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php b/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php index d386fa8..6eddf62 100644 --- a/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php +++ b/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php @@ -72,8 +72,7 @@ // <https://github.com/wikimedia/operations-puppet/blob/2a2714c28eab25eed469375dc5322ea6a6ef85df/modules/varnish/templates/text-frontend.inc.vcl.erb#L74-L78>. // @codingStandardsIgnoreEnd - // @FIXME Change the default value of $wgMFMobileHeader to "X-Subdomain". - $this->request->setHeader( 'X-WAP', 'M' ); + $this->request->setHeader( 'X-Subdomain', 'M' ); $properties = $this->detectDeviceProperties(); @@ -85,7 +84,7 @@ * @FIXME Should this really be the case? */ public function test_it_should_prioritize_the_amf_environment_variables() { - $this->request->setHeader( 'X-WAP', 'M' ); + $this->request->setHeader( 'X-Subdomain', 'M' ); $this->server[ 'AMF_DEVICE_IS_TABLET' ] = 'true'; -- To view, visit https://gerrit.wikimedia.org/r/315240 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I81774ed34c86fa607b5e8d4613af16a4b5f68f45 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Phuedx <g...@samsmith.io> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits