aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Authentication')
-rw-r--r--tests/lib/Authentication/LoginCredentials/StoreTest.php7
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenMapperTest.php8
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php20
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php10
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php16
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php7
6 files changed, 33 insertions, 35 deletions
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php
index e7b9cb5996f..ea490b76b8a 100644
--- a/tests/lib/Authentication/LoginCredentials/StoreTest.php
+++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php
@@ -34,18 +34,17 @@ use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\ILogger;
use OCP\ISession;
use OCP\Session\Exceptions\SessionNotAvailableException;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class StoreTest extends TestCase {
- /** @var ISession|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ISession|\PHPUnit\Framework\MockObject\MockObject */
private $session;
- /** @var IProvider|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
/** @var Store */
diff --git a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
index 855e90ab6b9..6fdf5b9060e 100644
--- a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
@@ -145,7 +145,7 @@ class DefaultTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetInvalidToken() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -175,14 +175,14 @@ class DefaultTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetTokenByIdNotFound() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->mapper->getTokenById(-1);
}
-
+
public function testGetInvalidTokenById() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -200,7 +200,7 @@ class DefaultTokenMapperTest extends TestCase {
}
public function testDeleteById() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('id')
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index d95e4c0418d..00b7f0dee03 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -38,17 +38,17 @@ use Test\TestCase;
class DefaultTokenProviderTest extends TestCase {
- /** @var DefaultTokenProvider|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var DefaultTokenProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var DefaultTokenMapper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var DefaultTokenMapper|\PHPUnit\Framework\MockObject\MockObject */
private $mapper;
- /** @var ICrypto|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ICrypto|\PHPUnit\Framework\MockObject\MockObject */
private $crypto;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
/** @var int */
private $time;
@@ -131,7 +131,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->tokenProvider->updateTokenActivity($tk);
}
-
+
public function testGetTokenByUser() {
$this->mapper->expects($this->once())
->method('getTokenByUser')
@@ -159,7 +159,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->assertEquals('passme', $actual);
}
-
+
public function testGetPasswordPasswordLessToken() {
$this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
@@ -170,7 +170,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($tk, $token);
}
-
+
public function testGetPasswordDeletesInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
@@ -222,7 +222,7 @@ class DefaultTokenProviderTest extends TestCase {
$this->assertEquals('encryptedpassword', $token->getPassword());
}
-
+
public function testSetPasswordInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
index 5ba7fe7c40e..2f2af38851d 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
@@ -172,7 +172,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetInvalidToken() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -204,14 +204,14 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals($token, $dbToken);
}
-
+
public function testGetTokenByIdNotFound() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->mapper->getTokenById(-1);
}
-
+
public function testGetInvalidTokenById() {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
@@ -229,7 +229,7 @@ class PublicKeyTokenMapperTest extends TestCase {
}
public function testDeleteById() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('id')
@@ -243,7 +243,7 @@ class PublicKeyTokenMapperTest extends TestCase {
}
public function testDeleteByIdWrongUser() {
- /** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$id = 33;
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 43ae0e9542c..c16ee7b818e 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -39,17 +39,17 @@ use Test\TestCase;
class PublicKeyTokenProviderTest extends TestCase {
- /** @var PublicKeyTokenProvider|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var PublicKeyTokenProvider|\PHPUnit\Framework\MockObject\MockObject */
private $tokenProvider;
- /** @var PublicKeyTokenMapper|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var PublicKeyTokenMapper|\PHPUnit\Framework\MockObject\MockObject */
private $mapper;
/** @var ICrypto */
private $crypto;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
- /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ILogger|\PHPUnit\Framework\MockObject\MockObject */
private $logger;
- /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
/** @var int */
private $time;
@@ -145,7 +145,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
}
-
+
public function testGetPasswordPasswordLessToken() {
$this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
@@ -156,7 +156,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($tk, $token);
}
-
+
public function testGetPasswordInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
@@ -205,7 +205,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($newpass, $this->tokenProvider->getPassword($actual, 'token'));
}
-
+
public function testSetPasswordInvalidToken() {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
index b77bddcd5a4..378376a41f9 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
@@ -29,15 +29,14 @@ namespace lib\Authentication\TwoFactorAuth;
use OC\Authentication\TwoFactorAuth\ProviderLoader;
use OCP\App\IAppManager;
use OCP\Authentication\TwoFactorAuth\IProvider;
-use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class ProviderLoaderTest extends TestCase {
- /** @var IAppManager|PHPUnit_Framework_MockObject_MockObject */
+ /** @var IAppManager|\PHPUnit\Framework\MockObject\MockObject */
private $appManager;
- /** @var IUser|PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IUser|\PHPUnit\Framework\MockObject\MockObject */
private $user;
/** @var ProviderLoader */
@@ -52,7 +51,7 @@ class ProviderLoaderTest extends TestCase {
$this->loader = new ProviderLoader($this->appManager);
}
-
+
public function testFailHardIfProviderCanNotBeLoaded() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Could not load two-factor auth provider \\OCA\\MyFaulty2faApp\\DoesNotExist');