Log test setup, start and end to the tests-phpunit log channel. This
helps when interpreting debug logs. The channel name was chosen by
analogy with the existing tests-parser log channel.
Change-Id: I2bc87564247f2f136b2244d426fa127d21663f92
*/
private $loggers = [];
*/
private $loggers = [];
+ /**
+ * @var LoggerInterface
+ */
+ private $testLogger;
+
/**
* Table name prefixes. Oracle likes it shorter.
*/
/**
* Table name prefixes. Oracle likes it shorter.
*/
$this->backupGlobals = false;
$this->backupStaticAttributes = false;
$this->backupGlobals = false;
$this->backupStaticAttributes = false;
+ $this->testLogger = self::getTestLogger();
+ }
+
+ private static function getTestLogger() {
+ return LoggerFactory::getInstance( 'tests-phpunit' );
}
public function __destruct() {
}
public function __destruct() {
if ( !self::$dbSetup || $this->needsDB() ) {
// set up a DB connection for this test to use
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' );
self::$useTemporaryTables = !$this->getCliArg( 'use-normal-tables' );
self::$reuseDB = $this->getCliArg( 'reuse-db' );
+ $this->testLogger->info( "Starting test " . $this->toString() );
+ $this->testLogger->info( "Finished test " . $this->toString() );
+ $this->testLogger->info( "Resetting DB" );
$this->resetDB( $this->db, $this->tablesUsed );
}
}
$this->resetDB( $this->db, $this->tablesUsed );
}
}
}
// Check for unsafe queries
if ( $this->db->getType() === 'mysql' ) {
}
// 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->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() {
* @since 1.32
*/
protected function addCoreDBData() {
+ $this->testLogger->info( __METHOD__ );
if ( $this->db->getType() == 'oracle' ) {
# Insert 0 user to prevent FK violations
# Anonymous user
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' ) {
// 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 ] );
}
Hooks::run( 'UnitTestsAfterDatabaseSetup', [ $db, $prefix ] );