summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/MediaWiki/Hooks/ResourceLoaderTestModules.php
blob: 6fcc5acfb6f75b3240701fadb6245165349ce6cc (plain)
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
<?php

namespace SMW\MediaWiki\Hooks;

use ResourceLoader;

/**
 * Add new JavaScript/QUnit testing modules
 *
 * @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderTestModules
 *
 * @license GNU GPL v2+
 * @since 2.0
 *
 * @author mwjames
 */
class ResourceLoaderTestModules extends HookHandler {

	/**
	 * @var ResourceLoader
	 */
	private $resourceLoader;

	/**
	 * @var string
	 */
	private $path;

	/**
	 * @var string
	 */
	private $ip;

	/**
	 * @since 2.0
	 *
	 * @param ResourceLoader $resourceLoader object
	 * @param string $path
	 * @param string $ip
	 */
	public function __construct( ResourceLoader &$resourceLoader, $path = '', $ip = '' ) {
		$this->resourceLoader = $resourceLoader;
		$this->path = $path;
		$this->ip = $ip;
	}

	/**
	 * @since 1.9
	 *
	 * @param array &$testModules
	 *
	 * @return boolean
	 */
	public function process(  array &$testModules ) {

		$testModules['qunit']['ext.smw.tests'] = [
			'scripts' => [
				'tests/qunit/smw/ext.smw.test.js',
				'tests/qunit/smw/util/ext.smw.util.tooltip.test.js',

				// dataItem tests
				'tests/qunit/smw/data/ext.smw.dataItem.wikiPage.test.js',
				'tests/qunit/smw/data/ext.smw.dataItem.uri.test.js',
				'tests/qunit/smw/data/ext.smw.dataItem.time.test.js',
				'tests/qunit/smw/data/ext.smw.dataItem.property.test.js',
				'tests/qunit/smw/data/ext.smw.dataItem.unknown.test.js',
				'tests/qunit/smw/data/ext.smw.dataItem.number.test.js',
				'tests/qunit/smw/data/ext.smw.dataItem.text.test.js',

				// dataValues
				'tests/qunit/smw/data/ext.smw.dataValue.quantity.test.js',

				// Api / Query
				'tests/qunit/smw/data/ext.smw.data.test.js',
				'tests/qunit/smw/api/ext.smw.api.test.js',
				'tests/qunit/smw/query/ext.smw.query.test.js',
			],
			'dependencies' => [
				'ext.smw',
				'ext.smw.tooltip',
				'ext.smw.query',
				'ext.smw.data',
				'ext.smw.api'
			],
			'position' => 'top',
			'localBasePath' => $this->path,
			'remoteExtPath' => 'SemanticMediaWiki',
		];

		return true;
	}

}