Adamw has uploaded a new change for review. https://gerrit.wikimedia.org/r/133888
Change subject: Add a hook to discover and run all tests during "--testsuite extensions" ...................................................................... Add a hook to discover and run all tests during "--testsuite extensions" Change-Id: I0945ae10792dc77b00cb084ac3c2bdf386bb08e9 --- M Campaigns.hooks.php M Campaigns.php 2 files changed, 19 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Campaigns refs/changes/88/133888/1 diff --git a/Campaigns.hooks.php b/Campaigns.hooks.php index 90102c3..def41a3 100644 --- a/Campaigns.hooks.php +++ b/Campaigns.hooks.php @@ -3,6 +3,8 @@ namespace Campaigns; use \DatabaseUpdater; +use \RecursiveDirectoryIterator; +use \RecursiveIteratorIterator; /** * Static methods for hooks. @@ -133,4 +135,20 @@ return true; } + + /** + * Return test suites + */ + public static function onUnitTestsList( &$files ) { + // Search for tests + $dirIterator = new RecursiveDirectoryIterator( __DIR__ . '/tests' ); + $iterator = new RecursiveIteratorIterator( $dirIterator, RecursiveIteratorIterator::LEAVES_ONLY ); + foreach ( $iterator as $path => $fileObject ) { + if ( fnmatch( "*Test.php", $fileObject->getFilename() ) ) { + $files[] = $path; + } + } + + return true; + } } diff --git a/Campaigns.php b/Campaigns.php index 1d38414..fc29480 100644 --- a/Campaigns.php +++ b/Campaigns.php @@ -79,6 +79,7 @@ $wgHooks['AddNewAccount'][] = 'Campaigns\Hooks::onAddNewAccount'; $wgHooks['UserLoginForm'][] = 'Campaigns\Hooks::onUserLoginForm'; $wgHooks['LoadExtensionSchemaUpdates'][] = 'Campaigns\Hooks::onLoadExtensionSchemaUpdate'; +$wgHooks['UnitTestsList'][] = 'Campaigns\Hooks::onUnitTestsList'; // Modules -- To view, visit https://gerrit.wikimedia.org/r/133888 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0945ae10792dc77b00cb084ac3c2bdf386bb08e9 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Campaigns Gerrit-Branch: wip/editorcampaigns Gerrit-Owner: Adamw <awi...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits