Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-10-24 16:26:53 +0300
committerMorris Jobke <hey@morrisjobke.de>2017-10-24 18:45:32 +0300
commit43e498844e8c1aa519a19238d2cf3d6b95e1aab0 (patch)
tree59510ef2ffc6c1fd1fd92475013b108f1da2bfeb /tests/lib
parentb1f77aca4effec99387481a831910d4870ae2ffc (diff)
Use ::class in test mocks
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/APITest.php4
-rw-r--r--tests/lib/Accounts/AccountsManagerTest.php12
-rw-r--r--tests/lib/Activity/ManagerTest.php5
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php2
-rw-r--r--tests/lib/AppFramework/Controller/ApiControllerTest.php3
-rw-r--r--tests/lib/AppFramework/Controller/ControllerTest.php3
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php13
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php2
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php3
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareTest.php3
-rw-r--r--tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php3
-rw-r--r--tests/lib/AppFramework/Routing/RoutingTest.php11
-rw-r--r--tests/lib/BackgroundJob/JobTest.php4
-rw-r--r--tests/lib/CapabilitiesManagerTest.php2
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php5
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php3
-rw-r--r--tests/lib/Encryption/UpdateTest.php3
-rw-r--r--tests/lib/Encryption/UtilTest.php3
-rw-r--r--tests/lib/Files/Node/NodeTest.php12
-rw-r--r--tests/lib/Files/Node/RootTest.php14
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php3
-rw-r--r--tests/lib/Files/Storage/Wrapper/QuotaTest.php2
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php3
-rw-r--r--tests/lib/Files/Type/DetectionTest.php19
-rw-r--r--tests/lib/Group/GroupTest.php6
-rw-r--r--tests/lib/HTTPHelperTest.php3
-rw-r--r--tests/lib/Memcache/FactoryTest.php6
-rw-r--r--tests/lib/Migration/BackgroundRepairTest.php2
-rw-r--r--tests/lib/Notification/ManagerTest.php53
-rw-r--r--tests/lib/Repair/CleanTagsTest.php3
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php3
-rw-r--r--tests/lib/Repair/RepairMimeTypesTest.php2
-rw-r--r--tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php2
-rw-r--r--tests/lib/Security/HasherTest.php5
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php2
-rw-r--r--tests/lib/Settings/Admin/AdditionalTest.php2
-rw-r--r--tests/lib/Settings/Admin/EncryptionTest.php2
-rw-r--r--tests/lib/Settings/Admin/ServerTest.php4
-rw-r--r--tests/lib/Settings/Admin/SharingTest.php2
-rw-r--r--tests/lib/Settings/Admin/TipsTricksTest.php2
-rw-r--r--tests/lib/SystemTag/SystemTagManagerTest.php7
-rw-r--r--tests/lib/TestCase.php2
-rw-r--r--tests/lib/Updater/VersionCheckTest.php5
-rw-r--r--tests/lib/User/ManagerTest.php2
-rw-r--r--tests/lib/User/SessionTest.php8
-rw-r--r--tests/lib/User/UserTest.php2
-rw-r--r--tests/lib/UtilTest.php6
47 files changed, 154 insertions, 114 deletions
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php
index c2a25d1306c..b1ac8fbb24f 100644
--- a/tests/lib/APITest.php
+++ b/tests/lib/APITest.php
@@ -8,6 +8,8 @@
namespace Test;
+use OCP\IRequest;
+
class APITest extends \Test\TestCase {
// Helps build a response variable
@@ -71,7 +73,7 @@ class APITest extends \Test\TestCase {
* @param bool $expected
*/
public function testIsV2($scriptName, $expected) {
- $request = $this->getMockBuilder('\OCP\IRequest')
+ $request = $this->getMockBuilder(IRequest::class)
->disableOriginalConstructor()
->getMock();
$request
diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php
index 6cefebdea86..c4add0244bd 100644
--- a/tests/lib/Accounts/AccountsManagerTest.php
+++ b/tests/lib/Accounts/AccountsManagerTest.php
@@ -71,7 +71,7 @@ class AccountsManagerTest extends TestCase {
* @return \PHPUnit_Framework_MockObject_MockObject | AccountManager
*/
public function getInstance($mockedMethods = null) {
- return $this->getMockBuilder('OC\Accounts\AccountManager')
+ return $this->getMockBuilder(AccountManager::class)
->setConstructorArgs([$this->connection, $this->eventDispatcher, $this->jobList])
->setMethods($mockedMethods)
->getMock();
@@ -146,7 +146,7 @@ class AccountsManagerTest extends TestCase {
* @param array $setData
* @param IUser $askUser
* @param array $expectedData
- * @param book $userAlreadyExists
+ * @param bool $userAlreadyExists
*/
public function testGetUser($setUser, $setData, $askUser, $expectedData, $userAlreadyExists) {
$accountManager = $this->getInstance(['buildDefaultUserRecord', 'insertNewUser', 'addMissingDefaultValues']);
@@ -172,9 +172,9 @@ class AccountsManagerTest extends TestCase {
}
public function dataTestGetUser() {
- $user1 = $this->getMockBuilder('OCP\IUser')->getMock();
+ $user1 = $this->getMockBuilder(IUser::class)->getMock();
$user1->expects($this->any())->method('getUID')->willReturn('user1');
- $user2 = $this->getMockBuilder('OCP\IUser')->getMock();
+ $user2 = $this->getMockBuilder(IUser::class)->getMock();
$user2->expects($this->any())->method('getUID')->willReturn('user2');
return [
['user1', ['key' => 'value'], $user1, ['key' => 'value'], true],
@@ -183,7 +183,7 @@ class AccountsManagerTest extends TestCase {
}
public function testUpdateExistingUser() {
- $user = $this->getMockBuilder('OCP\IUser')->getMock();
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())->method('getUID')->willReturn('uid');
$oldData = ['key' => 'value'];
$newData = ['newKey' => 'newValue'];
@@ -196,7 +196,7 @@ class AccountsManagerTest extends TestCase {
}
public function testInsertNewUser() {
- $user = $this->getMockBuilder('OCP\IUser')->getMock();
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$uid = 'uid';
$data = ['key' => 'value'];
diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php
index 13932f389f8..a1877d3fcc6 100644
--- a/tests/lib/Activity/ManagerTest.php
+++ b/tests/lib/Activity/ManagerTest.php
@@ -12,6 +12,7 @@ namespace Test\Activity;
use OCP\IConfig;
use OCP\IRequest;
+use OCP\IUser;
use OCP\IUserSession;
use OCP\RichObjectStrings\IValidator;
use Test\TestCase;
@@ -247,7 +248,7 @@ class ManagerTest extends TestCase {
}
protected function mockUserSession($user) {
- $mockUser = $this->getMockBuilder('\OCP\IUser')
+ $mockUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$mockUser->expects($this->any())
@@ -314,7 +315,7 @@ class ManagerTest extends TestCase {
*/
public function testPublish($author, $expected) {
if ($author !== null) {
- $authorObject = $this->getMockBuilder('OCP\IUser')
+ $authorObject = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
$authorObject->expects($this->once())
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index 65b45a002d4..081f6d767db 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -59,7 +59,7 @@ class DependencyAnalyzerTest extends TestCase {
->method('getOcVersion')
->will( $this->returnValue('8.0.2'));
- $this->l10nMock = $this->getMockBuilder('\OCP\IL10N')
+ $this->l10nMock = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()
->getMock();
$this->l10nMock->expects($this->any())
diff --git a/tests/lib/AppFramework/Controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php
index 74231b8d6ac..b7172ab6a9f 100644
--- a/tests/lib/AppFramework/Controller/ApiControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php
@@ -26,6 +26,7 @@ namespace Test\AppFramework\Controller;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\ApiController;
+use OCP\IConfig;
class ChildApiController extends ApiController {};
@@ -41,7 +42,7 @@ class ApiControllerTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index 5c8124c5e7f..ca71e9154ef 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -29,6 +29,7 @@ use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\DataResponse;
+use OCP\IConfig;
class ChildController extends Controller {
@@ -79,7 +80,7 @@ class ControllerTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index c2d73adfd7b..eb08d00e358 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -31,6 +31,7 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
+use OCP\IConfig;
class TestController extends Controller {
@@ -301,7 +302,7 @@ class DispatcherTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
@@ -332,7 +333,7 @@ class DispatcherTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
@@ -366,7 +367,7 @@ class DispatcherTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
@@ -399,7 +400,7 @@ class DispatcherTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
@@ -433,7 +434,7 @@ class DispatcherTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
@@ -469,7 +470,7 @@ class DispatcherTest extends \Test\TestCase {
$this->getMockBuilder('\OCP\Security\ISecureRandom')
->disableOriginalConstructor()
->getMock(),
- $this->getMockBuilder('\OCP\IConfig')
+ $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock()
);
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index 40698ef8d73..d3f36a6d886 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -40,7 +40,7 @@ class RequestTest extends \Test\TestCase {
stream_wrapper_register('fakeinput', 'Test\AppFramework\Http\RequestStream');
$this->secureRandom = $this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->csrfTokenManager = $this->getMockBuilder('\OC\Security\CSRF\CsrfTokenManager')
->disableOriginalConstructor()->getMock();
}
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
index f948e184f53..e71be9c5f16 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
@@ -29,6 +29,7 @@ use OC\AppFramework\Middleware\MiddlewareDispatcher;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Http\Response;
+use OCP\IConfig;
// needed to test ordering
@@ -133,7 +134,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
new Request(
['method' => 'GET'],
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
- $this->getMockBuilder('\OCP\IConfig')->getMock()
+ $this->getMockBuilder(IConfig::class)->getMock()
)
])->getMock();
}
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php
index c5c812839b2..07028745676 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php
@@ -27,6 +27,7 @@ namespace Test\AppFramework\Middleware;
use OC\AppFramework\Http\Request;
use OCP\AppFramework\Middleware;
use OCP\AppFramework\Http\Response;
+use OCP\IConfig;
class ChildMiddleware extends Middleware {};
@@ -59,7 +60,7 @@ class MiddlewareTest extends \Test\TestCase {
new Request(
[],
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
- $this->getMockBuilder('\OCP\IConfig')->getMock()
+ $this->getMockBuilder(IConfig::class)->getMock()
)
])->getMock();
$this->exception = new \Exception();
diff --git a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php
index 3c218bb53c7..8d097e3a8a1 100644
--- a/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/SessionMiddlewareTest.php
@@ -17,6 +17,7 @@ use OC\AppFramework\Middleware\SessionMiddleware;
use OC\AppFramework\Utility\ControllerMethodReflector;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Response;
+use OCP\IConfig;
class SessionMiddlewareTest extends \Test\TestCase {
@@ -36,7 +37,7 @@ class SessionMiddlewareTest extends \Test\TestCase {
$this->request = new Request(
[],
$this->getMockBuilder('\OCP\Security\ISecureRandom')->getMock(),
- $this->getMockBuilder('\OCP\IConfig')->getMock()
+ $this->getMockBuilder(IConfig::class)->getMock()
);
$this->reflector = new ControllerMethodReflector();
$this->controller = $this->createMock(Controller::class);
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index d395584d011..76533fff014 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -5,6 +5,7 @@ namespace Test\AppFramework\Routing;
use OC\AppFramework\DependencyInjection\DIContainer;
use OC\AppFramework\Routing\RouteActionHandler;
use OC\AppFramework\Routing\RouteConfig;
+use OCP\ILogger;
class RoutingTest extends \Test\TestCase
{
@@ -130,7 +131,7 @@ class RoutingTest extends \Test\TestCase
// router mock
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
- ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()])
+ ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()])
->getMock();
// load route configuration
@@ -151,7 +152,7 @@ class RoutingTest extends \Test\TestCase
// router mock
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
- ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()])
+ ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()])
->getMock();
// load route configuration
@@ -212,7 +213,7 @@ class RoutingTest extends \Test\TestCase
// router mock
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
- ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()])
+ ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()])
->getMock();
// we expect create to be called once:
@@ -260,7 +261,7 @@ class RoutingTest extends \Test\TestCase
// router mock
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
- ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()])
+ ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()])
->getMock();
// we expect create to be called once:
@@ -287,7 +288,7 @@ class RoutingTest extends \Test\TestCase
// router mock
$router = $this->getMockBuilder('\OC\Route\Router')
->setMethods(['create'])
- ->setConstructorArgs([$this->getMockBuilder('\OCP\ILogger')->getMock()])
+ ->setConstructorArgs([$this->getMockBuilder(ILogger::class)->getMock()])
->getMock();
// route mocks
diff --git a/tests/lib/BackgroundJob/JobTest.php b/tests/lib/BackgroundJob/JobTest.php
index 7923eef11ef..ecd8bde8626 100644
--- a/tests/lib/BackgroundJob/JobTest.php
+++ b/tests/lib/BackgroundJob/JobTest.php
@@ -8,6 +8,8 @@
namespace Test\BackgroundJob;
+use OCP\ILogger;
+
class JobTest extends \Test\TestCase {
private $run = false;
@@ -24,7 +26,7 @@ class JobTest extends \Test\TestCase {
});
$jobList->add($job);
- $logger = $this->getMockBuilder('OCP\ILogger')
+ $logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
$logger->expects($this->once())
diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php
index 139940eb306..8df385e6ef9 100644
--- a/tests/lib/CapabilitiesManagerTest.php
+++ b/tests/lib/CapabilitiesManagerTest.php
@@ -37,7 +37,7 @@ class CapabilitiesManagerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->logger = $this->getMockBuilder('OCP\ILogger')->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
$this->manager = new CapabilitiesManager($this->logger);
}
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index 289e7de27ab..c52619c3b12 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -29,6 +29,7 @@ use OC\Encryption\Manager;
use OC\Files\FileInfo;
use OC\Files\View;
use OCP\IUserManager;
+use OCP\UserInterface;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Test\TestCase;
@@ -65,7 +66,7 @@ class DecryptAllTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()->getMock();
$this->encryptionManager = $this->getMockBuilder('OC\Encryption\Manager')
->disableOriginalConstructor()->getMock();
@@ -75,7 +76,7 @@ class DecryptAllTest extends TestCase {
->disableOriginalConstructor()->getMock();
$this->outputInterface = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')
->disableOriginalConstructor()->getMock();
- $this->userInterface = $this->getMockBuilder('OCP\UserInterface')
+ $this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
$this->outputInterface->expects($this->any())->method('getFormatter')
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index 4e9719351f3..a5924d1dc88 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 OCP\IConfig;
use Test\TestCase;
class StorageTest extends TestCase {
@@ -51,7 +52,7 @@ class StorageTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php
index b222bc42d7a..ccd2bb796fc 100644
--- a/tests/lib/Encryption/UpdateTest.php
+++ b/tests/lib/Encryption/UpdateTest.php
@@ -24,6 +24,7 @@ namespace Test\Encryption;
use OC\Encryption\Update;
+use OC\Files\View;
use Test\TestCase;
class UpdateTest extends TestCase {
@@ -55,7 +56,7 @@ class UpdateTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->view = $this->getMockBuilder('\OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('\OC\Encryption\Util')
->disableOriginalConstructor()->getMock();
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index 609f6ae1e68..e313274516e 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -4,6 +4,7 @@ namespace Test\Encryption;
use OC\Encryption\Util;
use OCP\Encryption\IEncryptionModule;
+use OCP\IConfig;
use Test\TestCase;
class UtilTest extends TestCase {
@@ -44,7 +45,7 @@ class UtilTest extends TestCase {
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index 5e18caa2014..160787411f1 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -13,7 +13,10 @@ use OC\Files\View;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
+use OCP\Files\Storage;
+use OCP\IConfig;
use OCP\ILogger;
+use OCP\IURLGenerator;
use OCP\IUserManager;
use OCP\Files\NotFoundException;
@@ -41,17 +44,18 @@ abstract class NodeTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator
+ ::class)
->disableOriginalConstructor()
->getMock();
$this->user = new \OC\User\User('', new \Test\Util\User\Dummy, null, $config, $urlGenerator);
$this->manager = $this->getMockBuilder('\OC\Files\Mount\Manager')
->disableOriginalConstructor()
->getMock();
- $this->view = $this->getMockBuilder('\OC\Files\View')
+ $this->view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$this->userMountCache = $this->getMockBuilder('\OCP\Files\Config\IUserMountCache')
@@ -88,7 +92,7 @@ abstract class NodeTest extends \Test\TestCase {
protected abstract function getViewDeleteMethod();
protected function getMockStorage() {
- $storage = $this->getMockBuilder('\OCP\Files\Storage')
+ $storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
$storage->expects($this->any())
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index fbc33cafcd8..2f81a96d486 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -13,7 +13,9 @@ use OC\Files\FileInfo;
use OC\Files\Mount\Manager;
use OC\Files\Node\Folder;
use OC\Files\View;
+use OCP\IConfig;
use OCP\ILogger;
+use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
@@ -37,10 +39,10 @@ class RootTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $urlgenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlgenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -69,7 +71,7 @@ class RootTest extends \Test\TestCase {
/**
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$root = new \OC\Files\Node\Root(
@@ -105,7 +107,7 @@ class RootTest extends \Test\TestCase {
/**
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$root = new \OC\Files\Node\Root(
@@ -133,7 +135,7 @@ class RootTest extends \Test\TestCase {
/**
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$root = new \OC\Files\Node\Root(
@@ -155,7 +157,7 @@ class RootTest extends \Test\TestCase {
/**
* @var \OC\Files\View | \PHPUnit_Framework_MockObject_MockObject $view
*/
- $view = $this->getMockBuilder('\OC\Files\View')
+ $view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->getMock();
$root = new \OC\Files\Node\Root(
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index 80d62b16578..459abf3b64c 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -16,6 +16,7 @@ use OCP\Encryption\IFile;
use OCP\Encryption\Keys\IStorage;
use OCP\Files\Cache\ICache;
use OCP\Files\Mount\IMountPoint;
+use OCP\IConfig;
use OCP\ILogger;
use Test\Files\Storage\Storage;
@@ -120,7 +121,7 @@ class EncryptionTest extends Storage {
->willReturn($mockModule);
$this->arrayCache = $this->createMock(ArrayCache::class);
- $this->config = $this->getMockBuilder('\OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$this->groupManager = $this->getMockBuilder('\OC\Group\Manager')
diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
index ee01d0c3f26..b796e767a7b 100644
--- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php
+++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
@@ -185,7 +185,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
}
public function testSpaceRoot() {
- $storage = $this->getMockBuilder('\OC\Files\Storage\Local')->disableOriginalConstructor()->getMock();
+ $storage = $this->getMockBuilder(Local::class)->disableOriginalConstructor()->getMock();
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock();
$storage->expects($this->once())
->method('getCache')
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index 1dc9dca0aad..983428ee51d 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -4,6 +4,7 @@ namespace Test\Files\Stream;
use OC\Files\View;
use OC\Memcache\ArrayCache;
+use OCP\IConfig;
class EncryptionTest extends \Test\TestCase {
@@ -29,7 +30,7 @@ class EncryptionTest extends \Test\TestCase {
->disableOriginalConstructor()->getMock();
$encStorage = $this->getMockBuilder('\OC\Files\Storage\Wrapper\Encryption')
->disableOriginalConstructor()->getMock();
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$arrayCache = $this->createMock(ArrayCache::class);
diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php
index 5c1f48a806e..295b9bf9fac 100644
--- a/tests/lib/Files/Type/DetectionTest.php
+++ b/tests/lib/Files/Type/DetectionTest.php
@@ -21,7 +21,8 @@
namespace Test\Files\Type;
-use \OC\Files\Type\Detection;
+use OC\Files\Type\Detection;
+use OCP\IURLGenerator;
class DetectionTest extends \Test\TestCase {
/** @var Detection */
@@ -107,7 +108,7 @@ class DetectionTest extends \Test\TestCase {
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -126,7 +127,7 @@ class DetectionTest extends \Test\TestCase {
* Test dir-shareed mimetype
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -146,7 +147,7 @@ class DetectionTest extends \Test\TestCase {
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -166,7 +167,7 @@ class DetectionTest extends \Test\TestCase {
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -186,7 +187,7 @@ class DetectionTest extends \Test\TestCase {
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -216,7 +217,7 @@ class DetectionTest extends \Test\TestCase {
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -246,7 +247,7 @@ class DetectionTest extends \Test\TestCase {
*/
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
@@ -272,7 +273,7 @@ class DetectionTest extends \Test\TestCase {
$mimetypealiases_dist->setContent(json_encode(['foo' => 'foobar/baz'], JSON_FORCE_OBJECT));
//Mock UrlGenerator
- $urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlGenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php
index c1824566733..c7cbbc2321b 100644
--- a/tests/lib/Group/GroupTest.php
+++ b/tests/lib/Group/GroupTest.php
@@ -10,6 +10,8 @@
namespace Test\Group;
use OC\User\User;
+use OCP\IConfig;
+use OCP\IURLGenerator;
class GroupTest extends \Test\TestCase {
@@ -19,10 +21,10 @@ class GroupTest extends \Test\TestCase {
* @return User
*/
private function newUser($uid, \OC\User\Backend $backend) {
- $config = $this->getMockBuilder('\OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $urlgenerator = $this->getMockBuilder('\OCP\IURLGenerator')
+ $urlgenerator = $this->getMockBuilder(IURLGenerator::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/HTTPHelperTest.php b/tests/lib/HTTPHelperTest.php
index d241acb2f93..d39cc34c464 100644
--- a/tests/lib/HTTPHelperTest.php
+++ b/tests/lib/HTTPHelperTest.php
@@ -9,6 +9,7 @@
namespace Test;
use OCP\Http\Client\IClientService;
+use OCP\IConfig;
class HTTPHelperTest extends \Test\TestCase {
@@ -22,7 +23,7 @@ class HTTPHelperTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
$this->clientService = $this->createMock(IClientService::class);
$this->httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper')
diff --git a/tests/lib/Memcache/FactoryTest.php b/tests/lib/Memcache/FactoryTest.php
index 8607ea7de9b..ce6c25cd87f 100644
--- a/tests/lib/Memcache/FactoryTest.php
+++ b/tests/lib/Memcache/FactoryTest.php
@@ -20,6 +20,8 @@
*/
namespace Test\Memcache;
+use OCP\ILogger;
+
class Test_Factory_Available_Cache1 {
public function __construct($prefix = '') {
}
@@ -114,7 +116,7 @@ class FactoryTest extends \Test\TestCase {
*/
public function testCacheAvailability($localCache, $distributedCache, $lockingCache,
$expectedLocalCache, $expectedDistributedCache, $expectedLockingCache) {
- $logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->getMock();
$factory = new \OC\Memcache\Factory('abc', $logger, $localCache, $distributedCache, $lockingCache);
$this->assertTrue(is_a($factory->createLocal(), $expectedLocalCache));
$this->assertTrue(is_a($factory->createDistributed(), $expectedDistributedCache));
@@ -126,7 +128,7 @@ class FactoryTest extends \Test\TestCase {
* @expectedException \OC\HintException
*/
public function testCacheNotAvailableException($localCache, $distributedCache) {
- $logger = $this->getMockBuilder('\OCP\ILogger')->getMock();
+ $logger = $this->getMockBuilder(ILogger::class)->getMock();
new \OC\Memcache\Factory('abc', $logger, $localCache, $distributedCache);
}
}
diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php
index 2de55f647e7..7a3a960074f 100644
--- a/tests/lib/Migration/BackgroundRepairTest.php
+++ b/tests/lib/Migration/BackgroundRepairTest.php
@@ -72,7 +72,7 @@ class BackgroundRepairTest extends TestCase {
$this->jobList = $this->getMockBuilder('OC\BackgroundJob\JobList')
->disableOriginalConstructor()
->getMock();
- $this->logger = $this->getMockBuilder('OCP\ILogger')
+ $this->logger = $this->getMockBuilder(ILogger::class)
->disableOriginalConstructor()
->getMock();
$this->job = $this->getMockBuilder(BackgroundRepair::class)
diff --git a/tests/lib/Notification/ManagerTest.php b/tests/lib/Notification/ManagerTest.php
index e280838424b..cb6504b67e7 100644
--- a/tests/lib/Notification/ManagerTest.php
+++ b/tests/lib/Notification/ManagerTest.php
@@ -22,7 +22,10 @@
namespace Test\Notification;
use OC\Notification\Manager;
+use OCP\Notification\IApp;
use OCP\Notification\IManager;
+use OCP\Notification\INotification;
+use OCP\Notification\INotifier;
use OCP\RichObjectStrings\IValidator;
use Test\TestCase;
@@ -37,7 +40,7 @@ class ManagerTest extends TestCase {
}
public function testRegisterApp() {
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
@@ -61,7 +64,7 @@ class ManagerTest extends TestCase {
* @expectedException \InvalidArgumentException
*/
public function testRegisterAppInvalid() {
- $notifier = $this->getMockBuilder('OCP\Notification\INotifier')
+ $notifier = $this->getMockBuilder(INotifier::class)
->disableOriginalConstructor()
->getMock();
@@ -75,7 +78,7 @@ class ManagerTest extends TestCase {
}
public function testRegisterNotifier() {
- $notifier = $this->getMockBuilder('OCP\Notification\INotifier')
+ $notifier = $this->getMockBuilder(INotifier::class)
->disableOriginalConstructor()
->getMock();
@@ -107,7 +110,7 @@ class ManagerTest extends TestCase {
* @expectedException \InvalidArgumentException
*/
public function testRegisterNotifierInvalid() {
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
@@ -138,7 +141,7 @@ class ManagerTest extends TestCase {
* @param mixed $data
*/
public function testRegisterNotifierInfoInvalid($data) {
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
@@ -158,7 +161,7 @@ class ManagerTest extends TestCase {
* @expectedExceptionMessage The given notifier ID test1 is already in use
*/
public function testRegisterNotifierInfoDuplicate() {
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
@@ -184,7 +187,7 @@ class ManagerTest extends TestCase {
public function testNotify() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->once())
@@ -192,7 +195,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
$app->expects($this->once())
@@ -200,7 +203,7 @@ class ManagerTest extends TestCase {
->with($notification);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */
- $app2 = $this->getMockBuilder('OCP\Notification\IApp')
+ $app2 = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
$app2->expects($this->once())
@@ -222,7 +225,7 @@ class ManagerTest extends TestCase {
*/
public function testNotifyInvalid() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->once())
@@ -234,14 +237,14 @@ class ManagerTest extends TestCase {
public function testPrepare() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->once())
->method('isValidParsed')
->willReturn(true);
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification2 */
- $notification2 = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification2 = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification2->expects($this->exactly(2))
@@ -249,7 +252,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */
- $notifier = $this->getMockBuilder('OCP\Notification\INotifier')
+ $notifier = $this->getMockBuilder(INotifier::class)
->disableOriginalConstructor()
->getMock();
$notifier->expects($this->once())
@@ -258,7 +261,7 @@ class ManagerTest extends TestCase {
->willReturnArgument(0);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier2 */
- $notifier2 = $this->getMockBuilder('OCP\Notification\INotifier')
+ $notifier2 = $this->getMockBuilder(INotifier::class)
->disableOriginalConstructor()
->getMock();
$notifier2->expects($this->once())
@@ -285,7 +288,7 @@ class ManagerTest extends TestCase {
*/
public function testPrepareInvalid() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->once())
@@ -293,7 +296,7 @@ class ManagerTest extends TestCase {
->willReturn(false);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */
- $notifier = $this->getMockBuilder('OCP\Notification\INotifier')
+ $notifier = $this->getMockBuilder(INotifier::class)
->disableOriginalConstructor()
->getMock();
$notifier->expects($this->once())
@@ -312,7 +315,7 @@ class ManagerTest extends TestCase {
public function testPrepareNotifierThrows() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->once())
@@ -320,7 +323,7 @@ class ManagerTest extends TestCase {
->willReturn(true);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */
- $notifier = $this->getMockBuilder('OCP\Notification\INotifier')
+ $notifier = $this->getMockBuilder(INotifier::class)
->disableOriginalConstructor()
->getMock();
$notifier->expects($this->once())
@@ -342,7 +345,7 @@ class ManagerTest extends TestCase {
*/
public function testPrepareNoNotifier() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
$notification->expects($this->once())
@@ -354,12 +357,12 @@ class ManagerTest extends TestCase {
public function testMarkProcessed() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
$app->expects($this->once())
@@ -367,7 +370,7 @@ class ManagerTest extends TestCase {
->with($notification);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */
- $app2 = $this->getMockBuilder('OCP\Notification\IApp')
+ $app2 = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
$app2->expects($this->once())
@@ -386,12 +389,12 @@ class ManagerTest extends TestCase {
public function testGetCount() {
/** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */
- $notification = $this->getMockBuilder('OCP\Notification\INotification')
+ $notification = $this->getMockBuilder(INotification::class)
->disableOriginalConstructor()
->getMock();
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */
- $app = $this->getMockBuilder('OCP\Notification\IApp')
+ $app = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
$app->expects($this->once())
@@ -400,7 +403,7 @@ class ManagerTest extends TestCase {
->willReturn(21);
/** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */
- $app2 = $this->getMockBuilder('OCP\Notification\IApp')
+ $app2 = $this->getMockBuilder(IApp::class)
->disableOriginalConstructor()
->getMock();
$app2->expects($this->once())
diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php
index ac79907c525..115bce49f71 100644
--- a/tests/lib/Repair/CleanTagsTest.php
+++ b/tests/lib/Repair/CleanTagsTest.php
@@ -8,6 +8,7 @@
namespace Test\Repair;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IUserManager;
use OCP\Migration\IOutput;
/**
@@ -41,7 +42,7 @@ class CleanTagsTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index fa75f58472a..0c67cc992ef 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -11,6 +11,7 @@ namespace Test\Repair;
use OC\Repair\RepairInvalidShares;
use OC\Share\Constants;
+use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
use Test\TestCase;
@@ -33,7 +34,7 @@ class RepairInvalidSharesTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$config->expects($this->any())
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index 6f3ed5ce318..b9d73d27d00 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -39,7 +39,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
$this->mimetypeLoader = \OC::$server->getMimeTypeLoader();
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject $config */
- $config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$config->expects($this->any())
diff --git a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
index d1e76684507..92a6557f8e3 100644
--- a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
+++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
@@ -31,7 +31,7 @@ class SessionStorageTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->session = $this->getMockBuilder('\OCP\ISession')
+ $this->session = $this->getMockBuilder(ISession::class)
->disableOriginalConstructor()->getMock();
$this->sessionStorage = new \OC\Security\CSRF\TokenStorage\SessionStorage($this->session);
}
diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php
index 913f4d703e8..5f7613a823d 100644
--- a/tests/lib/Security/HasherTest.php
+++ b/tests/lib/Security/HasherTest.php
@@ -9,6 +9,7 @@
namespace Test\Security;
use OC\Security\Hasher;
+use OCP\IConfig;
/**
* Class HasherTest
@@ -75,13 +76,13 @@ class HasherTest extends \Test\TestCase {
/** @var Hasher */
protected $hasher;
- /** @var \OCP\IConfig */
+ /** @var IConfig */
protected $config;
protected function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()->getMock();
$this->hasher = new Hasher($this->config);
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index 1beb7a66717..25586a1bc27 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -21,7 +21,7 @@ class TrustedDomainHelperTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
}
/**
diff --git a/tests/lib/Settings/Admin/AdditionalTest.php b/tests/lib/Settings/Admin/AdditionalTest.php
index 84c63f3aeb1..4a254da060b 100644
--- a/tests/lib/Settings/Admin/AdditionalTest.php
+++ b/tests/lib/Settings/Admin/AdditionalTest.php
@@ -36,7 +36,7 @@ class AdditionalTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->admin = new Additional(
$this->config
diff --git a/tests/lib/Settings/Admin/EncryptionTest.php b/tests/lib/Settings/Admin/EncryptionTest.php
index a5f483863e6..41196a9bc41 100644
--- a/tests/lib/Settings/Admin/EncryptionTest.php
+++ b/tests/lib/Settings/Admin/EncryptionTest.php
@@ -40,7 +40,7 @@ class EncryptionTest extends TestCase {
public function setUp() {
parent::setUp();
$this->manager = $this->getMockBuilder('\OC\Encryption\Manager')->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
$this->admin = new Encryption(
$this->manager,
diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php
index 106390f25a5..b8317540117 100644
--- a/tests/lib/Settings/Admin/ServerTest.php
+++ b/tests/lib/Settings/Admin/ServerTest.php
@@ -49,11 +49,11 @@ class ServerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->request = $this->createMock(IRequest::class);
$this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock();
$this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock();
- $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->admin = new Server(
$this->dbConnection,
diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php
index d9aa14fecea..9498a1466d3 100644
--- a/tests/lib/Settings/Admin/SharingTest.php
+++ b/tests/lib/Settings/Admin/SharingTest.php
@@ -36,7 +36,7 @@ class SharingTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->admin = new Sharing(
$this->config
diff --git a/tests/lib/Settings/Admin/TipsTricksTest.php b/tests/lib/Settings/Admin/TipsTricksTest.php
index cbecd51ed55..2bbadab52cb 100644
--- a/tests/lib/Settings/Admin/TipsTricksTest.php
+++ b/tests/lib/Settings/Admin/TipsTricksTest.php
@@ -36,7 +36,7 @@ class TipsTrickTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->admin = new TipsTricks(
$this->config
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php
index 61fac99ca6c..f81bbaf1643 100644
--- a/tests/lib/SystemTag/SystemTagManagerTest.php
+++ b/tests/lib/SystemTag/SystemTagManagerTest.php
@@ -13,6 +13,7 @@ namespace Test\SystemTag;
use OC\SystemTag\SystemTagManager;
use OC\SystemTag\SystemTagObjectMapper;
use OCP\IDBConnection;
+use OCP\IUser;
use OCP\SystemTag\ISystemTag;
use OCP\SystemTag\ISystemTagManager;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -56,7 +57,7 @@ class SystemTagManagerTest extends TestCase {
$this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')
->getMock();
- $this->groupManager = $this->getMockBuilder('\OCP\IGroupManager')->getMock();
+ $this->groupManager = $this->getMockBuilder(IGroupManager::class)->getMock();
$this->tagManager = new SystemTagManager(
$this->connection,
@@ -433,7 +434,7 @@ class SystemTagManagerTest extends TestCase {
* @dataProvider visibilityCheckProvider
*/
public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult) {
- $user = $this->getMockBuilder('\OCP\IUser')->getMock();
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
->will($this->returnValue('test'));
@@ -480,7 +481,7 @@ class SystemTagManagerTest extends TestCase {
* @dataProvider assignabilityCheckProvider
*/
public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult, $userGroupIds = [], $tagGroupIds = []) {
- $user = $this->getMockBuilder('\OCP\IUser')->getMock();
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
->will($this->returnValue('test'));
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index 818b3454c3a..64036084dc2 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -491,7 +491,7 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
->method('getName')
->willReturn('Nextcloud');
/** @var IL10N|\PHPUnit_Framework_MockObject_MockObject $l10n */
- $l10n = $this->getMockBuilder('\OCP\IL10N')
+ $l10n = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
$l10n
->expects($this->any())
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index 6f6c6c1ad0c..ff04aa17681 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -23,6 +23,7 @@
namespace Test\Updater;
use OC\Updater\VersionCheck;
+use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\Util;
@@ -34,10 +35,10 @@ class VersionCheckTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('\OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $clientService = $this->getMockBuilder('\OCP\Http\Client\IClientService')
+ $clientService = $this->getMockBuilder(IClientService::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index 9520cd640fd..0d98a9825de 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -615,7 +615,7 @@ class ManagerTest extends TestCase {
}
public function testDeleteUser() {
- $config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$config
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index c4d29b979ae..9cbac8dfc29 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -769,7 +769,7 @@ class SessionTest extends \Test\TestCase {
$session = new Memory('');
$session->set('user_id', 'foo');
- $userSession = $this->getMockBuilder('\OC\User\Session')
+ $userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager])
->setMethods([
'validateSession'
@@ -950,7 +950,7 @@ class SessionTest extends \Test\TestCase {
$token->setUid('fritz0');
$token->setLastCheck(100); // Needs check
$user = $this->createMock(IUser::class);
- $userSession = $this->getMockBuilder('\OC\User\Session')
+ $userSession = $this->getMockBuilder(Session::class)
->setMethods(['logout'])
->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager])
->getMock();
@@ -980,7 +980,7 @@ class SessionTest extends \Test\TestCase {
$session = $this->createMock(ISession::class);
$timeFactory = $this->createMock(ITimeFactory::class);
$tokenProvider = $this->createMock(IProvider::class);
- $userSession = $this->getMockBuilder('\OC\User\Session')
+ $userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([$userManager, $session, $timeFactory, $tokenProvider, $this->config, $this->random, $this->lockdownManager])
->setMethods(['logout'])
->getMock();
@@ -1027,7 +1027,7 @@ class SessionTest extends \Test\TestCase {
$session = $this->createMock(ISession::class);
$timeFactory = $this->createMock(ITimeFactory::class);
$tokenProvider = $this->createMock(IProvider::class);
- $userSession = $this->getMockBuilder('\OC\User\Session')
+ $userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([$userManager, $session, $timeFactory, $tokenProvider, $this->config, $this->random, $this->lockdownManager])
->setMethods(['logout'])
->getMock();
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index 089f30a1fef..acb171d92e3 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -276,7 +276,7 @@ class UserTest extends TestCase {
->method('implementsActions')
->will($this->returnValue(false));
- $allConfig = $this->getMockBuilder('\OCP\IConfig')
+ $allConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
$allConfig->expects($this->any())
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index 52d18571647..49dc4ddebb1 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -10,6 +10,8 @@ namespace Test;
use OC_Util;
use OCP\App\IAppManager;
+use OCP\IConfig;
+use OCP\IUser;
/**
* Class UtilTest
@@ -259,9 +261,9 @@ class UtilTest extends \Test\TestCase {
* @param bool $expected expected result
*/
function testIsSharingDisabledForUser($groups, $membership, $excludedGroups, $expected) {
- $config = $this->getMockBuilder('OCP\IConfig')->disableOriginalConstructor()->getMock();
+ $config = $this->getMockBuilder(IConfig::class)->disableOriginalConstructor()->getMock();
$groupManager = $this->getMockBuilder('OCP\IGroupManager')->disableOriginalConstructor()->getMock();
- $user = $this->getMockBuilder('OCP\IUser')->disableOriginalConstructor()->getMock();
+ $user = $this->getMockBuilder(IUser::class)->disableOriginalConstructor()->getMock();
$config
->expects($this->at(0))