follow-up r95171 - add unit test for tracking categories.
authorBrian Wolff <bawolff@users.mediawiki.org>
Sun, 21 Aug 2011 19:28:35 +0000 (19:28 +0000)
committerBrian Wolff <bawolff@users.mediawiki.org>
Sun, 21 Aug 2011 19:28:35 +0000 (19:28 +0000)
tests/phpunit/includes/ExtraParserTest.php

index 1fdee94..a38f1c3 100644 (file)
@@ -134,4 +134,20 @@ class ExtraParserTest extends MediaWikiTestCase {
                        'finalTitle' => $title,
                        'deps' => $deps );
        }
+       function testTrackingCategory() {
+               $title = Title::newFromText( __FUNCTION__ );
+               $catName =  wfMsgForContent( 'broken-file-category' );
+               $cat = Title::makeTitleSafe( NS_CATEGORY, $catName );
+               $expected = array( $cat->getDBkey() );
+               $parserOutput = $this->parser->parse( "[[file:nonexistent]]" , $title, $this->options );
+               $result = $parserOutput->getCategoryLinks();
+               $this->assertEquals( $expected, $result );
+       }
+       function testTrackingCategorySpecial() {
+               // Special pages shouldn't have tracking cats.
+               $title = SpecialPage::getTitleFor( 'Contributions' );
+               $parserOutput = $this->parser->parse( "[[file:nonexistent]]" , $title, $this->options );
+               $result = $parserOutput->getCategoryLinks();
+               $this->assertEmpty( $result );
+       }
  }