(#18187) Clear *root* environment when clearing caches

When changing settings or initializing Puppet via TestHelper, the
Puppet::Node::Environment.clear method is called to delete the cached
environment objects, as they may reference cached module paths based on old
values of settings.

The *root* environment is a special case, as it acts as the current environment
when no other environment has been created and set yet.  It can still have a
module path based on current settings, so it too should be cleared along with
other cached environments.

Failure to reinitialize *root* causes failures when initializing Puppet via the
TestHelper.  The Puppet::MetaType::Manager class uses the current environment
in calls to Puppet::Util::Autoload, which starts as the default *root*
enviroment.  The type loader is called a few times during TestHelper
initialization and so if the module path is then changed (which triggers a
.clear call), the *root* environment will contain paths based on old settings,
so types won't load.

Loading types based on the environment is new in 8173a6e6 (2.7.19).  3.x is
unaffected as caching of module paths doesn't begin until
app_defaults_initialized? changes to true.
Merge branch 'pull-1339' into 3.1.x

GH-1339 corrects the behavior of Puppet::Node::Environment.clear when dealing
with the *root* environment and improves the related test coverage. It was
originally targeted at the 2.7.x but as of 2013-02-05 only fixes for major
issues will be merged into 2.7.x. Since this improves the quality of the code
this has been merged into 3.1.x.