r106525 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106524‎ | r106525 | r106526 >
Date:20:03, 17 December 2011
Author:catrope
Status:ok
Tags:
Comment:
[RL2] Followup r106524: move testPreferences back to GadgetsTest.php , it doesn't belong in GadgetPrefsTest.php although its name suggests otherwise
Modified paths:
  • /branches/RL2/extensions/Gadgets/tests/GadgetPrefsTest.php (modified) (history)
  • /branches/RL2/extensions/Gadgets/tests/GadgetsTest.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/tests/GadgetPrefsTest.php
@@ -3,46 +3,6 @@
44 * @group Gadgets
55 */
66 class GadgetPrefsTest extends PHPUnit_Framework_TestCase {
7 - function testPreferences() {
8 - // FIXME this test is broken
9 - $this->markTestIncomplete( 'Broken for now' );
10 - return;
11 -
12 - global $wgUser;
13 -
14 - // This test makes call to the parser which requires valids Outputpage
15 - // and Title objects. Set them up there, they will be released at the
16 - // end of the test.
17 - global $wgOut, $wgTitle;
18 - $old_wgOut = $wgOut;
19 - $old_wgTitle = $wgTitle;
20 - $wgTitle = Title::newFromText( 'Parser test for Gadgets extension' );
21 -
22 - // Proceed with test setup:
23 - $prefs = array();
24 - $context = new RequestContext();
25 - $wgOut = $context->getOutput();
26 - $wgOut->setTitle( Title::newFromText( 'test' ) );
27 -
28 - Gadget::loadStructuredList( '* foo | foo.js
29 -==keep-section1==
30 -* bar| bar.js
31 -==remove-section==
32 -* baz [rights=embezzle] |baz.js
33 -==keep-section2==
34 -* quux [rights=read] | quux.js' );
35 - $this->assertTrue( GadgetsHooks::getPreferences( $wgUser, $prefs ), 'GetPrefences hook should return true' );
36 -
37 - $options = $prefs['gadgets']['options'];
38 - $this->assertFalse( isset( $options['<gadget-section-remove-section>'] ), 'Must not show empty sections' );
39 - $this->assertTrue( isset( $options['<gadget-section-keep-section1>'] ) );
40 - $this->assertTrue( isset( $options['<gadget-section-keep-section2>'] ) );
41 -
42 - // Restore globals
43 - $wgOut = $old_wgOut;
44 - $wgTitle = $old_wgTitle;
45 - }
46 -
477 //Test preferences descriptions validator (generic)
488 function testPrefsDescriptions() {
499 $this->assertFalse( GadgetPrefs::isPrefsDescriptionValid( null ) );
Index: branches/RL2/extensions/Gadgets/tests/GadgetsTest.php
@@ -44,4 +44,44 @@
4545 $this->assertTrue( $g->supportsResourceLoader() );
4646 $this->assertEquals( array( 'jquery.ui' ), $g->getDependencies() );
4747 }
 48+
 49+ function testPreferences() {
 50+ // FIXME this test is broken
 51+ $this->markTestIncomplete( 'Broken for now' );
 52+ return;
 53+
 54+ global $wgUser;
 55+
 56+ // This test makes call to the parser which requires valid OutputPage
 57+ // and Title objects. Set them up here, they will be released at the
 58+ // end of the test.
 59+ global $wgOut, $wgTitle;
 60+ $old_wgOut = $wgOut;
 61+ $old_wgTitle = $wgTitle;
 62+ $wgTitle = Title::newFromText( 'Parser test for Gadgets extension' );
 63+
 64+ // Proceed with test setup:
 65+ $prefs = array();
 66+ $context = new RequestContext();
 67+ $wgOut = $context->getOutput();
 68+ $wgOut->setTitle( Title::newFromText( 'test' ) );
 69+
 70+ Gadget::loadStructuredList( '* foo | foo.js
 71+==keep-section1==
 72+* bar| bar.js
 73+==remove-section==
 74+* baz [rights=embezzle] |baz.js
 75+==keep-section2==
 76+* quux [rights=read] | quux.js' );
 77+ $this->assertTrue( GadgetsHooks::getPreferences( $wgUser, $prefs ), 'GetPrefences hook should return true' );
 78+
 79+ $options = $prefs['gadgets']['options'];
 80+ $this->assertFalse( isset( $options['<gadget-section-remove-section>'] ), 'Must not show empty sections' );
 81+ $this->assertTrue( isset( $options['<gadget-section-keep-section1>'] ) );
 82+ $this->assertTrue( isset( $options['<gadget-section-keep-section2>'] ) );
 83+
 84+ // Restore globals
 85+ $wgOut = $old_wgOut;
 86+ $wgTitle = $old_wgTitle;
 87+ }
4888 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106524[RL2] Move GadgetPrefs-related tests from GadgetsTest.php to GadgetPrefsTest.php...catrope20:00, 17 December 2011

Status & tagging log