TitleFormatter: Implement fbc144965315 and unify prefix logic
authorKunal Mehta <legoktm@member.fsf.org>
Sat, 18 Aug 2018 00:09:26 +0000 (17:09 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Sat, 18 Aug 2018 00:43:52 +0000 (17:43 -0700)
commit63b2003520134dd3bc90ade3ad0c78d96461cff6
tree512b38e214c95bac836dbaa0436c3da6166fc58f
parente4e3e64f3a3630f94912f79e5c36f7f48dc16744
TitleFormatter: Implement fbc144965315 and unify prefix logic

fbc144965315 (Make Titles with an unknown namespace ID refer to
Special:Badtitle.) was never implemented in TitleFormatter, so let's do
that.

While we're at it, formatTitle() is now structured in the same format as
Title::prefix(), to make it easier to compare code between the two
implementations. The existing tests verify that this is a no-op. There's
a little extra indirection in getPrefixedDBkey(), which now goes through
dbkeyform -> textform -> dbkeyform, but reduces duplication of code,
which I think is worth it.

Bug: T165149
Change-Id: I4e43487a52663d2a647f9e71d487f58e25474f7a
includes/title/MediaWikiTitleCodec.php
tests/phpunit/includes/title/MediaWikiTitleCodecTest.php