Glaisher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/248377
Change subject: Fix UnitTestsList hook to include all *Tests.php files as well
......................................................................
Fix UnitTestsList hook to include all *Tests.php files as well
Previously, this was only run on one file.
php > var_dump( glob( __DIR__ . '/tests/*Test.php' ) );
array(1) {
[0]=>
string(67)
"/var/www/html/wiki/extensions/Newsletter/tests/NewsletterDbTest.php"
}
Copied this from another extension and this will work, I think.
Change-Id: I256ebedc560e3c3d372e5cfb4a5a39c1006d1735
---
M Newsletter.hooks.php
1 file changed, 21 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Newsletter
refs/changes/77/248377/1
diff --git a/Newsletter.hooks.php b/Newsletter.hooks.php
index 9c86f59..1bd19b6 100755
--- a/Newsletter.hooks.php
+++ b/Newsletter.hooks.php
@@ -60,10 +60,30 @@
return true;
}
+ /**
+ * Handler for UnitTestsList hook.
+ * @see http://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList
+ * @param &$files Array of unit test files
+ * @return bool true in all cases
+ */
public static function onUnitTestsList( &$files ) {
- $files = array_merge( $files, glob( __DIR__ .
'/tests/*Test.php' ) );
+ // @codeCoverageIgnoreStart
+ $directoryIterator = new RecursiveDirectoryIterator( __DIR__ .
'/tests/' );
+
+ /**
+ * @var SplFileInfo $fileInfo
+ */
+ $ourFiles = array();
+ foreach ( new RecursiveIteratorIterator( $directoryIterator )
as $fileInfo ) {
+ if ( substr( $fileInfo->getFilename(), -8 ) ===
'Test.php' ) {
+ $ourFiles[] = $fileInfo->getPathname();
+ }
+ }
+
+ $files = array_merge( $files, $ourFiles );
return true;
+ // @codeCoverageIgnoreEnd
}
}
--
To view, visit https://gerrit.wikimedia.org/r/248377
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I256ebedc560e3c3d372e5cfb4a5a39c1006d1735
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Newsletter
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits