(PUP-1584) Module tool acceptance with_environment tests directory envs

Update the acceptance/tests/modules/*/with_environment.rb tests to check
both legacy and new directory environments.  Also extracts common
environment setup to module_utils.
(PUP-1584) module_tool uses current_environment with target_dir overrides

The module tool was relying on the implicit creation and caching of
legacy environments based on puppet settings for environment and
modulepath.  But this does not work for the new directory style of
environments.  So we are being explicit about using the current
environment from the context, and overriding modulepath to prepend a
target_dir if given, and then directly inserting the environment to be
used into the options rather than expecting the module_tool applications
to retrieve the correct environment from any other loaders.

Testing is now simpler, but because we are now comparing different but
equal environments, I added equality and hash to node/environment to
facilitate this.

This in turn broke tests, because of
Puppet::Node::Environment#known_resource_types which caches using the
global $known_resource_types.  Previously this would always clear itself
when called if $known_resource_types.environment
!= self, but with the new node equality, state was now leaking between
tests.  The test_helper now sets $known_resource_types nil after each
test.
(PUP-1584) Be explicit about adding log functions to root environment

Previously log level functions were being initialized on the root
environment purely as an artifact of initialization timing.  Now we're
being explicit about it.
Merge pull request #2367 from jpartlow/issue/master/pup-1584-module-tool-and-directory-envs

Issue/master/pup 1584 module tool and directory envs