blob: 63e740fcc5e00aa8ece2a2fb604408fa3bddc6c1 (
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
|
<?php
namespace SRF\Tests\Integration\JSONScript;
use SMW\Tests\Integration\JSONScript\JsonTestCaseScriptRunnerTest as SMWJsonTestCaseScriptRunnerTest;
/**
* @see https://github.com/SemanticMediaWiki/SemanticMediaWiki/tree/master/tests#write-integration-tests-using-json-script
*
* `JsonTestCaseScriptRunner` provisioned by SMW is a base class allowing to use a JSON
* format to create test definitions with the objective to compose "real" content
* and test integration with MediaWiki, Semantic MediaWiki, and Scribunto.
*
* @group SRF
* @group SMWExtension
*
* @license GNU GPL v2+
* @since 2.5
*
* @author Stephan Gambke
*/
class JsonTestCaseScriptRunnerTest extends SMWJsonTestCaseScriptRunnerTest {
/**
* @see \SMW\Tests\JsonTestCaseScriptRunner::getTestCaseLocation
* @return string
*/
protected function getTestCaseLocation() {
return __DIR__ . '/TestCases';
}
/**
* @return string[]
* @since 3.0
*/
protected function getPermittedSettings() {
$settings = parent::getPermittedSettings();
$settings[] = 'srfgMapProvider';
return $settings;
}
/**
* @see JsonTestCaseScriptRunner::getDependencyDefinitions
*/
protected function getDependencyDefinitions() {
return [
'Mermaid' => [ $this, 'checkMermaidDependency' ]
];
}
public function checkMermaidDependency( $val, &$reason ) {
if ( !defined( 'MERMAID_VERSION' ) ) {
$reason = "Dependency: Mermaid as requirement is not available!";
return false;
}
list( $compare, $requiredVersion ) = explode( ' ', $val );
$version = MERMAID_VERSION;
if ( !version_compare( $version, $requiredVersion, $compare ) ) {
$reason = "Dependency: Required version of Mermaid($requiredVersion $compare $version) is not available!";
return false;
}
return true;
}
}
|