Index: trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php |
— | — | @@ -313,6 +313,7 @@ |
314 | 314 | |
315 | 315 | $GLOBALS['wgMemc'] = new EmptyBagOStuff; |
316 | 316 | $GLOBALS['wgOut'] = $context->getOutput(); |
| 317 | + $GLOBALS['wgUser'] = $context->getUser(); |
317 | 318 | |
318 | 319 | global $wgHooks; |
319 | 320 | |
— | — | @@ -328,8 +329,7 @@ |
329 | 330 | RepoGroup::destroySingleton(); |
330 | 331 | MessageCache::singleton()->destroyInstance(); |
331 | 332 | |
332 | | - global $wgUser; |
333 | | - $wgUser = new User(); |
| 333 | + return $context; |
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
— | — | @@ -471,10 +471,10 @@ |
472 | 472 | wfDebug( "Running parser test: $desc\n" ); |
473 | 473 | |
474 | 474 | $opts = $this->parseOptions( $opts ); |
475 | | - $this->setupGlobals( $opts, $config ); |
| 475 | + $context = $this->setupGlobals( $opts, $config ); |
476 | 476 | |
477 | | - $user = new User(); |
478 | | - $options = ParserOptions::newFromUser( $user ); |
| 477 | + $user = $context->getUser(); |
| 478 | + $options = ParserOptions::newFromContext( $context ); |
479 | 479 | |
480 | 480 | if ( isset( $opts['title'] ) ) { |
481 | 481 | $titleText = $opts['title']; |
— | — | @@ -519,11 +519,10 @@ |
520 | 520 | if ( isset( $opts['ill'] ) ) { |
521 | 521 | $out = $this->tidy( implode( ' ', $output->getLanguageLinks() ) ); |
522 | 522 | } elseif ( isset( $opts['cat'] ) ) { |
523 | | - global $wgOut; |
| 523 | + $outputPage = $context->getOutput(); |
| 524 | + $outputPage->addCategoryLinks( $output->getCategories() ); |
| 525 | + $cats = $outputPage->getCategoryLinks(); |
524 | 526 | |
525 | | - $wgOut->addCategoryLinks( $output->getCategories() ); |
526 | | - $cats = $wgOut->getCategoryLinks(); |
527 | | - |
528 | 527 | if ( isset( $cats['normal'] ) ) { |
529 | 528 | $out = $this->tidy( implode( ' ', $cats['normal'] ) ); |
530 | 529 | } else { |
Index: trunk/phase3/tests/parser/parserTest.inc |
— | — | @@ -435,10 +435,10 @@ |
436 | 436 | } |
437 | 437 | |
438 | 438 | $opts = $this->parseOptions( $opts ); |
439 | | - $this->setupGlobals( $opts, $config ); |
| 439 | + $context = $this->setupGlobals( $opts, $config ); |
440 | 440 | |
441 | | - $user = new User(); |
442 | | - $options = ParserOptions::newFromUser( $user ); |
| 441 | + $user = $context->getUser(); |
| 442 | + $options = ParserOptions::newFromContext( $context ); |
443 | 443 | |
444 | 444 | if ( isset( $opts['title'] ) ) { |
445 | 445 | $titleText = $opts['title']; |
— | — | @@ -482,11 +482,10 @@ |
483 | 483 | if ( isset( $opts['ill'] ) ) { |
484 | 484 | $out = $this->tidy( implode( ' ', $output->getLanguageLinks() ) ); |
485 | 485 | } elseif ( isset( $opts['cat'] ) ) { |
486 | | - global $wgOut; |
| 486 | + $outputPage = $context->getOutput(); |
| 487 | + $outputPage->addCategoryLinks( $output->getCategories() ); |
| 488 | + $cats = $outputPage->getCategoryLinks(); |
487 | 489 | |
488 | | - $wgOut->addCategoryLinks( $output->getCategories() ); |
489 | | - $cats = $wgOut->getCategoryLinks(); |
490 | | - |
491 | 490 | if ( isset( $cats['normal'] ) ) { |
492 | 491 | $out = $this->tidy( implode( ' ', $cats['normal'] ) ); |
493 | 492 | } else { |
— | — | @@ -704,6 +703,8 @@ |
705 | 704 | $wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp'; |
706 | 705 | |
707 | 706 | MagicWord::clearCache(); |
| 707 | + |
| 708 | + return $context; |
708 | 709 | } |
709 | 710 | |
710 | 711 | /** |