Index: trunk/extensions/Gadgets/Gadgets_tests.php |
— | — | @@ -45,8 +45,20 @@ |
46 | 46 | } |
47 | 47 | |
48 | 48 | 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: |
50 | 60 | $prefs = array(); |
| 61 | + $context = new RequestContext(); |
| 62 | + $wgOut = $context->getOutput(); |
51 | 63 | $wgOut->setTitle( Title::newFromText( 'test' ) ); |
52 | 64 | |
53 | 65 | Gadget::loadStructuredList( '* foo | foo.js |
— | — | @@ -62,5 +74,9 @@ |
63 | 75 | $this->assertFalse( isset( $options['<gadget-section-remove-section>'] ), 'Must not show empty sections' ); |
64 | 76 | $this->assertTrue( isset( $options['<gadget-section-keep-section1>'] ) ); |
65 | 77 | $this->assertTrue( isset( $options['<gadget-section-keep-section2>'] ) ); |
| 78 | + |
| 79 | + // Restore globals |
| 80 | + $wgOut = $old_wgOut; |
| 81 | + $wgTitle = $old_wgTitle; |
66 | 82 | } |
67 | | -} |
\ No newline at end of file |
| 83 | +} |