Merge "maintenance: Script to rename titles for Unicode uppercasing changes"
[lhc/web/wiklou.git] / tests / phpunit / includes / Revision / PreMcrSchemaOverride.php
1 <?php
2
3 namespace MediaWiki\Tests\Revision;
4
5 use Wikimedia\Rdbms\IMaintainableDatabase;
6 use MediaWiki\DB\PatchFileLocation;
7
8 /**
9 * Trait providing schema overrides that allow tests to run against the pre-MCR database schema.
10 */
11 trait PreMcrSchemaOverride {
12
13 use PatchFileLocation;
14 use McrSchemaDetection;
15
16 /**
17 * @return int
18 */
19 protected function getMcrMigrationStage() {
20 return MIGRATION_OLD;
21 }
22
23 /**
24 * @return string[]
25 */
26 protected function getMcrTablesToReset() {
27 return [];
28 }
29
30 /**
31 * @return array[]
32 */
33 protected function getSchemaOverrides( IMaintainableDatabase $db ) {
34 $overrides = [
35 'scripts' => [],
36 'drop' => [],
37 'create' => [],
38 'alter' => [],
39 ];
40
41 if ( $this->hasMcrTables( $db ) ) {
42 $overrides['drop'] = [ 'slots', 'content', 'slot_roles', 'content_models', ];
43 $overrides['scripts'][] = $this->getSqlPatchPath( $db, '/drop-mcr-tables', __DIR__ );
44 }
45
46 if ( !$this->hasPreMcrFields( $db ) ) {
47 $overrides['alter'][] = 'revision';
48 $overrides['scripts'][] = $this->getSqlPatchPath( $db, '/create-pre-mcr-fields', __DIR__ );
49 }
50
51 return $overrides;
52 }
53
54 }