Index: trunk/phase3/tests/phpunit/includes/parser/MagicVariableTest.php |
— | — | @@ -38,6 +38,8 @@ |
39 | 39 | |
40 | 40 | # initialize parser output |
41 | 41 | $this->testParser->clearState(); |
| 42 | + # Needs a title to do magic word stuff |
| 43 | + $this->testParser->setTitle( Title::newFromText( 'Tests' ) ); |
42 | 44 | } |
43 | 45 | |
44 | 46 | /** destroy parser (TODO: is it really neded?)*/ |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -2660,6 +2660,15 @@ |
2661 | 2661 | global $wgContLang, $wgSitename, $wgServer; |
2662 | 2662 | global $wgArticlePath, $wgScriptPath, $wgStylePath; |
2663 | 2663 | |
| 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 | + |
2664 | 2673 | /** |
2665 | 2674 | * Some of these require message or data lookups and can be |
2666 | 2675 | * expensive to check many times. |