Import: Handle uploads with sha1 starting with 0 properly
[mediawiki.git] / tests / phpunit / suites / ExtensionsTestSuite.php
blob723328e2df7fd6060a8e364f2ce81a353ea55865
1 <?php
2 /**
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.
6 */
8 class ExtensionsTestSuite extends PHPUnit_Framework_TestSuite {
9 public function __construct() {
10 parent::__construct();
11 $paths = array();
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.
17 // @since 1.24
18 $suffixes = array(
19 'Test.php',
21 $fileIterator = new File_Iterator_Facade();
22 $matchingFiles = $fileIterator->getFilesAsArray( $path, $suffixes );
23 $this->addTestFiles( $matchingFiles );
24 } else {
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() {
35 return new self;
39 /**
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 );