浏览代码

Add login/logout to TestCase base class

tags/v8.0.0alpha1
Vincent Petry 9 年前
父节点
当前提交
5101bc54fa
共有 1 个文件被更改,包括 21 次插入0 次删除
  1. 21
    0
      tests/lib/testcase.php

+ 21
- 0
tests/lib/testcase.php 查看文件

@@ -148,4 +148,25 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
\OC_FileProxy::$enabled = true;
\OC_FileProxy::clearProxies();
}

/**
* Login and setup FS as a given user,
* sets the given user as the current user.
*
* @param string $user user id
*/
static protected function loginAsUser($user) {
self::logout();
\OC\Files\Filesystem::tearDown();
\OC_User::setUserId($user);
\OC_Util::setupFS($user);
}

/**
* Logout the current user and tear down the filesystem.
*/
static protected function logout() {
\OC_Util::tearDownFS();
\OC_User::setUserId('');
}
}

正在加载...
取消
保存