From 2e44b49a2db3026050b136de9b00f749dd3ff939 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 25 Apr 2014 06:26:49 +0200 Subject: Update to MediaWiki 1.22.6 --- extensions/Gadgets/tests/GadgetTest.php | 81 --------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 extensions/Gadgets/tests/GadgetTest.php (limited to 'extensions/Gadgets/tests/GadgetTest.php') diff --git a/extensions/Gadgets/tests/GadgetTest.php b/extensions/Gadgets/tests/GadgetTest.php deleted file mode 100644 index c9332a6c..00000000 --- a/extensions/Gadgets/tests/GadgetTest.php +++ /dev/null @@ -1,81 +0,0 @@ -assertEquals( 'Gadget', get_class( $g ) ); - - return $g; - } - - function testInvalidLines() { - $this->assertFalse( Gadget::newFromDefinition( '' ) ); - $this->assertFalse( Gadget::newFromDefinition( '' ) ); - } - - function testSimpleCases() { - $g = $this->create( '* foo bar| foo.css|foo.js|foo.bar' ); - $this->assertEquals( 'foo_bar', $g->getName() ); - $this->assertEquals( 'ext.gadget.foo_bar', $g->getModuleName() ); - $this->assertEquals( array( 'Gadget-foo.js' ), $g->getScripts() ); - $this->assertEquals( array( 'Gadget-foo.css' ), $g->getStyles() ); - $this->assertEquals( array( 'Gadget-foo.js', 'Gadget-foo.css' ), - $g->getScriptsAndStyles() ); - $this->assertEquals( array( 'Gadget-foo.js' ), $g->getLegacyScripts() ); - $this->assertFalse( $g->supportsResourceLoader() ); - $this->assertTrue( $g->hasModule() ); - } - - function testRLtag() { - $g = $this->create( '*foo [ResourceLoader]|foo.js|foo.css' ); - $this->assertEquals( 'foo', $g->getName() ); - $this->assertTrue( $g->supportsResourceLoader() ); - $this->assertEquals( 0, count( $g->getLegacyScripts() ) ); - } - - function testDependencies() { - $g = $this->create( '* foo[ResourceLoader|dependencies=jquery.ui]|bar.js' ); - $this->assertEquals( array( 'Gadget-bar.js' ), $g->getScripts() ); - $this->assertTrue( $g->supportsResourceLoader() ); - $this->assertEquals( array( 'jquery.ui' ), $g->getDependencies() ); - } - - function testPreferences() { - global $wgUser, $wgOut, $wgTitle; - - // 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. - $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 -==keep-section1== -* bar| bar.js -==remove-section== -* baz [rights=embezzle] |baz.js -==keep-section2== -* quux [rights=read] | quux.js' ); - $this->assertTrue( GadgetHooks::getPreferences( $wgUser, $prefs ), 'GetPrefences hook should return true' ); - - $options = $prefs['gadgets']['options']; - $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; - } -} -- cgit v1.2.2