Mwjames has uploaded a new change for review.

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


Change subject: Extend SMW\SpecialsTest
......................................................................

Extend SMW\SpecialsTest

Change-Id: I86a27728349fc3bacddb3e6425dc7f7940d4cf85
---
M includes/Setup.php
M tests/phpunit/includes/specials/SpecialsTest.php
2 files changed, 53 insertions(+), 30 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticMediaWiki 
refs/changes/79/61179/1

diff --git a/includes/Setup.php b/includes/Setup.php
index 641d8c5..ebbe10c 100644
--- a/includes/Setup.php
+++ b/includes/Setup.php
@@ -362,45 +362,70 @@
  * Register all SMW special pages with MediaWiki.
  */
 function smwfRegisterSpecialPages() {
-       global $wgSpecialPages, $wgSpecialPageGroups;
+       $specials = array(
+               'Ask' => array(
+                       'page' => 'SMWAskPage',
+                       'group' => 'smw_group'
+               ),
+               'Browse' => array(
+                       'page' =>  'SMWSpecialBrowse',
+                       'group' => 'smw_group'
+               ),
+               'PageProperty' => array(
+                       'page' =>  'SMWPageProperty',
+                       'group' => 'smw_group'
+               ),
+               'SearchByProperty' => array(
+                       'page' => 'SMWSearchByProperty',
+                       'group' => 'smw_group'
+               ),
+               'SMWAdmin' => array(
+                       'page' => 'SMWAdmin',
+                       'group' => 'smw_group'
+               ),
+               'SemanticStatistics' => array(
+                       'page' => 'SMW\SpecialSemanticStatistics',
+                       'group' => 'wiki'
+               ),
+               'ExportRDF' => array(
+                       'page' => 'SMWSpecialOWLExport',
+                       'group' => 'smw_group'
+               ),
+               'Types' => array(
+                       'page' => 'SMWSpecialTypes',
+                       'group' => 'pages'
+               ),
+       );
 
-       $wgSpecialPages['Ask']                          = 'SMWAskPage';
-       $wgSpecialPageGroups['Ask']                     = 'smw_group';
+       // Register data
+       foreach ( $specials as $special => $page ) {
+               $GLOBALS['wgSpecialPages'][$special] = $page['page'];
 
-//     $wgSpecialPages['QueryCreator']                 = 'SMWQueryCreatorPage';
-//     $wgSpecialPageGroups['QueryCreator']            = 'smw_group';
+               if ( isset( $page['group'] ) ) {
+                       $GLOBALS['wgSpecialPageGroups'][$special] = 
$page['group'];
+               }
+       }
 
-       $wgSpecialPages['Browse']                       = 'SMWSpecialBrowse';
-       $wgSpecialPageGroups['Browse']                  = 'smw_group';
+       //      $wgSpecialPages['QueryCreator']             = 
'SMWQueryCreatorPage';
+       //      $wgSpecialPageGroups['QueryCreator']        = 'smw_group';
 
-       $wgSpecialPages['PageProperty']                 = 'SMWPageProperty';
-       $wgSpecialPageGroups['PageProperty']            = 'smw_group';
-
-       $wgSpecialPages['SearchByProperty']             = 'SMWSearchByProperty';
-       $wgSpecialPageGroups['SearchByProperty']        = 'smw_group';
-
+       // FIXME Test fails with Undefined index: HTTP_ACCEPT
        $wgSpecialPages['URIResolver']                  = 'SMWURIResolver';
 
-       $wgSpecialPages['SMWAdmin']                     = 'SMWAdmin';
-       $wgSpecialPageGroups['SMWAdmin']                = 'smw_group';
-
-       $wgSpecialPages['SemanticStatistics']           = 
'SMW\SpecialSemanticStatistics';
-       $wgSpecialPageGroups['SemanticStatistics']      = 'wiki'; // Similar to 
Special:Statistics
-
-       $wgSpecialPages['ExportRDF']                    = 'SMWSpecialOWLExport';
-       $wgSpecialPageGroups['ExportRDF']               = 'smw_group';
-
+       // FIXME Test fails with (SMWSpecialProperties) Use of wfViewPrevNext 
was deprecated in MediaWiki 1.19
        $wgSpecialPages['Properties']                   = 
'SMWSpecialProperties';
        $wgSpecialPageGroups['Properties']              = 'pages';
 
-       $wgSpecialPages['Types']                        = 'SMWSpecialTypes';
-       $wgSpecialPageGroups['Types']                   = 'pages';
-
+       // FIXME Test fails with (SMWSpecialUnusedProperties) Use of 
wfViewPrevNext was deprecated in MediaWiki 1.19.
        $wgSpecialPages['UnusedProperties']             = 
'SMWSpecialUnusedProperties';
        $wgSpecialPageGroups['UnusedProperties']        = 'maintenance';
 
+       // FIXME Test fails with (SMWSpecialWantedProperties) Use of 
Linker::makeLinkObj was deprecated in MediaWiki 1.21
        $wgSpecialPages['WantedProperties']             = 
'SMWSpecialWantedProperties';
        $wgSpecialPageGroups['WantedProperties']        = 'maintenance';
+
+       // $specials is used in SpecialsTest therefore above are excluded as 
their fail the test
+       return $specials;
 }
 
 /**
diff --git a/tests/phpunit/includes/specials/SpecialsTest.php 
b/tests/phpunit/includes/specials/SpecialsTest.php
index 55b66f8..bafa4ce 100644
--- a/tests/phpunit/includes/specials/SpecialsTest.php
+++ b/tests/phpunit/includes/specials/SpecialsTest.php
@@ -62,14 +62,12 @@
         * @return array
         */
        public function specialProvider() {
-               $specials = array(
-                       'SemanticStatistics'
-               );
-
                $argLists = array();
 
-               foreach ( $specials as $special ) {
+               foreach ( smwfRegisterSpecialPages() as $special => $values ) {
+
                        if ( array_key_exists( $special, 
$GLOBALS['wgSpecialPages'] ) ) {
+
                                $specialPage = SpecialPageFactory::getPage( 
$special );
                                $context = 
RequestContext::newExtraneousContext( $specialPage->getTitle() );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86a27728349fc3bacddb3e6425dc7f7940d4cf85
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticMediaWiki
Gerrit-Branch: master
Gerrit-Owner: Mwjames <jamesin.hongkon...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to