- /**
- * Auth-less test of Title::isValidMoveOperation
- *
- * @param string $source
- * @param string $target
- * @param array|string|bool $expected Required error
- * @dataProvider provideTestIsValidMoveOperation
- * @covers Title::isValidMoveOperation
- */
- public function testIsValidMoveOperation( $source, $target, $expected ) {
- $this->hideDeprecated( 'Title::isValidMoveOperation' );
-
- $this->setMwGlobals( 'wgContentHandlerUseDB', false );
- $title = Title::newFromText( $source );
- $nt = Title::newFromText( $target );
- $errors = $title->isValidMoveOperation( $nt, false );
- if ( $expected === true ) {
- $this->assertTrue( $errors );
- } else {
- $errors = $this->flattenErrorsArray( $errors );
- foreach ( (array)$expected as $error ) {
- $this->assertContains( $error, $errors );
- }
- }
- }
-
- public static function provideTestIsValidMoveOperation() {
- return [
- // 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' ],
- ];
- }
-