*/
private $loggers = [];
+ /**
+ * @var LoggerInterface
+ */
+ private $testLogger;
+
/**
* Table name prefixes. Oracle likes it shorter.
*/
$this->backupGlobals = false;
$this->backupStaticAttributes = false;
+ $this->testLogger = self::getTestLogger();
+ }
+
+ private static function getTestLogger() {
+ return LoggerFactory::getInstance( 'tests-phpunit' );
}
public function __destruct() {
if ( !self::$dbSetup || $this->needsDB() ) {
// set up a DB connection for this test to use
+ $this->testLogger->info( "Setting up DB for " . $this->toString() );
self::$useTemporaryTables = !$this->getCliArg( 'use-normal-tables' );
self::$reuseDB = $this->getCliArg( 'reuse-db' );
$needsResetDB = true;
}
+ $this->testLogger->info( "Starting test " . $this->toString() );
parent::run( $result );
+ $this->testLogger->info( "Finished test " . $this->toString() );
if ( $needsResetDB ) {
+ $this->testLogger->info( "Resetting DB" );
$this->resetDB( $this->db, $this->tablesUsed );
}
}
}
// Check for unsafe queries
if ( $this->db->getType() === 'mysql' ) {
- $this->db->query( "SET sql_mode = 'STRICT_ALL_TABLES'" );
+ $this->db->query( "SET sql_mode = 'STRICT_ALL_TABLES'", __METHOD__ );
}
}
$this->db->rollback( __METHOD__, 'flush' );
}
if ( $this->db->getType() === 'mysql' ) {
- $this->db->query( "SET sql_mode = " . $this->db->addQuotes( $wgSQLMode ) );
+ $this->db->query( "SET sql_mode = " . $this->db->addQuotes( $wgSQLMode ),
+ __METHOD__ );
}
}
* @since 1.32
*/
protected function addCoreDBData() {
+ $this->testLogger->info( __METHOD__ );
if ( $this->db->getType() == 'oracle' ) {
# Insert 0 user to prevent FK violations
# Anonymous user
// Assuming this isn't needed for External Store database, and not sure if the procedure
// would be available there.
if ( $db->getType() == 'oracle' ) {
- $db->query( 'BEGIN FILL_WIKI_INFO; END;' );
+ $db->query( 'BEGIN FILL_WIKI_INFO; END;', __METHOD__ );
}
Hooks::run( 'UnitTestsAfterDatabaseSetup', [ $db, $prefix ] );