* Removed maintenance/purgeOldText.inc and the PurgeRedundantText() function
it contained (superseded by Maintenance::purgeRedundantText() in 1.16).
The purgeOldText.php maintenance script has been retained.
+* PHPUnit tests can be found by directory discovery, by adding the directory
+ path from your UnitTestsList callback. Older versions of MediaWiki core will
+ barf at this usage.
==== Renamed classes ====
* CLDRPluralRuleConverter_Expression to CLDRPluralRuleConverterExpression
$action: action name
$article: article "acted on"
-'UnitTestsList': Called when building a list of files with PHPUnit tests.
-&$files: list of files
+'UnitTestsList': Called when building a list of paths containing PHPUnit tests.
+Since 1.24: Paths pointing to a directory will be recursively scanned for
+test case files matching the suffix "Test.php".
+&$paths: list of test cases and directories to search.
'UnwatchArticle': Before a watch is removed from an article.
$user: user watching
class ExtensionsTestSuite extends PHPUnit_Framework_TestSuite {
public function __construct() {
parent::__construct();
- $files = array();
- wfRunHooks( 'UnitTestsList', array( &$files ) );
- foreach ( $files as $file ) {
- $this->addTestFile( $file );
+ $paths = array();
+ // Extensions can return a list of files or directories
+ wfRunHooks( 'UnitTestsList', array( &$paths ) );
+ foreach ( $paths as $path ) {
+ if ( is_dir( $path ) ) {
+ // If the path is a directory, search for test cases.
+ // @since 1.24
+ $suffixes = array(
+ 'Test.php',
+ );
+ $fileIterator = new File_Iterator_Facade();
+ $matchingFiles = $fileIterator->getFilesAsArray( $path, $suffixes );
+ $this->addTestFiles( $matchingFiles );
+ } else {
+ // Add a single test case or suite class
+ $this->addTestFile( $path );
+ }
}
- if ( !count( $files ) ) {
+ if ( !count( $paths ) ) {
$this->addTest( new DummyExtensionsTest( 'testNothing' ) );
}
}