Avoid extensions conflicts by hook GetPreferences

Some other extensions register GetPreferences which can cause troubles
when running tests. Known incompatibility are with OATHAuth and
OpenStackManager.

The fix is to override $wgHooks['GetPreferences'] to discard any hooks
set by another extension and only register the BetaFeatures callback.
Using setMwGlobals() happilly restore the hooks after each test.

Since the code was being used in three classes, I factored out common
code (ie creation of a user belonging to the 'unittests' group) and
added the hook magic.

The test classes AutoEnrollmentTest, DependentFeatureTest and
PreferenceHandlingTest now extends BetaFeaturesTestCase.

This patch also removes HooksRunTest::testCanRegisterHooks(). It is
asserting the GetBetaFeaturePreferences hook is registered. That never
happen in the code.  I suspect the code was passing because the hooks
were not restaured between tests, they now are thanks to setMwGlobals().

Bug: 67138
Change-Id: If0b6d0a35028bfdcbfcf6409450620401edf01b3
Merge "Avoid extensions conflicts by hook GetPreferences"