r88512 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88511‎ | r88512 | r88513 >
Date:11:23, 21 May 2011
Author:hashar
Status:ok
Tags:
Comment:
Fix up test so they can run from trunk
Modified paths:
  • /trunk/extensions/Gadgets/Gadgets_tests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Gadgets/Gadgets_tests.php
@@ -45,8 +45,20 @@
4646 }
4747
4848 function testPreferences() {
49 - global $wgUser, $wgOut;
 49+ global $wgUser;
 50+
 51+ // This test makes call to the parser which requires valids Outputpage
 52+ // and Title objects. Set them up there, they will be released at the
 53+ // end of the test.
 54+ global $wgOut, $wgTitle;
 55+ $old_wgOut = $wgOut;
 56+ $old_wgTitle = $wgTitle;
 57+ $wgTitle = Title::newFromText( 'Parser test for Gadgets extension' );
 58+
 59+ // Proceed with test setup:
5060 $prefs = array();
 61+ $context = new RequestContext();
 62+ $wgOut = $context->getOutput();
5163 $wgOut->setTitle( Title::newFromText( 'test' ) );
5264
5365 Gadget::loadStructuredList( '* foo | foo.js
@@ -62,5 +74,9 @@
6375 $this->assertFalse( isset( $options['<gadget-section-remove-section>'] ), 'Must not show empty sections' );
6476 $this->assertTrue( isset( $options['<gadget-section-keep-section1>'] ) );
6577 $this->assertTrue( isset( $options['<gadget-section-keep-section2>'] ) );
 78+
 79+ // Restore globals
 80+ $wgOut = $old_wgOut;
 81+ $wgTitle = $old_wgTitle;
6682 }
67 -}
\ No newline at end of file
 83+}

Status & tagging log