phpunit: factor out logic to handle globals vars
loggingTest data providers loads $wgConf in global scope. With PHPUnit
backing up globals on each test, that slow down the test run. The class
has logic to restore the globals in the data provider so tests get run
with a clean global scope.
cirrusTest has the same need. Hence factor out global handling code to a
new PHPUnit_FrameWork_TestCase: WgConfTestCase.
Switch loggingTest to it.
When setting globals with setGlobals(), we want to make sure they are
restored with restoreGlobals(). Thus throw an exception whenever the
test case object is descruted but globals have not been restored, that
will prevent unintentional leaks.
Test runs for cirrusTest goes from 7s to 3s.
Later on WgConfTestCase can be extended to load a $wgConf object. That
seems to be a common behavior of loggingTest and cirrusTest.