changed unit tests so that they run without php errors or warnings
fixed some errors with overzealous search and replace
fixed an issue where sessions wouldn't be properly mocked.