Skip to content

Commit

Permalink
Use LightweightJsonTestCaseScriptRunner (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwjames authored Aug 4, 2019
1 parent e6a6bfd commit 25902b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
6 changes: 3 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
date_default_timezone_set( 'UTC' );
ini_set( 'display_errors', 1 );

if ( !is_readable( __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php' ) ) {
die( 'The Semantic MediaWiki test autoloader is required to run the tests.' );
if ( !defined( 'SMW_PHPUNIT_AUTOLOADER_FILE' ) || !is_readable( SMW_PHPUNIT_AUTOLOADER_FILE ) ) {
die( "\nThe Semantic MediaWiki test autoloader is not available" );
}

if ( !class_exists( 'SemanticCite' ) || ( $version = SemanticCite::getVersion() ) === null ) {
Expand All @@ -26,7 +26,7 @@

print sprintf( "\n%-20s%s\n", "Semantic Cite:", SCI_VERSION );

$autoloader = require __DIR__ . '/../../SemanticMediaWiki/tests/autoloader.php';
$autoloader = require SMW_PHPUNIT_AUTOLOADER_FILE;
$autoloader->addPsr4( 'SCI\\Tests\\', __DIR__ . '/phpunit/Unit' );
$autoloader->addPsr4( 'SCI\\Tests\\Integration\\', __DIR__ . '/phpunit/Integration' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use SCI\HookRegistry;
use SCI\Options;
use Onoi\Cache\CacheFactory;
use SMW\Tests\JsonTestCaseScriptRunner;
use SMW\Tests\LightweightJsonTestCaseScriptRunner;
use SMW\Tests\JsonTestCaseFileHandler;
use SMW\Tests\Utils\UtilityFactory;
use SMW\DIWikiPage;
Expand All @@ -20,7 +20,7 @@
*
* @author mwjames
*/
class SemanticCiteJsonTestCaseScriptRunnerTest extends JsonTestCaseScriptRunner {
class SemanticCiteJsonTestCaseScriptRunnerTest extends LightweightJsonTestCaseScriptRunner {

private $semanticDataValidator;
private $stringValidator;
Expand Down Expand Up @@ -81,13 +81,6 @@ protected function getRequiredJsonTestCaseMinVersion() {
return '0.1';
}

/**
* @see JsonTestCaseScriptRunner::getAllowedTestCaseFiles
*/
protected function getAllowedTestCaseFiles() {
return [];
}

/**
* @see JsonTestCaseScriptRunner::getTestCaseLocation
*/
Expand Down Expand Up @@ -118,15 +111,7 @@ protected function getPermittedSettings() {
* @param JsonTestCaseFileHandler $jsonTestCaseFileHandler
*/
protected function runTestCaseFile( JsonTestCaseFileHandler $jsonTestCaseFileHandler ) {

$this->checkEnvironmentToSkipCurrentTest( $jsonTestCaseFileHandler );

foreach ( $this->getPermittedSettings() as $key ) {
$this->changeGlobalSettingTo(
$key,
$jsonTestCaseFileHandler->getSettingsFor( $key, $this->getConfigValueCallback( $key ) )
);
}
parent::runTestCaseFile( $jsonTestCaseFileHandler );

// On SQLite we don't want DB dead locks due to parallel write access
$this->changeGlobalSettingTo(
Expand Down

0 comments on commit 25902b7

Please sign in to comment.