*/
private $normalizationFunctions = [];
+ /**
+ * Run disabled parser tests
+ * @var bool
+ */
+ private $runDisabled;
+
+ /**
+ * Run tests intended only for parsoid
+ * @var bool
+ */
+ private $runParsoid;
+
+ /**
+ * Disable parse on article insertion
+ * @var bool
+ */
+ private $disableSaveParse;
+
+ /**
+ * Reuse upload directory
+ * @var bool
+ */
+ private $keepUploads;
+
/**
* @param TestRecorder $recorder
* @param array $options
$this->keepUploads = !empty( $options['keep-uploads'] );
- $this->fileBackendName = isset( $options['file-backend'] ) ?
- $options['file-backend'] : false;
+ $this->fileBackendName = $options['file-backend'] ?? false;
$this->runDisabled = !empty( $options['run-disabled'] );
$this->runParsoid = !empty( $options['run-parsoid'] );
+ $this->disableSaveParse = !empty( $options['disable-save-parse'] );
+
$this->tidySupport = new TidySupport( !empty( $options['use-tidy-config'] ) );
if ( !$this->tidySupport->isEnabled() ) {
$this->recorder->warning(
if ( is_int( $name ) ) {
$value();
} else {
- $saved[$name] = isset( $GLOBALS[$name] ) ? $GLOBALS[$name] : null;
+ $saved[$name] = $GLOBALS[$name] ?? null;
$GLOBALS[$name] = $value;
}
}
* @return bool
*/
public function isSetupDone( $funcName ) {
- return isset( $this->setupDone[$funcName] ) ? $this->setupDone[$funcName] : false;
+ return $this->setupDone[$funcName] ?? false;
}
/**
/**
* Get a Parser object
*
- * @param string $preprocessor
+ * @param string|null $preprocessor
* @return Parser
*/
function getParser( $preprocessor = null ) {
}
$local = isset( $opts['local'] );
- $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null;
+ $preprocessor = $opts['preprocessor'] ?? null;
$parser = $this->getParser( $preprocessor );
$title = Title::newFromText( $titleText );
'site_stats', 'ipblocks', 'image', 'oldimage',
'recentchanges', 'watchlist', 'interwiki', 'logging', 'log_search',
'querycache', 'objectcache', 'job', 'l10n_cache', 'redirect', 'querycachetwo',
- 'archive', 'user_groups', 'page_props', 'category'
+ 'archive', 'user_groups', 'page_props', 'category',
+ 'slots', 'content', 'slot_roles', 'content_models',
];
if ( $wgCommentTableSchemaMigrationStage >= MIGRATION_WRITE_BOTH ) {
$this->dbClone = new CloneDatabase( $this->db, $this->listTables(), $prefix );
$this->dbClone->useTemporaryTables( $temporary );
$this->dbClone->cloneTableStructure();
+ CloneDatabase::changePrefix( $prefix );
if ( $dbType == 'oracle' ) {
$this->db->query( 'BEGIN FILL_WIKI_INFO; END;' );
// Wipe some DB query result caches on setup and teardown
$reset = function () {
- LinkCache::singleton()->clear();
+ MediaWikiServices::getInstance()->getLinkCache()->clear();
// Clear the message cache
MessageCache::singleton()->clear();
$this->checkSetupDone( 'setupDatabase' );
$this->dbClone->destroy();
- $this->databaseSetupDone = false;
if ( $this->useTemporaryTables ) {
if ( $this->db->getType() == 'sqlite' ) {
);
}
- // Use mock parser, to make debugging of actual parser tests simpler.
+ // Optionally use mock parser, to make debugging of actual parser tests simpler.
// But initialise the MessageCache clone first, don't let MessageCache
// get a reference to the mock object.
- MessageCache::singleton()->getParser();
- $restore = $this->executeSetupSnippets( [ 'wgParser' => new ParserTestMockParser ] );
+ if ( $this->disableSaveParse ) {
+ MessageCache::singleton()->getParser();
+ $restore = $this->executeSetupSnippets( [ 'wgParser' => new ParserTestMockParser ] );
+ } else {
+ $restore = false;
+ }
try {
$status = $page->doEditContent(
$newContent,
EDIT_NEW | EDIT_INTERNAL
);
} finally {
- $restore();
+ if ( $restore ) {
+ $restore();
+ }
}
if ( !$status->isOK() ) {