Jeroen De Dauw has uploaded a new change for review.

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


Change subject: Automatically register tests with MW
......................................................................

Automatically register tests with MW

Change-Id: If21ff4ee7178efd10f25d1d166ae879f68191449
---
M DataTypes/DataTypes.mw.php
R DataTypes/tests/phpunit/DataTypeFactoryTest.php
R DataTypes/tests/phpunit/DataTypeTest.php
M DataValues/DataValues.mw.php
M ValueFormatters/ValueFormatters.mw.php
R ValueFormatters/tests/phpunit/FormatterOptionsTest.php
R ValueFormatters/tests/phpunit/ValueFormatterFactoryTest.php
R ValueFormatters/tests/phpunit/ValueFormatterTestBase.php
R ValueFormatters/tests/phpunit/formatters/GeoCoordinateFormatterTest.php
R ValueFormatters/tests/phpunit/formatters/IriFormatterTest.php
R ValueFormatters/tests/phpunit/formatters/StringFormatterTest.php
M ValueParsers/ValueParsers.mw.php
R ValueParsers/tests/phpunit/ParserOptionsTest.php
R ValueParsers/tests/phpunit/ValueParserFactoryTest.php
R ValueParsers/tests/phpunit/api/ApiParseValueTest.php
R ValueParsers/tests/phpunit/parsers/BoolParserTest.php
R ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
R ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
R ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
R ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
R ValueParsers/tests/phpunit/parsers/FloatParserTest.php
R ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
R ValueParsers/tests/phpunit/parsers/IntParserTest.php
R ValueParsers/tests/phpunit/parsers/NullParserTest.php
R ValueParsers/tests/phpunit/parsers/StringValueParserTest.php
R ValueParsers/tests/phpunit/parsers/ValueParserTestBase.php
M ValueValidators/ValueValidators.mw.php
M phpunit.xml.dist
28 files changed, 41 insertions(+), 59 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DataValues 
refs/changes/64/67464/1

diff --git a/DataTypes/DataTypes.mw.php b/DataTypes/DataTypes.mw.php
index 23622ac..a1b6826 100644
--- a/DataTypes/DataTypes.mw.php
+++ b/DataTypes/DataTypes.mw.php
@@ -70,14 +70,15 @@
  */
 $wgHooks['UnitTestsList'][] = function( array &$files ) {
        // @codeCoverageIgnoreStart
-       $testFiles = array(
-               'includes/DataType',
+       $directoryIterator = new \RecursiveDirectoryIterator( __DIR__ . 
'/tests/phpunit/' );
 
-               'includes/DataTypeFactory',
-       );
-
-       foreach ( $testFiles as $file ) {
-               $files[] = __DIR__ . '/tests/' . $file . 'Test.php';
+       /**
+        * @var \SplFileInfo $fileInfo
+        */
+       foreach ( new \RecursiveIteratorIterator( $directoryIterator ) as 
$fileInfo ) {
+               if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
+                       $files[] = $fileInfo->getPathname();
+               }
        }
 
        return true;
diff --git a/DataTypes/tests/includes/DataTypeFactoryTest.php 
b/DataTypes/tests/phpunit/DataTypeFactoryTest.php
similarity index 100%
rename from DataTypes/tests/includes/DataTypeFactoryTest.php
rename to DataTypes/tests/phpunit/DataTypeFactoryTest.php
diff --git a/DataTypes/tests/includes/DataTypeTest.php 
b/DataTypes/tests/phpunit/DataTypeTest.php
similarity index 100%
rename from DataTypes/tests/includes/DataTypeTest.php
rename to DataTypes/tests/phpunit/DataTypeTest.php
diff --git a/DataValues/DataValues.mw.php b/DataValues/DataValues.mw.php
index 6fa56a7..dcaefe5 100644
--- a/DataValues/DataValues.mw.php
+++ b/DataValues/DataValues.mw.php
@@ -58,23 +58,15 @@
  */
 $wgHooks['UnitTestsList'][] = function( array &$files ) {
        // @codeCoverageIgnoreStart
-       $testFiles = array(
-               'includes/values/BooleanValue',
-               'includes/values/GeoCoordinateValue',
-               'includes/values/IriValue',
-               'includes/values/MonolingualTextValue',
-               'includes/values/MultilingualTextValue',
-               'includes/values/NumberValue',
-               'includes/values/QuantityValue',
-               'includes/values/StringValue',
-               'includes/values/TimeValue',
-               'includes/values/UnknownValue',
+       $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . 
'/tests/phpunit/' );
 
-               'includes/DataValueFactory',
-       );
-
-       foreach ( $testFiles as $file ) {
-               $files[] = __DIR__ . '/tests/phpunit/' . $file . 'Test.php';
+       /**
+        * @var SplFileInfo $fileInfo
+        */
+       foreach ( new RecursiveIteratorIterator( $directoryIterator ) as 
$fileInfo ) {
+               if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
+                       $files[] = $fileInfo->getPathname();
+               }
        }
 
        return true;
diff --git a/ValueFormatters/ValueFormatters.mw.php 
b/ValueFormatters/ValueFormatters.mw.php
index f2293c4..9beea1d 100644
--- a/ValueFormatters/ValueFormatters.mw.php
+++ b/ValueFormatters/ValueFormatters.mw.php
@@ -66,17 +66,15 @@
  */
 $wgHooks['UnitTestsList'][] = function( array &$files ) {
        // @codeCoverageIgnoreStart
-       $testFiles = array(
-               'formatters/GeoCoordinateFormatter',
-               'formatters/IriFormatter',
-               'formatters/StringFormatter',
+       $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . 
'/tests/phpunit/' );
 
-               'FormatterOptions',
-               'ValueFormatterFactory',
-       );
-
-       foreach ( $testFiles as $file ) {
-               $files[] = __DIR__ . '/tests/' . $file . 'Test.php';
+       /**
+        * @var SplFileInfo $fileInfo
+        */
+       foreach ( new RecursiveIteratorIterator( $directoryIterator ) as 
$fileInfo ) {
+               if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
+                       $files[] = $fileInfo->getPathname();
+               }
        }
 
        return true;
diff --git a/ValueFormatters/tests/FormatterOptionsTest.php 
b/ValueFormatters/tests/phpunit/FormatterOptionsTest.php
similarity index 100%
rename from ValueFormatters/tests/FormatterOptionsTest.php
rename to ValueFormatters/tests/phpunit/FormatterOptionsTest.php
diff --git a/ValueFormatters/tests/ValueFormatterFactoryTest.php 
b/ValueFormatters/tests/phpunit/ValueFormatterFactoryTest.php
similarity index 100%
rename from ValueFormatters/tests/ValueFormatterFactoryTest.php
rename to ValueFormatters/tests/phpunit/ValueFormatterFactoryTest.php
diff --git a/ValueFormatters/tests/ValueFormatterTestBase.php 
b/ValueFormatters/tests/phpunit/ValueFormatterTestBase.php
similarity index 100%
rename from ValueFormatters/tests/ValueFormatterTestBase.php
rename to ValueFormatters/tests/phpunit/ValueFormatterTestBase.php
diff --git a/ValueFormatters/tests/formatters/GeoCoordinateFormatterTest.php 
b/ValueFormatters/tests/phpunit/formatters/GeoCoordinateFormatterTest.php
similarity index 100%
rename from ValueFormatters/tests/formatters/GeoCoordinateFormatterTest.php
rename to 
ValueFormatters/tests/phpunit/formatters/GeoCoordinateFormatterTest.php
diff --git a/ValueFormatters/tests/formatters/IriFormatterTest.php 
b/ValueFormatters/tests/phpunit/formatters/IriFormatterTest.php
similarity index 100%
rename from ValueFormatters/tests/formatters/IriFormatterTest.php
rename to ValueFormatters/tests/phpunit/formatters/IriFormatterTest.php
diff --git a/ValueFormatters/tests/formatters/StringFormatterTest.php 
b/ValueFormatters/tests/phpunit/formatters/StringFormatterTest.php
similarity index 100%
rename from ValueFormatters/tests/formatters/StringFormatterTest.php
rename to ValueFormatters/tests/phpunit/formatters/StringFormatterTest.php
diff --git a/ValueParsers/ValueParsers.mw.php b/ValueParsers/ValueParsers.mw.php
index 21a8650..49ee6f2 100644
--- a/ValueParsers/ValueParsers.mw.php
+++ b/ValueParsers/ValueParsers.mw.php
@@ -65,26 +65,15 @@
  */
 $wgHooks['UnitTestsList'][] = function( array &$files ) {
        // @codeCoverageIgnoreStart
-       $testFiles = array(
-               'includes/api/ApiParseValue',
+       $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . 
'/tests/phpunit/' );
 
-               'includes/parsers/BoolParser',
-               'includes/parsers/DdCoordinateParser',
-               'includes/parsers/DmCoordinateParser',
-               'includes/parsers/DmsCoordinateParser',
-               'includes/parsers/FloatCoordinateParser',
-               'includes/parsers/GeoCoordinateParser',
-               'includes/parsers/FloatParser',
-               'includes/parsers/IntParser',
-               'includes/parsers/IntParser',
-               'includes/parsers/NullParser',
-
-               'includes/ParserOptions',
-               'includes/ValueParserFactory',
-       );
-
-       foreach ( $testFiles as $file ) {
-               $files[] = __DIR__ . '/tests/' . $file . 'Test.php';
+       /**
+        * @var SplFileInfo $fileInfo
+        */
+       foreach ( new RecursiveIteratorIterator( $directoryIterator ) as 
$fileInfo ) {
+               if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
+                       $files[] = $fileInfo->getPathname();
+               }
        }
 
        return true;
diff --git a/ValueParsers/tests/includes/ParserOptionsTest.php 
b/ValueParsers/tests/phpunit/ParserOptionsTest.php
similarity index 100%
rename from ValueParsers/tests/includes/ParserOptionsTest.php
rename to ValueParsers/tests/phpunit/ParserOptionsTest.php
diff --git a/ValueParsers/tests/includes/ValueParserFactoryTest.php 
b/ValueParsers/tests/phpunit/ValueParserFactoryTest.php
similarity index 100%
rename from ValueParsers/tests/includes/ValueParserFactoryTest.php
rename to ValueParsers/tests/phpunit/ValueParserFactoryTest.php
diff --git a/ValueParsers/tests/includes/api/ApiParseValueTest.php 
b/ValueParsers/tests/phpunit/api/ApiParseValueTest.php
similarity index 100%
rename from ValueParsers/tests/includes/api/ApiParseValueTest.php
rename to ValueParsers/tests/phpunit/api/ApiParseValueTest.php
diff --git a/ValueParsers/tests/includes/parsers/BoolParserTest.php 
b/ValueParsers/tests/phpunit/parsers/BoolParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/BoolParserTest.php
rename to ValueParsers/tests/phpunit/parsers/BoolParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/DdCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/DdCoordinateParserTest.php
rename to ValueParsers/tests/phpunit/parsers/DdCoordinateParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/DmCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/DmCoordinateParserTest.php
rename to ValueParsers/tests/phpunit/parsers/DmCoordinateParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/DmsCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/DmsCoordinateParserTest.php
rename to ValueParsers/tests/phpunit/parsers/DmsCoordinateParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/FloatCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/FloatCoordinateParserTest.php
rename to ValueParsers/tests/phpunit/parsers/FloatCoordinateParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/FloatParserTest.php 
b/ValueParsers/tests/phpunit/parsers/FloatParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/FloatParserTest.php
rename to ValueParsers/tests/phpunit/parsers/FloatParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/GeoCoordinateParserTest.php 
b/ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/GeoCoordinateParserTest.php
rename to ValueParsers/tests/phpunit/parsers/GeoCoordinateParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/IntParserTest.php 
b/ValueParsers/tests/phpunit/parsers/IntParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/IntParserTest.php
rename to ValueParsers/tests/phpunit/parsers/IntParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/NullParserTest.php 
b/ValueParsers/tests/phpunit/parsers/NullParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/NullParserTest.php
rename to ValueParsers/tests/phpunit/parsers/NullParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/StringValueParserTest.php 
b/ValueParsers/tests/phpunit/parsers/StringValueParserTest.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/StringValueParserTest.php
rename to ValueParsers/tests/phpunit/parsers/StringValueParserTest.php
diff --git a/ValueParsers/tests/includes/parsers/ValueParserTestBase.php 
b/ValueParsers/tests/phpunit/parsers/ValueParserTestBase.php
similarity index 100%
rename from ValueParsers/tests/includes/parsers/ValueParserTestBase.php
rename to ValueParsers/tests/phpunit/parsers/ValueParserTestBase.php
diff --git a/ValueValidators/ValueValidators.mw.php 
b/ValueValidators/ValueValidators.mw.php
index 0b0d046..3ad375b 100644
--- a/ValueValidators/ValueValidators.mw.php
+++ b/ValueValidators/ValueValidators.mw.php
@@ -62,13 +62,15 @@
  */
 $wgHooks['UnitTestsList'][] = function( array &$files ) {
        // @codeCoverageIgnoreStart
-       $testFiles = array(
-               'Error',
-               'ValueValidatorFactory',
-       );
+       $directoryIterator = new RecursiveDirectoryIterator( __DIR__ . 
'/tests/phpunit/' );
 
-       foreach ( $testFiles as $file ) {
-               $files[] = __DIR__ . '/tests/phpunit/' . $file . 'Test.php';
+       /**
+        * @var SplFileInfo $fileInfo
+        */
+       foreach ( new RecursiveIteratorIterator( $directoryIterator ) as 
$fileInfo ) {
+               if ( substr( $fileInfo->getFilename(), -8 ) === 'Test.php' ) {
+                       $files[] = $fileInfo->getPathname();
+               }
        }
 
        return true;
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index d862e4a..019b6a0 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -24,7 +24,7 @@
         </testsuite>
         <testsuite name="ValueParsers">
             <directory>ValueParsers/tests</directory>
-            <exclude>ValueParsers/tests/includes/api</exclude>
+            <exclude>ValueParsers/tests/phpunit/api</exclude>
         </testsuite>
         <testsuite name="ValueValidators">
             <directory>ValueValidators/tests</directory>

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If21ff4ee7178efd10f25d1d166ae879f68191449
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

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

Reply via email to