[MediaWiki-commits] [Gerrit] Clean-up to global overrides in NewParserTest - change (mediawiki/core)

2013-04-29 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Clean-up to global overrides in NewParserTest
..


Clean-up to global overrides in NewParserTest

- Move definitions of constant values from NewParserTest::setupGlobals()
  to NewParserTest::setUp() so that the former only defines values
  depending on the test
- Remove duplicate definitions
- Use setMwGlobals() to override the globals in NewParserTest::setUp()
- Change the overriding of $wgNamespaceProtection to use the normal
  procedure instead of the weirdglobal thing
- Only define $wgUser, $wgOut and $wgRequest in NewParserTest::setupGlobals()

Change-Id: I1362932db2230455b23e469759ff3f9946da0392
---
M tests/phpunit/includes/parser/NewParserTest.php
1 file changed, 50 insertions(+), 76 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/phpunit/includes/parser/NewParserTest.php 
b/tests/phpunit/includes/parser/NewParserTest.php
index 934f181..994bc1c 100644
--- a/tests/phpunit/includes/parser/NewParserTest.php
+++ b/tests/phpunit/includes/parser/NewParserTest.php
@@ -19,7 +19,6 @@
public $runParsoid = false;
public $regex = '';
public $showProgress = true;
-   public $savedInitialGlobals = array();
public $savedWeirdGlobals = array();
public $savedGlobals = array();
public $hooks = array();
@@ -33,7 +32,7 @@
protected $file = false;
 
protected function setUp() {
-   global $wgNamespaceProtection, $wgNamespaceAliases;
+   global $wgNamespaceAliases;
global $wgHooks, $IP;
 
parent::setUp();
@@ -52,11 +51,17 @@
 
$tmpGlobals['wgLanguageCode'] = 'en';
$tmpGlobals['wgContLang'] = Language::factory( 'en' );
+   $tmpGlobals['wgSitename'] = 'MediaWiki';
+   $tmpGlobals['wgServer'] = 'http://example.org';
$tmpGlobals['wgScript'] = '/index.php';
$tmpGlobals['wgScriptPath'] = '/';
$tmpGlobals['wgArticlePath'] = '/wiki/$1';
+   $tmpGlobals['wgActionPaths'] = array();
+   $tmpGlobals['wgVariantArticlePath'] = false;
+   $tmpGlobals['wgExtensionAssetsPath'] = '/extensions';
$tmpGlobals['wgStyleSheetPath'] = '/skins';
$tmpGlobals['wgStylePath'] = '/skins';
+   $tmpGlobals['wgEnableUploads'] = true;
$tmpGlobals['wgThumbnailScriptPath'] = false;
$tmpGlobals['wgLocalFileRepo'] = array(
'class' = 'LocalRepo',
@@ -67,50 +72,62 @@
'backend' = 'local-backend'
);
$tmpGlobals['wgForeignFileRepos'] = array();
+   $tmpGlobals['wgDefaultExternalStore'] = array();
$tmpGlobals['wgEnableParserCache'] = false;
-   $tmpGlobals['wgHooks'] = $wgHooks;
+   $tmpGlobals['wgCapitalLinks'] = true;
+   $tmpGlobals['wgNoFollowLinks'] = true;
+   $tmpGlobals['wgNoFollowDomainExceptions'] = array();
+   $tmpGlobals['wgExternalLinkTarget'] = false;
+   $tmpGlobals['wgThumbnailScriptPath'] = false;
+   $tmpGlobals['wgUseImageResize'] = true;
+   $tmpGlobals['wgAllowExternalImages'] = true;
+   $tmpGlobals['wgRawHtml'] = false;
+   $tmpGlobals['wgUseTidy'] = false;
+   $tmpGlobals['wgAlwaysUseTidy'] = false;
+   $tmpGlobals['wgHtml5'] = true;
+   $tmpGlobals['wgWellFormedXml'] = true;
+   $tmpGlobals['wgAllowMicrodataAttributes'] = true;
+   $tmpGlobals['wgExperimentalHtmlIds'] = false;
+   $tmpGlobals['wgAdaptiveMessageCache'] = true;
+   $tmpGlobals['wgUseDatabaseMessages'] = true;
+   $tmpGlobals['wgLocaltimezone'] = 'UTC';
$tmpGlobals['wgDeferredUpdateList'] = array();
-   $tmpGlobals['wgMemc'] = wfGetMainCache();
+   $tmpGlobals['wgGroupPermissions'] = array(
+   '*' = array(
+   'createaccount' = true,
+   'read' = true,
+   'edit' = true,
+   'createpage' = true,
+   'createtalk' = true,
+   ) );
+   $tmpGlobals['wgNamespaceProtection'] = array( NS_MEDIAWIKI = 
'editinterface' );
+   $tmpGlobals['wgMemc'] = new EmptyBagOStuff;
$tmpGlobals['messageMemc'] = wfGetMessageCacheStorage();
$tmpGlobals['parserMemc'] = wfGetParserCacheStorage();
 
-   // $tmpGlobals['wgContLang'] = new StubContLang;
-   $tmpGlobals['wgUser'] = new User;
-   $context = new RequestContext();
-   

[MediaWiki-commits] [Gerrit] Clean-up to global overrides in NewParserTest - change (mediawiki/core)

2013-04-20 Thread IAlex (Code Review)
IAlex has uploaded a new change for review.

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


Change subject: Clean-up to global overrides in NewParserTest
..

Clean-up to global overrides in NewParserTest

- Move definitions of constant values from NewParserTest::setupGlobals()
  to NewParserTest::setUp() so that the former only defines values
  depending on the test
- Remove duplicate definitions
- Use setMwGlobals() to override the globals in NewParserTest::setUp()
- Change the overriding of $wgNamespaceProtection to use the normal
  procedure instead of the weirdglobal thing
- Only define $wgUser, $wgOut and $wgRequest in NewParserTest::setupGlobals()

Change-Id: I1362932db2230455b23e469759ff3f9946da0392
---
M tests/phpunit/includes/parser/NewParserTest.php
1 file changed, 50 insertions(+), 77 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/24/60124/1

diff --git a/tests/phpunit/includes/parser/NewParserTest.php 
b/tests/phpunit/includes/parser/NewParserTest.php
index 77311b9..5a78852 100644
--- a/tests/phpunit/includes/parser/NewParserTest.php
+++ b/tests/phpunit/includes/parser/NewParserTest.php
@@ -19,7 +19,6 @@
public $runParsoid = false;
public $regex = '';
public $showProgress = true;
-   public $savedInitialGlobals = array();
public $savedWeirdGlobals = array();
public $savedGlobals = array();
public $hooks = array();
@@ -33,7 +32,7 @@
protected $file = false;
 
protected function setUp() {
-   global $wgNamespaceProtection, $wgNamespaceAliases;
+   global $wgNamespaceAliases;
global $wgHooks, $IP;
 
parent::setUp();
@@ -52,11 +51,17 @@
 
$tmpGlobals['wgLanguageCode'] = 'en';
$tmpGlobals['wgContLang'] = Language::factory( 'en' );
+   $tmpGlobals['wgSitename'] = 'MediaWiki';
+   $tmpGlobals['wgServer'] = 'http://example.org';
$tmpGlobals['wgScript'] = '/index.php';
$tmpGlobals['wgScriptPath'] = '/';
$tmpGlobals['wgArticlePath'] = '/wiki/$1';
+   $tmpGlobals['wgActionPaths'] = array();
+   $tmpGlobals['wgVariantArticlePath'] = false;
+   $tmpGlobals['wgExtensionAssetsPath'] = '/extensions';
$tmpGlobals['wgStyleSheetPath'] = '/skins';
$tmpGlobals['wgStylePath'] = '/skins';
+   $tmpGlobals['wgEnableUploads'] = true;
$tmpGlobals['wgThumbnailScriptPath'] = false;
$tmpGlobals['wgLocalFileRepo'] = array(
'class' = 'LocalRepo',
@@ -67,51 +72,62 @@
'backend' = 'local-backend'
);
$tmpGlobals['wgForeignFileRepos'] = array();
+   $tmpGlobals['wgDefaultExternalStore'] = array();
$tmpGlobals['wgEnableParserCache'] = false;
-   $tmpGlobals['wgHooks'] = $wgHooks;
+   $tmpGlobals['wgCapitalLinks'] = true;
+   $tmpGlobals['wgNoFollowLinks'] = true;
+   $tmpGlobals['wgNoFollowDomainExceptions'] = array();
+   $tmpGlobals['wgExternalLinkTarget'] = false;
+   $tmpGlobals['wgThumbnailScriptPath'] = false;
+   $tmpGlobals['wgUseImageResize'] = true;
+   $tmpGlobals['wgAllowExternalImages'] = true;
+   $tmpGlobals['wgRawHtml'] = false;
+   $tmpGlobals['wgUseTidy'] = false;
+   $tmpGlobals['wgAlwaysUseTidy'] = false;
+   $tmpGlobals['wgHtml5'] = true;
+   $tmpGlobals['wgWellFormedXml'] = true;
+   $tmpGlobals['wgAllowMicrodataAttributes'] = true;
+   $tmpGlobals['wgExperimentalHtmlIds'] = false;
+   $tmpGlobals['wgAdaptiveMessageCache'] = true;
+   $tmpGlobals['wgUseDatabaseMessages'] = true;
+   $tmpGlobals['wgLocaltimezone'] = 'UTC';
$tmpGlobals['wgDeferredUpdateList'] = array();
-   $tmpGlobals['wgMemc'] = wfGetMainCache();
+   $tmpGlobals['wgGroupPermissions'] = array(
+   '*' = array(
+   'createaccount' = true,
+   'read' = true,
+   'edit' = true,
+   'createpage' = true,
+   'createtalk' = true,
+   ) );
+   $tmpGlobals['wgNamespaceProtection'] = array( NS_MEDIAWIKI = 
'editinterface' );
+   $tmpGlobals['wgMemc'] = new EmptyBagOStuff;
$tmpGlobals['messageMemc'] = wfGetMessageCacheStorage();
$tmpGlobals['parserMemc'] = wfGetParserCacheStorage();
 
-   // $tmpGlobals['wgContLang'] = new StubContLang;
-   $tmpGlobals['wgUser'] = new User;
-   $context = new