If the test says it uses database tables, then it needs the database.
And while we are at it, make the check for the test group declaration
more lenient.
Patch set 2: tweaked according to demon's comments.
Change-Id: Ib123745d45b85cebeab5ec87ea7d8227ec3d1dea
}
function needsDB() {
+ # if the test says it uses database tables, it needs the database
+ if ( $this->tablesUsed ) {
+ return true;
+ }
+
+ # if the test says it belongs to the Database group, it needs the database
$rc = new ReflectionClass( $this );
- return strpos( $rc->getDocComment(), '@group Database' ) !== false;
+ if ( preg_match( '/@group +Database/im', $rc->getDocComment() ) ) {
+ return true;
+ }
+
+ return false;
}
/**