http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88512
Revision: 88512
Author: hashar
Date: 2011-05-21 11:23:06 +0000 (Sat, 21 May 2011)
Log Message:
-----------
Fix up test so they can run from trunk
Modified Paths:
--------------
trunk/extensions/Gadgets/Gadgets_tests.php
Modified: trunk/extensions/Gadgets/Gadgets_tests.php
===================================================================
--- trunk/extensions/Gadgets/Gadgets_tests.php 2011-05-21 11:06:52 UTC (rev
88511)
+++ trunk/extensions/Gadgets/Gadgets_tests.php 2011-05-21 11:23:06 UTC (rev
88512)
@@ -45,8 +45,20 @@
}
function testPreferences() {
- global $wgUser, $wgOut;
+ global $wgUser;
+
+ // This test makes call to the parser which requires valids
Outputpage
+ // and Title objects. Set them up there, they will be released
at the
+ // end of the test.
+ global $wgOut, $wgTitle;
+ $old_wgOut = $wgOut;
+ $old_wgTitle = $wgTitle;
+ $wgTitle = Title::newFromText( 'Parser test for Gadgets
extension' );
+
+ // Proceed with test setup:
$prefs = array();
+ $context = new RequestContext();
+ $wgOut = $context->getOutput();
$wgOut->setTitle( Title::newFromText( 'test' ) );
Gadget::loadStructuredList( '* foo | foo.js
@@ -62,5 +74,9 @@
$this->assertFalse( isset(
$options['<gadget-section-remove-section>'] ), 'Must not show empty
sections' );
$this->assertTrue( isset(
$options['<gadget-section-keep-section1>'] ) );
$this->assertTrue( isset(
$options['<gadget-section-keep-section2>'] ) );
+
+ // Restore globals
+ $wgOut = $old_wgOut;
+ $wgTitle = $old_wgTitle;
}
-}
\ No newline at end of file
+}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs