-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDataValuesJavascript.php
94 lines (80 loc) · 2.49 KB
/
DataValuesJavascript.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
// @codeCoverageIgnoreStart
if ( defined( 'DATA_VALUES_JAVASCRIPT_VERSION' ) ) {
// Do not initialize more than once.
return 1;
}
define( 'DATA_VALUES_JAVASCRIPT_VERSION', '0.6.1' );
// Include the composer autoloader if it is present.
if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
include_once( __DIR__ . '/vendor/autoload.php' );
}
$GLOBALS['wgExtensionCredits']['datavalues'][] = array(
'path' => __DIR__,
'name' => 'DataValues Javascript',
'version' => DATA_VALUES_JAVASCRIPT_VERSION,
'author' => array(
'[https://www.mediawiki.org/wiki/User:Danwe Daniel Werner]',
'[http://www.snater.com H. Snater]',
'[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]',
),
'url' => 'https://github.com/wmde/DataValuesJavascript',
'description' => 'JavaScript related to the DataValues library',
'license-name' => 'GPL-2.0+'
);
// Resource Loader module registration
$GLOBALS['wgResourceModules'] = array_merge(
isset( $GLOBALS['wgResourceModules'] ) ? $GLOBALS['wgResourceModules'] : array(),
include( __DIR__ . '/lib/resources.php' ),
include( __DIR__ . '/src/resources.php' )
);
/**
* Register QUnit test base classes used by test modules in dependent components.
* @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
) {
preg_match(
'+^.*?' . preg_quote( DIRECTORY_SEPARATOR, '+' ) . '((?:vendor|extensions)' .
preg_quote( DIRECTORY_SEPARATOR, '+' ) . '.*)$+',
__DIR__,
$remoteExtPathParts
);
$moduleTemplate = array(
'localBasePath' => __DIR__ . '/tests',
'remoteExtPath' => '..' . DIRECTORY_SEPARATOR . $remoteExtPathParts[1] . DIRECTORY_SEPARATOR . 'tests',
);
$testModuleTemplates = array(
'valueFormatters.tests' => $moduleTemplate + array(
'scripts' => array(
'src/valueFormatters/valueFormatters.tests.js',
),
'dependencies' => array(
'dataValues.DataValue',
'jquery.qunit',
'util.inherit',
'valueFormatters',
),
),
'valueParsers.tests' => $moduleTemplate + array(
'scripts' => array(
'src/valueParsers/valueParsers.tests.js',
),
'dependencies' => array(
'dataValues.DataValue',
'jquery.qunit',
'util.inherit',
'valueParsers',
),
),
);
$testModules['qunit'] = array_merge( $testModules['qunit'], $testModuleTemplates );
return true;
};