X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTitleMethodsTest.php;h=77d6f59d21cb249d8acf3342f1eb8a10cc93cbf6;hb=902c7eef341ce5b7aae13113d2bb2369868e5b2a;hp=25dc9b3e30cf8c8c11784ae160047b860f82b01d;hpb=342749942bb05852b645bbda23bc60695c25ac79;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/TitleMethodsTest.php b/tests/phpunit/includes/TitleMethodsTest.php index 25dc9b3e30..77d6f59d21 100644 --- a/tests/phpunit/includes/TitleMethodsTest.php +++ b/tests/phpunit/includes/TitleMethodsTest.php @@ -31,30 +31,6 @@ class TitleMethodsTest extends MediaWikiLangTestCase { ); } - public static function provideEquals() { - return [ - [ 'Main Page', 'Main Page', true ], - [ 'Main Page', 'Not The Main Page', false ], - [ 'Main Page', 'Project:Main Page', false ], - [ 'File:Example.png', 'Image:Example.png', true ], - [ 'Special:Version', 'Special:Version', true ], - [ 'Special:Version', 'Special:Recentchanges', false ], - [ 'Special:Version', 'Main Page', false ], - ]; - } - - /** - * @dataProvider provideEquals - * @covers Title::equals - */ - public function testEquals( $titleA, $titleB, $expectedBool ) { - $titleA = Title::newFromText( $titleA ); - $titleB = Title::newFromText( $titleB ); - - $this->assertEquals( $expectedBool, $titleA->equals( $titleB ) ); - $this->assertEquals( $expectedBool, $titleB->equals( $titleA ) ); - } - public static function provideInNamespace() { return [ [ 'Main Page', NS_MAIN, true ], @@ -461,6 +437,31 @@ class TitleMethodsTest extends MediaWikiLangTestCase { $this->assertSame( $expected, $title->getLinkURL( $query, $query2, $proto ) ); } + /** + * Integration test to catch regressions like T74870. Taken and modified + * from SemanticMediaWiki + * + * @covers Title::moveTo + */ + public function testTitleMoveCompleteIntegrationTest() { + $this->hideDeprecated( 'Title::moveTo' ); + + $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() + ); + } + function tearDown() { Title::clearCaches(); parent::tearDown();