Skip to content

Commit

Permalink
Install SMW for some of the builds on TravisCI
Browse files Browse the repository at this point in the history
This to run the SemanticMaps tests
  • Loading branch information
JeroenDeDauw committed Sep 21, 2016
1 parent 29b3816 commit 99c6664
Show file tree
Hide file tree
Showing 36 changed files with 90 additions and 183 deletions.
3 changes: 2 additions & 1 deletion build/travis/before_script.sh → .travis.install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ cp -r $originalDirectory Maps

cd Maps
composer install --prefer-source
composer require 'phpunit/phpunit=3.7.*' --prefer-source

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

cd ../..

Expand Down
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@ matrix:
include:
- env: DBTYPE=mysql; MW=1.27.1
php: 7
- env: DBTYPE=mysql; MW=master
- env: DBTYPE=mysql; MW=master; SMW=2.4.1
php: 7
- env: DBTYPE=sqlite; MW=1.23.0
- env: DBTYPE=sqlite; MW=1.23.0; SMW=2.4.1
php: 5.5
- env: DBTYPE=mysql; MW=1.24.0
php: 5.5
- env: DBTYPE=sqlite; MW=master; TYPE=coverage
php: 5.6

install: travis_retry composer self-update
install:
- travis_retry composer self-update
- bash .travis.install.sh

before_script: bash ./build/travis/before_script.sh
script: ../phase3/tests/phpunit/phpunit.php -c ../phase3/extensions/Maps/phpunit.xml.dist

script: bash ./build/travis/script.sh

after_success: bash ./build/travis/after_success.sh
after_success:
- if [[ "$TYPE" != "coverage" ]]; then exit 0; fi
- ../phase3/tests/phpunit/phpunit.php -c ../phase3/extensions/Maps/phpunit.xml.dist --coverage-clover coverage.clover
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ On [Packagist](https://packagist.org/packages/mediawiki/maps):
Feel free to fork the [code on GitHub](https://github.com/JeroenDeDauw/Maps) and to submit pull
requests. We have a list of [enhancements that newcommers can work on](https://github.com/JeroenDeDauw/Maps/issues?q=is%3Aissue+is%3Aopen+label%3Anewcomer) easily.

You can run the PHPUnit tests by changing into the `tests/phpunit` directory of your MediaWiki
install and running
To run the tests, execute this in the root directory of maps:

php phpunit.php -c ../../extensions/Maps/
composer ci

You can run the MediaWiki independent tests by running `composer unit` in the root directory of Maps.
All tests in `tests/phpunit` are MediaWiki independent, with those depending on MediaWiki residing in
To run only the MediaWiki independent tests, execute this in the root directory of maps:

phpunit

All tests in `tests/Unit` are MediaWiki independent, with those depending on MediaWiki reside in
`tests/Integration`.

## Credits to other projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@
/**
* @covers SMGeoCoordsValue
*
* @group SemanticMaps
* @group SMWExtension
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
class SMGeoCoordsValueTest extends \PHPUnit_Framework_TestCase {

public function setUp() {
if ( !defined( 'SMW_VERSION' ) ) {
$this->markTestSkipped( 'SMW is not available' );
}
}

public function testConstruct() {
$geoDI = new SMWDIGeoCoord( 23, 42 );

Expand Down
37 changes: 0 additions & 37 deletions SemanticMaps/tests/phpunit/printers/KMLPrinterTest.php

This file was deleted.

37 changes: 0 additions & 37 deletions SemanticMaps/tests/phpunit/printers/MapPrinterTest.php

This file was deleted.

14 changes: 0 additions & 14 deletions build/travis/after_success.sh

This file was deleted.

14 changes: 0 additions & 14 deletions build/travis/script.sh

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"jeroen/simple-cache": "~2.0"
},
"require-dev": {
"data-values/common": "~0.3.1"
"data-values/common": "~0.3.1",
"phpunit/phpunit": "~3.7"
},
"autoload": {
"files" : [
Expand All @@ -60,7 +61,7 @@
"Maps\\Tests\\TestDoubles\\": "tests/TestDoubles/"
},
"classmap": [
"tests/phpunit/elements/",
"tests/Unit/Elements/",
"tests/Integration/parserhooks/ParserHookTest.php"
]
},
Expand All @@ -77,7 +78,6 @@
"process-timeout": 0
},
"scripts":{
"phpunit": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist",
"unit-test": "phpunit -c phpunit.xml.dist tests/phpunit"
"ci": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist"
}
}
7 changes: 4 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true">
stopOnSkipped="false">
<testsuites>
<testsuite name="Maps">
<directory>tests/phpunit</directory>
<directory>tests</directory>
<directory>SemanticMaps/tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">includes</directory>
<directory suffix=".php">src</directory>
<directory suffix=".php">SemanticMaps/src</directory>
</whitelist>
</filter>
</phpunit>
14 changes: 8 additions & 6 deletions tests/Integration/MapsDistanceParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
/**
* @covers MapsCoordinates
*
* @since 0.6.5
*
* @group Maps
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
class MapsDistanceParserTest extends \MediaWikiTestCase {

class MapsDistanceParserTest extends \PHPUnit_Framework_TestCase {

public function setUp() {
if ( !defined( 'MEDIAWIKI' ) ) {
$this->markTestSkipped( 'MediaWiki is not available' );
}
}

public static $distances = [
'1' => 1,
'1m' => 1,
Expand Down
10 changes: 6 additions & 4 deletions tests/Integration/MapsMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
/**
* @covers MapsMapper
*
* @since 3.6
*
* @group Maps
*
* @licence GNU GPL v2+
* @author Peter Grassberger < [email protected] >
*/
class MapsMapperTest extends \PHPUnit_Framework_TestCase {

public function setUp() {
if ( !defined( 'MEDIAWIKI' ) ) {
$this->markTestSkipped( 'MediaWiki is not available' );
}
}

public function imageUrlProvider() {
return [
['markerImage.png', 'markerImage.png'],
Expand Down
4 changes: 0 additions & 4 deletions tests/Integration/parserhooks/CoordinatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
/**
* @covers MapsCoordinates
*
* @group Maps
* @group ParserHook
* @group CoordinatesTest
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
4 changes: 0 additions & 4 deletions tests/Integration/parserhooks/DisplayMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
/**
* @covers MapsDisplayMap
*
* @group Maps
* @group ParserHook
* @group DisplayMapTest
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
4 changes: 0 additions & 4 deletions tests/Integration/parserhooks/DistanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
/**
* @covers MapsDistance
*
* @group Maps
* @group ParserHook
* @group MapsDistanceTest
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
4 changes: 0 additions & 4 deletions tests/Integration/parserhooks/FinddestinationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
/**
* @covers MapsFinddestination
*
* @group Maps
* @group ParserHook
* @group MapsFinddestinationTest
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
3 changes: 0 additions & 3 deletions tests/Integration/parserhooks/GeocodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
/**
* @covers MapsGeocode
*
* @group Maps
* @group ParserHook
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
4 changes: 0 additions & 4 deletions tests/Integration/parserhooks/GeodistanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
/**
* @covers MapsGeodistance
*
* @group Maps
* @group ParserHook
* @group GeodistanceTest
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
3 changes: 0 additions & 3 deletions tests/Integration/parserhooks/MapsDocTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
/**
* @covers MapsMapsDoc
*
* @group Maps
* @group ParserHook
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
Expand Down
9 changes: 6 additions & 3 deletions tests/Integration/parserhooks/ParserHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
use ParamProcessor\Processor;

/**
* @group Maps
* @group ParserHook
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
abstract class ParserHookTest extends \PHPUnit_Framework_TestCase {

public static function setUpBeforeClass() {
if ( !defined( 'MEDIAWIKI' ) ) {
self::markTestSkipped( 'MediaWiki is not available' );
}
}

/**
* @since 2.0
* @return \ParserHook
Expand Down
6 changes: 6 additions & 0 deletions tests/Integration/parsers/CircleParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
*/
class CircleParserTest extends \PHPUnit_Framework_TestCase {

public function setUp() {
if ( !defined( 'MEDIAWIKI' ) ) {
$this->markTestSkipped( 'MediaWiki is not available' );
}
}

public function testCanConstruct() {
new CircleParser();
$this->assertTrue( true );
Expand Down
Loading

0 comments on commit 99c6664

Please sign in to comment.