PHPUnit: Add Database tags
[lhc/web/wiklou.git] / tests / phpunit / includes / WikiPageTest.php
index 37f1975..7f7945b 100644 (file)
@@ -499,6 +499,10 @@ class WikiPageTest extends MediaWikiLangTestCase {
         * @covers WikiPage::getRedirectTarget
         */
        public function testGetRedirectTarget( $title, $model, $text, $target ) {
+               $this->setMwGlobals( array(
+                       'wgCapitalLinks' => true,
+               ) );
+
                $page = $this->createPage( $title, $text, $model );
 
                # sanity check, because this test seems to fail for no reason for some people.
@@ -817,6 +821,22 @@ more stuff
                $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) );
        }
 
+       /**
+        * @dataProvider dataReplaceSection
+        * @covers WikiPage::replaceSectionAtRev
+        */
+       public function testReplaceSectionAtRev( $title, $model, $text, $section,
+               $with, $sectionTitle, $expected
+       ) {
+               $page = $this->createPage( $title, $text, $model );
+               $baseRevId = $page->getLatest();
+
+               $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() );
+               $c = $page->replaceSectionAtRev( $section, $content, $sectionTitle, $baseRevId );
+
+               $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) );
+       }
+
        /* @todo FIXME: fix this!
        public function testGetUndoText() {
        $this->checkHasDiff3();