Index: trunk/phase3/maintenance/tests/phpunit/suite.xml |
— | — | @@ -20,6 +20,9 @@ |
21 | 21 | <testsuite name="uploadfromurl"> |
22 | 22 | <file>./suites/UploadFromUrlTestSuite.php</file> |
23 | 23 | </testsuite> |
| 24 | + <testsuite name="extensions"> |
| 25 | + <file>./suites/ExtensionsTestSuite.php</file> |
| 26 | + </testsuite> |
24 | 27 | </testsuites> |
25 | 28 | <groups> |
26 | 29 | <exclude> |
Index: trunk/phase3/maintenance/tests/phpunit/suites/ExtensionsTestSuite.php |
— | — | @@ -1,4 +1,34 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * This is where a PHPUnit_Framework_TestSuite that runs extension tests through a hook or something should go. |
5 | | - */ |
\ No newline at end of file |
| 4 | + * This test suite runs unit tests registered by extensions. |
| 5 | + * See http://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList for details of how to register your tests. |
| 6 | + */ |
| 7 | + |
| 8 | + class ExtensionsTestSuite extends PHPUnit_Framework_TestSuite { |
| 9 | + public function __construct() { |
| 10 | + parent::__construct(); |
| 11 | + $files = array(); |
| 12 | + wfRunHooks( 'UnitTestsList', array( &$files ) ); |
| 13 | + var_dump($files); |
| 14 | + foreach ( $files as $file ) { |
| 15 | + $this->addTestFile( $file ); |
| 16 | + } |
| 17 | + if ( !count( $files ) ) { |
| 18 | + $this->addTest( new DummyExtensionsTest( 'testNothing' ) ); |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + public static function suite() { |
| 23 | + return new self; |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +/** |
| 28 | + * Needed to avoid warnings like 'No tests found in class "ExtensionsTestSuite".' |
| 29 | + * when no extensions with tests are used. |
| 30 | + */ |
| 31 | +class DummyExtensionsTest extends PHPUnit_Framework_TestCase { |
| 32 | + public function testNothing() { |
| 33 | + |
| 34 | + } |
| 35 | +} |
\ No newline at end of file |