summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/KeyManagerTest.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-26 13:46:16 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-10-26 13:56:56 +0200
commitc733cdaa65ea473b848fb8329674145f54c1277b (patch)
treefa1bebe361ee81a1c3e8ead10263af65610f6d97 /apps/encryption/tests/KeyManagerTest.php
parent06f46bd25614c080b75558e8372124142906d977 (diff)
downloadnextcloud-server-c733cdaa65ea473b848fb8329674145f54c1277b.tar.gz
nextcloud-server-c733cdaa65ea473b848fb8329674145f54c1277b.zip
Use ::class in test mocks of encryption app
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/encryption/tests/KeyManagerTest.php')
-rw-r--r--apps/encryption/tests/KeyManagerTest.php32
1 files changed, 19 insertions, 13 deletions
diff --git a/apps/encryption/tests/KeyManagerTest.php b/apps/encryption/tests/KeyManagerTest.php
index a8441427a2c..721b7f53a0c 100644
--- a/apps/encryption/tests/KeyManagerTest.php
+++ b/apps/encryption/tests/KeyManagerTest.php
@@ -27,9 +27,15 @@
namespace OCA\Encryption\Tests;
+use OC\Files\FileInfo;
+use OC\Files\View;
+use OCA\Encryption\Crypto\Crypt;
use OCA\Encryption\KeyManager;
use OCA\Encryption\Session;
+use OCA\Encryption\Util;
use OCP\Encryption\Keys\IStorage;
+use OCP\Files\Cache\ICache;
+use OCP\Files\Storage;
use OCP\IConfig;
use OCP\ILogger;
use OCP\IUserSession;
@@ -74,7 +80,7 @@ class KeyManagerTest extends TestCase {
$this->userId = 'user1';
$this->systemKeyId = 'systemKeyId';
$this->keyStorageMock = $this->createMock(IStorage::class);
- $this->cryptMock = $this->getMockBuilder('OCA\Encryption\Crypto\Crypt')
+ $this->cryptMock = $this->getMockBuilder(Crypt::class)
->disableOriginalConstructor()
->getMock();
$this->configMock = $this->createMock(IConfig::class);
@@ -82,11 +88,11 @@ class KeyManagerTest extends TestCase {
->method('getAppValue')
->willReturn($this->systemKeyId);
$this->userMock = $this->createMock(IUserSession::class);
- $this->sessionMock = $this->getMockBuilder('OCA\Encryption\Session')
+ $this->sessionMock = $this->getMockBuilder(Session::class)
->disableOriginalConstructor()
->getMock();
$this->logMock = $this->createMock(ILogger::class);
- $this->utilMock = $this->getMockBuilder('OCA\Encryption\Util')
+ $this->utilMock = $this->getMockBuilder(Util::class)
->disableOriginalConstructor()
->getMock();
@@ -251,7 +257,7 @@ class KeyManagerTest extends TestCase {
public function testInit($useMasterKey) {
/** @var \OCA\Encryption\KeyManager|\PHPUnit_Framework_MockObject_MockObject $instance */
- $instance = $this->getMockBuilder('OCA\Encryption\KeyManager')
+ $instance = $this->getMockBuilder(KeyManager::class)
->setConstructorArgs(
[
$this->keyStorageMock,
@@ -544,7 +550,7 @@ class KeyManagerTest extends TestCase {
public function testValidateMasterKey($masterKey) {
/** @var \OCA\Encryption\KeyManager | \PHPUnit_Framework_MockObject_MockObject $instance */
- $instance = $this->getMockBuilder('OCA\Encryption\KeyManager')
+ $instance = $this->getMockBuilder(KeyManager::class)
->setConstructorArgs(
[
$this->keyStorageMock,
@@ -592,7 +598,7 @@ class KeyManagerTest extends TestCase {
}
public function testGetVersionWithoutFileInfo() {
- $view = $this->getMockBuilder('\\OC\\Files\\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$view->expects($this->once())
->method('getFileInfo')
@@ -604,9 +610,9 @@ class KeyManagerTest extends TestCase {
}
public function testGetVersionWithFileInfo() {
- $view = $this->getMockBuilder('\\OC\\Files\\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
- $fileInfo = $this->getMockBuilder('\\OC\\Files\\FileInfo')
+ $fileInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
$fileInfo->expects($this->once())
->method('getEncryptedVersion')
@@ -621,19 +627,19 @@ class KeyManagerTest extends TestCase {
}
public function testSetVersionWithFileInfo() {
- $view = $this->getMockBuilder('\\OC\\Files\\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
- $cache = $this->getMockBuilder('\\OCP\\Files\\Cache\\ICache')
+ $cache = $this->getMockBuilder(ICache::class)
->disableOriginalConstructor()->getMock();
$cache->expects($this->once())
->method('update')
->with(123, ['encrypted' => 5, 'encryptedVersion' => 5]);
- $storage = $this->getMockBuilder('\\OCP\\Files\\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()->getMock();
$storage->expects($this->once())
->method('getCache')
->willReturn($cache);
- $fileInfo = $this->getMockBuilder('\\OC\\Files\\FileInfo')
+ $fileInfo = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()->getMock();
$fileInfo->expects($this->once())
->method('getStorage')
@@ -651,7 +657,7 @@ class KeyManagerTest extends TestCase {
}
public function testSetVersionWithoutFileInfo() {
- $view = $this->getMockBuilder('\\OC\\Files\\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$view->expects($this->once())
->method('getFileInfo')