summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.drone.yml4
-rw-r--r--apps/federation/tests/BackgroundJob/GetSharedSecretTest.php14
-rw-r--r--apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php12
-rw-r--r--apps/federation/tests/Controller/SettingsControllerTest.php9
-rw-r--r--apps/federation/tests/DbHandlerTest.php2
-rw-r--r--apps/federation/tests/Middleware/AddServerMiddlewareTest.php7
-rw-r--r--apps/federation/tests/TrustedServersTest.php18
-rw-r--r--apps/user_ldap/js/wizard/wizard.js2
-rw-r--r--apps/user_ldap/lib/Access.php3
-rw-r--r--apps/user_ldap/lib/Configuration.php5
-rw-r--r--apps/user_ldap/lib/Connection.php4
-rw-r--r--apps/user_ldap/lib/Jobs/UpdateGroups.php1
-rw-r--r--apps/user_ldap/lib/LDAP.php1
-rw-r--r--apps/user_ldap/lib/User_LDAP.php5
-rw-r--r--apps/user_ldap/lib/Wizard.php1
-rw-r--r--apps/user_ldap/tests/AccessTest.php1
-rw-r--r--apps/user_ldap/tests/ConfigurationTest.php8
-rw-r--r--apps/user_ldap/tests/Integration/Lib/IntegrationTestUserHome.php4
-rw-r--r--apps/user_ldap/tests/User/ManagerTest.php1
-rw-r--r--lib/private/LargeFileHelper.php17
-rw-r--r--lib/private/Memcache/APCu.php32
-rw-r--r--tests/Core/Command/Config/App/DeleteConfigTest.php14
-rw-r--r--tests/Core/Command/Config/App/GetConfigTest.php9
-rw-r--r--tests/Core/Command/Config/App/SetConfigTest.php9
-rw-r--r--tests/Core/Command/Config/ImportTest.php9
-rw-r--r--tests/Core/Command/Config/ListConfigsTest.php12
-rw-r--r--tests/Core/Command/Config/System/DeleteConfigTest.php9
-rw-r--r--tests/Core/Command/Config/System/GetConfigTest.php9
-rw-r--r--tests/Core/Command/Config/System/SetConfigTest.php9
-rw-r--r--tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php18
-rw-r--r--tests/Core/Command/Encryption/DecryptAllTest.php20
-rw-r--r--tests/Core/Command/Encryption/DisableTest.php9
-rw-r--r--tests/Core/Command/Encryption/EnableTest.php12
-rw-r--r--tests/Core/Command/Encryption/EncryptAllTest.php21
-rw-r--r--tests/Core/Command/Encryption/SetDefaultModuleTest.php9
-rw-r--r--tests/Core/Command/Log/FileTest.php9
-rw-r--r--tests/Core/Command/Log/ManageTest.php9
-rw-r--r--tests/Core/Command/Maintenance/DataFingerprintTest.php10
-rw-r--r--tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php12
-rw-r--r--tests/Core/Command/Maintenance/SingleUserTest.php9
-rw-r--r--tests/Core/Command/User/DeleteTest.php12
-rw-r--r--tests/Core/Command/User/LastSeenTest.php12
-rw-r--r--tests/Core/Command/User/SettingTest.php15
-rw-r--r--tests/lib/LargeFileHelperGetFileSizeTest.php15
44 files changed, 244 insertions, 179 deletions
diff --git a/.drone.yml b/.drone.yml
index 6016ebd6981..70c5f246a6a 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -4,13 +4,13 @@ build:
commands:
- ./autotest-js.sh
nodb-php5.6:
- image: nextcloudci/php5.6:1.0.6
+ image: nextcloudci/php5.6:php5.6-1
commands:
- rm -rf data/* config/config.php # TODO: remove this - temporary fix for CI issues
- git submodule update --init
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
nodb-php7.0:
- image: nextcloudci/php7.0:1.0.9
+ image: nextcloudci/php7.0:php7.0-1
commands:
- rm -rf data/* config/config.php # TODO: remove this - temporary fix for CI issues
- git submodule update --init
diff --git a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
index 0746c517fa7..fe7cc5cc337 100644
--- a/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/GetSharedSecretTest.php
@@ -73,15 +73,15 @@ class GetSharedSecretTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->httpClient = $this->getMock('OCP\Http\Client\IClient');
- $this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
- $this->urlGenerator = $this->getMock('OCP\IURLGenerator');
- $this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
+ $this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
+ $this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
+ $this->trustedServers = $this->getMockBuilder(TrustedServers::class)
->disableOriginalConstructor()->getMock();
- $this->dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
+ $this->dbHandler = $this->getMockBuilder(DbHandler::class)
->disableOriginalConstructor()->getMock();
- $this->logger = $this->getMock('OCP\ILogger');
- $this->response = $this->getMock('OCP\Http\Client\IResponse');
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->getSharedSecret = new GetSharedSecret(
$this->httpClient,
diff --git a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
index 339a2cbad00..3fa2ca2973e 100644
--- a/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
+++ b/apps/federation/tests/BackgroundJob/RequestSharedSecretTest.php
@@ -61,14 +61,14 @@ class RequestSharedSecretTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->httpClient = $this->getMock('OCP\Http\Client\IClient');
- $this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
- $this->urlGenerator = $this->getMock('OCP\IURLGenerator');
- $this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
+ $this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
+ $this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
+ $this->urlGenerator = $this->getMockBuilder(IURLGenerator::class)->getMock();
+ $this->trustedServers = $this->getMockBuilder(TrustedServers::class)
->disableOriginalConstructor()->getMock();
- $this->dbHandler = $this->getMockBuilder('OCA\Federation\DbHandler')
+ $this->dbHandler = $this->getMockBuilder(DbHandler::class)
->disableOriginalConstructor()->getMock();
- $this->response = $this->getMock('OCP\Http\Client\IResponse');
+ $this->response = $this->getMockBuilder(IResponse::class)->getMock();
$this->requestSharedSecret = new RequestSharedSecret(
$this->httpClient,
diff --git a/apps/federation/tests/Controller/SettingsControllerTest.php b/apps/federation/tests/Controller/SettingsControllerTest.php
index e73d1f47cdd..2f93ebfeaa1 100644
--- a/apps/federation/tests/Controller/SettingsControllerTest.php
+++ b/apps/federation/tests/Controller/SettingsControllerTest.php
@@ -25,7 +25,10 @@ namespace OCA\Federation\Tests\Controller;
use OCA\Federation\Controller\SettingsController;
+use OCA\Federation\TrustedServers;
use OCP\AppFramework\Http\DataResponse;
+use OCP\IL10N;
+use OCP\IRequest;
use Test\TestCase;
class SettingsControllerTest extends TestCase {
@@ -45,9 +48,9 @@ class SettingsControllerTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->request = $this->getMock('OCP\IRequest');
- $this->l10n = $this->getMock('OCP\IL10N');
- $this->trustedServers = $this->getMockBuilder('OCA\Federation\TrustedServers')
+ $this->request = $this->getMockBuilder(IRequest::class)->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->trustedServers = $this->getMockBuilder(TrustedServers::class)
->disableOriginalConstructor()->getMock();
$this->controller = new SettingsController(
diff --git a/apps/federation/tests/DbHandlerTest.php b/apps/federation/tests/DbHandlerTest.php
index f27317cfad9..d9f9cf162b6 100644
--- a/apps/federation/tests/DbHandlerTest.php
+++ b/apps/federation/tests/DbHandlerTest.php
@@ -53,7 +53,7 @@ class DbHandlerTest extends TestCase {
parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection();
- $this->il10n = $this->getMock('OCP\IL10N');
+ $this->il10n = $this->getMockBuilder(IL10N::class)->getMock();
$this->dbHandler = new DbHandler(
$this->connection,
diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
index 9eed79b0db0..b2096cb3730 100644
--- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
+++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
@@ -29,6 +29,7 @@ use OC\HintException;
use OCA\Federation\Middleware\AddServerMiddleware;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
+use OCP\IL10N;
use OCP\ILogger;
use Test\TestCase;
@@ -49,9 +50,9 @@ class AddServerMiddlewareTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->logger = $this->getMock('OCP\ILogger');
- $this->l10n = $this->getMock('OCP\IL10N');
- $this->controller = $this->getMockBuilder('OCP\AppFramework\Controller')
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
+ $this->controller = $this->getMockBuilder(Controller::class)
->disableOriginalConstructor()->getMock();
$this->middleware = new AddServerMiddleware(
diff --git a/apps/federation/tests/TrustedServersTest.php b/apps/federation/tests/TrustedServersTest.php
index 1bf1475aef2..d16c0908dd4 100644
--- a/apps/federation/tests/TrustedServersTest.php
+++ b/apps/federation/tests/TrustedServersTest.php
@@ -74,17 +74,17 @@ class TrustedServersTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->dbHandler = $this->getMockBuilder('\OCA\Federation\DbHandler')
+ $this->dbHandler = $this->getMockBuilder(DbHandler::class)
->disableOriginalConstructor()->getMock();
- $this->dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcherInterface')
+ $this->dispatcher = $this->getMockBuilder(EventDispatcherInterface::class)
->disableOriginalConstructor()->getMock();
- $this->httpClientService = $this->getMock('OCP\Http\Client\IClientService');
- $this->httpClient = $this->getMock('OCP\Http\Client\IClient');
- $this->response = $this->getMock('OCP\Http\Client\IResponse');
- $this->logger = $this->getMock('OCP\ILogger');
- $this->jobList = $this->getMock('OCP\BackgroundJob\IJobList');
- $this->secureRandom = $this->getMock('OCP\Security\ISecureRandom');
- $this->config = $this->getMock('OCP\IConfig');
+ $this->httpClientService = $this->getMockBuilder(IClientService::class)->getMock();
+ $this->httpClient = $this->getMockBuilder(IClient::class)->getMock();
+ $this->response = $this->getMockBuilder(IResponse::class)->getMock();
+ $this->logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $this->jobList = $this->getMockBuilder(IJobList::class)->getMock();
+ $this->secureRandom = $this->getMockBuilder(ISecureRandom::class)->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->trustedServers = new TrustedServers(
$this->dbHandler,
diff --git a/apps/user_ldap/js/wizard/wizard.js b/apps/user_ldap/js/wizard/wizard.js
index e8450d1c78f..62a3fccbdfb 100644
--- a/apps/user_ldap/js/wizard/wizard.js
+++ b/apps/user_ldap/js/wizard/wizard.js
@@ -70,7 +70,7 @@ OCA = OCA || {};
controller.setView(view);
controller.setModel(model);
controller.run();
- }
+ };
OCA.LDAP.Wizard.Wizard = Wizard;
})();
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 299ad581644..12d71b1528a 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -869,7 +869,7 @@ class Access extends LDAPUtility implements IUserTools {
//browsing through prior pages to get the cookie for the new one
if($skipHandling) {
- return;
+ return false;
}
// if count is bigger, then the server does not support
// paged search. Instead, he did a normal search. We set a
@@ -983,7 +983,6 @@ class Access extends LDAPUtility implements IUserTools {
$findings = array();
$savedoffset = $offset;
do {
- $continue = false;
$search = $this->executeSearch($filter, $base, $attr, $limit, $offset);
if($search === false) {
return array();
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 2fa42efda26..54dfe6779ba 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -106,12 +106,13 @@ class Configuration {
/**
* @param string $name
- * @return mixed|void
+ * @return mixed|null
*/
public function __get($name) {
if(isset($this->config[$name])) {
return $this->config[$name];
}
+ return null;
}
/**
@@ -182,7 +183,7 @@ class Configuration {
$applied[] = $inputKey;
}
}
-
+ return null;
}
public function readConfiguration() {
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 7fb26526195..07a595f0529 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -558,12 +558,13 @@ class Connection extends LDAPUtility {
}
return $bindStatus;
}
+ return null;
}
/**
* @param string $host
* @param string $port
- * @return false|void
+ * @return bool
* @throws \OC\ServerNotAvailableException
*/
private function doConnect($host, $port) {
@@ -580,6 +581,7 @@ class Connection extends LDAPUtility {
} else {
throw new \OC\ServerNotAvailableException('Could not set required LDAP Protocol version.');
}
+ return true;
}
/**
diff --git a/apps/user_ldap/lib/Jobs/UpdateGroups.php b/apps/user_ldap/lib/Jobs/UpdateGroups.php
index 047b95a6d9b..3b951d20c43 100644
--- a/apps/user_ldap/lib/Jobs/UpdateGroups.php
+++ b/apps/user_ldap/lib/Jobs/UpdateGroups.php
@@ -44,7 +44,6 @@ class UpdateGroups extends \OC\BackgroundJob\TimedJob {
static private $groupsFromDB;
static private $groupBE;
- static private $connector;
public function __construct(){
$this->interval = self::getRefreshInterval();
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php
index 5376d92a742..74d83e4ab4f 100644
--- a/apps/user_ldap/lib/LDAP.php
+++ b/apps/user_ldap/lib/LDAP.php
@@ -259,6 +259,7 @@ class LDAP implements ILDAPWrapper {
}
return $result;
}
+ return null;
}
/**
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index ce1aafc210e..13e61c63c08 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -189,11 +189,6 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
$this->access->connection->ldapUserDisplayName . '=*',
$this->access->getFilterPartForUserSearch($search)
));
- $attrs = array($this->access->connection->ldapUserDisplayName, 'dn');
- $additionalAttribute = $this->access->connection->ldapUserDisplayName2;
- if(!empty($additionalAttribute)) {
- $attrs[] = $additionalAttribute;
- }
\OCP\Util::writeLog('user_ldap',
'getUsers: Options: search '.$search.' limit '.$limit.' offset '.$offset.' Filter: '.$filter,
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index 573d30f0005..852c806b104 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -943,7 +943,6 @@ class Wizard extends LDAPUtility {
$cns = $this->configuration->ldapGroupFilterGroups;
if(is_array($cns) && count($cns) > 0) {
$filter .= '(|';
- $base = $this->configuration->ldapBase[0];
foreach($cns as $cn) {
$filter .= '(cn=' . $cn . ')';
}
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index 2fddafa214b..5e99583c70f 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -201,6 +201,7 @@ class AccessTest extends \Test\TestCase {
return $case['interResult'];
}
}
+ return null;
}));
foreach($cases as $case) {
diff --git a/apps/user_ldap/tests/ConfigurationTest.php b/apps/user_ldap/tests/ConfigurationTest.php
index 9951b97e06c..797d2598be4 100644
--- a/apps/user_ldap/tests/ConfigurationTest.php
+++ b/apps/user_ldap/tests/ConfigurationTest.php
@@ -93,14 +93,6 @@ class ConfigurationTest extends \Test\TestCase {
public function testSetValue($key, $input, $expected) {
$configuration = new \OCA\User_LDAP\Configuration('t01', false);
- $settingsInput = array(
- 'ldapBaseUsers' => array(
- 'cn=someUsers,dc=example,dc=org',
- ' ',
- ' cn=moreUsers,dc=example,dc=org '
- )
- );
-
$configuration->setConfiguration([$key => $input]);
$this->assertSame($configuration->$key, $expected);
}
diff --git a/apps/user_ldap/tests/Integration/Lib/IntegrationTestUserHome.php b/apps/user_ldap/tests/Integration/Lib/IntegrationTestUserHome.php
index 95c14ca8947..2200ac327a1 100644
--- a/apps/user_ldap/tests/Integration/Lib/IntegrationTestUserHome.php
+++ b/apps/user_ldap/tests/Integration/Lib/IntegrationTestUserHome.php
@@ -111,7 +111,7 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
*/
protected function case2() {
\OC::$server->getConfig()->setAppValue('user_ldap', 'enforce_home_folder_naming_rule', true);
- $userManager = \oc::$server->getUserManager();
+ $userManager = \OC::$server->getUserManager();
// clearing backends is critical, otherwise the userManager will have
// the user objects cached and the value from case1 returned
$userManager->clearBackends();
@@ -144,7 +144,7 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
$this->connection->setConfiguration([
'homeFolderNamingRule' => 'attr:',
]);
- $userManager = \oc::$server->getUserManager();
+ $userManager = \OC::$server->getUserManager();
$userManager->clearBackends();
$userManager->registerBackend($this->backend);
$users = $userManager->search('', 5, 0);
diff --git a/apps/user_ldap/tests/User/ManagerTest.php b/apps/user_ldap/tests/User/ManagerTest.php
index 0c370f12c43..b3f22d6a068 100644
--- a/apps/user_ldap/tests/User/ManagerTest.php
+++ b/apps/user_ldap/tests/User/ManagerTest.php
@@ -208,7 +208,6 @@ class ManagerTest extends \Test\TestCase {
list($access, $config, $filesys, $image, $log, $avaMgr, $dbc, $userMgr) =
$this->getTestInstances();
- $dn = 'cn=foo,dc=foobar,dc=bar';
$uid = 'gone';
$access->expects($this->never())
diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php
index f89d3216a39..9d0fe864033 100644
--- a/lib/private/LargeFileHelper.php
+++ b/lib/private/LargeFileHelper.php
@@ -138,23 +138,6 @@ class LargeFileHelper {
}
/**
- * @brief Tries to get the size of a file via the Windows DOM extension.
- *
- * @param string $filename Path to the file.
- *
- * @return null|int|float Number of bytes as number (float or int) or
- * null on failure.
- */
- public function getFileSizeViaCOM($filename) {
- if (class_exists('COM')) {
- $fsObj = new \COM("Scripting.FileSystemObject");
- $file = $fsObj->GetFile($filename);
- return 0 + $file->Size;
- }
- return null;
- }
-
- /**
* @brief Tries to get the size of a file via an exec() call.
*
* @param string $filename Path to the file.
diff --git a/lib/private/Memcache/APCu.php b/lib/private/Memcache/APCu.php
index 713ed152648..70f0d73d2d4 100644
--- a/lib/private/Memcache/APCu.php
+++ b/lib/private/Memcache/APCu.php
@@ -88,7 +88,21 @@ class APCu extends Cache implements IMemcache {
*/
public function inc($key, $step = 1) {
$this->add($key, 0);
- return apcu_inc($this->getPrefix() . $key, $step);
+ /**
+ * TODO - hack around a PHP 7 specific issue in APCu
+ *
+ * on PHP 7 the apcu_inc method on a non-existing object will increment
+ * "0" and result in "1" as value - therefore we check for existence
+ * first
+ *
+ * on PHP 5.6 this is not the case
+ *
+ * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
+ * for details
+ */
+ return apcu_exists($this->getPrefix() . $key)
+ ? apcu_inc($this->getPrefix() . $key, $step)
+ : false;
}
/**
@@ -99,7 +113,21 @@ class APCu extends Cache implements IMemcache {
* @return int | bool
*/
public function dec($key, $step = 1) {
- return apcu_dec($this->getPrefix() . $key, $step);
+ /**
+ * TODO - hack around a PHP 7 specific issue in APCu
+ *
+ * on PHP 7 the apcu_dec method on a non-existing object will decrement
+ * "0" and result in "-1" as value - therefore we check for existence
+ * first
+ *
+ * on PHP 5.6 this is not the case
+ *
+ * see https://github.com/krakjoe/apcu/issues/183#issuecomment-244038221
+ * for details
+ */
+ return apcu_exists($this->getPrefix() . $key)
+ ? apcu_dec($this->getPrefix() . $key, $step)
+ : false;
}
/**
diff --git a/tests/Core/Command/Config/App/DeleteConfigTest.php b/tests/Core/Command/Config/App/DeleteConfigTest.php
index 7056e1b1ff9..f74fd73d697 100644
--- a/tests/Core/Command/Config/App/DeleteConfigTest.php
+++ b/tests/Core/Command/Config/App/DeleteConfigTest.php
@@ -23,10 +23,13 @@ namespace Tests\Core\Command\Config\App;
use OC\Core\Command\Config\App\DeleteConfig;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DeleteConfigTest extends TestCase {
- /** @var \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
protected $config;
/** @var \PHPUnit_Framework_MockObject_MockObject */
@@ -40,14 +43,13 @@ class DeleteConfigTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
- /** @var \OCP\IConfig $config */
- $this->command = new DeleteConfig($config);
+ $this->command = new DeleteConfig($this->config);
}
diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php
index 1ceeb16ccf4..2fac1572e37 100644
--- a/tests/Core/Command/Config/App/GetConfigTest.php
+++ b/tests/Core/Command/Config/App/GetConfigTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\App;
use OC\Core\Command\Config\App\GetConfig;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class GetConfigTest extends TestCase {
@@ -40,11 +43,11 @@ class GetConfigTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
$this->command = new GetConfig($config);
diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php
index 14d7b0cb7b5..f66390871de 100644
--- a/tests/Core/Command/Config/App/SetConfigTest.php
+++ b/tests/Core/Command/Config/App/SetConfigTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\App;
use OC\Core\Command\Config\App\SetConfig;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SetConfigTest extends TestCase {
@@ -40,11 +43,11 @@ class SetConfigTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
$this->command = new SetConfig($config);
diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php
index f14880f8bf4..7afa47d3536 100644
--- a/tests/Core/Command/Config/ImportTest.php
+++ b/tests/Core/Command/Config/ImportTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config;
use OC\Core\Command\Config\Import;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class ImportTest extends TestCase {
@@ -40,11 +43,11 @@ class ImportTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
$this->command = new Import($config);
diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php
index bde6a1b0db3..0f170cee840 100644
--- a/tests/Core/Command/Config/ListConfigsTest.php
+++ b/tests/Core/Command/Config/ListConfigsTest.php
@@ -23,7 +23,11 @@ namespace Tests\Core\Command\Config;
use OC\Core\Command\Config\ListConfigs;
+use OC\SystemConfig;
+use OCP\IAppConfig;
use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class ListConfigsTest extends TestCase {
@@ -43,14 +47,14 @@ class ListConfigsTest extends TestCase {
protected function setUp() {
parent::setUp();
- $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig')
+ $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor()
->getMock();
- $appConfig = $this->appConfig = $this->getMockBuilder('OCP\IAppConfig')
+ $appConfig = $this->appConfig = $this->getMockBuilder(IAppConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */
/** @var \OCP\IAppConfig $appConfig */
diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php
index 11bfb6ae7ad..5ac4c853df3 100644
--- a/tests/Core/Command/Config/System/DeleteConfigTest.php
+++ b/tests/Core/Command/Config/System/DeleteConfigTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System;
use OC\Core\Command\Config\System\DeleteConfig;
+use OC\SystemConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DeleteConfigTest extends TestCase {
@@ -40,11 +43,11 @@ class DeleteConfigTest extends TestCase {
protected function setUp() {
parent::setUp();
- $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig')
+ $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */
$this->command = new DeleteConfig($systemConfig);
diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php
index ebbea634cde..943cc4cfa40 100644
--- a/tests/Core/Command/Config/System/GetConfigTest.php
+++ b/tests/Core/Command/Config/System/GetConfigTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System;
use OC\Core\Command\Config\System\GetConfig;
+use OC\SystemConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class GetConfigTest extends TestCase {
@@ -40,11 +43,11 @@ class GetConfigTest extends TestCase {
protected function setUp() {
parent::setUp();
- $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig')
+ $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */
$this->command = new GetConfig($systemConfig);
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php
index c0b664d7522..bb8d2c4b962 100644
--- a/tests/Core/Command/Config/System/SetConfigTest.php
+++ b/tests/Core/Command/Config/System/SetConfigTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Config\System;
use OC\Core\Command\Config\System\SetConfig;
+use OC\SystemConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SetConfigTest extends TestCase {
@@ -40,11 +43,11 @@ class SetConfigTest extends TestCase {
protected function setUp() {
parent::setUp();
- $systemConfig = $this->systemConfig = $this->getMockBuilder('OC\SystemConfig')
+ $systemConfig = $this->systemConfig = $this->getMockBuilder(SystemConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OC\SystemConfig $systemConfig */
$this->command = new SetConfig($systemConfig);
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
index 2a1f48983f1..57eb2137ac1 100644
--- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
+++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
@@ -28,6 +28,8 @@ use OC\Encryption\Util;
use OC\Files\View;
use OCP\IConfig;
use OCP\IUserManager;
+use OCP\UserInterface;
+use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -65,16 +67,16 @@ class ChangeKeyStorageRootTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->view = $this->getMock('\OC\Files\View');
- $this->userManager = $this->getMock('\OCP\IUserManager');
- $this->config = $this->getMock('\OCP\IConfig');
+ $this->view = $this->getMockBuilder(View::class)->getMock();
+ $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->util = $this->getMockBuilder('OC\Encryption\Util')->disableOriginalConstructor()->getMock();
- $this->questionHelper = $this->getMock('Symfony\Component\Console\Helper\QuestionHelper');
- $this->inputInterface = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->outputInterface = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
- $this->userInterface = $this->getMock('\OCP\UserInterface');
+ $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)->getMock();
+ $this->inputInterface = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->outputInterface = $this->getMockBuilder(OutputInterface::class)->getMock();
+ $this->userInterface = $this->getMockBuilder(UserInterface::class)->getMock();
- $outputFormatterInterface = $this->getMock('Symfony\Component\Console\Formatter\OutputFormatterInterface');
+ $outputFormatterInterface = $this->getMockBuilder(OutputFormatterInterface::class)->getMock();
$this->outputInterface->expects($this->any())->method('getFormatter')
->willReturn($outputFormatterInterface);
diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php
index 972ea03150c..8f674aa5b44 100644
--- a/tests/Core/Command/Encryption/DecryptAllTest.php
+++ b/tests/Core/Command/Encryption/DecryptAllTest.php
@@ -24,6 +24,12 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\DecryptAll;
+use OCP\App\IAppManager;
+use OCP\Encryption\IManager;
+use OCP\IConfig;
+use Symfony\Component\Console\Helper\QuestionHelper;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DecryptAllTest extends TestCase {
@@ -52,22 +58,22 @@ class DecryptAllTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->encryptionManager = $this->getMockBuilder('OCP\Encryption\IManager')
+ $this->encryptionManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
- $this->appManager = $this->getMockBuilder('OCP\App\IAppManager')
+ $this->appManager = $this->getMockBuilder(IAppManager::class)
->disableOriginalConstructor()
->getMock();
- $this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
+ $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)
->disableOriginalConstructor()
->getMock();
- $this->decryptAll = $this->getMockBuilder('OC\Encryption\DecryptAll')
+ $this->decryptAll = $this->getMockBuilder(\OC\Encryption\DecryptAll::class)
->disableOriginalConstructor()->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->config->expects($this->any())
->method('getSystemValue')
diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php
index dfd06e2e26e..77a690fe264 100644
--- a/tests/Core/Command/Encryption/DisableTest.php
+++ b/tests/Core/Command/Encryption/DisableTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\Disable;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DisableTest extends TestCase {
@@ -39,11 +42,11 @@ class DisableTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
$this->command = new Disable($config);
diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php
index e2357464aa1..eb1b7842385 100644
--- a/tests/Core/Command/Encryption/EnableTest.php
+++ b/tests/Core/Command/Encryption/EnableTest.php
@@ -23,6 +23,10 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\Enable;
+use OCP\Encryption\IManager;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class EnableTest extends TestCase {
@@ -41,14 +45,14 @@ class EnableTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $manager = $this->manager = $this->getMockBuilder('OCP\Encryption\IManager')
+ $manager = $this->manager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
/** @var \OCP\Encryption\IManager $manager */
diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php
index 128b4caa148..00895541782 100644
--- a/tests/Core/Command/Encryption/EncryptAllTest.php
+++ b/tests/Core/Command/Encryption/EncryptAllTest.php
@@ -24,6 +24,13 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\EncryptAll;
+use OCP\App\IAppManager;
+use OCP\Encryption\IEncryptionModule;
+use OCP\Encryption\IManager;
+use OCP\IConfig;
+use Symfony\Component\Console\Helper\QuestionHelper;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class EncryptAllTest extends TestCase {
@@ -55,23 +62,23 @@ class EncryptAllTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->encryptionManager = $this->getMockBuilder('OCP\Encryption\IManager')
+ $this->encryptionManager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
- $this->appManager = $this->getMockBuilder('OCP\App\IAppManager')
+ $this->appManager = $this->getMockBuilder(IAppManager::class)
->disableOriginalConstructor()
->getMock();
- $this->encryptionModule = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule')
+ $this->encryptionModule = $this->getMockBuilder(IEncryptionModule::class)
->disableOriginalConstructor()
->getMock();
- $this->questionHelper = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
+ $this->questionHelper = $this->getMockBuilder(QuestionHelper::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
}
diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
index 3230a57db07..3f04ba7e79d 100644
--- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php
+++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Encryption;
use OC\Core\Command\Encryption\SetDefaultModule;
+use OCP\Encryption\IManager;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SetDefaultModuleTest extends TestCase {
@@ -39,11 +42,11 @@ class SetDefaultModuleTest extends TestCase {
protected function setUp() {
parent::setUp();
- $manager = $this->manager = $this->getMockBuilder('OCP\Encryption\IManager')
+ $manager = $this->manager = $this->getMockBuilder(IManager::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\Encryption\IManager $manager */
$this->command = new SetDefaultModule($manager);
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php
index f55f92901d6..4270684c9b6 100644
--- a/tests/Core/Command/Log/FileTest.php
+++ b/tests/Core/Command/Log/FileTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Log;
use OC\Core\Command\Log\File;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class FileTest extends TestCase {
@@ -39,11 +42,11 @@ class FileTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->command = new File($config);
}
diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php
index cf4506a64eb..4b026f14847 100644
--- a/tests/Core/Command/Log/ManageTest.php
+++ b/tests/Core/Command/Log/ManageTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Log;
use OC\Core\Command\Log\Manage;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class ManageTest extends TestCase {
@@ -39,11 +42,11 @@ class ManageTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->command = new Manage($config);
}
diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php
index 4d661b5c027..90ffa50c012 100644
--- a/tests/Core/Command/Maintenance/DataFingerprintTest.php
+++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php
@@ -24,6 +24,8 @@ namespace Tests\Core\Command\Maintenance;
use OC\Core\Command\Maintenance\DataFingerprint;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DataFingerprintTest extends TestCase {
@@ -42,10 +44,10 @@ class DataFingerprintTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->config = $this->getMock('OCP\IConfig');
- $this->timeFactory = $this->getMock('OCP\AppFramework\Utility\ITimeFactory');
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->config = $this->getMockBuilder(IConfig::class)->getMock();
+ $this->timeFactory = $this->getMockBuilder(ITimeFactory::class)->getMock();
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
$this->command = new DataFingerprint($this->config, $this->timeFactory);
diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
index 217301102c5..8c023274da5 100644
--- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
+++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
@@ -22,6 +22,10 @@
namespace Tests\Core\Command\Maintenance\Mimetype;
use OC\Core\Command\Maintenance\Mimetype\UpdateDB;
+use OC\Files\Type\Detection;
+use OC\Files\Type\Loader;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
use OCP\Files\IMimeTypeDetector;
use OCP\Files\IMimeTypeLoader;
@@ -43,15 +47,15 @@ class UpdateDBTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->detector = $this->getMockBuilder('OC\Files\Type\Detection')
+ $this->detector = $this->getMockBuilder(Detection::class)
->disableOriginalConstructor()
->getMock();
- $this->loader = $this->getMockBuilder('OC\Files\Type\Loader')
+ $this->loader = $this->getMockBuilder(Loader::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
$this->command = new UpdateDB($this->detector, $this->loader);
}
diff --git a/tests/Core/Command/Maintenance/SingleUserTest.php b/tests/Core/Command/Maintenance/SingleUserTest.php
index 6629f39564f..13efebacb0a 100644
--- a/tests/Core/Command/Maintenance/SingleUserTest.php
+++ b/tests/Core/Command/Maintenance/SingleUserTest.php
@@ -23,6 +23,9 @@ namespace Tests\Core\Command\Maintenance;
use OC\Core\Command\Maintenance\SingleUser;
+use OCP\IConfig;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SingleUserTest extends TestCase {
@@ -39,11 +42,11 @@ class SingleUserTest extends TestCase {
protected function setUp() {
parent::setUp();
- $config = $this->config = $this->getMockBuilder('OCP\IConfig')
+ $config = $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IConfig $config */
$this->command = new SingleUser($config);
diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php
index bb813626d7a..1b94d37cfc4 100644
--- a/tests/Core/Command/User/DeleteTest.php
+++ b/tests/Core/Command/User/DeleteTest.php
@@ -23,6 +23,10 @@ namespace Tests\Core\Command\User;
use OC\Core\Command\User\Delete;
+use OCP\IUser;
+use OCP\IUserManager;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class DeleteTest extends TestCase {
@@ -39,11 +43,11 @@ class DeleteTest extends TestCase {
protected function setUp() {
parent::setUp();
- $userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $userManager = $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IUserManager $userManager */
$this->command = new Delete($userManager);
@@ -64,7 +68,7 @@ class DeleteTest extends TestCase {
* @param string $expectedString
*/
public function testValidUser($deleteSuccess, $expectedString) {
- $user = $this->getMock('OCP\IUser');
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
->method('delete')
->willReturn($deleteSuccess);
diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php
index 84805f5c072..cceefb98810 100644
--- a/tests/Core/Command/User/LastSeenTest.php
+++ b/tests/Core/Command/User/LastSeenTest.php
@@ -23,6 +23,10 @@ namespace Tests\Core\Command\User;
use OC\Core\Command\User\LastSeen;
+use OCP\IUser;
+use OCP\IUserManager;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class LastSeenTest extends TestCase {
@@ -39,11 +43,11 @@ class LastSeenTest extends TestCase {
protected function setUp() {
parent::setUp();
- $userManager = $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $userManager = $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMock('Symfony\Component\Console\Input\InputInterface');
- $this->consoleOutput = $this->getMock('Symfony\Component\Console\Output\OutputInterface');
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
/** @var \OCP\IUserManager $userManager */
$this->command = new LastSeen($userManager);
@@ -63,7 +67,7 @@ class LastSeenTest extends TestCase {
* @param string $expectedString
*/
public function testValidUser($lastSeen, $expectedString) {
- $user = $this->getMock('OCP\IUser');
+ $user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
->method('getLastLogin')
->willReturn($lastSeen);
diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php
index 002e8dfef2f..56db670657a 100644
--- a/tests/Core/Command/User/SettingTest.php
+++ b/tests/Core/Command/User/SettingTest.php
@@ -23,6 +23,11 @@ namespace Tests\Core\Command\User;
use OC\Core\Command\User\Setting;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\IUserManager;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SettingTest extends TestCase {
@@ -40,19 +45,19 @@ class SettingTest extends TestCase {
protected function setUp() {
parent::setUp();
- $this->userManager = $this->getMockBuilder('OCP\IUserManager')
+ $this->userManager = $this->getMockBuilder(IUserManager::class)
->disableOriginalConstructor()
->getMock();
- $this->config = $this->getMockBuilder('OCP\IConfig')
+ $this->config = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
->getMock();
- $this->connection = $this->getMockBuilder('OCP\IDBConnection')
+ $this->connection = $this->getMockBuilder(IDBConnection::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleInput = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')
+ $this->consoleInput = $this->getMockBuilder(InputInterface::class)
->disableOriginalConstructor()
->getMock();
- $this->consoleOutput = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')
+ $this->consoleOutput = $this->getMockBuilder(OutputInterface::class)
->disableOriginalConstructor()
->getMock();
}
diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php
index 0c3a11e971a..b2735d7f619 100644
--- a/tests/lib/LargeFileHelperGetFileSizeTest.php
+++ b/tests/lib/LargeFileHelperGetFileSizeTest.php
@@ -57,21 +57,6 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
/**
* @dataProvider dataFileNameProvider
*/
- public function testGetFileSizeViaCOM($filename, $fileSize) {
- if (!extension_loaded('COM')) {
- $this->markTestSkipped(
- 'The PHP Windows COM extension is required for this test.'
- );
- }
- $this->assertSame(
- $fileSize,
- $this->helper->getFileSizeViaCOM($filename)
- );
- }
-
- /**
- * @dataProvider dataFileNameProvider
- */
public function testGetFileSizeViaExec($filename, $fileSize) {
if (!\OC_Helper::is_function_enabled('exec')) {
$this->markTestSkipped(