MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/82050


Change subject: Very code hygienic change: KILL WAP WITH FIRE!!1
......................................................................

Very code hygienic change: KILL WAP WITH FIRE!!1

Change-Id: I58f172505016540dddf5d9ae1cf227bf7bdfc175
---
M MobileFrontend.i18n.php
M MobileFrontend.php
M includes/DeviceDetection.php
M includes/MobileContext.php
M includes/MobileFrontend.hooks.php
D includes/WmlContext.php
M includes/api/ApiParseExtender.php
M includes/formatters/MobileFormatter.php
D includes/formatters/MobileFormatterWML.php
D includes/skins/SkinMobileWML.php
M tests/DeviceDetectionTest.php
11 files changed, 26 insertions(+), 414 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/50/82050/1

diff --git a/MobileFrontend.i18n.php b/MobileFrontend.i18n.php
index 9cab202..f59482a 100644
--- a/MobileFrontend.i18n.php
+++ b/MobileFrontend.i18n.php
@@ -18,7 +18,6 @@
        'mobile-frontend-desc' => 'Mobile Frontend',
        'mobile.css' => '/* CSS placed here will affect users of the mobile 
site */', # only translate this message to other languages if you have to 
change it
        'mobile.js' => '/* Any JavaScript here will be loaded for users using 
the mobile site */', # only translate this message to other languages if you 
have to change it
-       'mobile-frontend-search-submit' => 'Go',
        'mobile-frontend-home-button' => 'Home',
        'mobile-frontend-logged-out' => 'Not logged in',
        'mobile-frontend-logged-in-homepage-notification' => 'Welcome, $1!',
@@ -42,8 +41,6 @@
        'mobile-frontend-back-to-top-of-section' => 'Jump back a section',
        'mobile-frontend-close-section' => 'Close this section',
        'mobile-frontend-regular-site' => 'Desktop view',
-       'mobile-frontend-wml-continue' => 'Continue...',
-       'mobile-frontend-wml-back' => 'Back...',
        'mobile-frontend-view' => 'Mobile view',
        'mobile-frontend-view-desktop' => 'Desktop',
        'mobile-frontend-view-mobile' => 'Mobile',
diff --git a/MobileFrontend.php b/MobileFrontend.php
index 73fe178..91d26de 100644
--- a/MobileFrontend.php
+++ b/MobileFrontend.php
@@ -39,14 +39,11 @@
        'DeviceDetection' => 'DeviceDetection',
        'HtmlDeviceProperties' => 'DeviceDetection',
        'MobileContext' => 'MobileContext',
-       'WmlContext' => 'WmlContext',
-       'WmlDeviceProperties' => 'DeviceDetection',
 
        'ExtractFormatter' => 'formatters/ExtractFormatter',
        'HtmlFormatter' => 'formatters/HtmlFormatter',
        'MobileFormatter' => 'formatters/MobileFormatter',
        'MobileFormatterHTML' => 'formatters/MobileFormatterHTML',
-       'MobileFormatterWML' => 'formatters/MobileFormatterWML',
 
        'ApiMobileView' => 'api/ApiMobileView',
        'ApiParseExtender' => 'api/ApiParseExtender',
@@ -69,12 +66,10 @@
        'MobileTemplate' => 'skins/MobileTemplate',
        'MobileTemplateBeta' => 'skins/MobileTemplateBeta',
        'MobileTemplateAlpha' => 'skins/MobileTemplateAlpha',
-       'MobileTemplateWML' => 'skins/MobileTemplateWML',
        'SkinMinerva' => 'skins/SkinMinerva',
        'SkinMobile' => 'skins/SkinMobile',
        'SkinMobileBeta' => 'skins/SkinMobileBeta',
        'SkinMobileAlpha' => 'skins/SkinMobileAlpha',
-       'SkinMobileWML' => 'skins/SkinMobileWML',
        'UserLoginAndCreateTemplate' => 'skins/UserLoginAndCreateTemplate',
        'UserLoginMobileTemplate' => 'skins/UserLoginMobileTemplate',
        'UserAccountCreateMobileTemplate' => 
'skins/UserAccountCreateMobileTemplate',
@@ -238,11 +233,6 @@
        ),
        // HTML view
        'HTML' => array(),
-       // WML view
-       'WML' => array(
-               '.mw-editsection',
-               'sup.reference', // References generally don't work in WML due 
to per-section views
-       ),
        // Text extracts
        'extracts' => array(
                'table', 'div', '.mw-editsection', 'sup.reference', 
'.noexcerpt', '.error'
diff --git a/includes/DeviceDetection.php b/includes/DeviceDetection.php
index 53fa2b2..76dc37b 100644
--- a/includes/DeviceDetection.php
+++ b/includes/DeviceDetection.php
@@ -28,11 +28,6 @@
  */
 interface IDeviceProperties {
        /**
-        * @return string: 'html' or 'wml'
-        */
-       function format();
-
-       /**
         * @return bool
         */
        function isMobileDevice();
@@ -42,10 +37,9 @@
 interface IDeviceDetector {
        /**
         * @param string $userAgent
-        * @param string $acceptHeader
         * @return IDeviceProperties
         */
-       function detectDeviceProperties( $userAgent, $acceptHeader );
+       function detectDeviceProperties( $userAgent );
 }
 
 /**
@@ -53,38 +47,10 @@
  */
 class DeviceProperties implements IDeviceProperties {
        private $userAgent,
-               $acceptHeader,
-               $isMobile = null,
-               $format = null;
+               $isMobile = null;
 
-       public function __construct( $userAgent, $acceptHeader ) {
+       public function __construct( $userAgent ) {
                $this->userAgent = $userAgent;
-               $this->acceptHeader = $acceptHeader;
-       }
-
-       /**
-        * @return string
-        */
-       public function format() {
-               wfProfileIn( __METHOD__ );
-               if ( !$this->format ) {
-                       $this->format = $this->detectFormat( $this->userAgent, 
$this->acceptHeader );
-               }
-               wfProfileOut( __METHOD__ );
-               return $this->format;
-       }
-
-       /**
-        * @return string
-        */
-       protected function detectFormat() {
-               if ( strpos( $this->acceptHeader, 'vnd.wap.wml' ) !== false
-                       && strpos( $this->acceptHeader, 'text/html' ) === false
-                       && strpos( $this->acceptHeader, 
'application/vnd.wap.xhtml+xml' ) === false )
-               {
-                       return 'wml';
-               }
-               return 'html';
        }
 
        /**
@@ -168,31 +134,6 @@
 }
 
 class HtmlDeviceProperties implements IDeviceProperties {
-
-       /**
-        * @return string
-        */
-       function format() {
-               return 'html';
-       }
-
-       /**
-        * @return bool
-        */
-       function isMobileDevice() {
-               return true;
-       }
-}
-
-class WmlDeviceProperties implements IDeviceProperties {
-
-       /**
-        * @return string
-        */
-       function format() {
-               return 'wml';
-       }
-
        /**
         * @return bool
         */
@@ -224,10 +165,9 @@
 
        /**
         * @param string $userAgent
-        * @param string $acceptHeader
         * @return IDeviceProperties
         */
-       public function detectDeviceProperties( $userAgent, $acceptHeader ) {
-               return new DeviceProperties( $userAgent, $acceptHeader );
+       public function detectDeviceProperties( $userAgent ) {
+               return new DeviceProperties( $userAgent );
        }
 }
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 847a513..35da770 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -66,49 +66,14 @@
 
                $wap = $this->getRequest()->getHeader( 'X-WAP' );
                if ( $wap ) {
-                       $className = ( $wap === 'no' ) ? 'HtmlDeviceProperties' 
: 'WmlDeviceProperties';
-                       $this->device = new $className;
+                       $this->device = new HtmlDeviceProperties;
                } else {
                        $userAgent = $request->getHeader( 'User-agent' );
-                       $acceptHeader = $request->getHeader( 'Accept' );
-                       $acceptHeader = $acceptHeader === false ? '' : 
$acceptHeader;
-                       $this->device = $detector->detectDeviceProperties( 
$userAgent, $acceptHeader );
+                       $this->device = $detector->detectDeviceProperties( 
$userAgent );
                }
 
                wfProfileOut( __METHOD__ );
                return $this->device;
-       }
-
-       /**
-        * @return string
-        */
-       public function getContentFormat() {
-               if ( $this->contentFormat ) {
-                       return $this->contentFormat;
-               }
-               // honor useformat if it's set, otherwise determine by device
-               $device = $this->getDevice();
-               $viewFormat = ( $this->getUseFormat() != '' ) ? 
$this->getUseFormat() : $device->format();
-               $this->contentFormat = static::parseContentFormat( $viewFormat 
);
-               return $this->contentFormat;
-       }
-
-       /**
-        * Converts a multitude of format strings to 'HTML' or 'WML'
-        * @param string $format
-        *
-        * @return string
-        */
-       public static function parseContentFormat( $format ) {
-               if ( $format === 'wml' ) {
-                       return 'WML';
-               } elseif ( $format === 'html' ) {
-                       return 'HTML';
-               }
-               if ( $format === 'mobile-wap' ) {
-                       return 'WML';
-               }
-               return 'HTML';
        }
 
        public function imagesDisabled() {
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index b190cd6..9e0b7a3 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -75,22 +75,17 @@
                // log whether user is using alpha/beta/stable
                $mobileContext->logMobileMode();
 
-               if ( $mobileContext->getContentFormat() == 'WML' ) {
-                       # Grab the skin class and initialise it.
-                       $skin = new SkinMobileWML( $context );
-               } else {
-                       $skinName = $wgMFDefaultSkinClass;
-                       $betaSkinName = $skinName . 'Beta';
-                       $alphaSkinName = $skinName . 'Alpha';
-                       // Force alpha for test mode to sure all modules can run
-                       $inTestMode = $context->getTitle()->getDBkey() === 
'JavaScriptTest/qunit';
-                       if ( ( $mobileContext->isAlphaGroupMember() || 
$inTestMode ) && class_exists( $alphaSkinName ) ) {
-                               $skinName = $alphaSkinName;
-                       } else if ( $mobileContext->isBetaGroupMember() && 
class_exists( $betaSkinName ) ) {
-                               $skinName = $betaSkinName;
-                       }
-                       $skin = new $skinName( $context );
+               $skinName = $wgMFDefaultSkinClass;
+               $betaSkinName = $skinName . 'Beta';
+               $alphaSkinName = $skinName . 'Alpha';
+               // Force alpha for test mode to sure all modules can run
+               $inTestMode = $context->getTitle()->getDBkey() === 
'JavaScriptTest/qunit';
+               if ( ( $mobileContext->isAlphaGroupMember() || $inTestMode ) && 
class_exists( $alphaSkinName ) ) {
+                       $skinName = $alphaSkinName;
+               } else if ( $mobileContext->isBetaGroupMember() && 
class_exists( $betaSkinName ) ) {
+                       $skinName = $betaSkinName;
                }
+               $skin = new $skinName( $context );
 
                return false;
        }
@@ -627,12 +622,7 @@
         * @return bool
         */
        public static function onUserRequiresHTTPS( $user, &$https ) {
-               // WAP phones allegedly can't handle HTTPS, don't redirect them 
there
-               $context = MobileContext::singleton();
-               if ( $context->shouldDisplayMobileView() && 
$context->getDevice()->format() === 'wml' ) {
-                       $https = false;
-                       return false; // Stop further hook processing
-               }
+               // @todo: WAP phones allegedly can't handle HTTPS, don't 
redirect them there
                return true;
        }
 }
diff --git a/includes/WmlContext.php b/includes/WmlContext.php
deleted file mode 100644
index 03b343d..0000000
--- a/includes/WmlContext.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * Provides information for creation of WML cards
- */
-class WmlContext {
-       private $requestedSegment;
-       private $useFormat;
-       private $currentUrl;
-       private $onlyThisSegment = false;
-
-       public function __construct( MobileContext $context = null ) {
-               if ( $context ) {
-                       $request = $context->getRequest();
-                       $this->requestedSegment = $request->getInt( 'seg', 0 );
-                       $useFormat = $context->getUseFormat();
-                       if ( $useFormat ) {
-                               $this->useFormat = $useFormat;
-                       }
-                       $this->currentUrl = 
$context->getTitle()->getCanonicalURL();
-               }
-       }
-
-       public function getRequestedSegment() {
-               return $this->requestedSegment;
-       }
-
-       public function setRequestedSegment( $value ) {
-               $this->requestedSegment = $value;
-       }
-
-       public function getUseFormat() {
-               return $this->useFormat;
-       }
-
-       public function setUseFormat( $value ) {
-               $this->useFormat = $value;
-       }
-
-       public function getCurrentUrl() {
-               return $this->currentUrl;
-       }
-
-       public function setCurrentUrl( $value ) {
-               $this->currentUrl = $value;
-       }
-
-       public function getOnlyThisSegment() {
-               return $this->onlyThisSegment;
-       }
-
-       public function setOnlyThisSegment( $value ) {
-               $this->onlyThisSegment = $value;
-       }
-}
diff --git a/includes/api/ApiParseExtender.php 
b/includes/api/ApiParseExtender.php
index 3c430bb..1aa4246 100644
--- a/includes/api/ApiParseExtender.php
+++ b/includes/api/ApiParseExtender.php
@@ -14,9 +14,7 @@
         */
        public static function onAPIGetAllowedParams( ApiBase &$module, 
&$params ) {
                if ( $module->getModuleName() == 'parse' ) {
-                       $params['mobileformat'] = array(
-                               ApiBase::PARAM_TYPE => array( 'wml', 'html' ),
-                       );
+                       $params['mobileformat'] = null;
                        $params['noimages'] = false;
                        $params['mainpage'] = false;
                }
@@ -72,8 +70,8 @@
 
                                $title = Title::newFromText( 
$data['parse']['title'] );
                                $html = MobileFormatter::wrapHTML( 
$data['parse']['text']['*'] );
-                               if ( MobileContext::parseContentFormat( 
$params['mobileformat'] ) === 'WML' ) {
-                                       // @todo: make mobileformat accept only 
HTML on July 25, 2013
+                               if ( $params['mobileformat'] === 'wml' ) {
+                                       // @todo: kill completely
                                        $module->setWarning( 'mobileformat=wml 
is not supported anymore' );
                                }
                                $mf = new MobileFormatterHTML( $html, $title );
diff --git a/includes/formatters/MobileFormatter.php 
b/includes/formatters/MobileFormatter.php
index 02d083c..6f054c8 100644
--- a/includes/formatters/MobileFormatter.php
+++ b/includes/formatters/MobileFormatter.php
@@ -45,13 +45,8 @@
                $isSpecialPage = $title->isSpecialPage();
 
                $html = self::wrapHTML( $html );
-               if ( $context->getContentFormat() === 'WML' ) {
-                       $wmlContext = new WmlContext( $context );
-                       $formatter = new MobileFormatterWML( $html, $title, 
$wmlContext );
-               } else {
-                       $formatter = new MobileFormatterHTML( $html, $title );
-                       $formatter->enableExpandableSections( !$isMainPage && 
!$isSpecialPage );
-               }
+               $formatter = new MobileFormatterHTML( $html, $title );
+               $formatter->enableExpandableSections( !$isMainPage && 
!$isSpecialPage );
 
                if ( $context->isBetaGroupMember() ) {
                        $formatter->disableBackToTop();
@@ -106,7 +101,7 @@
        }
 
        /**
-        * Performs final transformations to mobile format and returns 
resulting HTML/WML
+        * Performs final transformations to mobile format and returns 
resulting HTML
         *
         * @param DOMElement|string|null $element: ID of element to get HTML 
from or false to get it from the whole tree
         * @return string: Processed HTML
@@ -142,7 +137,7 @@
        }
 
        /**
-        * Prepares headings in WML mode, makes sections expandable in HTML mode
+        * Makes sections expandable
         * @param string $s
         * @return string
         */
diff --git a/includes/formatters/MobileFormatterWML.php 
b/includes/formatters/MobileFormatterWML.php
deleted file mode 100644
index e12ed3e..0000000
--- a/includes/formatters/MobileFormatterWML.php
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-
-class MobileFormatterWML extends MobileFormatter {
-       const WML_SECTION_SEPARATOR = 
'***************************************************************************';
-
-       /**
-        * @var WmlContext
-        */
-       protected $wmlContext;
-
-       /**
-        * Constructor
-        *
-        * @param string $html: Text to process
-        * @param Title $title: Title to which $html belongs
-        * @param WmlContext $wmlContext: Context for creation of WML cards, 
can be omitted if $format == 'HTML'
-        * @throws MWException
-        */
-       public function __construct( $html, $title, WmlContext $wmlContext = 
null ) {
-               parent::__construct( $html, $title );
-
-               if ( !$wmlContext ) {
-                       throw new MWException( __METHOD__ . '(): WML context 
not set' );
-               }
-               $this->wmlContext = $wmlContext;
-       }
-
-       public function getFormat() {
-               return 'WML';
-       }
-
-       protected function onHtmlReady( $html ) {
-               wfProfileIn( __METHOD__ );
-               $html = $this->headingTransform( $html );
-               // Content removal for WML rendering
-               $this->flatten( array( 'span', 'div', 'sup', 'h[1-6]', 'sup', 
'sub' ) );
-               // Content wrapping
-               $html = $this->createWMLCard( $html );
-               wfProfileOut( __METHOD__ );
-               return $html;
-       }
-
-       /**
-        * Creates a WML card from input
-        * @param string $s: Raw WML
-        * @return string: WML card
-        */
-       private function createWMLCard( $s ) {
-               wfProfileIn( __METHOD__ );
-               $segments = explode( self::WML_SECTION_SEPARATOR, $s );
-               $card = '';
-               $idx = 0;
-               $requestedSegment = htmlspecialchars( 
$this->wmlContext->getRequestedSegment() );
-               $title = htmlspecialchars( $this->title->getText() );
-               $segmentText = $this->wmlContext->getOnlyThisSegment()
-                       ? str_replace( self::WML_SECTION_SEPARATOR, '', $s )
-                       : $segments[$requestedSegment];
-
-               $card .= "<card id='s{$idx}' 
title='{$title}'><p>{$segmentText}</p>";
-               $idx = intval( $requestedSegment ) + 1;
-               $segmentsCount = $this->wmlContext->getOnlyThisSegment()
-                       ? $idx + 1 // @todo: when using from API we don't have 
the total section count
-                       : count( $segments );
-               $card .= "<p>" . $idx . "/" . $segmentsCount . "</p>";
-
-               $useFormatParam = ( $this->wmlContext->getUseFormat() )
-                       ? '&amp;useformat=' . $this->wmlContext->getUseFormat()
-                       : '';
-
-               // Title::getLocalUrl doesn't work at this point since PHP 
5.1.x, all objects have their destructors called
-               // before the output buffer callback function executes.
-               // Thus, globalized objects will not be available as expected 
in the function.
-               // This is stated to be intended behavior, as per the 
following: [https://bugs.php.net/bug.php?id=40104]
-               $defaultQuery = wfCgiToArray( preg_replace( '/^.*?(\?|$)/', '', 
$this->wmlContext->getCurrentUrl() ) );
-               unset( $defaultQuery['seg'] );
-               unset( $defaultQuery['useformat'] );
-
-               $qs = wfArrayToCgi( $defaultQuery );
-               $delimiter = ( !empty( $qs ) ) ? '?' : '';
-               $basePageParts = wfParseUrl( $this->wmlContext->getCurrentUrl() 
);
-               $basePage = $basePageParts['scheme'] . 
$basePageParts['delimiter'] . $basePageParts['host'] . $basePageParts['path'] . 
$delimiter . $qs;
-               $appendDelimiter = ( $delimiter === '?' ) ? '&amp;' : '?';
-
-               if ( $idx < $segmentsCount ) {
-                       $card .= "<p><a 
href=\"{$basePage}{$appendDelimiter}seg={$idx}{$useFormatParam}\">"
-                               . $this->msg( 'mobile-frontend-wml-continue' ) 
. "</a></p>";
-               }
-
-               if ( $idx > 1 ) {
-                       $back_idx = $requestedSegment - 1;
-                       $card .= "<p><a 
href=\"{$basePage}{$appendDelimiter}seg={$back_idx}{$useFormatParam}\">"
-                               . $this->msg( 'mobile-frontend-wml-back' ) . 
"</a></p>";
-               }
-
-               $card .= '</card>';
-               wfProfileOut( __METHOD__ );
-               return $card;
-       }
-
-       protected function headingTransformCallback( $matches ) {
-               wfProfileIn( __METHOD__ );
-               $this->headings++;
-
-               $base = self::WML_SECTION_SEPARATOR .
-                       "<h2 class='section_heading' 
id='section_{$this->headings}'>{$matches[2]}</h2>";
-
-               wfProfileOut( __METHOD__ );
-               return $base;
-       }
-}
diff --git a/includes/skins/SkinMobileWML.php b/includes/skins/SkinMobileWML.php
deleted file mode 100644
index d817f26..0000000
--- a/includes/skins/SkinMobileWML.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
-class SkinMobileWML extends SkinTemplate {
-       public $skinname = 'SkinMobileWML';
-       public $stylename = 'SkinMobileWML';
-       public $template = 'MobileTemplateWML';
-
-       public function __construct( IContextSource $context ) {
-               $this->setContext( $context );
-       }
-
-       public function outputPage( OutputPage $out = null ) {
-               wfProfileIn( __METHOD__ );
-               if ( !$out ) {
-                       $out = $this->getOutput();
-               }
-
-               $options = null;
-               wfRunHooks( 'BeforePageDisplayMobile', array( &$out, &$options 
) );
-
-               $out->getRequest()->response()->header( 'Content-Type: 
text/vnd.wap.wml' );
-               $tpl = $this->setupTemplate( $this->template );
-               $tpl->setRef( 'skin', $this );
-               $lang = $this->getLanguage();
-               $tpl->set( 'code', $lang->getCode() );
-               $tpl->set( 'dir', $lang->isRTL() ? 'rtl' : 'ltr' );
-               $tpl->set( 'mainPageUrl', Title::newMainPage()->getLocalUrl() );
-               $tpl->set( 'randomPageUrl', SpecialPage::getTitleFor( 
'Randompage' )->getLocalUrl() );
-               $tpl->set( 'wgScript', wfScript() );
-               $tpl->set( 'searchField', $this->getRequest()->getText( 
'search', '' ) );
-               $notice = '';
-               wfRunHooks( 'GetMobileNotice', array( $this, &$notice ) );
-               $tpl->set( 'banner', $notice );
-               $html = ExtMobileFrontend::DOMParse( $out );
-               $tpl->set( 'bodytext', $html );
-
-               $tpl->execute();
-
-               wfProfileOut( __METHOD__ );
-       }
-}
-
-class MobileTemplateWML extends BaseTemplate {
-       public function execute() {
-               wfProfileIn( __METHOD__ );
-               echo '<?xml version="1.0" encoding="utf-8" ?>';
-               ?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
-               "http://www.wapforum.org/DTD/wml13.dtd";>
-       <wml xml:lang="<?php $this->text( 'code' ) ?>" dir="<?php $this->text( 
'dir' ) ?>">
-               <template>
-                       <do name="home" type="options" label="<?php $this->msg( 
'mobile-frontend-home-button' ) ?>" >
-                               <go href="<?php $this->text( 'mainPageUrl' ) 
?>"/>
-                       </do>
-                       <do name="random" type="options" label="<?php 
$this->msg( 'mobile-frontend-random-button' ) ?>">
-                               <go href="<?php $this->text( 'randomPageUrl' ) 
?>"/>
-                       </do>
-               </template>
-
-               <?php echo $this->data['banner']; ?>
-
-               <p><input emptyok="true" format="*M" type="text" name="search" 
value="" size="16" />
-                       <do type="accept" label="<?php $this->msg( 
'mobile-frontend-search-submit' ) ?>">
-                               <go href="<?php $this->text( 'wgScript' ) 
?>?title=Special%3ASearch&amp;search=<?php $this->text( 'searchField' ) 
?>"></go></do>
-               </p>
-               <?php $this->html( 'bodytext' ) ?>
-       </wml>
-<?php
-               wfProfileOut( __METHOD__ );
-       }
-}
diff --git a/tests/DeviceDetectionTest.php b/tests/DeviceDetectionTest.php
index 0ae3452..c784a46 100644
--- a/tests/DeviceDetectionTest.php
+++ b/tests/DeviceDetectionTest.php
@@ -5,34 +5,6 @@
  */
 class DeviceDetectionTest extends MediaWikiTestCase {
 
-       /**
-        * @dataProvider provideTestFormat
-        */
-       public function testFormat( $format, $acceptHeader ) {
-               $detector = new DeviceDetection();
-               $device = $detector->detectDeviceProperties( '', $acceptHeader 
);
-               $this->assertEquals( $format, $device->format() );
-       }
-
-       public function provideTestFormat() {
-               return array(
-                       // Typical WebKit-based mobile browser, e.g. Android
-                       array( 'html', 
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ),
-                       // Opera Mini
-                       array( 'html', 'text/html, application/xml;q=0.9, 
application/xhtml+xml, image/png,image/webp, image/jpeg,image/gif, 
image/x-xbitmap, */*;q=0.1' ),
-                       // Samsung JET, 
https://bugzilla.wikimedia.org/show_bug.cgi?id=30827
-                       array( 'html', 'text/html, application/xml, 
image/vnd.wap.wbmp, image/png, image/jpeg, image/gif, image/bmp, 
application/vnd.wap.xhtml+xml, application/xhtml+xml, 
application/vnd.wap.multipart.mixed, multipart/mixed, text/vnd.wap.wml, 
application/vnd.wap.wmlc, application/vnd.oma.dd+xml, 
text/vnd.sun.j2me.app-descriptor, application/java-archive, */*' ),
-                       // Some average WAP browser
-                       array( 'wml', 'text/vnd.wap.wml, image/vnd.wap.wbmp, 
image/png, image/jpeg, image/gif, image/bmp' ),
-                       // Imaginary browser that prefers wml to html, but 
still takes html
-                       array( 'html', 'text/vnd.wap.wml, text/html' ),
-                       // Imaginary browser that prefers html to wml
-                       array( 'html', 'text/html, text/vnd.wap.wml' ),
-                       // Imaginary browser that wants only wml
-                       array( 'wml', 'text/vnd.wap.wml' ),
-               );
-       }
-
        private function mobileDevices() {
                return array(
                        // Firefox OS (bug 40919)
@@ -79,7 +51,7 @@
         */
        public function testIsMobileDevice( $expected, $userAgent ) {
                $detector = new DeviceDetection();
-               $device = $detector->detectDeviceProperties( $userAgent, '' );
+               $device = $detector->detectDeviceProperties( $userAgent );
                $this->assertEquals( (bool)$expected, $device->isMobileDevice() 
);
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/82050
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I58f172505016540dddf5d9ae1cf227bf7bdfc175
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to