Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/159109

Change subject: Improve UnitTestsList hook
......................................................................

Improve UnitTestsList hook

Change-Id: Iad11e9362b64e067e2d99fa4194a9d309734348b
---
M Gadgets.hooks.php
1 file changed, 16 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gadgets 
refs/changes/09/159109/1

diff --git a/Gadgets.hooks.php b/Gadgets.hooks.php
index 0ec735f..4ce9887 100644
--- a/Gadgets.hooks.php
+++ b/Gadgets.hooks.php
@@ -391,8 +391,22 @@
         * @return bool
         */
        public static function onUnitTestsList( array &$files ) {
-               $testDir = __DIR__ . '/tests/';
-               $files = array_merge( $files, glob( "$testDir/*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
                return true;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/159109
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad11e9362b64e067e2d99fa4194a9d309734348b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Gadgets
Gerrit-Branch: RL2
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to