Skip to content

Commit

Permalink
Restructured files and directories
Browse files Browse the repository at this point in the history
  • Loading branch information
snaterlicious committed Jan 20, 2014
1 parent c2652cc commit 9c11161
Show file tree
Hide file tree
Showing 96 changed files with 376 additions and 387 deletions.
95 changes: 0 additions & 95 deletions DataValues.resources.mw.php

This file was deleted.

103 changes: 0 additions & 103 deletions DataValues.tests.qunit.php

This file was deleted.

135 changes: 13 additions & 122 deletions DataValuesJavascript.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

// @codeCoverageIgnoreStart

if ( defined( 'DATA_VALUES_JAVASCRIPT_VERSION' ) ) {
// Do not initialize more than once.
return 1;
Expand All @@ -26,9 +28,10 @@
// Resource Loader module registration
$GLOBALS['wgResourceModules'] = array_merge(
$GLOBALS['wgResourceModules'],
include( __DIR__ . '/DataValues.resources.mw.php' ),
include( __DIR__ . '/js/ValueParsers.resources.mw.php' ),
include( __DIR__ . '/js/ValueFormatters.resources.mw.php' )
include( __DIR__ . '/lib/resources.php' ),
include( __DIR__ . '/src/resources.mw.php' ),
include( __DIR__ . '/src/valueParsers/resources.mw.php' ),
include( __DIR__ . '/src/valueFormatters/resources.mw.php' )
);

// API module registration
Expand All @@ -48,129 +51,17 @@
* @param \ResourceLoader &$resourceLoader
* @return boolean
*/
$GLOBALS['wgHooks']['ResourceLoaderTestModules'][] = function ( array &$testModules, \ResourceLoader &$resourceLoader ) {
// Register DataValue QUnit tests. Take the predefined test definitions and make them
// suitable for registration with MediaWiki's resource loader.
$ownModules = include( __DIR__ . '/DataValues.tests.qunit.php' );
$ownModulesTemplate = array(
'localBasePath' => __DIR__,
'remoteExtPath' => '..' . substr( __DIR__, strlen( $GLOBALS['IP'] ) ),
);
foreach( $ownModules as $ownModuleName => $ownModule ) {
$testModules['qunit'][ $ownModuleName ] = $ownModule + $ownModulesTemplate;
}
return true;
};

/**
* Hook to add QUnit test cases.
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
* @since 0.1
*
* @param array &$testModules
* @param \ResourceLoader &$resourceLoader
* @return boolean
*/
$GLOBALS['wgHooks']['ResourceLoaderTestModules'][] = function ( array &$testModules, \ResourceLoader &$resourceLoader ) {
// @codeCoverageIgnoreStart
$moduleTemplate = array(
'localBasePath' => __DIR__ . '/js/tests/ValueParsers',
'remoteExtPath' => '..' . substr( __DIR__, strlen( $GLOBALS['IP'] ) ) . '/js/tests/ValueParsers',
);

$testModules['qunit']['ext.valueParsers.tests'] = $moduleTemplate + array(
'scripts' => array(
'ValueParser.tests.js',
),
'dependencies' => array(
'valueParsers.parsers',
),
);

$testModules['qunit']['ext.valueParsers.factory'] = $moduleTemplate + array(
'scripts' => array(
'ValueParserFactory.tests.js',
),
'dependencies' => array(
'qunit.parameterize',
'valueParsers.factory',
'valueParsers.parsers',
),
);

$testModules['qunit']['ext.valueParsers.parsers'] = $moduleTemplate + array(
'scripts' => array(
'parsers/BoolParser.tests.js',
'parsers/GlobeCoordinateParser.tests.js',
'parsers/FloatParser.tests.js',
'parsers/IntParser.tests.js',
'parsers/StringParser.tests.js',
'parsers/TimeParser.tests.js',
'parsers/QuantityParser.tests.js',
'parsers/NullParser.tests.js',
),
'dependencies' => array(
'ext.valueParsers.tests',
'util.inherit',
),
);

return true;
// @codeCoverageIgnoreEnd
};

/**
* Adding valueFormatters QUnit tests.
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
* @since 0.1
*
* @param array &$testModules
* @param \ResourceLoader &$resourceLoader
* @return boolean
*/
$GLOBALS['wgHooks']['ResourceLoaderTestModules'][] = function(
array &$testModules,
\ResourceLoader &$resourceLoader
) {
// @codeCoverageIgnoreStart
$moduleTemplate = array(
'localBasePath' => __DIR__ . '/js/tests/ValueFormatters',
'remoteExtPath' => '..' . substr( __DIR__, strlen( $GLOBALS['IP'] ) ) . '/js/tests/ValueFormatters',
$testModules['qunit'] = array_merge(
$testModules['qunit'],
include( __DIR__ . '/tests/lib/resources.php' ),
include( __DIR__ . '/tests/src/resources.php' ),
include( __DIR__ . '/tests/src/valueFormatters/resources.php' ),
include( __DIR__ . '/tests/src/valueParsers/resources.php' )
);

$testModules['qunit']['ext.valueFormatters.tests'] = $moduleTemplate + array(
'scripts' => array(
'ValueFormatter.tests.js',
),
'dependencies' => array(
'valueFormatters',
'valueFormatters.ValueFormatter',
),
);

$testModules['qunit']['ext.valueFormatters.factory'] = $moduleTemplate + array(
'scripts' => array(
'ValueFormatterFactory.tests.js',
),
'dependencies' => array(
'qunit.parameterize',
'valueFormatters.factory',
'valueFormatters.formatters',
),
);

$testModules['qunit']['ext.valueFormatters.formatters'] = $moduleTemplate + array(
'scripts' => array(
'formatters/NullFormatter.tests.js',
'formatters/StringFormatter.tests.js',
),
'dependencies' => array(
'ext.valueFormatters.tests',
'util.inherit',
'valueFormatters.formatters',
),
);

return true;
// @codeCoverageIgnoreEnd
};
};
2 changes: 1 addition & 1 deletion COPYING → LICENCE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The license text below "----" applies to all files within this distribution, other
than those that are in a directory which contains files named "LICENSE" or
than those that are in a directory which contains files named "LICENCE", "LICENSE" or
"COPYING", or a subdirectory thereof. For those files, the license text contained in
said file overrides any license information contained in directories of smaller depth.
Alternative licenses are typically used for software that is provided by external
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 9c11161

Please sign in to comment.