Merge "FauxRequest: don’t override getValues()"
[lhc/web/wiklou.git] / tests / phpunit / includes / TitleMethodsTest.php
index 25dc9b3..ec002e0 100644 (file)
@@ -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 ],
@@ -351,7 +327,7 @@ class TitleMethodsTest extends MediaWikiLangTestCase {
 
                $title2 = Title::newFromText( 'Foo' );
                $this->assertNotSame( $title1, $title2, 'title cache should be empty' );
-               $this->assertEquals( 0, $linkCache->getGoodLinkID( 'Foo' ), 'link cache should be empty' );
+               $this->assertSame( 0, $linkCache->getGoodLinkID( 'Foo' ), 'link cache should be empty' );
        }
 
        public function provideGetLinkURL() {
@@ -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();