doc: Fix a few Example docs for PHP classes
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiTestCase.php
index c2eebfa..31cfa70 100644 (file)
@@ -5,6 +5,8 @@ use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\Logger\MonologSpi;
 use MediaWiki\MediaWikiServices;
 use Psr\Log\LoggerInterface;
+use Wikimedia\Rdbms\IMaintainableDatabase;
+use Wikimedia\Rdbms\Database;
 use Wikimedia\TestingAccessWrapper;
 
 /**
@@ -638,8 +640,8 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         * The key is added to the array of globals that will be reset afterwards
         * in the tearDown().
         *
-        * @example
-        * <code>
+        * @par Example
+        * @code
         *     protected function setUp() {
         *         $this->setMwGlobals( 'wgRestrictStuff', true );
         *     }
@@ -654,7 +656,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         *     }
         *
         *     function testQuux() {}
-        * </code>
+        * @endcode
         *
         * @param array|string $pairs Key to the global variable, or an array
         *  of key/value pairs.
@@ -1049,7 +1051,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
 
        private function addCoreDBData() {
                if ( $this->db->getType() == 'oracle' ) {
-
                        # Insert 0 user to prevent FK violations
                        # Anonymous user
                        if ( !$this->db->selectField( 'user', '1', [ 'user_id' => 0 ] ) ) {
@@ -1114,6 +1115,8 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                        return;
                }
 
+               Hooks::run( 'UnitTestsBeforeDatabaseTeardown' );
+
                foreach ( $wgJobClasses as $type => $class ) {
                        // Delete any jobs under the clone DB (or old prefix in other stores)
                        JobQueueGroup::singleton()->get( $type )->delete();
@@ -1216,6 +1219,8 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                if ( $db->getType() == 'oracle' ) {
                        $db->query( 'BEGIN FILL_WIKI_INFO; END;' );
                }
+
+               Hooks::run( 'UnitTestsAfterDatabaseSetup', [ $db, $prefix ] );
        }
 
        /**
@@ -1713,7 +1718,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
                        if ( !isset( $wgNamespaceContentModels[$ns] ) ||
                                $wgNamespaceContentModels[$ns] === CONTENT_MODEL_WIKITEXT
                        ) {
-
                                $wikitextNS = $ns;
 
                                return $wikitextNS;