HomePhabricator

Improve test coverage for ImportPlanValidator::cleanWikitext()

Authored by thiemowmde on Jun 5 2019, 9:55 AM.

Description

Improve test coverage for ImportPlanValidator::cleanWikitext()

Pretty much all relevant code is already covered via the
WikitextContentCleaner test. But the small snippet of code in
ImportPlanValidator::cleanWikitext() was not covered, especially not the
Title construction, exists() and setSourceWikiLanguageTemplate() calls.

This test now asserts:

  • The details object must contain a language.
  • That language must make it to the cleaner. Otherwise it won't add the {{de|…}} template.
  • The actual title is transformed into uppercase Template:De. This is critical when checking if it exists. I tried and the test fails when makeTitle() is used instead of makeTitleSafe().

Bug: T198607
Change-Id: I4219b48a1b9f9be448379f4d6629d84065e6d1de