Unit tests and PHP alternatives

Added some unit tests for file operations and, in the process, replaced most of the system command - touch, mkdir, rm, ln -s, etc - with PHP alternatives.  This should make things more portable and annoy different environments (like Travis CI) much less.