From f6d65e533c62f6deb21342d4901ece24497b433e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 4 Jun 2015 07:31:04 +0200 Subject: Update to MediaWiki 1.25.1 --- tests/phpunit/includes/MovePageTest.php | 63 +++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/phpunit/includes/MovePageTest.php (limited to 'tests/phpunit/includes/MovePageTest.php') diff --git a/tests/phpunit/includes/MovePageTest.php b/tests/phpunit/includes/MovePageTest.php new file mode 100644 index 00000000..9501e452 --- /dev/null +++ b/tests/phpunit/includes/MovePageTest.php @@ -0,0 +1,63 @@ +setMwGlobals( 'wgContentHandlerUseDB', false ); + $mp = new MovePage( + Title::newFromText( $old ), + Title::newFromText( $new ) + ); + $status = $mp->isValidMove(); + if ( $error === true ) { + $this->assertTrue( $status->isGood() ); + } else { + $this->assertTrue( $status->hasMessage( $error ) ); + } + } + + /** + * This should be kept in sync with TitleTest::provideTestIsValidMoveOperation + */ + public static function provideIsValidMove() { + return array( + // for MovePage::isValidMove + array( 'Test', 'Test', 'selfmove' ), + array( 'Special:FooBar', 'Test', 'immobile-source-namespace' ), + array( 'Test', 'Special:FooBar', 'immobile-target-namespace' ), + array( 'MediaWiki:Common.js', 'Help:Some wikitext page', 'bad-target-model' ), + array( 'Page', 'File:Test.jpg', 'nonfile-cannot-move-to-file' ), + // for MovePage::isValidFileMove + array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' ), + ); + } + + /** + * Integration test to catch regressions like T74870. Taken and modified + * from SemanticMediaWiki + */ + public function testTitleMoveCompleteIntegrationTest() { + $oldTitle = Title::newFromText( 'Help:Some title' ); + WikiPage::factory( $oldTitle )->doEditContent( new WikitextContent( 'foo' ), 'bar' ); + $newTitle = Title::newFromText( 'Help:Some other title' ); + $this->assertNull( + WikiPage::factory( $newTitle )->getRevision() + ); + + $this->assertTrue( $oldTitle->moveTo( $newTitle, false, 'test1', true ) ); + $this->assertNotNull( + WikiPage::factory( $oldTitle )->getRevision() + ); + $this->assertNotNull( + WikiPage::factory( $newTitle)->getRevision() + ); + } +} -- cgit v1.2.3-54-g00ecf