aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Authentication/Token')
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenMapperTest.php9
-rw-r--r--tests/lib/Authentication/Token/DefaultTokenProviderTest.php19
2 files changed, 17 insertions, 11 deletions
diff --git a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
index 6b73cab5ed0..d71d9468477 100644
--- a/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenMapperTest.php
@@ -27,6 +27,7 @@ use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\DefaultTokenMapper;
use OC\Authentication\Token\IToken;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IUser;
use Test\TestCase;
/**
@@ -150,7 +151,7 @@ class DefaultTokenMapperTest extends TestCase {
}
public function testGetTokenByUser() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('user1'));
@@ -159,7 +160,7 @@ class DefaultTokenMapperTest extends TestCase {
}
public function testGetTokenByUserNotFound() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('getUID')
->will($this->returnValue('user1000'));
@@ -168,7 +169,7 @@ class DefaultTokenMapperTest extends TestCase {
}
public function testDeleteById() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('id')
->from('authtoken')
@@ -184,7 +185,7 @@ class DefaultTokenMapperTest extends TestCase {
}
public function testDeleteByIdWrongUser() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$id = 33;
$user->expects($this->once())
->method('getUID')
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
index 28a59529dec..7f90cf051f4 100644
--- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php
@@ -26,6 +26,11 @@ use OC\Authentication\Token\DefaultToken;
use OC\Authentication\Token\DefaultTokenProvider;
use OC\Authentication\Token\IToken;
use OCP\AppFramework\Db\DoesNotExistException;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\IConfig;
+use OCP\ILogger;
+use OCP\IUser;
+use OCP\Security\ICrypto;
use Test\TestCase;
class DefaultTokenProviderTest extends TestCase {
@@ -45,10 +50,10 @@ class DefaultTokenProviderTest extends TestCase {
$this->mapper = $this->getMockBuilder('\OC\Authentication\Token\DefaultTokenMapper')
->disableOriginalConstructor()
->getMock();
- $this->crypto = $this->getMock('\OCP\Security\ICrypto');
- $this->config = $this->getMock('\OCP\IConfig');
- $this->logger = $this->getMock('\OCP\ILogger');
- $this->timeFactory = $this->getMock('\OCP\AppFramework\Utility\ITimeFactory');
+ $this->crypto = $this->createMock(ICrypto::class);
+ $this->config = $this->createMock(IConfig::class);
+ $this->logger = $this->createMock(ILogger::class);
+ $this->timeFactory = $this->createMock(ITimeFactory::class);
$this->time = 1313131;
$this->timeFactory->expects($this->any())
->method('getTime')
@@ -118,7 +123,7 @@ class DefaultTokenProviderTest extends TestCase {
}
public function testGetTokenByUser() {
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with($user)
@@ -212,7 +217,7 @@ class DefaultTokenProviderTest extends TestCase {
* @expectedException \OC\Authentication\Exceptions\InvalidTokenException
*/
public function testSetPasswordInvalidToken() {
- $token = $this->getMock('\OC\Authentication\Token\IToken');
+ $token = $this->createMock(IToken::class);
$tokenId = 'token123';
$password = '123456';
@@ -229,7 +234,7 @@ class DefaultTokenProviderTest extends TestCase {
public function testInvaildateTokenById() {
$id = 123;
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$this->mapper->expects($this->once())
->method('deleteById')