Refactor hook handling in ResourceLoaderTest

No need to set a global $wgHooks, just set it for the current test.

Change-Id: Ic3e82608efa617a5a7f7c31365d748222bc6d6da