r81639 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81638‎ | r81639 | r81640 >
Date:19:00, 7 February 2011
Author:tparscal
Status:deferred (Comments)
Tags:
Comment:
Really simple base for ResourceLoader tests.
Modified paths:
  • /trunk/extensions/ResourceLoaderTests (added) (history)
  • /trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.alias.php (added) (history)
  • /trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.i18n.php (added) (history)
  • /trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.page.php (added) (history)
  • /trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.php (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.a.css (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.a.js (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.b.css (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.b.js (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.c.css (added) (history)
  • /trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.c.js (added) (history)

Diff [purge]

Index: trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.alias.php
@@ -0,0 +1,15 @@
 2+<?php
 3+/**
 4+ * Aliases for special pages of ResourceLoaderTests extension.
 5+ *
 6+ * @file
 7+ */
 8+
 9+$specialPageAliases = array();
 10+
 11+/** English
 12+ * @author Nike
 13+ */
 14+$specialPageAliases['en'] = array(
 15+ 'ResourceLoaderTests' => array( 'ResourceLoaderTests' ),
 16+);
Index: trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.page.php
@@ -0,0 +1,18 @@
 2+<?php
 3+
 4+class SpecialResourceLoaderTests extends UnlistedSpecialPage {
 5+
 6+ public function __construct() {
 7+ parent::__construct( 'ResourceLoaderTests', 'resourceloadertests' );
 8+ }
 9+
 10+ public function execute( $par ) {
 11+ global $wgOut;
 12+
 13+ $wgOut->addModules( 'ext.resourceLoaderTests.a' );
 14+
 15+ $this->setHeaders();
 16+
 17+ $wgOut->addHtml( '<a id="resourceloadertests-load-b" href="#">Load B</a>' );
 18+ }
 19+}
Index: trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.i18n.php
@@ -0,0 +1,17 @@
 2+<?php
 3+/**
 4+ * Internationalisation for ResourceLoader Tests extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+/** English
 13+ * @author Trevor Parscal
 14+ */
 15+$messages['en'] = array(
 16+ 'resourceloadertests' => 'ResourceLoader Tests',
 17+ 'resourceloadertests-desc' => 'Tests functionaliy of ResrouceLoader.',
 18+);
Index: trunk/extensions/ResourceLoaderTests/ResourceLoaderTests.php
@@ -0,0 +1,49 @@
 2+<?php
 3+/**
 4+ * ResourceLoader Tests extension
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ *
 9+ * @author Trevor Parscal <trevor@wikimedia.org>
 10+ * @license GPL v2 or later
 11+ * @version 0.1.0
 12+ */
 13+
 14+/* Setup */
 15+
 16+$wgExtensionCredits['other'][] = array(
 17+ 'path' => __FILE__,
 18+ 'name' => 'ResourceLoaderTests',
 19+ 'author' => array( 'Trevor Parscal' ),
 20+ 'version' => '0.1.0',
 21+ 'url' => 'http://www.mediawiki.org/wiki/Extension:ResourceLoaderTests',
 22+ 'descriptionmsg' => 'resourceloadertests-desc',
 23+);
 24+
 25+$dir = dirname( __FILE__ ) . '/';
 26+$wgExtensionMessagesFiles['ResourceLoaderTests'] = $dir . 'ResourceLoaderTests.i18n.php';
 27+$wgExtensionAliasesFiles[ 'ResourceLoaderTests' ] = $dir . 'ResourceLoaderTests.alias.php';
 28+$wgAutoloadClasses[ 'SpecialResourceLoaderTests' ] = $dir . 'ResourceLoaderTests.page.php';
 29+$wgSpecialPages[ 'ResourceLoaderTests' ] = 'SpecialResourceLoaderTests';
 30+
 31+$rltResourceTemplate = array(
 32+ 'localBasePath' => dirname( __FILE__ ) . '/modules',
 33+ 'remoteExtPath' => 'ResourceLoaderTests/modules',
 34+ 'group' => 'ext.resourceLoaderTests',
 35+);
 36+$wgResourceModules += array(
 37+ 'ext.resourceLoaderTests.a' => $rltResourceTemplate + array(
 38+ 'scripts' => 'ext.resourceLoaderTests.a.js',
 39+ 'styles' => 'ext.resourceLoaderTests.a.css',
 40+ ),
 41+ 'ext.resourceLoaderTests.b' => $rltResourceTemplate + array(
 42+ 'scripts' => 'ext.resourceLoaderTests.b.js',
 43+ 'styles' => 'ext.resourceLoaderTests.b.css',
 44+ 'dependencies' => 'ext.resourceLoaderTests.c',
 45+ ),
 46+ 'ext.resourceLoaderTests.c' => $rltResourceTemplate + array(
 47+ 'scripts' => 'ext.resourceLoaderTests.c.js',
 48+ 'styles' => 'ext.resourceLoaderTests.c.css',
 49+ ),
 50+);
Index: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.a.css
Property changes on: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.a.css
___________________________________________________________________
Added: svn:mime-type
151 + text/plain
Index: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.b.css
Property changes on: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.b.css
___________________________________________________________________
Added: svn:mime-type
252 + text/plain
Index: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.c.css
Property changes on: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.c.css
___________________________________________________________________
Added: svn:mime-type
353 + text/plain
Index: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.a.js
@@ -0,0 +1,7 @@
 2+console.log( 'ext.resourceLoaderTests.a' );
 3+
 4+$( '#resourceloadertests-load-b' ).click( function() {
 5+ console.log( 'loading... ext.resourceLoaderTests.b' );
 6+ mw.loader.using( 'ext.resourceLoaderTests.b', function() { console.log( 'HELLO!' ); } );
 7+ return false;
 8+} );
Property changes on: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.a.js
___________________________________________________________________
Added: svn:mime-type
19 + text/plain
Index: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.b.js
@@ -0,0 +1 @@
 2+console.log( 'ext.resourceLoaderTests.b' );
\ No newline at end of file
Property changes on: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.b.js
___________________________________________________________________
Added: svn:mime-type
13 + text/plain
Index: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.c.js
@@ -0,0 +1 @@
 2+console.log( 'ext.resourceLoaderTests.c' );
\ No newline at end of file
Property changes on: trunk/extensions/ResourceLoaderTests/modules/ext.resourceLoaderTests.c.js
___________________________________________________________________
Added: svn:mime-type
13 + text/plain

Comments

#Comment by Reedy (talk | contribs)   19:09, 7 February 2011

Out of interest... Why are you doing this as an extension?

Also,

+ * @author Nike

I didn't know you were Niklas ;)

#Comment by Nikerabbit (talk | contribs)   19:29, 7 February 2011

Oops :)

#Comment by Trevor Parscal (WMF) (talk | contribs)   19:53, 7 February 2011

Short answer, integration testing.

Copy paste fail on the author of the i18n clearly. But generally this is just a way for me to setup some tests that we don't have a framework to cover fully. I'm not sure this extension will live very long, I may be able to figure out a way to push some or all of them into selenium or something.

Basically I am going to be exercising various scenarios with loading chains of modules after document ready in debug mode for instance.

Status & tagging log