Skip to content

Commit

Permalink
Merge pull request #550 from JeroenDeDauw/smwtests
Browse files Browse the repository at this point in the history
Run SMW tests on TravisCI
  • Loading branch information
JeroenDeDauw committed Jul 13, 2019
2 parents 3b60045 + 0d03d89 commit 3aa8347
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
30 changes: 25 additions & 5 deletions .travis.install.sh
Expand Up @@ -24,19 +24,39 @@ else
fi

cd extensions

cp -r $originalDirectory Maps

cd Maps
composer install --prefer-source
cd ..
cd ..

[[ ! -z $SMW ]] && composer require "mediawiki/semantic-media-wiki=$SMW" --prefer-source
if [ ! -z $SMW ]
then
composer require "mediawiki/semantic-media-wiki=$SMW" --prefer-source
fi

cd ../..
cat <<EOT >> composer.local.json
{
"extra": {
"merge-plugin": {
"merge-dev": true,
"include": [
"extensions/*/composer.json"
]
}
}
}
EOT

composer install --prefer-source

echo 'include_once( __DIR__ . "/extensions/Maps/vendor/autoload.php" );' >> LocalSettings.php
echo 'wfLoadExtension( "Maps" );' >> LocalSettings.php

if [ ! -z $SMW ]
then
echo 'wfLoadExtension( "SemanticMediaWiki" );' >> LocalSettings.php
fi

echo 'error_reporting(E_ALL| E_STRICT);' >> LocalSettings.php
echo 'ini_set("display_errors", 1);' >> LocalSettings.php
echo '$wgShowExceptionDetails = true;' >> LocalSettings.php
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -7,7 +7,7 @@ matrix:
include:
- env: DBTYPE=mysql; MW=1.31.3
php: 7.1
- env: DBTYPE=mysql; MW=master; SMW=master
- env: DBTYPE=mysql; MW=master; SMW=dev-master
php: 7.3
- env: DBTYPE=sqlite; MW=1.31.3; SMW=3.0.0
php: 7.1
Expand Down
17 changes: 16 additions & 1 deletion src/SemanticMW/ResultPrinters/MapPrinter.php
Expand Up @@ -84,6 +84,21 @@ public static function registerDefaultService( $serviceName ) {
self::$services['map'] = self::$services[$serviceName];
}

private function getParser(): Parser {
$parser = $GLOBALS['wgParser'];

if ( $parser instanceof \StubObject ) {
return $parser->_newObject();
}

return $parser;
}

private function getParserClone(): Parser {
$parser = $this->getParser();
return clone $parser;
}

/**
* Builds up and returns the HTML for the map, with the queried coordinate data on it.
*
Expand All @@ -101,7 +116,7 @@ public final function getResultText( SMWQueryResult $res, $outputMode ) {
$this->locationParser = $factory->newLocationParser();
$this->fileUrlFinder = $factory->getFileUrlFinder();

$this->wikitextParser = new WikitextParser( clone $GLOBALS['wgParser'] );
$this->wikitextParser = new WikitextParser( $this->getParserClone() );
$this->elementSerializer = new ElementJsonSerializer( $this->wikitextParser );

$this->addTrackingCategoryIfNeeded();
Expand Down

0 comments on commit 3aa8347

Please sign in to comment.