Support offsets in prefix searching
[mediawiki.git] / tests / phpunit / includes / MovePageTest.php
blob027b877ce440ef83058be8e12b82dcad678ff3a8
1 <?php
3 class MovePageTest extends MediaWikiTestCase {
5 /**
6 * @dataProvider provideIsValidMove
7 * @covers MovePage::isValidMove
8 * @covers MovePage::isValidFileMove
9 */
10 public function testIsValidMove( $old, $new, $error ) {
11 $this->setMwGlobals( 'wgContentHandlerUseDB', false );
12 $mp = new MovePage(
13 Title::newFromText( $old ),
14 Title::newFromText( $new )
16 $status = $mp->isValidMove();
17 if ( $error === true ) {
18 $this->assertTrue( $status->isGood() );
19 } else {
20 $this->assertTrue( $status->hasMessage( $error ) );
24 /**
25 * This should be kept in sync with TitleTest::provideTestIsValidMoveOperation
27 public static function provideIsValidMove() {
28 return array(
29 // for MovePage::isValidMove
30 array( 'Test', 'Test', 'selfmove' ),
31 array( 'Special:FooBar', 'Test', 'immobile-source-namespace' ),
32 array( 'Test', 'Special:FooBar', 'immobile-target-namespace' ),
33 array( 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ),
34 array( 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ),
35 // for MovePage::isValidFileMove
36 array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ),