private $loggers = [];
/**
- * @var LoggerInterface
+ * The CLI arguments passed through from phpunit.php
+ * @var array
*/
- private $testLogger;
+ private $cliArgs = [];
/**
* 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() {
}
public function run( PHPUnit_Framework_TestResult $result = null ) {
+ if ( $result instanceof MediaWikiTestResult ) {
+ $this->cliArgs = $result->getMediaWikiCliArgs();
+ }
$this->overrideMwServices();
$needsResetDB = false;
-
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 );
}
* @since 1.32
*/
protected function addCoreDBData() {
- $this->testLogger->info( __METHOD__ );
if ( $this->db->getType() == 'oracle' ) {
# Insert 0 user to prevent FK violations
# Anonymous user
* @return mixed
*/
public function getCliArg( $offset ) {
- if ( isset( PHPUnitMaintClass::$additionalOptions[$offset] ) ) {
- return PHPUnitMaintClass::$additionalOptions[$offset];
- }
-
- return null;
+ return $this->cliArgs[$offset] ?? null;
}
/**
* @param mixed $value
*/
public function setCliArg( $offset, $value ) {
- PHPUnitMaintClass::$additionalOptions[$offset] = $value;
+ $this->cliArgs[$offset] = $value;
}
/**