From 4cdfc72d58ff17cfc468b9474b7c480952ee7412 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Sun, 7 Oct 2012 00:19:35 +0200
Subject: [PATCH] fix hook test when not logged in

---
 tests/lib/filesystem.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/lib/filesystem.php b/tests/lib/filesystem.php
index 4239033551..ab5cbe717f 100644
--- a/tests/lib/filesystem.php
+++ b/tests/lib/filesystem.php
@@ -73,7 +73,12 @@ class Test_Filesystem extends UnitTestCase {
 	}
 
 	public function testHooks() {
-		$user = OC_User::getUser();
+		if(OC_User::isLoggedIn()){
+			$user = OC_User::getUser();
+		}else{
+			$user=uniqid();
+			OC_Filesystem::init('/'.$user.'/files');
+		}
 		OC_Hook::clear('OC_Filesystem');
 		OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook');
 
-- 
GitLab