Adding unit tests

resolves https://github.com/owncloud/apps/issues/1933 some cases are not testable in current architecture (per conversation with icewind)

depends on https://github.com/owncloud/core/pull/11322