Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/74274
Change subject: Add travisCI and PHPUnit config ...................................................................... Add travisCI and PHPUnit config Change-Id: I3fa3342a148ac82c68a25214ae04cf797124e07e --- A .travis.yml M DataTypes.php A phpunit.xml.dist R tests/modules/DataTypesModuleTest.php 4 files changed, 53 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataTypes refs/changes/74/74274/1 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1c2e16b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + +notifications: + email: + recipients: + - [email protected] + on_success: change + on_failure: always + +notifications: + irc: + channels: + - "chat.freenode.net#wikimedia-wikidata" + on_success: change + on_failure: always \ No newline at end of file diff --git a/DataTypes.php b/DataTypes.php index 6be8200..35e0980 100644 --- a/DataTypes.php +++ b/DataTypes.php @@ -46,6 +46,8 @@ namespace DataTypes; +use Exception; + if ( defined( 'DataTypes_VERSION' ) ) { // Do not initialize more then once. return; @@ -53,6 +55,17 @@ define( 'DataTypes_VERSION', '0.1 alpha' ); +// Attempt to include the DataValues lib if that hasn't been done yet. +// This is the path the DataValues entry point will be at when loaded as MediaWiki extension. +if ( !defined( 'DataValues_VERSION' ) && is_readable( __DIR__ . '/../DataValues/DataValues.php' ) ) { + include_once( __DIR__ . '/../DataValues/DataValues.php' ); +} + +// Only initialize the extension when all dependencies are present. +if ( !defined( 'DataValues_VERSION' ) ) { + throw new Exception( 'You need to have the DataValues library loaded in order to use Ask' ); +} + global $wgDataTypes; $wgDataTypes = array( 'commonsMedia' => array( diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..cb008e2 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,20 @@ +<phpunit backupGlobals="false" + backupStaticAttributes="false" + bootstrap="tests/bootstrap.php" + cacheTokens="false" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + stopOnError="false" + stopOnFailure="false" + stopOnIncomplete="false" + stopOnSkipped="false" + strict="true" + verbose="true"> + <testsuites> + <testsuite name="DataTypes"> + <directory>tests/phpunit</directory> + </testsuite> + </testsuites> +</phpunit> diff --git a/tests/phpunit/modules/DataTypesModuleTest.php b/tests/modules/DataTypesModuleTest.php similarity index 100% rename from tests/phpunit/modules/DataTypesModuleTest.php rename to tests/modules/DataTypesModuleTest.php -- To view, visit https://gerrit.wikimedia.org/r/74274 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3fa3342a148ac82c68a25214ae04cf797124e07e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/DataTypes Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
