Don't setup/destroy for databaseless tests.
Make needsDB() return based on the DocComment.
Delayed db init until the test is run, so that it isn't set for excluded tests (the exclusion is done after all the classes are instantiated).
$this->data = $data;
$this->dataName = $dataName;
$this->data = $data;
$this->dataName = $dataName;
+ }
+
+ function run( PHPUnit_Framework_TestResult $result = NULL ) {
if( $this->needsDB() && !is_object( $this->dbClone ) ) {
$this->initDB();
$this->addCoreDBData();
$this->addDBData();
}
if( $this->needsDB() && !is_object( $this->dbClone ) ) {
$this->initDB();
$this->addCoreDBData();
$this->addDBData();
}
+ parent::run( $result );
- if( $this->needsDB() && is_object( $this->dbClone ) && $this->dbClone instanceof CloneDatabase ) {
+ if( is_object( $this->dbClone ) && $this->dbClone instanceof CloneDatabase ) {
- function needsDB() { return true; }
+ function needsDB() {
+ $rc = new ReflectionClass( $this );
+ return strpos( '@group Database', $rc->getDocComment() ) !== false;
+ }
+/**
+ * @group Database
+ */
class BlockTest extends MediaWikiTestCase {
private $block, $madeAt;
class BlockTest extends MediaWikiTestCase {
private $block, $madeAt;
/**
* These tests should work regardless of $wgCapitalLinks
/**
* These tests should work regardless of $wgCapitalLinks
*/
class LocalFileTest extends MediaWikiTestCase {
*/
class LocalFileTest extends MediaWikiTestCase {
+/**
+ * @group Database
+ */
class NewDBTest extends MediaWikiTestCase {
function setUp() {
class NewDBTest extends MediaWikiTestCase {
function setUp() {