public function testDeleteByIdWrongUser()
 {
     $user = $this->getMock('\\OCP\\IUser');
     $id = 33;
     $user->expects($this->once())->method('getUID')->will($this->returnValue('user10000'));
     $this->mapper->deleteById($user, $id);
     $this->assertEquals(3, $this->getNumberOfTokens());
 }
 /**
  * @param string $token
  * @throws InvalidTokenException
  * @return DefaultToken user UID
  */
 public function validateToken($token)
 {
     try {
         $dbToken = $this->mapper->getToken($this->hashToken($token));
         $this->logger->debug('valid default token for ' . $dbToken->getUID());
         return $dbToken;
     } catch (DoesNotExistException $ex) {
         throw new InvalidTokenException();
     }
 }
 /**
  * Invalidate (delete) old session tokens
  */
 public function invalidateOldTokens()
 {
     $olderThan = $this->time->getTime() - (int) $this->config->getSystemValue('session_lifetime', 60 * 60 * 24);
     $this->logger->info('Invalidating tokens older than ' . date('c', $olderThan));
     $this->mapper->invalidateOld($olderThan);
 }