summaryrefslogtreecommitdiffstats
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php16
-rw-r--r--tests/lib/Encryption/EncryptionWrapperTest.php3
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php3
-rw-r--r--tests/lib/Encryption/UtilTest.php3
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php8
-rw-r--r--tests/lib/Security/CertificateManagerTest.php3
-rw-r--r--tests/lib/Session/CryptoWrappingTest.php3
7 files changed, 24 insertions, 15 deletions
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index c52619c3b12..06c5e0e2df8 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -28,9 +28,13 @@ use OC\Encryption\Exceptions\DecryptionFailedException;
use OC\Encryption\Manager;
use OC\Files\FileInfo;
use OC\Files\View;
+use OCP\Files\Storage;
use OCP\IUserManager;
use OCP\UserInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
+use Symfony\Component\Console\Helper\ProgressBar;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
/**
@@ -70,11 +74,11 @@ class DecryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->encryptionManager = $this->getMockBuilder('OC\Encryption\Manager')
->disableOriginalConstructor()->getMock();
- $this->view = $this->getMockBuilder('OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
- $this->inputInterface = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')
+ $this->inputInterface = $this->getMockBuilder(InputInterface::class)
->disableOriginalConstructor()->getMock();
- $this->outputInterface = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')
+ $this->outputInterface = $this->getMockBuilder(OutputInterface::class)
->disableOriginalConstructor()->getMock();
$this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
@@ -253,11 +257,11 @@ class DecryptAllTest extends TestCase {
->setMethods(['decryptFile'])
->getMock();
- $storage = $this->getMockBuilder('OCP\Files\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()->getMock();
- $sharedStorage = $this->getMockBuilder('OCP\Files\Storage')
+ $sharedStorage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()->getMock();
$sharedStorage->expects($this->once())->method('instanceOfStorage')
@@ -296,7 +300,7 @@ class DecryptAllTest extends TestCase {
->method('decryptFile')
->with('/user1/files/foo/subfile');
- $progressBar = $this->getMockBuilder('Symfony\Component\Console\Helper\ProgressBar')
+ $progressBar = $this->getMockBuilder(ProgressBar::class)
->disableOriginalConstructor()->getMock();
$this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']);
diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php
index 6a6a3db2f68..d20efa8821f 100644
--- a/tests/lib/Encryption/EncryptionWrapperTest.php
+++ b/tests/lib/Encryption/EncryptionWrapperTest.php
@@ -26,6 +26,7 @@ namespace Test\Encryption;
use OC\Encryption\EncryptionWrapper;
use OC\Encryption\Manager;
use OC\Memcache\ArrayCache;
+use OCP\Files\Storage;
use OCP\ILogger;
use Test\TestCase;
@@ -59,7 +60,7 @@ class EncryptionWrapperTest extends TestCase {
* @dataProvider provideWrapStorage
*/
public function testWrapStorage($expectedWrapped, $wrappedStorages) {
- $storage = $this->getMockBuilder('OC\Files\Storage\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index a5924d1dc88..cd8f1e9b953 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -24,6 +24,7 @@
namespace Test\Encryption\Keys;
use OC\Encryption\Keys\Storage;
+use OC\Files\View;
use OCP\IConfig;
use Test\TestCase;
@@ -48,7 +49,7 @@ class StorageTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $this->view = $this->getMockBuilder('OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index e313274516e..1e1b21d3671 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -3,6 +3,7 @@
namespace Test\Encryption;
use OC\Encryption\Util;
+use OC\Files\View;
use OCP\Encryption\IEncryptionModule;
use OCP\IConfig;
use Test\TestCase;
@@ -33,7 +34,7 @@ class UtilTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->view = $this->getMockBuilder('OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index 459abf3b64c..c184752ff7e 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -719,7 +719,7 @@ class EncryptionTest extends Storage {
}
public function testCopyBetweenStorageMinimumEncryptedVersion() {
- $storage2 = $this->getMockBuilder('OCP\Files\Storage')
+ $storage2 = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
@@ -768,7 +768,7 @@ class EncryptionTest extends Storage {
* @param bool $expectedEncrypted
*/
public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryptionEnabled, $expectedEncrypted) {
- $storage2 = $this->getMockBuilder('OCP\Files\Storage')
+ $storage2 = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
@@ -830,11 +830,11 @@ class EncryptionTest extends Storage {
*/
public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) {
- $sourceStorage = $this->getMockBuilder('OCP\Files\Storage')
+ $sourceStorage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
- $targetStorage = $this->getMockBuilder('OCP\Files\Storage')
+ $targetStorage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php
index 6bdb647abc5..2804ad99c0f 100644
--- a/tests/lib/Security/CertificateManagerTest.php
+++ b/tests/lib/Security/CertificateManagerTest.php
@@ -9,6 +9,7 @@
namespace Test\Security;
use OC\Files\Storage\Temporary;
+use OC\Files\View;
use \OC\Security\CertificateManager;
use OCP\IConfig;
use OCP\ILogger;
@@ -152,7 +153,7 @@ class CertificateManagerTest extends \Test\TestCase {
$expected
) {
- $view = $this->getMockBuilder('OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$config = $this->createMock(IConfig::class);
diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php
index e1fadbf933f..f34148fb50e 100644
--- a/tests/lib/Session/CryptoWrappingTest.php
+++ b/tests/lib/Session/CryptoWrappingTest.php
@@ -22,6 +22,7 @@
namespace Test\Session;
use OC\Session\CryptoSessionData;
+use OCP\ISession;
use Test\TestCase;
class CryptoWrappingTest extends TestCase {
@@ -37,7 +38,7 @@ class CryptoWrappingTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->wrappedSession = $this->getMockBuilder('OCP\ISession')
+ $this->wrappedSession = $this->getMockBuilder(ISession::class)
->disableOriginalConstructor()
->getMock();
$this->crypto = $this->getMockBuilder('OCP\Security\ICrypto')