r106646 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106645‎ | r106646 | r106647 >
Date:13:26, 19 December 2011
Author:catrope
Status:ok
Tags:
Comment:
[RL2] Fix Gadget object creation in GadgetPrefsTest.php . Tests are still broken, though, because Gadget::setPrefs() hasn't been integrated from Salvatore's branch yet
Modified paths:
  • /branches/RL2/extensions/Gadgets/tests/GadgetPrefsTest.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/tests/GadgetPrefsTest.php
@@ -2,7 +2,7 @@
33 /**
44 * @group Gadgets
55 */
6 -class GadgetPrefsTest extends PHPUnit_Framework_TestCase {
 6+class GadgetPrefsTest extends MediaWikiTestCase {
77 //Test preferences descriptions validator (generic)
88 function testPrefsDescriptions() {
99 $this->assertFalse( GadgetPrefs::isPrefsDescriptionValid( null ) );
@@ -825,6 +825,13 @@
826826 'testSelect2' => 3
827827 ) );
828828 }
 829+
 830+ private static function createGadgetObject() {
 831+ $gSettings = Gadget::getPropertiesBase();
 832+ $gSettings['module']['styles'] = array( 'foo.css' );
 833+ $gSettings['module']['scripts'] = array( 'foo.js' );
 834+ return new Gadget( 'GadgetsTest', LocalGadgetRepo::singleton(), $gSettings, wfTimestampNow() );
 835+ }
829836
830837 /**
831838 * Tests Gadget::setPrefsDescription, GadgetPrefs::checkPrefsAgainstDescription,
@@ -834,9 +841,9 @@
835842 */
836843 function testSetPrefs( $prefsDescription ) {
837844 // FIXME this test is broken
838 - $this->markTestIncomplete( 'Broken for now' );
 845+ $this->markTestIncomplete( 'Gadget::setPrefs not yet implemented' );
839846 return;
840 -
 847+
841848 $this->assertTrue( GadgetPrefs::isPrefsDescriptionValid( $prefsDescription ) );
842849
843850 $prefs = array(
@@ -865,7 +872,7 @@
866873 $this->assertEquals( $prefs2['testNumber2'], $defaults['testNumber2'] );
867874 $this->assertEquals( $prefs2['testSelect2'], $defaults['testSelect2'] );
868875
869 - $g = $this->create( '*foo[ResourceLoader]| foo.css|foo.js|foo.bar' ); //FIXME
 876+ $g = self::createGadgetObject();
870877 $g->setPrefsDescription( $prefsDescription );
871878 $this->assertTrue( $g->getPrefsDescription() !== null );
872879
@@ -885,10 +892,10 @@
886893 */
887894 function testSetPrefsWithWrongParam() {
888895 // FIXME this test is broken
889 - $this->markTestIncomplete( 'Broken for now' );
 896+ $this->markTestIncomplete( 'Gadget::setPrefs not yet implemented' );
890897 return;
891898
892 - $g = $this->create( '*foo[ResourceLoader]| foo.css|foo.js|foo.bar' ); //FIXME
 899+ $g = self::createGadgetObject();
893900 $g->setPrefsDescription( array(
894901 'fields' => array(
895902 'testBoolean' => array(

Status & tagging log