Add countUnreadNotifications to WatchedItemStore
[lhc/web/wiklou.git] / tests / phpunit / suites / ExtensionsTestSuite.php
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 */
7
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',
20 );
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 );
27 }
28 }
29 if ( !count( $paths ) ) {
30 $this->addTest( new DummyExtensionsTest( 'testNothing' ) );
31 }
32 }
33
34 public static function suite() {
35 return new self;
36 }
37 }
38
39 /**
40 * Needed to avoid warnings like 'No tests found in class "ExtensionsTestSuite".'
41 * when no extensions with tests are used.
42 */
43 class DummyExtensionsTest extends MediaWikiTestCase {
44 public function testNothing() {
45 $this->assertTrue( true );
46 }
47 }