resourceloader: Improve ResourceLoaderWikiModule test coverage
authorTimo Tijhof <krinklemail@gmail.com>
Thu, 25 Jul 2019 22:23:24 +0000 (23:23 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 25 Jul 2019 22:35:21 +0000 (23:35 +0100)
commite9cc45629e23f0d851711723a4809be3161fae0e
tree6858e47209e2759335bac9df39ed14cbb71c1084
parent167e6a449eec25faec036691e51788f467e34ac7
resourceloader: Improve ResourceLoaderWikiModule test coverage

* Remove redundant getContent() cases that were all testing the same.
  The redirect logic should indeed be tested, but exists in getContentObj(),
  not getContent(). This test was also mocking getContentObj() thus not
  actually testing what the case claims to test.
  Fortunately, the right test already exists (testGetContentForRedirects),
  so this is redundant.

* Add actual coverage of successful outcomes for getContent (previously
  they were all error/null cases), with JS content, and with CSS content.

* Fix broken test case for "Bad content model". This was not working because
  it mocked out getContentObj, thus it wasn't actually testing "bad content model",
  but rather pointlessly duplicated the previous test case.
  Fix it by actually making it use a WikitextContent object, which makes it
  test the branch that handles incompatible content models.

Change-Id: I59af5318e536c730755352e9be8f995df1f56a86
includes/resourceloader/ResourceLoaderWikiModule.php
tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php