3 * This test suite runs unit tests registered by extensions.
4 * See https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList for details of
5 * how to register your tests.
8 class ExtensionsTestSuite
extends PHPUnit_Framework_TestSuite
{
9 public function __construct() {
10 parent
::__construct();
12 // Extensions can return a list of files or directories
13 Hooks
::run( 'UnitTestsList', array( &$paths ) );
14 foreach ( $paths as $path ) {
15 if ( is_dir( $path ) ) {
16 // If the path is a directory, search for test cases.
21 $fileIterator = new File_Iterator_Facade();
22 $matchingFiles = $fileIterator->getFilesAsArray( $path, $suffixes );
23 $this->addTestFiles( $matchingFiles );
25 // Add a single test case or suite class
26 $this->addTestFile( $path );
29 if ( !count( $paths ) ) {
30 $this->addTest( new DummyExtensionsTest( 'testNothing' ) );
34 public static function suite() {
40 * Needed to avoid warnings like 'No tests found in class "ExtensionsTestSuite".'
41 * when no extensions with tests are used.
43 class DummyExtensionsTest
extends MediaWikiTestCase
{
44 public function testNothing() {
45 $this->assertTrue( true );