''The problem is if the test is run via the browser, any of the variables checked in is_https might be set, so we'd have to store, then reset them all at the beginning of the rest, and restore them afterwards (including dealing with removing not-present values).''

PHPUnit already restores superglobals after each test: http://phpunit.de/manual/current/en/fixtures.html#fixtures.global-state