r74558 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74557‎ | r74558 | r74559 >
Date:19:17, 9 October 2010
Author:maxsem
Status:ok
Tags:
Comment:
Restored the ability to run extension tests from the main runner
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/suite.xml (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit/suites/ExtensionsTestSuite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/suite.xml
@@ -20,6 +20,9 @@
2121 <testsuite name="uploadfromurl">
2222 <file>./suites/UploadFromUrlTestSuite.php</file>
2323 </testsuite>
 24+ <testsuite name="extensions">
 25+ <file>./suites/ExtensionsTestSuite.php</file>
 26+ </testsuite>
2427 </testsuites>
2528 <groups>
2629 <exclude>
Index: trunk/phase3/maintenance/tests/phpunit/suites/ExtensionsTestSuite.php
@@ -1,4 +1,34 @@
22 <?php
33 /**
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

Follow-up revisions

RevisionCommit summaryAuthorDate
r74559Follow-up r74558: remove var_dump()maxsem19:19, 9 October 2010

Status & tagging log