コード例 #1
0
ファイル: tags.php プロジェクト: ninjasilicon/core
	public function testTagManagerWithoutUserReturnsNull() {
		$this->userSession = $this->getMock('\OCP\IUserSession');
		$this->userSession
			->expects($this->any())
			->method('getUser')
			->will($this->returnValue(null));
		$this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
		$this->assertNull($this->tagMgr->load($this->objectType));
	}
コード例 #2
0
ファイル: tags.php プロジェクト: heldernl/owncloud8-extended
 protected function setUp()
 {
     parent::setUp();
     OC_User::clearBackends();
     OC_User::useBackend('dummy');
     $userId = $this->getUniqueID('user_');
     OC_User::createUser($userId, 'pass');
     OC_User::setUserId($userId);
     $this->user = new OC\User\User($userId, null);
     $this->userSession = $this->getMock('\\OCP\\IUserSession');
     $this->userSession->expects($this->any())->method('getUser')->will($this->returnValue($this->user));
     $this->objectType = $this->getUniqueID('type_');
     $this->tagMapper = new OC\Tagging\TagMapper(\OC::$server->getDb());
     $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
 }