* @param string|bool $error Expected error for test (or true for no error)
*/
public function testIsValidMerge( $source, $dest, $timestamp, $error ) {
- $this->setMwGlobals( 'wgContentHandlerUseDB', false );
if ( $timestamp === true ) {
// Although this timestamp is after the latest timestamp of both pages,
// MergeHistory should select the latest source timestamp up to this which should
* @covers MovePage::isValidFileMove
*/
public function testIsValidMove( $old, $new, $error ) {
- $this->setMwGlobals( 'wgContentHandlerUseDB', false );
+ global $wgMultiContentRevisionSchemaMigrationStage;
+ if ( $wgMultiContentRevisionSchemaMigrationStage === SCHEMA_COMPAT_OLD ) {
+ // We can only set this to false with the old schema
+ $this->setMwGlobals( 'wgContentHandlerUseDB', false );
+ }
$mp = new MovePage(
Title::newFromText( $old ),
Title::newFromText( $new )
* This should be kept in sync with TitleTest::provideTestIsValidMoveOperation
*/
public static function provideIsValidMove() {
- return [
+ global $wgMultiContentRevisionSchemaMigrationStage;
+ $ret = [
// for MovePage::isValidMove
[ 'Test', 'Test', 'selfmove' ],
[ 'Special:FooBar', 'Test', 'immobile-source-namespace' ],
[ 'Test', 'Special:FooBar', 'immobile-target-namespace' ],
- [ 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ],
[ 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ],
// for MovePage::isValidFileMove
[ 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ],
];
+ if ( $wgMultiContentRevisionSchemaMigrationStage === SCHEMA_COMPAT_OLD ) {
+ // The error can only occur if $wgContentHandlerUseDB is false, which doesn't work with
+ // the new schema, so omit the test in that case
+ array_push( $ret,
+ [ 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ] );
+ }
+ return $ret;
}
/**
* @covers Title::isValidMoveOperation
*/
public function testIsValidMoveOperation( $source, $target, $expected ) {
+ global $wgMultiContentRevisionSchemaMigrationStage;
+
$this->hideDeprecated( 'Title::isValidMoveOperation' );
- $this->setMwGlobals( 'wgContentHandlerUseDB', false );
+ if ( $wgMultiContentRevisionSchemaMigrationStage === SCHEMA_COMPAT_OLD ) {
+ // We can only set this to false with the old schema
+ $this->setMwGlobals( 'wgContentHandlerUseDB', false );
+ }
+
$title = Title::newFromText( $source );
$nt = Title::newFromText( $target );
$errors = $title->isValidMoveOperation( $nt, false );
}
public static function provideTestIsValidMoveOperation() {
- return [
+ global $wgMultiContentRevisionSchemaMigrationStage;
+ $ret = [
// for Title::isValidMoveOperation
[ 'Some page', '', 'badtitletext' ],
[ 'Test', 'Test', 'selfmove' ],
[ 'Special:FooBar', 'Test', 'immobile-source-namespace' ],
[ 'Test', 'Special:FooBar', 'immobile-target-namespace' ],
- [ 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ],
[ 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ],
[ 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ],
];
+ if ( $wgMultiContentRevisionSchemaMigrationStage === SCHEMA_COMPAT_OLD ) {
+ // The error can only occur if $wgContentHandlerUseDB is false, which doesn't work with
+ // the new schema, so omit the test in that case
+ array_push( $ret,
+ [ 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ]
+ );
+ }
+ return $ret;
}
/**