Add unittests

@owncloud-bot deal with it B-)

Unittests for:
- search/result
- util
- preferences

The tests for preferences are pretty similar to #4292, so some of that PR also applies to this PR.

@DeepDiver1975 
@butonic @bartv2 @icewind1991