Fix HtmlTest, XmlTest; Add setMwGlobals method to base TestCase.
authorTimo Tijhof <ttijhof@wikimedia.org>
Mon, 8 Oct 2012 10:59:55 +0000 (12:59 +0200)
committerTimo Tijhof <ttijhof@wikimedia.org>
Mon, 8 Oct 2012 22:26:52 +0000 (00:26 +0200)
commitd1c8bf85f86e3a535bcb1c484855631ae4930036
tree75dd87fe1d533507eab5c826599c197352fd479f
parenta7153315a6fd6b41949098537dd2023b9754e736
Fix HtmlTest, XmlTest; Add setMwGlobals method to base TestCase.

The HTML and XML test now set the globals they depend on
(instead of relying on the default settings).

Tests for the "other" scenarios still exist, globals are
overridden inline. They are automatically restored after each
test## function by PHPUnit from MediaWikiTestCase::tearDown.

Also fixed 2 other problems with the test suite:

* HtmlTest::testDropDefaults forgot to pass
  $message to the assertion from the provider ($case[3]).

* The data provider for HtmlTest::testDropDefaults was calling
  Html::element directly (instead of calling it within the test)
  which is problematic because data providers are expected to be
  static. PHPUnit calls them outside the setUp/tearDown flow.
  (also fixed the function to be public static, as PHPUnit
  expects).

That last one was crucial to make the test still pass correctly.

Updated the expected strings to what they are with these
fixed non-leakage settings.

Took wgHtml5 without xmlform as default. And added tests
for variations where it made sense.

Change-Id: Iccf6ea81f4bc2639273ab2ad101c58788ee49d45
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/HtmlTest.php
tests/phpunit/includes/XmlTest.php