Index: trunk/phase3/maintenance/tests/phpunit/includes/TitleTest.php |
— | — | @@ -1,6 +1,10 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class TitleTest extends PHPUnit_Framework_TestCase { |
| 5 | + function setUp() { |
| 6 | + global $wgContLang; |
| 7 | + $wgContLang = Language::factory( 'en' ); |
| 8 | + } |
5 | 9 | |
6 | 10 | function testLegalChars() { |
7 | 11 | $titlechars = Title::legalChars(); |
— | — | @@ -14,4 +18,24 @@ |
15 | 19 | } |
16 | 20 | } |
17 | 21 | } |
| 22 | + |
| 23 | + /** |
| 24 | + * Test originally wrote to investigate bug 24343 |
| 25 | + * FIXME : some tests might fail depending on local settings. |
| 26 | + */ |
| 27 | + function testGetURLS() { |
| 28 | + global $wgArticlePath, $wgScript; |
| 29 | + |
| 30 | + $title = Title::newFromText( 'User:Bob#section' ); |
| 31 | + |
| 32 | + $this->assertEquals( "$wgScript/User:Bob", $title->getLocalURL(), |
| 33 | + 'Title::getLocalURL() does NOT have fragment' ); |
| 34 | + $this->assertEquals( "$wgScript/User:Bob", $title->escapeLocalURL(), |
| 35 | + 'Title::escapeLocalURL() does NOT have fragment' ); |
| 36 | + $this->assertEquals( "$wgScript/User:Bob#section", $title->getLinkURL(), |
| 37 | + 'Title::getLinkURL() does have fragment' ); |
| 38 | + |
| 39 | + #$this->assertEquals( 'toto', $title->getFullURL() ); |
| 40 | + #$this->assertEquals( 'toto', $title->escapeFullURL() ); |
| 41 | + } |
18 | 42 | } |
Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -31,6 +31,7 @@ |
32 | 32 | $parser->setFunctionHook( 'localurle', array( __CLASS__, 'localurle' ), SFH_NO_HASH ); |
33 | 33 | $parser->setFunctionHook( 'fullurl', array( __CLASS__, 'fullurl' ), SFH_NO_HASH ); |
34 | 34 | $parser->setFunctionHook( 'fullurle', array( __CLASS__, 'fullurle' ), SFH_NO_HASH ); |
| 35 | + $parser->setFunctionHook( 'linkurl', array( __CLASS__, 'linkurl' ), SFH_NO_HASH ); |
35 | 36 | $parser->setFunctionHook( 'formatnum', array( __CLASS__, 'formatnum' ), SFH_NO_HASH ); |
36 | 37 | $parser->setFunctionHook( 'grammar', array( __CLASS__, 'grammar' ), SFH_NO_HASH ); |
37 | 38 | $parser->setFunctionHook( 'gender', array( __CLASS__, 'gender' ), SFH_NO_HASH ); |
— | — | @@ -194,6 +195,7 @@ |
195 | 196 | static function localurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeLocalURL', $s, $arg ); } |
196 | 197 | static function fullurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getFullURL', $s, $arg ); } |
197 | 198 | static function fullurle( $parser, $s = '', $arg = null ) { return self::urlFunction( 'escapeFullURL', $s, $arg ); } |
| 199 | + static function linkurl( $parser, $s = '', $arg = null ) { return self::urlFunction( 'getLinkUrl', $s, $arg ); } |
198 | 200 | |
199 | 201 | static function urlFunction( $func, $s = '', $arg = null ) { |
200 | 202 | $title = Title::newFromText( $s ); |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -295,6 +295,7 @@ |
296 | 296 | 'nse' => array( 0, 'NSE:' ), |
297 | 297 | 'localurl' => array( 0, 'LOCALURL:' ), |
298 | 298 | 'localurle' => array( 0, 'LOCALURLE:' ), |
| 299 | + 'linkurl' => array( 0, 'LINKURL:' ), |
299 | 300 | 'articlepath' => array( 0, 'ARTICLEPATH' ), |
300 | 301 | 'server' => array( 0, 'SERVER' ), |
301 | 302 | 'servername' => array( 0, 'SERVERNAME' ), |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -167,6 +167,7 @@ |
168 | 168 | limit for IP addresses: [[MediaWiki:Ratelimit-excluded-ips]] |
169 | 169 | * Special:Version now displays whether a SQLite database supports full-text |
170 | 170 | search. |
| 171 | +* (bug 24343) New parser hook {{linkurl:}}, same as {{localurl:}} with fragment |
171 | 172 | |
172 | 173 | === Bug fixes in 1.17 === |
173 | 174 | * (bug 17560) Half-broken deletion moved image files to deletion archive |