Currently, for ApiTestCase and all subclasses
- the global $wgUser is set via setMwGlobals() (set to the test sysop, MediaWikiIntegrationTestCase::$users['sysop']->getUser())
- when doApiRequest() is called with a performer, this results in $wgUser being updated to the associated User object
- when doApiRequest() is called without a performer, the performer to use is retrieved from $wgUser
However, no deployed extensions appear to need these. Accordingly, we should
- stop setting up $wgUser via setMwGlobals()
- stop updating $wgUser if doApiRequest() is called with a performer
- stop reading from $wgUser if doApiRequest() is called without a performer, instead using the sysop directly
If any (non-deployed) extension was relying on $wgUser instead of the context user, *and* in the tests the $wgUser was set to a different user, this will probably cause tests to fail, prompting them to fix their code. It should have no impact on production usage