BUG 3.1 Fixed cross-platform issues with test cases and file utilities

Please see https://github.com/silverstripe/silverstripe-framework/pull/2472 for SS 3.2 version.

This differs from 3.2 version due to the 3.2 specific fixes to `HtmlEditorFieldTest.php.`