Paladox has uploaded a new change for review. https://gerrit.wikimedia.org/r/247864
Change subject: Fix jenkins failing ...................................................................... Fix jenkins failing This fixes the mwext-ParserHooks-testextension-zend test it was failing so this patch fixes it. Also import from https://github.com/JeroenDeDauw/ParserHooks The author who did those updates were user JeroenDeDauw who is the author of this extension. Change-Id: I57b0b9f035b16cbb8107c8fea982cf207622d099 --- M ParserHooks.php M README.md M composer.json M tests/bootstrap.php D tests/evilMediaWikiBootstrap.php 5 files changed, 27 insertions(+), 79 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParserHooks refs/changes/64/247864/1 diff --git a/ParserHooks.php b/ParserHooks.php index 6a380b2..b57f986 100644 --- a/ParserHooks.php +++ b/ParserHooks.php @@ -14,15 +14,10 @@ return 1; } -define( 'ParserHooks_VERSION', '1.3.0' ); +define( 'ParserHooks_VERSION', '1.5.0 alpha' ); if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { - include_once( __DIR__ . '/vendor/autoload.php' ); -} - -// Only initialize the extension when all dependencies are present. -if ( !defined( 'ParamProcessor_VERSION' ) ) { - throw new Exception( 'You need to have the ParamProcessor library loaded in order to use ParserHooks' ); + require_once( __DIR__ . '/vendor/autoload.php' ); } call_user_func( function() { diff --git a/README.md b/README.md index f1835d2..477e61f 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ OOP interface for creating MediaWiki parser hooks in a declarative fashion. +This is a PHP library for MediaWiki extensions. It does not in itself add or enhance functionality of your wiki. + ## Requirements * [PHP](http://php.net/) 5.3 or later @@ -27,11 +29,11 @@ To add this package as a local, per-project dependency to your project, simply add a dependency on `mediawiki/parser-hooks` to your project's `composer.json` file. Here is a minimal example of a `composer.json` file that just defines a dependency on -ParserHooks 1.2: +ParserHooks 1.4: { "require": { - "mediawiki/parser-hooks": "1.2.*" + "mediawiki/parser-hooks": "~1.4" } } @@ -65,8 +67,8 @@ For instance, you can feed these definitions to a tool that generates parser hook documentation based on them. -The parameter definitions are ParamProcessor\ParamDefinition objects. See the ParamProcessor -documentation on how to specify these. +The parameter definitions are ParamProcessor\ParamDefinition objects. See the [ParamProcessor] +(https://github.com/JeroenDeDauw/ParamProcessor) documentation on how to specify these. ### HookHandler @@ -126,6 +128,11 @@ tests using the PHPUnit configuration file found in the root directory. The tests can also be run via TravisCI, as a TravisCI configuration file is also provided in the root directory. +The tests can be run for the `tests/phpunit` directory of your MediaWiki installation +with this command: + + php phpunit.php -c ../../extensions/ParserHooks/ + ## Authors ParserHooks has been written by [Jeroen De Dauw](https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw) @@ -134,6 +141,11 @@ ## Release notes +### 1.4 (2014-07-05) + +* Changed the PHPUnit bootstrap so that the tests can be run via the MediaWiki test runner +* Updated the CI configuration to test the code against multiple MediaWiki versions + ### 1.3 (2014-06-25) * Updated i18n message files diff --git a/composer.json b/composer.json index 770480d..dc1735e 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "require": { "php": ">=5.3.0", - "mediawiki/validator": "~2.0,>=2.0.4" + "param-processor/param-processor": "~1.2.2" }, "autoload": { "files" : [ diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 795cd52..45fed4f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -13,8 +13,14 @@ die( 'Not an entry point' ); } -require_once( __DIR__ . '/evilMediaWikiBootstrap.php' ); +if ( is_readable( $path = __DIR__ . '/../vendor/autoload.php' ) ) { + print( "\nUsing the local vendor autoloader ...\n\n" ); +} elseif ( is_readable( $path = __DIR__ . '/../../../vendor/autoload.php' ) ) { + print( "\nUsing the MediaWiki vendor autoloader ...\n\n" ); +} else { + die( 'To run tests it is required that packages are installed using Composer.' ); +} -require_once( __DIR__ . '/../ParserHooks.php' ); +$autoloader = require $path; $GLOBALS['wgExtensionMessagesFiles']['TagHookTest'] = __DIR__ . '/system/TagHookTest.i18n.php'; diff --git a/tests/evilMediaWikiBootstrap.php b/tests/evilMediaWikiBootstrap.php deleted file mode 100644 index b8bad0b..0000000 --- a/tests/evilMediaWikiBootstrap.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -define( 'MEDIAWIKI', true ); - -global $IP; -$IP = getenv( 'MW_INSTALL_PATH' ); - -if ( $IP === false ) { - $IP = dirname( __FILE__ ) . '/../../..'; -} - -$self = 'foobar'; - -// Detect compiled mode -# Get the MWInit class -require_once "$IP/includes/Init.php"; -require_once "$IP/includes/AutoLoader.php"; -# Stub the profiler -require_once "$IP/includes/profiler/Profiler.php"; - -# Start the profiler -$wgProfiler = array(); -if ( file_exists( "$IP/StartProfiler.php" ) ) { - require "$IP/StartProfiler.php"; -} - -// Some other requires -require_once "$IP/includes/Defines.php"; - -require_once MWInit::compiledPath( 'includes/DefaultSettings.php' ); - -foreach ( get_defined_vars() as $key => $var ) { - if ( !array_key_exists( $key, $GLOBALS ) ) { - $GLOBALS[$key] = $var; - } -} - -if ( defined( 'MW_CONFIG_CALLBACK' ) ) { - # Use a callback function to configure MediaWiki - MWFunction::call( MW_CONFIG_CALLBACK ); -} else { - // Require the configuration (probably LocalSettings.php) - require loadSettings(); -} - -// Some last includes -require_once MWInit::compiledPath( 'includes/Setup.php' ); - -// Much much faster startup than creating a title object -$wgTitle = null; - - -function loadSettings() { - global $wgCommandLineMode, $IP; - - $settingsFile = "$IP/LocalSettings.php"; - - if ( !is_readable( $settingsFile ) ) { - $this->error( "A copy of your installation's LocalSettings.php\n" . - "must exist and be readable in the source directory.\n" . - "Use --conf to specify it.", true ); - } - $wgCommandLineMode = true; - return $settingsFile; -} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/247864 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I57b0b9f035b16cbb8107c8fea982cf207622d099 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ParserHooks Gerrit-Branch: master Gerrit-Owner: Paladox <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
