From 6ad3716d43f0e6237a4b9171703221c6708d090e Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Sun, 21 Aug 2011 19:28:35 +0000 Subject: [PATCH] follow-up r95171 - add unit test for tracking categories. --- tests/phpunit/includes/ExtraParserTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index 1fdee947d1..a38f1c32f5 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -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 ); + } } -- 2.20.1