|
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
|
|
|
|