SemanticScribuntoJsonTestCaseScriptRunnerTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 49
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A getRequiredJsonTestCaseMinVersion() 0 3 1
A getTestCaseLocation() 0 3 1
A getPermittedSettings() 0 12 1
1
<?php
2
3
namespace SMW\Scribunto\Integration\JSONScript;
4
5
use SMW\DIWikiPage;
6
use SMW\Scribunto\HookRegistry;
7
use SMW\Tests\JsonTestCaseFileHandler;
8
use SMW\Tests\JsonTestCaseScriptRunner;
9
use SMW\Tests\LightweightJsonTestCaseScriptRunner;
10
11
/**
12
 * @see https://github.com/SemanticMediaWiki/SemanticMediaWiki/tree/master/tests#write-integration-tests-using-json-script
13
 *
14
 * `JsonTestCaseScriptRunner` provisioned by SMW is a base class allowing to use a JSON
15
 * format to create test definitions with the objective to compose "real" content
16
 * and test integration with MediaWiki, Semantic MediaWiki, and Scribunto.
17
 *
18
 * The focus is on describing test definitions with its content and specify assertions
19
 * to control the expected base line.
20
 *
21
 * `JsonTestCaseScriptRunner` will handle the tearDown process and ensures that no test
22
 * data are leaked into a production system but requires an active DB connection.
23
 *
24
 * @group semantic-scribunto
25
 * @group medium
26
 *
27
 * @license GNU GPL v2+
28
 * @since 1.0
29
 *
30
 * @author mwjames
31
 */
32
class SemanticScribuntoJsonTestCaseScriptRunnerTest extends LightweightJsonTestCaseScriptRunner {
33
34
	/**
35
	 * @var HookRegistry
36
	 */
37
	private $hookRegistry;
38
39
	protected function setUp() {
40
		parent::setUp();
41
42
		$this->hookRegistry = new HookRegistry();
43
44
		$this->hookRegistry->clear();
45
		$this->hookRegistry->register();
46
	}
47
48
	/**
49
	 * @see JsonTestCaseScriptRunner::getRequiredJsonTestCaseMinVersion
50
	 * @return string
51
	 */
52
	protected function getRequiredJsonTestCaseMinVersion() {
53
		return '1';
54
	}
55
56
	/**
57
	 * @see JsonTestCaseScriptRunner::getTestCaseLocation
58
	 * @return string
59
	 */
60
	protected function getTestCaseLocation() {
61
		return __DIR__ . '/TestCases';
62
	}
63
64
	/**
65
	 * @see JsonTestCaseScriptRunner::getPermittedSettings
66
	 */
67
	protected function getPermittedSettings() {
68
		parent::getPermittedSettings();
69
70
		return [
71
			'smwgNamespacesWithSemanticLinks',
72
			'smwgPageSpecialProperties',
73
			'smwgMaxNonExpNumber',
74
			'wgLanguageCode',
75
			'wgContLang',
76
			'wgLang'
77
		];
78
	}
79
80
}
81