Clarify the use of @group Database in MediaWikiTestCase
authoraddshore <addshorewiki@gmail.com>
Thu, 23 Nov 2017 19:19:14 +0000 (19:19 +0000)
committeraddshore <addshorewiki@gmail.com>
Thu, 23 Nov 2017 19:19:14 +0000 (19:19 +0000)
Only the class level doc comment is checked.
Adding @group Database to a method doc comment will do
nothing.

Change-Id: Ic0fff3636d6c44e7a27df8806c9712155ce81d8c

tests/phpunit/MediaWikiTestCase.php

index f04eec7..4d3c37b 100644 (file)
@@ -968,12 +968,13 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         * @since 1.18
         */
        public function needsDB() {
         * @since 1.18
         */
        public function needsDB() {
-               # if the test says it uses database tables, it needs the database
+               // If the test says it uses database tables, it needs the database
                if ( $this->tablesUsed ) {
                        return true;
                }
 
                if ( $this->tablesUsed ) {
                        return true;
                }
 
-               # if the test says it belongs to the Database group, it needs the database
+               // If the test class says it belongs to the Database group, it needs the database.
+               // NOTE: This ONLY checks for the group in the class level doc comment.
                $rc = new ReflectionClass( $this );
                if ( preg_match( '/@group +Database/im', $rc->getDocComment() ) ) {
                        return true;
                $rc = new ReflectionClass( $this );
                if ( preg_match( '/@group +Database/im', $rc->getDocComment() ) ) {
                        return true;