MediaWikiTitleCodec can throw MalformedTitleException, which cannot be created in unit tests (see T281935). Until that changes, add a helper callback MediaWikiTitleCodec::$createMalformedTitleException that will by default return a MalformedTitleException, but tests can override this to return a mock. We add this as an option to DummyServicesTrait to throw generic `MalformedTitleException`s without regard to the specifics of the message or parameters provided, this can be used if no finer control is needed, or callers can manually change the callback. Demonstrate using it by moving the tests for UserNameUtils to be unit tests - the only thing blocking this was the creation of `MalformedTitleException`s. Change-Id: I11ae4c6292465626ad1e432f7c6e9754c8ef36c2 |
||
|---|---|---|
| .. | ||
| Hook | ||
| ForeignTitle.php | ||
| ForeignTitleFactory.php | ||
| ImportTitleFactory.php | ||
| MalformedTitleException.php | ||
| MediaWikiTitleCodec.php | ||
| NaiveForeignTitleFactory.php | ||
| NaiveImportTitleFactory.php | ||
| NamespaceAwareForeignTitleFactory.php | ||
| NamespaceImportTitleFactory.php | ||
| NamespaceInfo.php | ||
| SubpageImportTitleFactory.php | ||
| TitleFormatter.php | ||
| TitleParser.php | ||
| TitleValue.php | ||