wiki.techinc.nl/tests/phpunit/includes/Storage/PreMcrSchemaOverride.php
Umherirrender 2faeb43453 Remove @override annotation
Doxygen does not know about this annotation

Change-Id: I5a2cac83899acd6954caba16da5023fe1ce09c50
2018-08-07 10:15:53 +00:00

53 lines
1.1 KiB
PHP

<?php
namespace MediaWiki\Tests\Storage;
use Wikimedia\Rdbms\IMaintainableDatabase;
use MediaWiki\DB\PatchFileLocation;
/**
* Trait providing schema overrides that allow tests to run against the pre-MCR database schema.
*/
trait PreMcrSchemaOverride {
use PatchFileLocation;
use McrSchemaDetection;
/**
* @return int
*/
protected function getMcrMigrationStage() {
return MIGRATION_OLD;
}
/**
* @return string[]
*/
protected function getMcrTablesToReset() {
return [];
}
/**
* @return array[]
*/
protected function getSchemaOverrides( IMaintainableDatabase $db ) {
$overrides = [
'scripts' => [],
'drop' => [],
'create' => [],
'alter' => [],
];
if ( $this->hasMcrTables( $db ) ) {
$overrides['drop'] = [ 'slots', 'content', 'slot_roles', 'content_models', ];
$overrides['scripts'][] = $this->getSqlPatchPath( $db, '/drop-mcr-tables', __DIR__ );
}
if ( !$this->hasPreMcrFields( $db ) ) {
$overrides['alter'][] = 'revision';
$overrides['scripts'][] = $this->getSqlPatchPath( $db, '/create-pre-mcr-fields', __DIR__ );
}
return $overrides;
}
}