r94716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94715‎ | r94716 | r94717 >
Date:00:46, 17 August 2011
Author:bawolff
Status:ok
Tags:
Comment:
Follow-up r94680 - fix unit tests.

The way the magic variable unit tests are run looks a little sketchy to me...
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/parser/MagicVariableTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/parser/MagicVariableTest.php
@@ -38,6 +38,8 @@
3939
4040 # initialize parser output
4141 $this->testParser->clearState();
 42+ # Needs a title to do magic word stuff
 43+ $this->testParser->setTitle( Title::newFromText( 'Tests' ) );
4244 }
4345
4446 /** destroy parser (TODO: is it really neded?)*/
Index: trunk/phase3/includes/parser/Parser.php
@@ -2660,6 +2660,15 @@
26612661 global $wgContLang, $wgSitename, $wgServer;
26622662 global $wgArticlePath, $wgScriptPath, $wgStylePath;
26632663
 2664+ if ( is_null( $this->mTitle ) ) {
 2665+ // If no title set, bad things are going to happen
 2666+ // later. Title should always be set since this
 2667+ // should only be called in the middle of a parse
 2668+ // operation (but the unit-tests do funky stuff)
 2669+ throw new MWException( __METHOD__ . ' Should only be '
 2670+ . ' called while parsing (no title set)' );
 2671+ }
 2672+
26642673 /**
26652674 * Some of these require message or data lookups and can be
26662675 * expensive to check many times.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94680Magic words (time and number-formatting ones, plus DIRECTIONMARK, but not NAM...robin19:29, 16 August 2011

Status & tagging log