Allow test to remove data from the database
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 28 May 2011 21:19:24 +0000 (21:19 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 28 May 2011 21:19:24 +0000 (21:19 +0000)
This new removeDBData() is run after the tests result. It is similar
to the addDBData() method.

tests/phpunit/MediaWikiTestCase.php

index 3363e3f..1051844 100644 (file)
@@ -59,6 +59,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                        $this->addDBData();
                        
                        parent::run( $result );
+
+                       $this->removeDBData();
+
                } else {
                        parent::run( $result );
                }
@@ -84,6 +87,12 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         * implement this method and do so
         */
        function addDBData() {}
+
+       /**
+        * Stub. If a test needs to remove data from the database. Called after
+        * test run.
+        */
+       function removeDBData() {}
        
        private function addCoreDBData() {