aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.mention-bot2
-rw-r--r--apps/files/l10n/cs_CZ.js9
-rw-r--r--apps/files/l10n/cs_CZ.json9
-rw-r--r--apps/files_external/appinfo/application.php38
-rw-r--r--apps/files_external/l10n/cs_CZ.js2
-rw-r--r--apps/files_external/l10n/cs_CZ.json2
-rw-r--r--apps/files_external/lib/config/iauthmechanismprovider.php38
-rw-r--r--apps/files_external/lib/config/ibackendprovider.php38
-rw-r--r--apps/files_external/service/backendservice.php50
-rw-r--r--apps/files_external/tests/service/backendservicetest.php76
-rw-r--r--apps/files_sharing/tests/deleteorphanedsharesjobtest.php2
-rw-r--r--apps/files_sharing/tests/server2server.php2
-rw-r--r--apps/systemtags/l10n/bg_BG.js1
-rw-r--r--apps/systemtags/l10n/bg_BG.json1
-rw-r--r--apps/updatenotification/l10n/bg_BG.js6
-rw-r--r--apps/updatenotification/l10n/bg_BG.json6
-rw-r--r--core/l10n/lv.js2
-rw-r--r--core/l10n/lv.json2
-rw-r--r--lib/autoloader.php8
-rw-r--r--lib/base.php2
-rw-r--r--lib/private/DB/Connection.php6
-rw-r--r--lib/private/OCS/Provider.php (renamed from ocs-provider/provider.php)2
-rw-r--r--lib/private/User/Session.php4
-rw-r--r--lib/public/API.php (renamed from lib/public/api.php)0
-rw-r--r--lib/public/App.php (renamed from lib/public/app.php)0
-rw-r--r--lib/public/AutoloadNotAllowedException.php (renamed from lib/public/autoloadnotallowedexception.php)0
-rw-r--r--lib/public/BackgroundJob.php (renamed from lib/public/backgroundjob.php)0
-rw-r--r--lib/public/Config.php (renamed from lib/public/config.php)0
-rw-r--r--lib/public/Constants.php (renamed from lib/public/constants.php)0
-rw-r--r--lib/public/Contacts.php (renamed from lib/public/contacts.php)0
-rw-r--r--lib/public/DB.php (renamed from lib/public/db.php)0
-rw-r--r--lib/public/Defaults.php (renamed from lib/public/defaults.php)0
-rw-r--r--lib/public/Files.php (renamed from lib/public/files.php)0
-rw-r--r--lib/public/GroupInterface.php (renamed from lib/public/groupinterface.php)0
-rw-r--r--lib/public/IAddressBook.php (renamed from lib/public/iaddressbook.php)0
-rw-r--r--lib/public/IAppConfig.php (renamed from lib/public/iappconfig.php)0
-rw-r--r--lib/public/IAvatar.php (renamed from lib/public/iavatar.php)0
-rw-r--r--lib/public/IAvatarManager.php (renamed from lib/public/iavatarmanager.php)0
-rw-r--r--lib/public/ICache.php (renamed from lib/public/icache.php)0
-rw-r--r--lib/public/ICacheFactory.php (renamed from lib/public/icachefactory.php)0
-rw-r--r--lib/public/ICertificate.php (renamed from lib/public/icertificate.php)0
-rw-r--r--lib/public/ICertificateManager.php (renamed from lib/public/icertificatemanager.php)0
-rw-r--r--lib/public/IConfig.php (renamed from lib/public/iconfig.php)0
-rw-r--r--lib/public/IContainer.php (renamed from lib/public/icontainer.php)0
-rw-r--r--lib/public/IDBConnection.php (renamed from lib/public/idbconnection.php)0
-rw-r--r--lib/public/IDateTimeFormatter.php (renamed from lib/public/idatetimeformatter.php)0
-rw-r--r--lib/public/IDateTimeZone.php (renamed from lib/public/idatetimezone.php)0
-rw-r--r--lib/public/IDb.php (renamed from lib/public/idb.php)0
-rw-r--r--lib/public/IEventSource.php (renamed from lib/public/ieventsource.php)0
-rw-r--r--lib/public/IGroup.php (renamed from lib/public/igroup.php)0
-rw-r--r--lib/public/IGroupManager.php (renamed from lib/public/igroupmanager.php)0
-rw-r--r--lib/public/IHelper.php (renamed from lib/public/ihelper.php)0
-rw-r--r--lib/public/IImage.php (renamed from lib/public/iimage.php)0
-rw-r--r--lib/public/IL10N.php (renamed from lib/public/il10n.php)0
-rw-r--r--lib/public/ILogger.php (renamed from lib/public/ilogger.php)0
-rw-r--r--lib/public/IMemcache.php (renamed from lib/public/imemcache.php)0
-rw-r--r--lib/public/IMemcacheTTL.php (renamed from lib/public/imemcachettl.php)0
-rw-r--r--lib/public/INavigationManager.php (renamed from lib/public/inavigationmanager.php)0
-rw-r--r--lib/public/IPreview.php (renamed from lib/public/ipreview.php)0
-rw-r--r--lib/public/IRequest.php (renamed from lib/public/irequest.php)0
-rw-r--r--lib/public/ISearch.php (renamed from lib/public/isearch.php)0
-rw-r--r--lib/public/ISession.php (renamed from lib/public/isession.php)0
-rw-r--r--lib/public/ITagManager.php (renamed from lib/public/itagmanager.php)0
-rw-r--r--lib/public/ITags.php (renamed from lib/public/itags.php)0
-rw-r--r--lib/public/ITempManager.php (renamed from lib/public/itempmanager.php)0
-rw-r--r--lib/public/IURLGenerator.php (renamed from lib/public/iurlgenerator.php)0
-rw-r--r--lib/public/IUser.php (renamed from lib/public/iuser.php)0
-rw-r--r--lib/public/IUserBackend.php (renamed from lib/public/iuserbackend.php)0
-rw-r--r--lib/public/IUserManager.php (renamed from lib/public/iusermanager.php)0
-rw-r--r--lib/public/IUserSession.php (renamed from lib/public/iusersession.php)0
-rw-r--r--lib/public/Image.php (renamed from lib/public/image.php)0
-rw-r--r--lib/public/JSON.php (renamed from lib/public/json.php)0
-rw-r--r--lib/public/Mail/IMailer.php (renamed from lib/public/mail/imailer.php)0
-rw-r--r--lib/public/Migration/IOutput.php (renamed from lib/public/migration/ioutput.php)0
-rw-r--r--lib/public/Migration/IRepairStep.php (renamed from lib/public/migration/irepairstep.php)0
-rw-r--r--lib/public/Notification/IAction.php (renamed from lib/public/notification/iaction.php)0
-rw-r--r--lib/public/Notification/IApp.php (renamed from lib/public/notification/iapp.php)0
-rw-r--r--lib/public/Notification/IManager.php (renamed from lib/public/notification/imanager.php)0
-rw-r--r--lib/public/Notification/INotification.php (renamed from lib/public/notification/inotification.php)0
-rw-r--r--lib/public/Notification/INotifier.php (renamed from lib/public/notification/inotifier.php)0
-rw-r--r--lib/public/PreConditionNotMetException.php (renamed from lib/public/preconditionnotmetexception.php)0
-rw-r--r--lib/public/Response.php (renamed from lib/public/response.php)0
-rw-r--r--lib/public/SabrePluginEvent.php (renamed from lib/public/sabrepluginevent.php)0
-rw-r--r--lib/public/SabrePluginException.php (renamed from lib/public/sabrepluginexception.php)0
-rw-r--r--lib/public/Security/IContentSecurityPolicyManager.php (renamed from lib/public/security/icontentsecuritypolicymanager.php)0
-rw-r--r--lib/public/Security/ICredentialsManager.php (renamed from lib/public/security/icredentialsmanager.php)0
-rw-r--r--lib/public/Security/ICrypto.php (renamed from lib/public/security/icrypto.php)0
-rw-r--r--lib/public/Security/IHasher.php (renamed from lib/public/security/ihasher.php)0
-rw-r--r--lib/public/Security/ISecureRandom.php (renamed from lib/public/security/isecurerandom.php)0
-rw-r--r--lib/public/Security/StringUtils.php (renamed from lib/public/security/stringutils.php)0
-rw-r--r--lib/public/Share.php (renamed from lib/public/share.php)0
-rw-r--r--lib/public/Share_Backend.php (renamed from lib/public/share_backend.php)0
-rw-r--r--lib/public/Share_Backend_Collection.php (renamed from lib/public/share_backend_collection.php)0
-rw-r--r--lib/public/Share_Backend_File_Dependent.php (renamed from lib/public/share_backend_file_dependent.php)0
-rw-r--r--lib/public/SystemTag/ISystemTag.php (renamed from lib/public/systemtag/isystemtag.php)0
-rw-r--r--lib/public/SystemTag/ISystemTagManager.php (renamed from lib/public/systemtag/isystemtagmanager.php)0
-rw-r--r--lib/public/SystemTag/ISystemTagManagerFactory.php (renamed from lib/public/systemtag/isystemtagmanagerfactory.php)0
-rw-r--r--lib/public/SystemTag/ISystemTagObjectMapper.php (renamed from lib/public/systemtag/isystemtagobjectmapper.php)0
-rw-r--r--lib/public/SystemTag/ManagerEvent.php (renamed from lib/public/systemtag/managerevent.php)0
-rw-r--r--lib/public/SystemTag/MapperEvent.php (renamed from lib/public/systemtag/mapperevent.php)0
-rw-r--r--lib/public/SystemTag/TagAlreadyExistsException.php (renamed from lib/public/systemtag/tagalreadyexistsexception.php)0
-rw-r--r--lib/public/SystemTag/TagNotFoundException.php (renamed from lib/public/systemtag/tagnotfoundexception.php)0
-rw-r--r--lib/public/User.php (renamed from lib/public/user.php)0
-rw-r--r--lib/public/UserInterface.php (renamed from lib/public/userinterface.php)0
-rw-r--r--lib/public/Util.php (renamed from lib/public/util.php)0
-rw-r--r--ocs-provider/index.php3
-rw-r--r--settings/l10n/lv.js3
-rw-r--r--settings/l10n/lv.json3
-rw-r--r--tests/bootstrap.php2
-rw-r--r--tests/lib/APITest.php (renamed from tests/lib/api.php)14
-rw-r--r--tests/lib/AllConfigTest.php (renamed from tests/lib/allconfig.php)4
-rw-r--r--tests/lib/AppTest.php (renamed from tests/lib/app.php)15
-rw-r--r--tests/lib/CapabilitiesManagerTest.php (renamed from tests/lib/capabilitiesmanager.php)2
-rw-r--r--tests/lib/ConfigTest.php (renamed from tests/lib/configtests.php)2
-rw-r--r--tests/lib/ContactsManagerTest.php (renamed from tests/lib/contactsmanager.php)5
-rw-r--r--tests/lib/ErrorHandlerTest.php (renamed from tests/lib/errorHandler.php)4
-rw-r--r--tests/lib/HTTPHelperTest.php (renamed from tests/lib/httphelper.php)4
-rw-r--r--tests/lib/HelperStorageTest.php (renamed from tests/lib/helperstorage.php)4
-rw-r--r--tests/lib/ImageTest.php (renamed from tests/lib/image.php)6
-rw-r--r--tests/lib/LegacyHelperTest.php (renamed from tests/lib/helper.php)6
-rw-r--r--tests/lib/NaturalSortTest.php (renamed from tests/lib/naturalsort.php)4
-rw-r--r--tests/lib/RepairStepTest.php (renamed from tests/lib/RepairTest.php)2
-rw-r--r--tests/lib/SetupTest.php (renamed from tests/lib/setup.php)18
-rw-r--r--tests/lib/StreamWrappersTest.php (renamed from tests/lib/streamwrappers.php)8
-rw-r--r--tests/lib/TagsTest.php (renamed from tests/lib/tags.php)36
-rw-r--r--tests/lib/TemplateFunctionsTest.php (renamed from tests/lib/template.php)8
-rw-r--r--tests/lib/TestCase.php (renamed from tests/lib/testcase.php)0
-rw-r--r--tests/lib/UpdaterTest.php (renamed from tests/lib/updater.php)3
-rw-r--r--tests/lib/UrlGeneratorTest.php (renamed from tests/lib/urlGenerator.php)6
-rw-r--r--tests/lib/UtilCheckServerTest.php (renamed from tests/lib/utilcheckserver.php)6
-rw-r--r--tests/lib/UtilTest.php (renamed from tests/lib/util.php)12
-rw-r--r--tests/lib/appconfig.php6
-rw-r--r--tests/lib/autoloader.php10
-rw-r--r--tests/lib/avatarmanagertest.php5
-rw-r--r--tests/lib/avatartest.php19
-rw-r--r--tests/lib/db/DBSchemaTest.php (renamed from tests/lib/dbschema.php)12
-rw-r--r--tests/lib/db/LegacyDBTest.php (renamed from tests/lib/db.php)10
-rw-r--r--tests/lib/files/cache/cache.php3
-rw-r--r--tests/lib/files/node/IntegrationTest.php (renamed from tests/lib/files/node/integration.php)2
-rw-r--r--tests/lib/files/objectstore/SwiftTest.php (renamed from tests/lib/files/objectstore/swift.php)14
-rw-r--r--tests/lib/files/objectstore/noopscanner.php2
-rw-r--r--tests/lib/files/pathverificationtest.php2
-rw-r--r--tests/lib/files/storage/wrapper/availability.php1
-rw-r--r--tests/lib/files/type/DetectionTest.php (renamed from tests/lib/files/type/detection.php)0
-rw-r--r--tests/lib/files/type/loadertest.php2
-rw-r--r--tests/lib/files/view.php4
-rw-r--r--tests/lib/group/LegacyGroupTest.php (renamed from tests/lib/group.php)7
-rw-r--r--tests/lib/group/backend.php4
-rw-r--r--tests/lib/group/database.php6
-rw-r--r--tests/lib/group/dummy.php6
-rw-r--r--tests/lib/group/metadatatest.php (renamed from tests/lib/group/metadata.php)2
-rw-r--r--tests/lib/http/client/clientservicetest.php4
-rw-r--r--tests/lib/http/client/clienttest.php3
-rw-r--r--tests/lib/http/client/responsetest.php3
-rw-r--r--tests/lib/integritycheck/checkertest.php1
-rw-r--r--tests/lib/integritycheck/helpers/EnvironmentHelperTest.php2
-rw-r--r--tests/lib/log/OwncloudTest.php (renamed from tests/lib/log/owncloud.php)0
-rw-r--r--tests/lib/mail/MailerTest.php (renamed from tests/lib/mail/mailer.php)4
-rw-r--r--tests/lib/mail/MessageTest.php (renamed from tests/lib/mail/message.php)3
-rw-r--r--tests/lib/memcache/FactoryTest.php (renamed from tests/lib/memcache/factory.php)2
-rw-r--r--tests/lib/ocs/MapStatusCodeTest.php (renamed from tests/ocs/response.php)10
-rw-r--r--tests/lib/ocs/PrivatedataTest.php (renamed from tests/lib/ocs/privatedata.php)8
-rw-r--r--tests/lib/ocs/ProviderTest.php (renamed from tests/ocs-provider/provider.php)8
-rw-r--r--tests/lib/ocsclienttest.php2
-rw-r--r--tests/lib/publicnamespace/ContactsTest.php (renamed from tests/lib/public/contacts.php)30
-rw-r--r--tests/lib/publicnamespace/OCPConfigTest.php (renamed from tests/lib/public/ocpconfig.php)4
-rw-r--r--tests/lib/publicnamespace/UtilTest.php (renamed from tests/lib/public/util.php)7
-rw-r--r--tests/lib/repair/RepairCollationTest.php (renamed from tests/lib/repair/repaircollation.php)5
-rw-r--r--tests/lib/security/CertificateManagerTest.php (renamed from tests/lib/security/certificatemanager.php)2
-rw-r--r--tests/lib/security/CertificateTest.php (renamed from tests/lib/security/certificate.php)12
-rw-r--r--tests/lib/security/CredentialsManagerTest.php (renamed from tests/lib/security/credentialsmanager.php)2
-rw-r--r--tests/lib/security/CryptoTest.php (renamed from tests/lib/security/crypto.php)2
-rw-r--r--tests/lib/security/HasherTest.php (renamed from tests/lib/security/hasher.php)2
-rw-r--r--tests/lib/security/SecureRandomTest.php (renamed from tests/lib/security/securerandom.php)2
-rw-r--r--tests/lib/security/TrustedDomainHelperTest.php (renamed from tests/lib/security/trusteddomainhelper.php)2
-rw-r--r--tests/lib/security/csp/ContentSecurityPolicyManagerTest.php3
-rw-r--r--tests/lib/security/csrf/CsrfTokenGeneratorTest.php2
-rw-r--r--tests/lib/security/csrf/CsrfTokenManagerTest.php2
-rw-r--r--tests/lib/security/csrf/CsrfTokenTest.php2
-rw-r--r--tests/lib/security/csrf/tokenstorage/SessionStorageTest.php2
-rw-r--r--tests/lib/share/MailNotificationsTest.php14
-rw-r--r--tests/lib/share/backend.php4
-rw-r--r--tests/lib/share/helper.php6
-rw-r--r--tests/lib/share/searchresultsorter.php4
-rw-r--r--tests/lib/share/share.php490
-rw-r--r--tests/lib/updater/VersionCheckTest.php (renamed from tests/lib/updater/versioncheck.php)2
-rw-r--r--tests/lib/user/avataruserdummy.php6
-rw-r--r--tests/lib/user/backend.php4
-rw-r--r--tests/lib/user/database.php4
-rw-r--r--tests/lib/user/dummy.php4
-rw-r--r--tests/lib/user/session.php32
-rw-r--r--tests/lib/user/user.php6
192 files changed, 862 insertions, 450 deletions
diff --git a/.mention-bot b/.mention-bot
index 3e6c0fddb67..ca3a86dd18b 100644
--- a/.mention-bot
+++ b/.mention-bot
@@ -14,7 +14,7 @@
"lib/private/Activity/**",
"lib/private/Notification/**",
"lib/public/Activity/**",
- "lib/public/notification/**"
+ "lib/public/Notification/**"
]
},
{
diff --git a/apps/files/l10n/cs_CZ.js b/apps/files/l10n/cs_CZ.js
index cf3190c6ca2..d1bcb699e7a 100644
--- a/apps/files/l10n/cs_CZ.js
+++ b/apps/files/l10n/cs_CZ.js
@@ -32,6 +32,15 @@ OC.L10N.register(
"Could not get result from server." : "Nepodařilo se získat výsledek ze serveru.",
"Uploading..." : "Odesílám...",
"..." : "...",
+ "{hours}:{minutes}:{seconds} hour{plural_s} left" : "zbývá {hours}:{minutes}:{seconds} hour{plural_s}",
+ "{hours}:{minutes}h" : "{hours}:{minutes}h",
+ "{minutes}:{seconds} minute{plural_s} left" : "zbývá {minutes}:{seconds} minute{plural_s}",
+ "{minutes}:{seconds}m" : "{minutes}:{seconds}m",
+ "{seconds} second{plural_s} left" : "\t!",
+ "{seconds}s" : "{seconds}s",
+ "Any moment now..." : "Každou chvíli...",
+ "Soon..." : "Za chvíli...",
+ "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} z {totalSize} ({bitrate})",
"File upload is in progress. Leaving the page now will cancel the upload." : "Probíhá odesílání souboru. Opuštění stránky způsobí zrušení nahrávání.",
"Actions" : "Činnosti",
"Download" : "Stáhnout",
diff --git a/apps/files/l10n/cs_CZ.json b/apps/files/l10n/cs_CZ.json
index e8890dc8c12..a9d03d923ab 100644
--- a/apps/files/l10n/cs_CZ.json
+++ b/apps/files/l10n/cs_CZ.json
@@ -30,6 +30,15 @@
"Could not get result from server." : "Nepodařilo se získat výsledek ze serveru.",
"Uploading..." : "Odesílám...",
"..." : "...",
+ "{hours}:{minutes}:{seconds} hour{plural_s} left" : "zbývá {hours}:{minutes}:{seconds} hour{plural_s}",
+ "{hours}:{minutes}h" : "{hours}:{minutes}h",
+ "{minutes}:{seconds} minute{plural_s} left" : "zbývá {minutes}:{seconds} minute{plural_s}",
+ "{minutes}:{seconds}m" : "{minutes}:{seconds}m",
+ "{seconds} second{plural_s} left" : "\t!",
+ "{seconds}s" : "{seconds}s",
+ "Any moment now..." : "Každou chvíli...",
+ "Soon..." : "Za chvíli...",
+ "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} z {totalSize} ({bitrate})",
"File upload is in progress. Leaving the page now will cancel the upload." : "Probíhá odesílání souboru. Opuštění stránky způsobí zrušení nahrávání.",
"Actions" : "Činnosti",
"Download" : "Stáhnout",
diff --git a/apps/files_external/appinfo/application.php b/apps/files_external/appinfo/application.php
index cdc58aed7e8..5d490c6091f 100644
--- a/apps/files_external/appinfo/application.php
+++ b/apps/files_external/appinfo/application.php
@@ -30,20 +30,26 @@ use \OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use \OCP\IContainer;
use \OCA\Files_External\Service\BackendService;
+use \OCA\Files_External\Lib\Config\IBackendProvider;
+use \OCA\Files_External\Lib\Config\IAuthMechanismProvider;
/**
* @package OCA\Files_External\Appinfo
*/
-class Application extends App {
+class Application extends App implements IBackendProvider, IAuthMechanismProvider {
+
public function __construct(array $urlParams = array()) {
parent::__construct('files_external', $urlParams);
- $this->getContainer()->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) {
+ $container = $this->getContainer();
+
+ $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) {
return $c->getServer()->query('UserMountCache');
});
- $this->loadBackends();
- $this->loadAuthMechanisms();
+ $backendService = $container->query('OCA\\Files_External\\Service\\BackendService');
+ $backendService->registerBackendProvider($this);
+ $backendService->registerAuthMechanismProvider($this);
// app developers: do NOT depend on this! it will disappear with oC 9.0!
\OC::$server->getEventDispatcher()->dispatch(
@@ -63,13 +69,12 @@ class Application extends App {
}
/**
- * Load storage backends provided by this app
+ * @{inheritdoc}
*/
- protected function loadBackends() {
+ public function getBackends() {
$container = $this->getContainer();
- $service = $container->query('OCA\\Files_External\\Service\\BackendService');
- $service->registerBackends([
+ $backends = [
$container->query('OCA\Files_External\Lib\Backend\Local'),
$container->query('OCA\Files_External\Lib\Backend\FTP'),
$container->query('OCA\Files_External\Lib\Backend\DAV'),
@@ -80,24 +85,25 @@ class Application extends App {
$container->query('OCA\Files_External\Lib\Backend\Google'),
$container->query('OCA\Files_External\Lib\Backend\Swift'),
$container->query('OCA\Files_External\Lib\Backend\SFTP_Key'),
- ]);
+ ];
if (!\OC_Util::runningOnWindows()) {
- $service->registerBackends([
+ $backends += [
$container->query('OCA\Files_External\Lib\Backend\SMB'),
$container->query('OCA\Files_External\Lib\Backend\SMB_OC'),
- ]);
+ ];
}
+
+ return $backends;
}
/**
- * Load authentication mechanisms provided by this app
+ * @{inheritdoc}
*/
- protected function loadAuthMechanisms() {
+ public function getAuthMechanisms() {
$container = $this->getContainer();
- $service = $container->query('OCA\\Files_External\\Service\\BackendService');
- $service->registerAuthMechanisms([
+ return [
// AuthMechanism::SCHEME_NULL mechanism
$container->query('OCA\Files_External\Lib\Auth\NullMechanism'),
@@ -123,7 +129,7 @@ class Application extends App {
// Specialized mechanisms
$container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'),
- ]);
+ ];
}
}
diff --git a/apps/files_external/l10n/cs_CZ.js b/apps/files_external/l10n/cs_CZ.js
index c2d99356eb6..9906a0ce123 100644
--- a/apps/files_external/l10n/cs_CZ.js
+++ b/apps/files_external/l10n/cs_CZ.js
@@ -19,6 +19,8 @@ OC.L10N.register(
"Insufficient data: %s" : "Nedostatečná data: %s",
"%s" : "%s",
"Storage with id \"%i\" is not user editable" : "Úložiště s id \"%i\" uživatelé nemohou upravovat",
+ "Dropbox App Configuration" : "Nastavení aplikace Dropbox",
+ "Google Drive App Configuration" : "Nastavení aplikace Disk Google",
"Personal" : "Osobní",
"System" : "Systém",
"Grant access" : "Povolit přístup",
diff --git a/apps/files_external/l10n/cs_CZ.json b/apps/files_external/l10n/cs_CZ.json
index 71704dccae8..69c9224c071 100644
--- a/apps/files_external/l10n/cs_CZ.json
+++ b/apps/files_external/l10n/cs_CZ.json
@@ -17,6 +17,8 @@
"Insufficient data: %s" : "Nedostatečná data: %s",
"%s" : "%s",
"Storage with id \"%i\" is not user editable" : "Úložiště s id \"%i\" uživatelé nemohou upravovat",
+ "Dropbox App Configuration" : "Nastavení aplikace Dropbox",
+ "Google Drive App Configuration" : "Nastavení aplikace Disk Google",
"Personal" : "Osobní",
"System" : "Systém",
"Grant access" : "Povolit přístup",
diff --git a/apps/files_external/lib/config/iauthmechanismprovider.php b/apps/files_external/lib/config/iauthmechanismprovider.php
new file mode 100644
index 00000000000..035b8e891f5
--- /dev/null
+++ b/apps/files_external/lib/config/iauthmechanismprovider.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @author Robin McCorkell <robin@mccorkell.me.uk>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Files_External\Lib\Config;
+
+use \OCA\Files_External\Lib\Auth\AuthMechanism;
+
+/**
+ * Provider of external storage auth mechanisms
+ * @since 9.1.0
+ */
+interface IAuthMechanismProvider {
+
+ /**
+ * @since 9.1.0
+ * @return AuthMechanism[]
+ */
+ public function getAuthMechanisms();
+
+}
diff --git a/apps/files_external/lib/config/ibackendprovider.php b/apps/files_external/lib/config/ibackendprovider.php
new file mode 100644
index 00000000000..2335e7133a6
--- /dev/null
+++ b/apps/files_external/lib/config/ibackendprovider.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @author Robin McCorkell <robin@mccorkell.me.uk>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OCA\Files_External\Lib\Config;
+
+use \OCA\Files_External\Lib\Backend\Backend;
+
+/**
+ * Provider of external storage backends
+ * @since 9.1.0
+ */
+interface IBackendProvider {
+
+ /**
+ * @since 9.1.0
+ * @return Backend[]
+ */
+ public function getBackends();
+
+}
diff --git a/apps/files_external/service/backendservice.php b/apps/files_external/service/backendservice.php
index 9b23a441c7c..c3dc4da0177 100644
--- a/apps/files_external/service/backendservice.php
+++ b/apps/files_external/service/backendservice.php
@@ -26,6 +26,8 @@ use \OCP\IConfig;
use \OCA\Files_External\Lib\Backend\Backend;
use \OCA\Files_External\Lib\Auth\AuthMechanism;
+use \OCA\Files_External\Lib\Config\IBackendProvider;
+use \OCA\Files_External\Lib\Config\IAuthMechanismProvider;
/**
* Service class to manage backend definitions
@@ -55,9 +57,15 @@ class BackendService {
/** @var Backend[] */
private $backends = [];
+ /** @var IBackendProvider[] */
+ private $backendProviders = [];
+
/** @var AuthMechanism[] */
private $authMechanisms = [];
+ /** @var IAuthMechanismProvider[] */
+ private $authMechanismProviders = [];
+
/**
* @param IConfig $config
*/
@@ -81,8 +89,43 @@ class BackendService {
}
/**
+ * Register a backend provider
+ *
+ * @since 9.1.0
+ * @param IBackendProvider $provider
+ */
+ public function registerBackendProvider(IBackendProvider $provider) {
+ $this->backendProviders[] = $provider;
+ }
+
+ private function loadBackendProviders() {
+ foreach ($this->backendProviders as $provider) {
+ $this->registerBackends($provider->getBackends());
+ }
+ $this->backendProviders = [];
+ }
+
+ /**
+ * Register an auth mechanism provider
+ *
+ * @since 9.1.0
+ * @param IAuthMechanismProvider $provider
+ */
+ public function registerAuthMechanismProvider(IAuthMechanismProvider $provider) {
+ $this->authMechanismProviders[] = $provider;
+ }
+
+ private function loadAuthMechanismProviders() {
+ foreach ($this->authMechanismProviders as $provider) {
+ $this->registerAuthMechanisms($provider->getAuthMechanisms());
+ }
+ $this->authMechanismProviders = [];
+ }
+
+ /**
* Register a backend
*
+ * @deprecated 9.1.0 use registerBackendProvider()
* @param Backend $backend
*/
public function registerBackend(Backend $backend) {
@@ -95,6 +138,7 @@ class BackendService {
}
/**
+ * @deprecated 9.1.0 use registerBackendProvider()
* @param Backend[] $backends
*/
public function registerBackends(array $backends) {
@@ -105,6 +149,7 @@ class BackendService {
/**
* Register an authentication mechanism
*
+ * @deprecated 9.1.0 use registerAuthMechanismProvider()
* @param AuthMechanism $authMech
*/
public function registerAuthMechanism(AuthMechanism $authMech) {
@@ -117,6 +162,7 @@ class BackendService {
}
/**
+ * @deprecated 9.1.0 use registerAuthMechanismProvider()
* @param AuthMechanism[] $mechanisms
*/
public function registerAuthMechanisms(array $mechanisms) {
@@ -131,6 +177,7 @@ class BackendService {
* @return Backend[]
*/
public function getBackends() {
+ $this->loadBackendProviders();
// only return real identifiers, no aliases
$backends = [];
foreach ($this->backends as $backend) {
@@ -155,6 +202,7 @@ class BackendService {
* @return Backend|null
*/
public function getBackend($identifier) {
+ $this->loadBackendProviders();
if (isset($this->backends[$identifier])) {
return $this->backends[$identifier];
}
@@ -167,6 +215,7 @@ class BackendService {
* @return AuthMechanism[]
*/
public function getAuthMechanisms() {
+ $this->loadAuthMechanismProviders();
// only return real identifiers, no aliases
$mechanisms = [];
foreach ($this->authMechanisms as $mechanism) {
@@ -192,6 +241,7 @@ class BackendService {
* @return AuthMechanism|null
*/
public function getAuthMechanism($identifier) {
+ $this->loadAuthMechanismProviders();
if (isset($this->authMechanisms[$identifier])) {
return $this->authMechanisms[$identifier];
}
diff --git a/apps/files_external/tests/service/backendservicetest.php b/apps/files_external/tests/service/backendservicetest.php
index 8621c98b9b7..ba9a1f533f2 100644
--- a/apps/files_external/tests/service/backendservicetest.php
+++ b/apps/files_external/tests/service/backendservicetest.php
@@ -49,6 +49,20 @@ class BackendServiceTest extends \Test\TestCase {
return $backend;
}
+ /**
+ * @param string $class
+ *
+ * @return \OCA\Files_External\Lib\Auth\AuthMechanism
+ */
+ protected function getAuthMechanismMock($class) {
+ $backend = $this->getMockBuilder('\OCA\Files_External\Lib\Auth\AuthMechanism')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $backend->method('getIdentifier')->will($this->returnValue('identifier:'.$class));
+ $backend->method('getIdentifierAliases')->will($this->returnValue(['identifier:'.$class]));
+ return $backend;
+ }
+
public function testRegisterBackend() {
$service = new BackendService($this->config, $this->l10n);
@@ -76,6 +90,68 @@ class BackendServiceTest extends \Test\TestCase {
$this->assertArrayNotHasKey('identifier_alias', $backends);
}
+ public function testBackendProvider() {
+ $service = new BackendService($this->config, $this->l10n);
+
+ $backend1 = $this->getBackendMock('\Foo\Bar');
+ $backend2 = $this->getBackendMock('\Bar\Foo');
+
+ $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider');
+ $providerMock->expects($this->once())
+ ->method('getBackends')
+ ->willReturn([$backend1, $backend2]);
+ $service->registerBackendProvider($providerMock);
+
+ $this->assertEquals($backend1, $service->getBackend('identifier:\Foo\Bar'));
+ $this->assertEquals($backend2, $service->getBackend('identifier:\Bar\Foo'));
+
+ $this->assertCount(2, $service->getBackends());
+ }
+
+ public function testAuthMechanismProvider() {
+ $service = new BackendService($this->config, $this->l10n);
+
+ $backend1 = $this->getAuthMechanismMock('\Foo\Bar');
+ $backend2 = $this->getAuthMechanismMock('\Bar\Foo');
+
+ $providerMock = $this->getMock('\OCA\Files_External\Lib\Config\IAuthMechanismProvider');
+ $providerMock->expects($this->once())
+ ->method('getAuthMechanisms')
+ ->willReturn([$backend1, $backend2]);
+ $service->registerAuthMechanismProvider($providerMock);
+
+ $this->assertEquals($backend1, $service->getAuthMechanism('identifier:\Foo\Bar'));
+ $this->assertEquals($backend2, $service->getAuthMechanism('identifier:\Bar\Foo'));
+
+ $this->assertCount(2, $service->getAuthMechanisms());
+ }
+
+ public function testMultipleBackendProviders() {
+ $service = new BackendService($this->config, $this->l10n);
+
+ $backend1a = $this->getBackendMock('\Foo\Bar');
+ $backend1b = $this->getBackendMock('\Bar\Foo');
+
+ $backend2 = $this->getBackendMock('\Dead\Beef');
+
+ $provider1Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider');
+ $provider1Mock->expects($this->once())
+ ->method('getBackends')
+ ->willReturn([$backend1a, $backend1b]);
+ $service->registerBackendProvider($provider1Mock);
+ $provider2Mock = $this->getMock('\OCA\Files_External\Lib\Config\IBackendProvider');
+ $provider2Mock->expects($this->once())
+ ->method('getBackends')
+ ->willReturn([$backend2]);
+ $service->registerBackendProvider($provider2Mock);
+
+ $this->assertEquals($backend1a, $service->getBackend('identifier:\Foo\Bar'));
+ $this->assertEquals($backend1b, $service->getBackend('identifier:\Bar\Foo'));
+ $this->assertEquals($backend2, $service->getBackend('identifier:\Dead\Beef'));
+
+ $this->assertCount(3, $service->getBackends());
+ }
+
public function testUserMountingBackends() {
$this->config->expects($this->exactly(2))
->method('getAppValue')
diff --git a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php
index 353520bd604..c9aea60d255 100644
--- a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php
+++ b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php
@@ -154,7 +154,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase {
public function testKeepNonFileShares() {
$this->loginAsUser($this->user1);
- \OCP\Share::registerBackend('test', 'Test_Share_Backend');
+ \OCP\Share::registerBackend('test', 'Test\Share\Backend');
$this->assertTrue(
\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
diff --git a/apps/files_sharing/tests/server2server.php b/apps/files_sharing/tests/server2server.php
index 1d047916ca9..1c8b5ed7a17 100644
--- a/apps/files_sharing/tests/server2server.php
+++ b/apps/files_sharing/tests/server2server.php
@@ -51,7 +51,7 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase {
parent::setUp();
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
- \OCP\Share::registerBackend('test', 'Test_Share_Backend');
+ \OCP\Share::registerBackend('test', 'Test\Share\Backend');
$config = $this->getMockBuilder('\OCP\IConfig')
->disableOriginalConstructor()->getMock();
diff --git a/apps/systemtags/l10n/bg_BG.js b/apps/systemtags/l10n/bg_BG.js
index 6971d20a8c0..eeddbd55d1a 100644
--- a/apps/systemtags/l10n/bg_BG.js
+++ b/apps/systemtags/l10n/bg_BG.js
@@ -2,6 +2,7 @@ OC.L10N.register(
"systemtags",
{
"Tags" : "Етикети",
+ "Tagged files" : "Отбелязани файлове",
"No files in here" : "Тук няма файлове",
"No entries found in this folder" : "Няма намерени записи в тази папка",
"Name" : "Име",
diff --git a/apps/systemtags/l10n/bg_BG.json b/apps/systemtags/l10n/bg_BG.json
index 4e9f849ce9a..b6f33731e60 100644
--- a/apps/systemtags/l10n/bg_BG.json
+++ b/apps/systemtags/l10n/bg_BG.json
@@ -1,5 +1,6 @@
{ "translations": {
"Tags" : "Етикети",
+ "Tagged files" : "Отбелязани файлове",
"No files in here" : "Тук няма файлове",
"No entries found in this folder" : "Няма намерени записи в тази папка",
"Name" : "Име",
diff --git a/apps/updatenotification/l10n/bg_BG.js b/apps/updatenotification/l10n/bg_BG.js
index 585d75d9e57..bfe17bf4533 100644
--- a/apps/updatenotification/l10n/bg_BG.js
+++ b/apps/updatenotification/l10n/bg_BG.js
@@ -1,7 +1,11 @@
OC.L10N.register(
"updatenotification",
{
+ "Updated channel" : "Обновяването е отказано",
"Updater" : "Обновяване",
- "A new version is available: %s" : "Има Нова Версия: %s"
+ "A new version is available: %s" : "Има Нова Версия: %s",
+ "Open updater" : "Отвори обновяването",
+ "Your version is up to date." : "Вие разполагате с последна версия",
+ "Update channel:" : "Обновяване отказано:"
},
"nplurals=2; plural=(n != 1);");
diff --git a/apps/updatenotification/l10n/bg_BG.json b/apps/updatenotification/l10n/bg_BG.json
index 465f8e978ec..7d4b4a5940b 100644
--- a/apps/updatenotification/l10n/bg_BG.json
+++ b/apps/updatenotification/l10n/bg_BG.json
@@ -1,5 +1,9 @@
{ "translations": {
+ "Updated channel" : "Обновяването е отказано",
"Updater" : "Обновяване",
- "A new version is available: %s" : "Има Нова Версия: %s"
+ "A new version is available: %s" : "Има Нова Версия: %s",
+ "Open updater" : "Отвори обновяването",
+ "Your version is up to date." : "Вие разполагате с последна версия",
+ "Update channel:" : "Обновяване отказано:"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/core/l10n/lv.js b/core/l10n/lv.js
index 71fa7f8ce40..a3ff72b4d0d 100644
--- a/core/l10n/lv.js
+++ b/core/l10n/lv.js
@@ -69,7 +69,7 @@ OC.L10N.register(
"Error while sharing" : "Kļūda, daloties",
"Error while unsharing" : "Kļūda, beidzot dalīties",
"Error setting expiration date" : "Kļūda, iestatot termiņa datumu",
- "Set expiration date" : "Iestaties termiņa datumu",
+ "Set expiration date" : "Iestatiet termiņa datumu",
"Expiration date" : "Termiņa datums",
"Resharing is not allowed" : "Atkārtota dalīšanās nav atļauta",
"Share link" : "Dalīt saiti",
diff --git a/core/l10n/lv.json b/core/l10n/lv.json
index f6befe4ba84..7bace2eff80 100644
--- a/core/l10n/lv.json
+++ b/core/l10n/lv.json
@@ -67,7 +67,7 @@
"Error while sharing" : "Kļūda, daloties",
"Error while unsharing" : "Kļūda, beidzot dalīties",
"Error setting expiration date" : "Kļūda, iestatot termiņa datumu",
- "Set expiration date" : "Iestaties termiņa datumu",
+ "Set expiration date" : "Iestatiet termiņa datumu",
"Expiration date" : "Termiņa datums",
"Resharing is not allowed" : "Atkārtota dalīšanās nav atļauta",
"Share link" : "Dalīt saiti",
diff --git a/lib/autoloader.php b/lib/autoloader.php
index 9cc573c0997..215da536e5b 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -94,7 +94,7 @@ class Autoloader {
$paths[] = \OC::$CLASSPATH[$class];
/**
* @TODO: Remove this when necessary
- * Remove "apps/" from inclusion path for smooth migration to mutli app dir
+ * Remove "apps/" from inclusion path for smooth migration to multi app dir
*/
if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', \OCP\Util::DEBUG);
@@ -113,8 +113,10 @@ class Autoloader {
// If not found in the root of the app directory, insert '/lib' after app id and try again.
$paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php');
}
- } elseif (strpos($class, 'Test_') === 0) {
- $paths[] = \OC::$SERVERROOT . '/tests/lib/' . strtolower(str_replace('_', '/', substr($class, 5)) . '.php');
+ } elseif ($class === 'Test\\TestCase') {
+ // This File is considered public API, so we make sure that the class
+ // can still be loaded, although the PSR-4 paths have not been loaded.
+ $paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php';
} elseif (strpos($class, 'Test\\') === 0) {
$paths[] = \OC::$SERVERROOT . '/tests/lib/' . strtolower(str_replace('\\', '/', substr($class, 5)) . '.php');
}
diff --git a/lib/base.php b/lib/base.php
index 1fdcf44f4d0..eddcec97b1f 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -53,7 +53,7 @@
*
*/
-require_once 'public/constants.php';
+require_once 'public/Constants.php';
/**
* Class that is a namespace for all global OC variables
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 7904fab0726..7cdc13a7c6d 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -33,7 +33,7 @@ use Doctrine\Common\EventManager;
use OC\DB\QueryBuilder\QueryBuilder;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
-use OCP\PreconditionNotMetException;
+use OCP\PreConditionNotMetException;
class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
/**
@@ -262,7 +262,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
* @param array $updatePreconditionValues ensure values match preconditions (column name => value)
* @return int number of new rows
* @throws \Doctrine\DBAL\DBALException
- * @throws PreconditionNotMetException
+ * @throws PreConditionNotMetException
*/
public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) {
try {
@@ -294,7 +294,7 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
$affected = $updateQb->execute();
if ($affected === 0 && !empty($updatePreconditionValues)) {
- throw new PreconditionNotMetException();
+ throw new PreConditionNotMetException();
}
return 0;
diff --git a/ocs-provider/provider.php b/lib/private/OCS/Provider.php
index 396b5b23fc6..4a7caa79fa5 100644
--- a/ocs-provider/provider.php
+++ b/lib/private/OCS/Provider.php
@@ -19,6 +19,8 @@
*
*/
+namespace OC\OCS;
+
class Provider extends \OCP\AppFramework\Controller {
/** @var \OCP\App\IAppManager */
private $appManager;
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index 3f074fa8adf..7104f46fea2 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -362,6 +362,10 @@ class Session implements IUserSession, Emitter {
// user does not exist
return false;
}
+ if (!$user->isEnabled()) {
+ // disabled users can not log in
+ return false;
+ }
//login
$this->setUser($user);
diff --git a/lib/public/api.php b/lib/public/API.php
index 4d68bef6f29..4d68bef6f29 100644
--- a/lib/public/api.php
+++ b/lib/public/API.php
diff --git a/lib/public/app.php b/lib/public/App.php
index c3ba90cea41..c3ba90cea41 100644
--- a/lib/public/app.php
+++ b/lib/public/App.php
diff --git a/lib/public/autoloadnotallowedexception.php b/lib/public/AutoloadNotAllowedException.php
index f0028b7d49d..f0028b7d49d 100644
--- a/lib/public/autoloadnotallowedexception.php
+++ b/lib/public/AutoloadNotAllowedException.php
diff --git a/lib/public/backgroundjob.php b/lib/public/BackgroundJob.php
index f532a97c747..f532a97c747 100644
--- a/lib/public/backgroundjob.php
+++ b/lib/public/BackgroundJob.php
diff --git a/lib/public/config.php b/lib/public/Config.php
index 5b5dcb0e78e..5b5dcb0e78e 100644
--- a/lib/public/config.php
+++ b/lib/public/Config.php
diff --git a/lib/public/constants.php b/lib/public/Constants.php
index abf5f95eb96..abf5f95eb96 100644
--- a/lib/public/constants.php
+++ b/lib/public/Constants.php
diff --git a/lib/public/contacts.php b/lib/public/Contacts.php
index 590fd9af1bd..590fd9af1bd 100644
--- a/lib/public/contacts.php
+++ b/lib/public/Contacts.php
diff --git a/lib/public/db.php b/lib/public/DB.php
index 4706c5e95ee..4706c5e95ee 100644
--- a/lib/public/db.php
+++ b/lib/public/DB.php
diff --git a/lib/public/defaults.php b/lib/public/Defaults.php
index 58b25d5914a..58b25d5914a 100644
--- a/lib/public/defaults.php
+++ b/lib/public/Defaults.php
diff --git a/lib/public/files.php b/lib/public/Files.php
index f7f0b30bf86..f7f0b30bf86 100644
--- a/lib/public/files.php
+++ b/lib/public/Files.php
diff --git a/lib/public/groupinterface.php b/lib/public/GroupInterface.php
index 628bc2f42ef..628bc2f42ef 100644
--- a/lib/public/groupinterface.php
+++ b/lib/public/GroupInterface.php
diff --git a/lib/public/iaddressbook.php b/lib/public/IAddressBook.php
index 63e7e061448..63e7e061448 100644
--- a/lib/public/iaddressbook.php
+++ b/lib/public/IAddressBook.php
diff --git a/lib/public/iappconfig.php b/lib/public/IAppConfig.php
index 1406e8a56d6..1406e8a56d6 100644
--- a/lib/public/iappconfig.php
+++ b/lib/public/IAppConfig.php
diff --git a/lib/public/iavatar.php b/lib/public/IAvatar.php
index 7b811b26b68..7b811b26b68 100644
--- a/lib/public/iavatar.php
+++ b/lib/public/IAvatar.php
diff --git a/lib/public/iavatarmanager.php b/lib/public/IAvatarManager.php
index ef6b00ffd13..ef6b00ffd13 100644
--- a/lib/public/iavatarmanager.php
+++ b/lib/public/IAvatarManager.php
diff --git a/lib/public/icache.php b/lib/public/ICache.php
index a1ce068d819..a1ce068d819 100644
--- a/lib/public/icache.php
+++ b/lib/public/ICache.php
diff --git a/lib/public/icachefactory.php b/lib/public/ICacheFactory.php
index 233a4f5525d..233a4f5525d 100644
--- a/lib/public/icachefactory.php
+++ b/lib/public/ICacheFactory.php
diff --git a/lib/public/icertificate.php b/lib/public/ICertificate.php
index c3a003fbf0a..c3a003fbf0a 100644
--- a/lib/public/icertificate.php
+++ b/lib/public/ICertificate.php
diff --git a/lib/public/icertificatemanager.php b/lib/public/ICertificateManager.php
index 27eebcf0491..27eebcf0491 100644
--- a/lib/public/icertificatemanager.php
+++ b/lib/public/ICertificateManager.php
diff --git a/lib/public/iconfig.php b/lib/public/IConfig.php
index 8dac390a99c..8dac390a99c 100644
--- a/lib/public/iconfig.php
+++ b/lib/public/IConfig.php
diff --git a/lib/public/icontainer.php b/lib/public/IContainer.php
index d23ee5ea3b5..d23ee5ea3b5 100644
--- a/lib/public/icontainer.php
+++ b/lib/public/IContainer.php
diff --git a/lib/public/idbconnection.php b/lib/public/IDBConnection.php
index 780fcd26364..780fcd26364 100644
--- a/lib/public/idbconnection.php
+++ b/lib/public/IDBConnection.php
diff --git a/lib/public/idatetimeformatter.php b/lib/public/IDateTimeFormatter.php
index e8d357ae50f..e8d357ae50f 100644
--- a/lib/public/idatetimeformatter.php
+++ b/lib/public/IDateTimeFormatter.php
diff --git a/lib/public/idatetimezone.php b/lib/public/IDateTimeZone.php
index 3df705a2413..3df705a2413 100644
--- a/lib/public/idatetimezone.php
+++ b/lib/public/IDateTimeZone.php
diff --git a/lib/public/idb.php b/lib/public/IDb.php
index f21fedd1f54..f21fedd1f54 100644
--- a/lib/public/idb.php
+++ b/lib/public/IDb.php
diff --git a/lib/public/ieventsource.php b/lib/public/IEventSource.php
index b643d1c9da7..b643d1c9da7 100644
--- a/lib/public/ieventsource.php
+++ b/lib/public/IEventSource.php
diff --git a/lib/public/igroup.php b/lib/public/IGroup.php
index 02f2ef201fd..02f2ef201fd 100644
--- a/lib/public/igroup.php
+++ b/lib/public/IGroup.php
diff --git a/lib/public/igroupmanager.php b/lib/public/IGroupManager.php
index cda40606f9d..cda40606f9d 100644
--- a/lib/public/igroupmanager.php
+++ b/lib/public/IGroupManager.php
diff --git a/lib/public/ihelper.php b/lib/public/IHelper.php
index 4ad1d5704fd..4ad1d5704fd 100644
--- a/lib/public/ihelper.php
+++ b/lib/public/IHelper.php
diff --git a/lib/public/iimage.php b/lib/public/IImage.php
index db0ca0f93be..db0ca0f93be 100644
--- a/lib/public/iimage.php
+++ b/lib/public/IImage.php
diff --git a/lib/public/il10n.php b/lib/public/IL10N.php
index f1954eeb4b9..f1954eeb4b9 100644
--- a/lib/public/il10n.php
+++ b/lib/public/IL10N.php
diff --git a/lib/public/ilogger.php b/lib/public/ILogger.php
index fa947612fcd..fa947612fcd 100644
--- a/lib/public/ilogger.php
+++ b/lib/public/ILogger.php
diff --git a/lib/public/imemcache.php b/lib/public/IMemcache.php
index b5c0cef923d..b5c0cef923d 100644
--- a/lib/public/imemcache.php
+++ b/lib/public/IMemcache.php
diff --git a/lib/public/imemcachettl.php b/lib/public/IMemcacheTTL.php
index f2d03dcdf40..f2d03dcdf40 100644
--- a/lib/public/imemcachettl.php
+++ b/lib/public/IMemcacheTTL.php
diff --git a/lib/public/inavigationmanager.php b/lib/public/INavigationManager.php
index 243f6ea3eea..243f6ea3eea 100644
--- a/lib/public/inavigationmanager.php
+++ b/lib/public/INavigationManager.php
diff --git a/lib/public/ipreview.php b/lib/public/IPreview.php
index cfcbebd8639..cfcbebd8639 100644
--- a/lib/public/ipreview.php
+++ b/lib/public/IPreview.php
diff --git a/lib/public/irequest.php b/lib/public/IRequest.php
index 296c70f4ecc..296c70f4ecc 100644
--- a/lib/public/irequest.php
+++ b/lib/public/IRequest.php
diff --git a/lib/public/isearch.php b/lib/public/ISearch.php
index ec6673dabbd..ec6673dabbd 100644
--- a/lib/public/isearch.php
+++ b/lib/public/ISearch.php
diff --git a/lib/public/isession.php b/lib/public/ISession.php
index 7bc8654a1b9..7bc8654a1b9 100644
--- a/lib/public/isession.php
+++ b/lib/public/ISession.php
diff --git a/lib/public/itagmanager.php b/lib/public/ITagManager.php
index e6d67ddd02c..e6d67ddd02c 100644
--- a/lib/public/itagmanager.php
+++ b/lib/public/ITagManager.php
diff --git a/lib/public/itags.php b/lib/public/ITags.php
index cbc178c37bf..cbc178c37bf 100644
--- a/lib/public/itags.php
+++ b/lib/public/ITags.php
diff --git a/lib/public/itempmanager.php b/lib/public/ITempManager.php
index 025e43d8563..025e43d8563 100644
--- a/lib/public/itempmanager.php
+++ b/lib/public/ITempManager.php
diff --git a/lib/public/iurlgenerator.php b/lib/public/IURLGenerator.php
index a702ca47bfc..a702ca47bfc 100644
--- a/lib/public/iurlgenerator.php
+++ b/lib/public/IURLGenerator.php
diff --git a/lib/public/iuser.php b/lib/public/IUser.php
index 16617a2f2f6..16617a2f2f6 100644
--- a/lib/public/iuser.php
+++ b/lib/public/IUser.php
diff --git a/lib/public/iuserbackend.php b/lib/public/IUserBackend.php
index 5cd7945dd7a..5cd7945dd7a 100644
--- a/lib/public/iuserbackend.php
+++ b/lib/public/IUserBackend.php
diff --git a/lib/public/iusermanager.php b/lib/public/IUserManager.php
index 00c0bbc8721..00c0bbc8721 100644
--- a/lib/public/iusermanager.php
+++ b/lib/public/IUserManager.php
diff --git a/lib/public/iusersession.php b/lib/public/IUserSession.php
index 2196f2c8ce0..2196f2c8ce0 100644
--- a/lib/public/iusersession.php
+++ b/lib/public/IUserSession.php
diff --git a/lib/public/image.php b/lib/public/Image.php
index 4a7ffe8bc9a..4a7ffe8bc9a 100644
--- a/lib/public/image.php
+++ b/lib/public/Image.php
diff --git a/lib/public/json.php b/lib/public/JSON.php
index fceffa0001e..fceffa0001e 100644
--- a/lib/public/json.php
+++ b/lib/public/JSON.php
diff --git a/lib/public/mail/imailer.php b/lib/public/Mail/IMailer.php
index e3c751277ac..e3c751277ac 100644
--- a/lib/public/mail/imailer.php
+++ b/lib/public/Mail/IMailer.php
diff --git a/lib/public/migration/ioutput.php b/lib/public/Migration/IOutput.php
index d3b43028495..d3b43028495 100644
--- a/lib/public/migration/ioutput.php
+++ b/lib/public/Migration/IOutput.php
diff --git a/lib/public/migration/irepairstep.php b/lib/public/Migration/IRepairStep.php
index 07830a935f9..07830a935f9 100644
--- a/lib/public/migration/irepairstep.php
+++ b/lib/public/Migration/IRepairStep.php
diff --git a/lib/public/notification/iaction.php b/lib/public/Notification/IAction.php
index 1f4d1d5b7fe..1f4d1d5b7fe 100644
--- a/lib/public/notification/iaction.php
+++ b/lib/public/Notification/IAction.php
diff --git a/lib/public/notification/iapp.php b/lib/public/Notification/IApp.php
index 98da265559b..98da265559b 100644
--- a/lib/public/notification/iapp.php
+++ b/lib/public/Notification/IApp.php
diff --git a/lib/public/notification/imanager.php b/lib/public/Notification/IManager.php
index a18af747b10..a18af747b10 100644
--- a/lib/public/notification/imanager.php
+++ b/lib/public/Notification/IManager.php
diff --git a/lib/public/notification/inotification.php b/lib/public/Notification/INotification.php
index 2d8557ec64d..2d8557ec64d 100644
--- a/lib/public/notification/inotification.php
+++ b/lib/public/Notification/INotification.php
diff --git a/lib/public/notification/inotifier.php b/lib/public/Notification/INotifier.php
index 0d9cecc88b8..0d9cecc88b8 100644
--- a/lib/public/notification/inotifier.php
+++ b/lib/public/Notification/INotifier.php
diff --git a/lib/public/preconditionnotmetexception.php b/lib/public/PreConditionNotMetException.php
index 212efc08ded..212efc08ded 100644
--- a/lib/public/preconditionnotmetexception.php
+++ b/lib/public/PreConditionNotMetException.php
diff --git a/lib/public/response.php b/lib/public/Response.php
index a2a7667684a..a2a7667684a 100644
--- a/lib/public/response.php
+++ b/lib/public/Response.php
diff --git a/lib/public/sabrepluginevent.php b/lib/public/SabrePluginEvent.php
index 11d939aee47..11d939aee47 100644
--- a/lib/public/sabrepluginevent.php
+++ b/lib/public/SabrePluginEvent.php
diff --git a/lib/public/sabrepluginexception.php b/lib/public/SabrePluginException.php
index 2c5a799c4f7..2c5a799c4f7 100644
--- a/lib/public/sabrepluginexception.php
+++ b/lib/public/SabrePluginException.php
diff --git a/lib/public/security/icontentsecuritypolicymanager.php b/lib/public/Security/IContentSecurityPolicyManager.php
index 10f1efe995f..10f1efe995f 100644
--- a/lib/public/security/icontentsecuritypolicymanager.php
+++ b/lib/public/Security/IContentSecurityPolicyManager.php
diff --git a/lib/public/security/icredentialsmanager.php b/lib/public/Security/ICredentialsManager.php
index d576bbcfbd8..d576bbcfbd8 100644
--- a/lib/public/security/icredentialsmanager.php
+++ b/lib/public/Security/ICredentialsManager.php
diff --git a/lib/public/security/icrypto.php b/lib/public/Security/ICrypto.php
index 62f27017ab7..62f27017ab7 100644
--- a/lib/public/security/icrypto.php
+++ b/lib/public/Security/ICrypto.php
diff --git a/lib/public/security/ihasher.php b/lib/public/Security/IHasher.php
index 39ba5094b12..39ba5094b12 100644
--- a/lib/public/security/ihasher.php
+++ b/lib/public/Security/IHasher.php
diff --git a/lib/public/security/isecurerandom.php b/lib/public/Security/ISecureRandom.php
index 9b346afe680..9b346afe680 100644
--- a/lib/public/security/isecurerandom.php
+++ b/lib/public/Security/ISecureRandom.php
diff --git a/lib/public/security/stringutils.php b/lib/public/Security/StringUtils.php
index ff1e290315a..ff1e290315a 100644
--- a/lib/public/security/stringutils.php
+++ b/lib/public/Security/StringUtils.php
diff --git a/lib/public/share.php b/lib/public/Share.php
index 9c62ec703e4..9c62ec703e4 100644
--- a/lib/public/share.php
+++ b/lib/public/Share.php
diff --git a/lib/public/share_backend.php b/lib/public/Share_Backend.php
index 110403c1f49..110403c1f49 100644
--- a/lib/public/share_backend.php
+++ b/lib/public/Share_Backend.php
diff --git a/lib/public/share_backend_collection.php b/lib/public/Share_Backend_Collection.php
index 185cf32ce3e..185cf32ce3e 100644
--- a/lib/public/share_backend_collection.php
+++ b/lib/public/Share_Backend_Collection.php
diff --git a/lib/public/share_backend_file_dependent.php b/lib/public/Share_Backend_File_Dependent.php
index 64b3bf43319..64b3bf43319 100644
--- a/lib/public/share_backend_file_dependent.php
+++ b/lib/public/Share_Backend_File_Dependent.php
diff --git a/lib/public/systemtag/isystemtag.php b/lib/public/SystemTag/ISystemTag.php
index 02d02037293..02d02037293 100644
--- a/lib/public/systemtag/isystemtag.php
+++ b/lib/public/SystemTag/ISystemTag.php
diff --git a/lib/public/systemtag/isystemtagmanager.php b/lib/public/SystemTag/ISystemTagManager.php
index 983bfd636ce..983bfd636ce 100644
--- a/lib/public/systemtag/isystemtagmanager.php
+++ b/lib/public/SystemTag/ISystemTagManager.php
diff --git a/lib/public/systemtag/isystemtagmanagerfactory.php b/lib/public/SystemTag/ISystemTagManagerFactory.php
index ad7467633b1..ad7467633b1 100644
--- a/lib/public/systemtag/isystemtagmanagerfactory.php
+++ b/lib/public/SystemTag/ISystemTagManagerFactory.php
diff --git a/lib/public/systemtag/isystemtagobjectmapper.php b/lib/public/SystemTag/ISystemTagObjectMapper.php
index 59b988a3656..59b988a3656 100644
--- a/lib/public/systemtag/isystemtagobjectmapper.php
+++ b/lib/public/SystemTag/ISystemTagObjectMapper.php
diff --git a/lib/public/systemtag/managerevent.php b/lib/public/SystemTag/ManagerEvent.php
index a0429fc9f67..a0429fc9f67 100644
--- a/lib/public/systemtag/managerevent.php
+++ b/lib/public/SystemTag/ManagerEvent.php
diff --git a/lib/public/systemtag/mapperevent.php b/lib/public/SystemTag/MapperEvent.php
index e05a5ce09c8..e05a5ce09c8 100644
--- a/lib/public/systemtag/mapperevent.php
+++ b/lib/public/SystemTag/MapperEvent.php
diff --git a/lib/public/systemtag/tagalreadyexistsexception.php b/lib/public/SystemTag/TagAlreadyExistsException.php
index 5c3d86ad642..5c3d86ad642 100644
--- a/lib/public/systemtag/tagalreadyexistsexception.php
+++ b/lib/public/SystemTag/TagAlreadyExistsException.php
diff --git a/lib/public/systemtag/tagnotfoundexception.php b/lib/public/SystemTag/TagNotFoundException.php
index 12feda8f58a..12feda8f58a 100644
--- a/lib/public/systemtag/tagnotfoundexception.php
+++ b/lib/public/SystemTag/TagNotFoundException.php
diff --git a/lib/public/user.php b/lib/public/User.php
index 64ac92d2100..64ac92d2100 100644
--- a/lib/public/user.php
+++ b/lib/public/User.php
diff --git a/lib/public/userinterface.php b/lib/public/UserInterface.php
index 954c2d68133..954c2d68133 100644
--- a/lib/public/userinterface.php
+++ b/lib/public/UserInterface.php
diff --git a/lib/public/util.php b/lib/public/Util.php
index 45df62ac735..45df62ac735 100644
--- a/lib/public/util.php
+++ b/lib/public/Util.php
diff --git a/ocs-provider/index.php b/ocs-provider/index.php
index 316b39cace8..20e27e38ce7 100644
--- a/ocs-provider/index.php
+++ b/ocs-provider/index.php
@@ -20,13 +20,12 @@
*/
require_once('../lib/base.php');
-require_once(__DIR__ . '/provider.php');
header('Content-Type: application/json');
$server = \OC::$server;
-$controller = new Provider(
+$controller = new \OC\OCS\Provider(
'ocs_provider',
$server->getRequest(),
$server->getAppManager()
diff --git a/settings/l10n/lv.js b/settings/l10n/lv.js
index 43a526fb657..90538cf7ef5 100644
--- a/settings/l10n/lv.js
+++ b/settings/l10n/lv.js
@@ -120,12 +120,15 @@ OC.L10N.register(
"Hide description …" : "Slēpt aprakstu …",
"Online documentation" : "Tiešsaistes dokumentācija",
"Forum" : "Forums",
+ "You are using <strong>%s</strong> of <strong>%s</strong>" : "Jūs izmantojiet <strong>%s</strong> no <strong>%s</strong>",
"Profile picture" : "Profila attēls",
"Upload new" : "Ielādēt jaunu",
"Remove image" : "Novākt attēlu",
"Cancel" : "Atcelt",
+ "Full name" : "Pilns vārds",
"Email" : "E-pasts",
"Your email address" : "Jūsu e-pasta adrese",
+ "You are member of the following groups:" : "Jūs esat šādu grupu biedrs:",
"Password" : "Parole",
"Unable to change your password" : "Nevar nomainīt jūsu paroli",
"Current password" : "Pašreizējā parole",
diff --git a/settings/l10n/lv.json b/settings/l10n/lv.json
index 1c6e84569eb..9c5bd4f7aa6 100644
--- a/settings/l10n/lv.json
+++ b/settings/l10n/lv.json
@@ -118,12 +118,15 @@
"Hide description …" : "Slēpt aprakstu …",
"Online documentation" : "Tiešsaistes dokumentācija",
"Forum" : "Forums",
+ "You are using <strong>%s</strong> of <strong>%s</strong>" : "Jūs izmantojiet <strong>%s</strong> no <strong>%s</strong>",
"Profile picture" : "Profila attēls",
"Upload new" : "Ielādēt jaunu",
"Remove image" : "Novākt attēlu",
"Cancel" : "Atcelt",
+ "Full name" : "Pilns vārds",
"Email" : "E-pasts",
"Your email address" : "Jūsu e-pasta adrese",
+ "You are member of the following groups:" : "Jūs esat šādu grupu biedrs:",
"Password" : "Parole",
"Unable to change your password" : "Nevar nomainīt jūsu paroli",
"Current password" : "Pašreizējā parole",
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 86bedc3f325..e2b980b1c80 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -8,6 +8,8 @@ if ($configDir) {
require_once __DIR__ . '/../lib/base.php';
+\OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib/', true);
+\OC::$composerAutoloader->addPsr4('Tests\\', OC::$SERVERROOT . '/tests/', true);
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
// load all enabled apps
diff --git a/tests/lib/api.php b/tests/lib/APITest.php
index 1d1f97c4942..d3ab6db9e4b 100644
--- a/tests/lib/api.php
+++ b/tests/lib/APITest.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class Test_API extends \Test\TestCase {
+namespace Test;
+
+class APITest extends \Test\TestCase {
// Helps build a response variable
@@ -14,7 +16,7 @@ class Test_API extends \Test\TestCase {
* @param string $message
*/
function buildResponse($shipped, $data, $code, $message=null) {
- $resp = new OC_OCS_Result($data, $code, $message);
+ $resp = new \OC_OCS_Result($data, $code, $message);
$resp->addHeader('KEY', 'VALUE');
return [
'shipped' => $shipped,
@@ -26,13 +28,13 @@ class Test_API extends \Test\TestCase {
// Validate details of the result
/**
- * @param OC_OCS_Result $result
+ * @param \OC_OCS_Result $result
*/
function checkResult($result, $success) {
// Check response is of correct type
$this->assertInstanceOf('OC_OCS_Result', $result);
// Check if it succeeded
- /** @var $result OC_OCS_Result */
+ /** @var $result \OC_OCS_Result */
$this->assertEquals($success, $result->succeeded());
}
@@ -108,7 +110,7 @@ class Test_API extends \Test\TestCase {
// Test merging one success result
$response = $this->buildResponse(true, $data1, $statusCode);
- $result = OC_API::mergeResponses([$response]);
+ $result = \OC_API::mergeResponses([$response]);
$this->assertEquals($response['response'], $result);
$this->checkResult($result, $succeeded);
}
@@ -170,7 +172,7 @@ class Test_API extends \Test\TestCase {
));
// Two shipped success results
- $result = OC_API::mergeResponses(array(
+ $result = \OC_API::mergeResponses(array(
$this->buildResponse($shipped1, $data1, $statusCode1, "message1"),
$this->buildResponse($shipped2, $data2, $statusCode2, "message2"),
));
diff --git a/tests/lib/allconfig.php b/tests/lib/AllConfigTest.php
index 869bf9b8d66..4f8b0658b80 100644
--- a/tests/lib/allconfig.php
+++ b/tests/lib/AllConfigTest.php
@@ -9,13 +9,13 @@
namespace Test;
/**
- * Class TestAllConfig
+ * Class AllConfigTest
*
* @group DB
*
* @package Test
*/
-class TestAllConfig extends \Test\TestCase {
+class AllConfigTest extends \Test\TestCase {
/** @var \OCP\IDBConnection */
protected $connection;
diff --git a/tests/lib/app.php b/tests/lib/AppTest.php
index e7255ad955a..2e5b6f74ab7 100644
--- a/tests/lib/app.php
+++ b/tests/lib/AppTest.php
@@ -7,12 +7,15 @@
* See the COPYING-README file.
*/
+namespace Test;
+use OCP\IAppConfig;
+
/**
- * Class Test_App
+ * Class AppTest
*
* @group DB
*/
-class Test_App extends \Test\TestCase {
+class AppTest extends \Test\TestCase {
const TEST_USER1 = 'user1';
const TEST_USER2 = 'user2';
@@ -267,7 +270,7 @@ class Test_App extends \Test\TestCase {
* @dataProvider appVersionsProvider
*/
public function testIsAppCompatible($ocVersion, $appInfo, $expectedResult) {
- $this->assertEquals($expectedResult, OC_App::isAppCompatible($ocVersion, $appInfo));
+ $this->assertEquals($expectedResult, \OC_App::isAppCompatible($ocVersion, $appInfo));
}
/**
@@ -280,7 +283,7 @@ class Test_App extends \Test\TestCase {
'requiremin' => '6',
'requiremax' => '6',
);
- $this->assertTrue(OC_App::isAppCompatible($ocVersion, $appInfo));
+ $this->assertTrue(\OC_App::isAppCompatible($ocVersion, $appInfo));
}
/**
@@ -478,9 +481,9 @@ class Test_App extends \Test\TestCase {
/**
* Register an app config mock for testing purposes.
*
- * @param $appConfig app config mock
+ * @param IAppConfig $appConfig app config mock
*/
- private function registerAppConfig($appConfig) {
+ private function registerAppConfig(IAppConfig $appConfig) {
\OC::$server->registerService('AppConfig', function ($c) use ($appConfig) {
return $appConfig;
});
diff --git a/tests/lib/capabilitiesmanager.php b/tests/lib/CapabilitiesManagerTest.php
index b5dac80ee51..d4dd52d07f1 100644
--- a/tests/lib/capabilitiesmanager.php
+++ b/tests/lib/CapabilitiesManagerTest.php
@@ -21,8 +21,6 @@
namespace Test;
-use OC\CapabilitiesManager;
-
class CapabilitiesManagerTest extends TestCase {
/**
diff --git a/tests/lib/configtests.php b/tests/lib/ConfigTest.php
index c0251e693c6..74dcdc192ce 100644
--- a/tests/lib/configtests.php
+++ b/tests/lib/ConfigTest.php
@@ -8,7 +8,7 @@
namespace Test;
-class ConfigTests extends TestCase {
+class ConfigTest extends TestCase {
const TESTCONTENT = '<?php $CONFIG=array("foo"=>"bar", "beers" => array("Appenzeller", "Guinness", "Kölsch"), "alcohol_free" => false);';
/** @var array */
diff --git a/tests/lib/contactsmanager.php b/tests/lib/ContactsManagerTest.php
index 39e44cc6302..89a9cb95b97 100644
--- a/tests/lib/contactsmanager.php
+++ b/tests/lib/ContactsManagerTest.php
@@ -1,7 +1,8 @@
<?php
+namespace Test;
-class Test_ContactsManager extends \Test\TestCase {
+class ContactsManagerTest extends \Test\TestCase {
/** @var \OC\ContactsManager */
private $cm;
@@ -206,4 +207,4 @@ class Test_ContactsManager extends \Test\TestCase {
$this->assertTrue($result);
}
-} \ No newline at end of file
+}
diff --git a/tests/lib/errorHandler.php b/tests/lib/ErrorHandlerTest.php
index 726529e83f4..aece7f146f6 100644
--- a/tests/lib/errorHandler.php
+++ b/tests/lib/ErrorHandlerTest.php
@@ -20,7 +20,9 @@
*
*/
-class Test_ErrorHandler extends \Test\TestCase {
+namespace Test;
+
+class ErrorHandlerTest extends \Test\TestCase {
/**
* provide username, password combinations for testRemovePassword
diff --git a/tests/lib/httphelper.php b/tests/lib/HTTPHelperTest.php
index 1d0981ba51b..6d9c4788735 100644
--- a/tests/lib/httphelper.php
+++ b/tests/lib/HTTPHelperTest.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class TestHTTPHelper extends \Test\TestCase {
+namespace Test;
+
+class HTTPHelperTest extends \Test\TestCase {
/** @var \OCP\IConfig*/
private $config;
diff --git a/tests/lib/helperstorage.php b/tests/lib/HelperStorageTest.php
index 3109b509549..e841dbfce18 100644
--- a/tests/lib/helperstorage.php
+++ b/tests/lib/HelperStorageTest.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test;
+
/**
* Test the storage functions of OC_Helper
*
* @group DB
*/
-class Test_Helper_Storage extends \Test\TestCase {
+class HelperStorageTest extends \Test\TestCase {
/** @var string */
private $user;
/** @var \OC\Files\Storage\Storage */
diff --git a/tests/lib/image.php b/tests/lib/ImageTest.php
index e74c75b48cf..9dba7e3739b 100644
--- a/tests/lib/image.php
+++ b/tests/lib/ImageTest.php
@@ -6,7 +6,11 @@
* See the COPYING-README file.
*/
-class Test_Image extends \Test\TestCase {
+namespace Test;
+
+use OC;
+
+class ImageTest extends \Test\TestCase {
public static function tearDownAfterClass() {
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.png');
@unlink(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
diff --git a/tests/lib/helper.php b/tests/lib/LegacyHelperTest.php
index 89a981e6e23..d8b1a82c271 100644
--- a/tests/lib/helper.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -6,7 +6,11 @@
* See the COPYING-README file.
*/
-class Test_Helper extends \Test\TestCase {
+namespace Test;
+
+use OC_Helper;
+
+class LegacyHelperTest extends \Test\TestCase {
/**
* @dataProvider humanFileSizeProvider
diff --git a/tests/lib/naturalsort.php b/tests/lib/NaturalSortTest.php
index 8fcbc6f5fd3..50c2d0be9f0 100644
--- a/tests/lib/naturalsort.php
+++ b/tests/lib/NaturalSortTest.php
@@ -6,7 +6,9 @@
* See the COPYING-README file.
*/
-class Test_NaturalSort extends \Test\TestCase {
+namespace Test;
+
+class NaturalSortTest extends \Test\TestCase {
/**
* @dataProvider naturalSortDataProvider
diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairStepTest.php
index 9ae1318eb32..3f7a0ce064b 100644
--- a/tests/lib/RepairTest.php
+++ b/tests/lib/RepairStepTest.php
@@ -11,7 +11,7 @@ namespace Test;
use OCP\Migration\IRepairStep;
use Symfony\Component\EventDispatcher\EventDispatcher;
-class TestRepairStep implements IRepairStep {
+class RepairStepTest implements IRepairStep {
private $warning;
public function __construct($warning = false) {
diff --git a/tests/lib/setup.php b/tests/lib/SetupTest.php
index bc78c14008f..e2723efd76a 100644
--- a/tests/lib/setup.php
+++ b/tests/lib/SetupTest.php
@@ -6,23 +6,25 @@
* See the COPYING-README file.
*/
+namespace Test;
+
use OCP\IConfig;
-class Test_OC_Setup extends \Test\TestCase {
+class SetupTest extends \Test\TestCase {
- /** @var IConfig | PHPUnit_Framework_MockObject_MockObject */
+ /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
protected $config;
- /** @var \bantu\IniGetWrapper\IniGetWrapper | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \bantu\IniGetWrapper\IniGetWrapper | \PHPUnit_Framework_MockObject_MockObject */
private $iniWrapper;
- /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject */
private $l10n;
- /** @var \OC_Defaults | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC_Defaults | \PHPUnit_Framework_MockObject_MockObject */
private $defaults;
- /** @var \OC\Setup | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OC\Setup | \PHPUnit_Framework_MockObject_MockObject */
protected $setupClass;
- /** @var \OCP\ILogger | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\ILogger | \PHPUnit_Framework_MockObject_MockObject */
protected $logger;
- /** @var \OCP\Security\ISecureRandom | PHPUnit_Framework_MockObject_MockObject */
+ /** @var \OCP\Security\ISecureRandom | \PHPUnit_Framework_MockObject_MockObject */
protected $random;
protected function setUp() {
diff --git a/tests/lib/streamwrappers.php b/tests/lib/StreamWrappersTest.php
index 7175683a60b..a378f975fde 100644
--- a/tests/lib/streamwrappers.php
+++ b/tests/lib/StreamWrappersTest.php
@@ -20,12 +20,14 @@
*
*/
+namespace Test;
+
/**
- * Class Test_StreamWrappers
+ * Class StreamWrappersTest
*
* @group DB
*/
-class Test_StreamWrappers extends \Test\TestCase {
+class StreamWrappersTest extends \Test\TestCase {
private static $trashBinStatus;
@@ -54,7 +56,7 @@ class Test_StreamWrappers extends \Test\TestCase {
public function testCloseStream() {
//ensure all basic stream stuff works
- $sourceFile = OC::$SERVERROOT . '/tests/data/lorem.txt';
+ $sourceFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('.txt');
$file = 'close://' . $tmpFile;
$this->assertTrue(file_exists($file));
diff --git a/tests/lib/tags.php b/tests/lib/TagsTest.php
index 91472d5ceb8..2662c209d2c 100644
--- a/tests/lib/tags.php
+++ b/tests/lib/TagsTest.php
@@ -20,12 +20,14 @@
*
*/
+namespace Test;
+
/**
- * Class Test_Tags
+ * Class TagsTest
*
* @group DB
*/
-class Test_Tags extends \Test\TestCase {
+class TagsTest extends \Test\TestCase {
protected $objectType;
/** @var \OCP\IUser */
@@ -41,12 +43,12 @@ class Test_Tags extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- OC_User::clearBackends();
- OC_User::useBackend('dummy');
+ \OC_User::clearBackends();
+ \OC_User::useBackend('dummy');
$userId = $this->getUniqueID('user_');
\OC::$server->getUserManager()->createUser($userId, 'pass');
- OC_User::setUserId($userId);
- $this->user = new OC\User\User($userId, null);
+ \OC_User::setUserId($userId);
+ $this->user = new \OC\User\User($userId, null);
$this->userSession = $this->getMock('\OCP\IUserSession');
$this->userSession
->expects($this->any())
@@ -54,8 +56,8 @@ class Test_Tags extends \Test\TestCase {
->will($this->returnValue($this->user));
$this->objectType = $this->getUniqueID('type_');
- $this->tagMapper = new OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
- $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
+ $this->tagMapper = new \OC\Tagging\TagMapper(\OC::$server->getDatabaseConnection());
+ $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
}
@@ -73,7 +75,7 @@ class Test_Tags extends \Test\TestCase {
->expects($this->any())
->method('getUser')
->will($this->returnValue(null));
- $this->tagMgr = new OC\TagManager($this->tagMapper, $this->userSession);
+ $this->tagMgr = new \OC\TagManager($this->tagMapper, $this->userSession);
$this->assertNull($this->tagMgr->load($this->objectType));
}
@@ -236,7 +238,7 @@ class Test_Tags extends \Test\TestCase {
$this->assertTrue($tagger->rename('Wrok', 'Work'));
$this->assertTrue($tagger->hasTag('Work'));
- $this->assertFalse($tagger->hastag('Wrok'));
+ $this->assertFalse($tagger->hasTag('Wrok'));
$this->assertFalse($tagger->rename('Wrok', 'Work')); // Rename non-existant tag.
$this->assertFalse($tagger->rename('Work', 'Family')); // Collide with existing tag.
}
@@ -284,28 +286,28 @@ class Test_Tags extends \Test\TestCase {
public function testShareTags() {
$testTag = 'TestTag';
- OCP\Share::registerBackend('test', 'Test_Share_Backend');
+ \OCP\Share::registerBackend('test', 'Test\Share\Backend');
$tagger = $this->tagMgr->load('test');
$tagger->tagAs(1, $testTag);
$otherUserId = $this->getUniqueID('user2_');
\OC::$server->getUserManager()->createUser($otherUserId, 'pass');
- OC_User::setUserId($otherUserId);
+ \OC_User::setUserId($otherUserId);
$otherUserSession = $this->getMock('\OCP\IUserSession');
$otherUserSession
->expects($this->any())
->method('getUser')
- ->will($this->returnValue(new OC\User\User($otherUserId, null)));
+ ->will($this->returnValue(new \OC\User\User($otherUserId, null)));
- $otherTagMgr = new OC\TagManager($this->tagMapper, $otherUserSession);
+ $otherTagMgr = new \OC\TagManager($this->tagMapper, $otherUserSession);
$otherTagger = $otherTagMgr->load('test');
$this->assertFalse($otherTagger->hasTag($testTag));
- OC_User::setUserId($this->user->getUID());
- OCP\Share::shareItem('test', 1, OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
+ \OC_User::setUserId($this->user->getUID());
+ \OCP\Share::shareItem('test', 1, \OCP\Share::SHARE_TYPE_USER, $otherUserId, \OCP\Constants::PERMISSION_READ);
- OC_User::setUserId($otherUserId);
+ \OC_User::setUserId($otherUserId);
$otherTagger = $otherTagMgr->load('test', array(), true); // Update tags, load shared ones.
$this->assertTrue($otherTagger->hasTag($testTag));
$this->assertContains(1, $otherTagger->getIdsForTag($testTag));
diff --git a/tests/lib/template.php b/tests/lib/TemplateFunctionsTest.php
index 6e62d3955f1..aa3c73d4743 100644
--- a/tests/lib/template.php
+++ b/tests/lib/TemplateFunctionsTest.php
@@ -1,5 +1,4 @@
<?php
-
/**
* ownCloud
*
@@ -20,12 +19,15 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
-class Test_TemplateFunctions extends \Test\TestCase {
+
+namespace Test;
+
+class TemplateFunctionsTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib']);
+ $loader = new \OC\Autoloader([\OC::$SERVERROOT . '/lib']);
$loader->load('OC_Template');
}
diff --git a/tests/lib/testcase.php b/tests/lib/TestCase.php
index 7ed121d3556..7ed121d3556 100644
--- a/tests/lib/testcase.php
+++ b/tests/lib/TestCase.php
diff --git a/tests/lib/updater.php b/tests/lib/UpdaterTest.php
index f97eb3ac139..643a18cc714 100644
--- a/tests/lib/updater.php
+++ b/tests/lib/UpdaterTest.php
@@ -20,8 +20,9 @@
*
*/
-namespace OC;
+namespace Test;
+use OC\Updater;
use OCP\IConfig;
use OCP\ILogger;
use OC\IntegrityCheck\Checker;
diff --git a/tests/lib/urlGenerator.php b/tests/lib/UrlGeneratorTest.php
index 07103225baa..7186c8fad80 100644
--- a/tests/lib/urlGenerator.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -6,12 +6,14 @@
* See the COPYING-README file.
*/
+namespace Test;
+
/**
- * Class Test_UrlGenerator
+ * Class UrlGeneratorTest
*
* @group DB
*/
-class Test_UrlGenerator extends \Test\TestCase {
+class UrlGeneratorTest extends \Test\TestCase {
/**
* @small
diff --git a/tests/lib/utilcheckserver.php b/tests/lib/UtilCheckServerTest.php
index 94e7fd2f779..b864af6888a 100644
--- a/tests/lib/utilcheckserver.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -6,18 +6,20 @@
* See the COPYING-README file.
*/
+namespace Test;
+
/**
* Tests for server check functions
*
* @group DB
*/
-class Test_Util_CheckServer extends \Test\TestCase {
+class UtilCheckServerTest extends \Test\TestCase {
private $datadir;
/**
* @param array $systemOptions
- * @return \OCP\IConfig | PHPUnit_Framework_MockObject_MockObject
+ * @return \OCP\IConfig | \PHPUnit_Framework_MockObject_MockObject
*/
protected function getConfig($systemOptions) {
$systemOptions['datadirectory'] = $this->datadir;
diff --git a/tests/lib/util.php b/tests/lib/UtilTest.php
index 4d788353881..7da7db0291c 100644
--- a/tests/lib/util.php
+++ b/tests/lib/UtilTest.php
@@ -1,12 +1,16 @@
<?php
-
/**
* Copyright (c) 2012 Lukas Reschke <lukas@statuscode.ch>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
-class Test_Util extends \Test\TestCase {
+
+namespace Test;
+
+use OC_Util;
+
+class UtilTest extends \Test\TestCase {
public function testGetVersion() {
$version = \OCP\Util::getVersion();
$this->assertTrue(is_array($version));
@@ -46,7 +50,7 @@ class Test_Util extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
*/
function testFormatDateWithInvalidTZ() {
OC_Util::formatDate(1350129205, false, 'Mordor/Barad-dûr');
@@ -283,7 +287,7 @@ class Test_Util extends \Test\TestCase {
* @dataProvider defaultAppsProvider
*/
function testDefaultApps($defaultAppConfig, $expectedPath, $enabledApps) {
- $oldDefaultApps = \OCP\Config::getSystemValue('core', 'defaultapp', '');
+ $oldDefaultApps = \OCP\Config::getSystemValue('defaultapp', '');
// CLI is doing messy stuff with the webroot, so need to work it around
$oldWebRoot = \OC::$WEBROOT;
\OC::$WEBROOT = '';
diff --git a/tests/lib/appconfig.php b/tests/lib/appconfig.php
index 64f0f80e045..12d9728c868 100644
--- a/tests/lib/appconfig.php
+++ b/tests/lib/appconfig.php
@@ -7,16 +7,14 @@
* See the COPYING-README file.
*/
-namespace Test\Lib;
-
-use Test\TestCase;
+namespace Test;
/**
* Class AppConfig
*
* @group DB
*
- * @package Test\Lib
+ * @package Test
*/
class AppConfig extends TestCase {
/** @var \OCP\IAppConfig */
diff --git a/tests/lib/autoloader.php b/tests/lib/autoloader.php
index adea702eca9..3669f514bee 100644
--- a/tests/lib/autoloader.php
+++ b/tests/lib/autoloader.php
@@ -37,16 +37,16 @@ class AutoLoader extends TestCase {
], $this->loader->findClass('OC_Files'));
}
- public function testLoadTestNamespace() {
+ public function testLoadTestTestCase() {
$this->assertEquals([
- \OC::$SERVERROOT . '/tests/lib/foo/bar.php'
- ], $this->loader->findClass('Test\Foo\Bar'));
+ \OC::$SERVERROOT . '/tests/lib/TestCase.php'
+ ], $this->loader->findClass('Test\TestCase'));
}
- public function testLoadTest() {
+ public function testLoadTestNamespace() {
$this->assertEquals([
\OC::$SERVERROOT . '/tests/lib/foo/bar.php'
- ], $this->loader->findClass('Test_Foo_Bar'));
+ ], $this->loader->findClass('Test\Foo\Bar'));
}
public function testLoadCore() {
diff --git a/tests/lib/avatarmanagertest.php b/tests/lib/avatarmanagertest.php
index f5cdd99176d..2dd6ff34923 100644
--- a/tests/lib/avatarmanagertest.php
+++ b/tests/lib/avatarmanagertest.php
@@ -18,6 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
+namespace Test;
+
use OC\AvatarManager;
use Test\Traits\UserTrait;
use Test\Traits\MountProviderTrait;
@@ -48,7 +51,7 @@ class AvatarManagerTest extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage user does not exist
*/
public function testGetAvatarInvalidUser() {
diff --git a/tests/lib/avatartest.php b/tests/lib/avatartest.php
index b0ab4cb8b5c..0a00f5d5614 100644
--- a/tests/lib/avatartest.php
+++ b/tests/lib/avatartest.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
* This file is licensed under the Affero General Public License version 3 or
@@ -7,23 +6,25 @@
* See the COPYING-README file.
*/
+namespace Test;
+
use OCP\Files\Folder;
class AvatarTest extends \Test\TestCase {
- /** @var Folder | PHPUnit_Framework_MockObject_MockObject */
+ /** @var Folder | \PHPUnit_Framework_MockObject_MockObject */
private $folder;
/** @var \OC\Avatar */
private $avatar;
- /** @var \OC\User\User | PHPUnit_Framework_MockObject_MockObject $user */
+ /** @var \OC\User\User | \PHPUnit_Framework_MockObject_MockObject $user */
private $user;
public function setUp() {
parent::setUp();
$this->folder = $this->getMock('\OCP\Files\Folder');
- /** @var \OCP\IL10N | PHPUnit_Framework_MockObject_MockObject $l */
+ /** @var \OCP\IL10N | \PHPUnit_Framework_MockObject_MockObject $l */
$l = $this->getMock('\OCP\IL10N');
$l->method('t')->will($this->returnArgument(0));
$this->user = $this->getMockBuilder('\OC\User\User')->disableOriginalConstructor()->getMock();
@@ -41,7 +42,7 @@ class AvatarTest extends \Test\TestCase {
['avatar.128.jpg', true],
]));
- $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
+ $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$file = $this->getMock('\OCP\Files\File');
$file->method('getContent')->willReturn($expected->data());
@@ -56,7 +57,7 @@ class AvatarTest extends \Test\TestCase {
['avatar.jpg', true],
]));
- $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
+ $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$file = $this->getMock('\OCP\Files\File');
$file->method('getContent')->willReturn($expected->data());
@@ -72,8 +73,8 @@ class AvatarTest extends \Test\TestCase {
['avatar.32.png', false],
]));
- $expected = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
- $expected2 = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
+ $expected = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
+ $expected2 = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$expected2->resize(32);
$file = $this->getMock('\OCP\Files\File');
@@ -157,7 +158,7 @@ class AvatarTest extends \Test\TestCase {
->with('avatar.png')
->willReturn($newFile);
- $image = new OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
+ $image = new \OC_Image(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$newFile->expects($this->once())
->method('putContent')
->with($image->data());
diff --git a/tests/lib/dbschema.php b/tests/lib/db/DBSchemaTest.php
index 11eacbf397f..284fc532c2a 100644
--- a/tests/lib/dbschema.php
+++ b/tests/lib/db/DBSchemaTest.php
@@ -1,5 +1,4 @@
<?php
-
/**
* Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
* This file is licensed under the Affero General Public License version 3 or
@@ -7,14 +6,17 @@
* See the COPYING-README file.
*/
+namespace Test\DB;
+
+use OC_DB;
use OCP\Security\ISecureRandom;
/**
- * Class Test_DBSchema
+ * Class DBSchemaTest
*
* @group DB
*/
-class Test_DBSchema extends \Test\TestCase {
+class DBSchemaTest extends \Test\TestCase {
protected $schema_file = 'static://test_db_scheme';
protected $schema_file2 = 'static://test_db_scheme2';
protected $table1;
@@ -23,8 +25,8 @@ class Test_DBSchema extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $dbfile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
- $dbfile2 = OC::$SERVERROOT.'/tests/data/db_structure2.xml';
+ $dbfile = \OC::$SERVERROOT.'/tests/data/db_structure.xml';
+ $dbfile2 = \OC::$SERVERROOT.'/tests/data/db_structure2.xml';
$r = '_' . \OC::$server->getSecureRandom()->
generate(4, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_DIGITS) . '_';
diff --git a/tests/lib/db.php b/tests/lib/db/LegacyDBTest.php
index 88c9ee75b3b..7aeeb3dd1f9 100644
--- a/tests/lib/db.php
+++ b/tests/lib/db/LegacyDBTest.php
@@ -6,12 +6,16 @@
* See the COPYING-README file.
*/
+namespace Test\DB;
+
+use OC_DB;
+
/**
- * Class Test_DB
+ * Class LegacyDBTest
*
* @group DB
*/
-class Test_DB extends \Test\TestCase {
+class LegacyDBTest extends \Test\TestCase {
protected $backupGlobals = FALSE;
protected static $schema_file = 'static://test_db_scheme';
@@ -45,7 +49,7 @@ class Test_DB extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- $dbFile = OC::$SERVERROOT.'/tests/data/db_structure.xml';
+ $dbFile = \OC::$SERVERROOT.'/tests/data/db_structure.xml';
$r = $this->getUniqueID('_', 4).'_';
$content = file_get_contents( $dbFile );
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 54aa7ad789a..3201e2d03fe 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -8,7 +8,6 @@
namespace Test\Files\Cache;
-use PHPUnit_Framework_MockObject_MockObject;
class LongId extends \OC\Files\Storage\Temporary {
public function getId() {
@@ -491,7 +490,7 @@ class Cache extends \Test\TestCase {
$folderWith0308 = "\x53\x63\x68\x6f\xcc\x88\x6e";
/**
- * @var \OC\Files\Cache\Cache | PHPUnit_Framework_MockObject_MockObject $cacheMock
+ * @var \OC\Files\Cache\Cache | \PHPUnit_Framework_MockObject_MockObject $cacheMock
*/
$cacheMock = $this->getMock('\OC\Files\Cache\Cache', array('normalize'), array($this->storage), '', true);
diff --git a/tests/lib/files/node/integration.php b/tests/lib/files/node/IntegrationTest.php
index addc7e98f48..e11f9bca4ea 100644
--- a/tests/lib/files/node/integration.php
+++ b/tests/lib/files/node/IntegrationTest.php
@@ -20,7 +20,7 @@ use OC\User\User;
*
* @package Test\Files\Node
*/
-class IntegrationTests extends \Test\TestCase {
+class IntegrationTest extends \Test\TestCase {
/**
* @var \OC\Files\Node\Root $root
*/
diff --git a/tests/lib/files/objectstore/swift.php b/tests/lib/files/objectstore/SwiftTest.php
index a63f5844145..4731936627d 100644
--- a/tests/lib/files/objectstore/swift.php
+++ b/tests/lib/files/objectstore/SwiftTest.php
@@ -18,22 +18,22 @@
*
*/
-namespace OCA\ObjectStore\Tests\Unit;
+namespace Test\Files\Cache\ObjectStore;
use OC\Files\ObjectStore\ObjectStoreStorage;
-use OC\Files\ObjectStore\Swift as ObjectStoreToTest;
+use OC\Files\ObjectStore\Swift;
/**
- * Class Swift
+ * Class SwiftTest
*
* @group DB
*
- * @package OCA\ObjectStore\Tests\Unit
+ * @package Test\Files\Cache\ObjectStore
*/
-class Swift extends \Test\Files\Storage\Storage {
+class SwiftTest extends \Test\Files\Storage\Storage {
/**
- * @var ObjectStoreToTest
+ * @var Swift
*/
private $objectStorage;
@@ -63,7 +63,7 @@ class Swift extends \Test\Files\Storage\Storage {
\OC_User::setUserId('test');
$config = \OC::$server->getConfig()->getSystemValue('objectstore');
- $this->objectStorage = new ObjectStoreToTest($config['arguments']);
+ $this->objectStorage = new Swift($config['arguments']);
$config['objectstore'] = $this->objectStorage;
$this->instance = new ObjectStoreStorage($config);
}
diff --git a/tests/lib/files/objectstore/noopscanner.php b/tests/lib/files/objectstore/noopscanner.php
index f860c03cb18..fba6619d42b 100644
--- a/tests/lib/files/objectstore/noopscanner.php
+++ b/tests/lib/files/objectstore/noopscanner.php
@@ -9,7 +9,7 @@
* later.
* See the COPYING-README file.
*/
-namespace Test\Files\Cache;
+namespace Test\Files\Cache\ObjectStore;
class NoopScanner extends \Test\TestCase {
/** @var \OC\Files\Storage\Storage $storage */
diff --git a/tests/lib/files/pathverificationtest.php b/tests/lib/files/pathverificationtest.php
index db393ce5e51..ea9859c862c 100644
--- a/tests/lib/files/pathverificationtest.php
+++ b/tests/lib/files/pathverificationtest.php
@@ -17,7 +17,7 @@ use OC\Files\View;
*
* @package Test\Files
*/
-class PathVerification extends \Test\TestCase {
+class PathVerificationTest extends \Test\TestCase {
/**
* @var \OC\Files\View
diff --git a/tests/lib/files/storage/wrapper/availability.php b/tests/lib/files/storage/wrapper/availability.php
index 99d6f7dbe5c..311334a80a3 100644
--- a/tests/lib/files/storage/wrapper/availability.php
+++ b/tests/lib/files/storage/wrapper/availability.php
@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
namespace Test\Files\Storage\Wrapper;
class Availability extends \Test\TestCase {
diff --git a/tests/lib/files/type/detection.php b/tests/lib/files/type/DetectionTest.php
index 5800f4eb8e3..5800f4eb8e3 100644
--- a/tests/lib/files/type/detection.php
+++ b/tests/lib/files/type/DetectionTest.php
diff --git a/tests/lib/files/type/loadertest.php b/tests/lib/files/type/loadertest.php
index 7f87afd2f4d..a77d672f667 100644
--- a/tests/lib/files/type/loadertest.php
+++ b/tests/lib/files/type/loadertest.php
@@ -19,7 +19,7 @@
*
*/
-namespace OC\Files\Type;
+namespace Test\Files\Type;
use \OC\Files\Type\Loader;
use \OCP\IDBConnection;
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 86413c61aa1..d33c9f31503 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -1508,7 +1508,7 @@ class View extends \Test\TestCase {
$defaultView = new \OC\Files\View('/foo/files');
$defaultRootValue->setValue($defaultView);
$view = new \OC\Files\View($root);
- $result = \Test_Helper::invokePrivate($view, 'shouldEmitHooks', [$path]);
+ $result = $this->invokePrivate($view, 'shouldEmitHooks', [$path]);
$defaultRootValue->setValue($oldRoot);
$this->assertEquals($shouldEmit, $result);
}
@@ -1872,7 +1872,7 @@ class View extends \Test\TestCase {
$this->assertEquals(ILockingProvider::LOCK_SHARED, $lockTypePre, 'File locked properly during pre-hook');
$this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeDuring, 'File locked properly during operation');
- $this->assertNull(null, $lockTypePost, 'No post hook, no lock check possible');
+ $this->assertNull($lockTypePost, 'No post hook, no lock check possible');
$this->assertEquals(ILockingProvider::LOCK_EXCLUSIVE, $lockTypeDuring, 'File still locked after fopen');
diff --git a/tests/lib/group.php b/tests/lib/group/LegacyGroupTest.php
index d3ac6d8d69e..12bcfdddf15 100644
--- a/tests/lib/group.php
+++ b/tests/lib/group/LegacyGroupTest.php
@@ -22,7 +22,12 @@
*
*/
-class Test_Group extends \Test\TestCase {
+namespace Test\Group;
+
+use OC_Group;
+use OC_User;
+
+class LegacyGroupTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
OC_Group::clearBackends();
diff --git a/tests/lib/group/backend.php b/tests/lib/group/backend.php
index 3b06a3eb3a9..53a13e6c62f 100644
--- a/tests/lib/group/backend.php
+++ b/tests/lib/group/backend.php
@@ -24,12 +24,14 @@
*
*/
+namespace Test\Group;
+
/**
* Class Test_Group_Backend
*
* @group DB
*/
-abstract class Test_Group_Backend extends \Test\TestCase {
+abstract class Backend extends \Test\TestCase {
/**
* @var \OC\Group\Backend $backend
*/
diff --git a/tests/lib/group/database.php b/tests/lib/group/database.php
index aae9f8bf1de..bf9d9c35b0b 100644
--- a/tests/lib/group/database.php
+++ b/tests/lib/group/database.php
@@ -23,12 +23,14 @@
*
*/
+namespace Test\Group;
+
/**
- * Class Test_Group_Database
+ * Class Database
*
* @group DB
*/
-class Test_Group_Database extends Test_Group_Backend {
+class Database extends Backend {
private $groups = array();
/**
diff --git a/tests/lib/group/dummy.php b/tests/lib/group/dummy.php
index eaa299c39af..5504cd63a0a 100644
--- a/tests/lib/group/dummy.php
+++ b/tests/lib/group/dummy.php
@@ -20,12 +20,14 @@
*
*/
+namespace Test\Group;
+
/**
- * Class Test_Group_Dummy
+ * Class Dummy
*
* @group DB
*/
-class Test_Group_Dummy extends Test_Group_Backend {
+class Dummy extends Backend {
protected function setUp() {
parent::setUp();
$this->backend=new \Test\Util\Group\Dummy();
diff --git a/tests/lib/group/metadata.php b/tests/lib/group/metadatatest.php
index 233463c71eb..593bbcb48db 100644
--- a/tests/lib/group/metadata.php
+++ b/tests/lib/group/metadatatest.php
@@ -22,7 +22,7 @@
namespace Test\Group;
-class Test_MetaData extends \Test\TestCase {
+class MetaDataTest extends \Test\TestCase {
/** @var \OC\Group\Manager */
private $groupManager;
/** @var \OCP\IUserSession */
diff --git a/tests/lib/http/client/clientservicetest.php b/tests/lib/http/client/clientservicetest.php
index 6d7acea0be7..3c406f30111 100644
--- a/tests/lib/http/client/clientservicetest.php
+++ b/tests/lib/http/client/clientservicetest.php
@@ -6,9 +6,11 @@
* See the COPYING-README file.
*/
-namespace OC\Http\Client;
+namespace Test\Http\Client;
use GuzzleHttp\Client as GuzzleClient;
+use OC\Http\Client\Client;
+use OC\Http\Client\ClientService;
/**
* Class ClientServiceTest
diff --git a/tests/lib/http/client/clienttest.php b/tests/lib/http/client/clienttest.php
index c76fe0532a7..705e1eeddea 100644
--- a/tests/lib/http/client/clienttest.php
+++ b/tests/lib/http/client/clienttest.php
@@ -6,9 +6,10 @@
* See the COPYING-README file.
*/
-namespace OC\Http\Client;
+namespace Test\Http\Client;
use GuzzleHttp\Message\Response;
+use OC\Http\Client\Client;
use OCP\IConfig;
/**
diff --git a/tests/lib/http/client/responsetest.php b/tests/lib/http/client/responsetest.php
index d9b181a8e28..685f34a0baf 100644
--- a/tests/lib/http/client/responsetest.php
+++ b/tests/lib/http/client/responsetest.php
@@ -6,10 +6,11 @@
* See the COPYING-README file.
*/
-namespace OC\Http\Client;
+namespace Test\Http\Client;
use Guzzle\Stream\Stream;
use GuzzleHttp\Message\Response as GuzzleResponse;
+use OC\Http\Client\Response;
/**
* Class ResponseTest
diff --git a/tests/lib/integritycheck/checkertest.php b/tests/lib/integritycheck/checkertest.php
index 0910c543a7a..6e6095668b0 100644
--- a/tests/lib/integritycheck/checkertest.php
+++ b/tests/lib/integritycheck/checkertest.php
@@ -23,7 +23,6 @@ namespace Test\IntegrityCheck;
use OC\IntegrityCheck\Checker;
use OC\Memcache\NullCache;
-use OCP\ICache;
use phpseclib\Crypt\RSA;
use phpseclib\File\X509;
use Test\TestCase;
diff --git a/tests/lib/integritycheck/helpers/EnvironmentHelperTest.php b/tests/lib/integritycheck/helpers/EnvironmentHelperTest.php
index a1d1f671b07..9dc9214a779 100644
--- a/tests/lib/integritycheck/helpers/EnvironmentHelperTest.php
+++ b/tests/lib/integritycheck/helpers/EnvironmentHelperTest.php
@@ -19,7 +19,7 @@
*
*/
-namespace Test\IntegrityCheck\Factories;
+namespace Test\IntegrityCheck\Helpers;
use OC\IntegrityCheck\Helpers\EnvironmentHelper;
use Test\TestCase;
diff --git a/tests/lib/log/owncloud.php b/tests/lib/log/OwncloudTest.php
index e19063a83f5..e19063a83f5 100644
--- a/tests/lib/log/owncloud.php
+++ b/tests/lib/log/OwncloudTest.php
diff --git a/tests/lib/mail/mailer.php b/tests/lib/mail/MailerTest.php
index 8023cda820e..c63ceb5982a 100644
--- a/tests/lib/mail/mailer.php
+++ b/tests/lib/mail/MailerTest.php
@@ -6,11 +6,13 @@
* See the COPYING-README file.
*/
-namespace Test;
+namespace Test\Mail;
+
use OC\Mail\Mailer;
use OCP\IConfig;
use OC_Defaults;
use OCP\ILogger;
+use Test\TestCase;
class MailerTest extends TestCase {
/** @var IConfig */
diff --git a/tests/lib/mail/message.php b/tests/lib/mail/MessageTest.php
index 339677c0a7c..691168ce24c 100644
--- a/tests/lib/mail/message.php
+++ b/tests/lib/mail/MessageTest.php
@@ -6,10 +6,11 @@
* See the COPYING-README file.
*/
-namespace Test;
+namespace Test\Mail;
use OC\Mail\Message;
use Swift_Message;
+use Test\TestCase;
class MessageTest extends TestCase {
/** @var Swift_Message */
diff --git a/tests/lib/memcache/factory.php b/tests/lib/memcache/FactoryTest.php
index 33a27a42113..8607ea7de9b 100644
--- a/tests/lib/memcache/factory.php
+++ b/tests/lib/memcache/FactoryTest.php
@@ -56,7 +56,7 @@ class Test_Factory_Unavailable_Cache2 {
}
}
-class Test_Factory extends \Test\TestCase {
+class FactoryTest extends \Test\TestCase {
const AVAILABLE1 = '\\Test\\Memcache\\Test_Factory_Available_Cache1';
const AVAILABLE2 = '\\Test\\Memcache\\Test_Factory_Available_Cache2';
const UNAVAILABLE1 = '\\Test\\Memcache\\Test_Factory_Unavailable_Cache1';
diff --git a/tests/ocs/response.php b/tests/lib/ocs/MapStatusCodeTest.php
index 919915a7c78..27ebfe209f7 100644
--- a/tests/ocs/response.php
+++ b/tests/lib/ocs/MapStatusCodeTest.php
@@ -1,6 +1,4 @@
<?php
-use OCP\AppFramework\Http;
-
/**
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
@@ -21,13 +19,17 @@ use OCP\AppFramework\Http;
*
*/
-class OcsResponseTest extends \Test\TestCase {
+namespace Test\OCS;
+
+use OCP\AppFramework\Http;
+
+class MapStatusCodeTest extends \Test\TestCase {
/**
* @dataProvider providesStatusCodes
*/
public function testStatusCodeMapper($expected, $sc) {
- $result = OC_API::mapStatusCodes($sc);
+ $result = \OC_API::mapStatusCodes($sc);
$this->assertEquals($expected, $result);
}
diff --git a/tests/lib/ocs/privatedata.php b/tests/lib/ocs/PrivatedataTest.php
index ce153bf07d6..0b3b23b8804 100644
--- a/tests/lib/ocs/privatedata.php
+++ b/tests/lib/ocs/PrivatedataTest.php
@@ -20,12 +20,16 @@
*
*/
+namespace Test\OCS;
+
+use OC_OCS_Privatedata;
+
/**
- * Class Test_OC_OCS_Privatedata
+ * Class PrivatedataTest
*
* @group DB
*/
-class Test_OC_OCS_Privatedata extends \Test\TestCase {
+class PrivatedataTest extends \Test\TestCase {
private $appKey;
protected function setUp() {
diff --git a/tests/ocs-provider/provider.php b/tests/lib/ocs/ProviderTest.php
index 17f557b16b5..399fd3933d9 100644
--- a/tests/ocs-provider/provider.php
+++ b/tests/lib/ocs/ProviderTest.php
@@ -19,7 +19,11 @@
*
*/
-class OcsProviderTest extends \Test\TestCase {
+namespace Test\OCS;
+
+use OC\OCS\Provider;
+
+class ProviderTest extends \Test\TestCase {
/** @var \OCP\IRequest */
private $request;
/** @var \OCP\App\IAppManager */
@@ -30,8 +34,6 @@ class OcsProviderTest extends \Test\TestCase {
public function setUp() {
parent::setUp();
- require_once '../ocs-provider/provider.php';
-
$this->request = $this->getMockBuilder('\\OCP\\IRequest')->getMock();
$this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager')->getMock();
$this->ocsProvider = new Provider('ocs_provider', $this->request, $this->appManager);
diff --git a/tests/lib/ocsclienttest.php b/tests/lib/ocsclienttest.php
index 7555562d124..4ae6fb62e0e 100644
--- a/tests/lib/ocsclienttest.php
+++ b/tests/lib/ocsclienttest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test;
+
use OC\OCSClient;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
diff --git a/tests/lib/public/contacts.php b/tests/lib/publicnamespace/ContactsTest.php
index 151e98d3905..8b07c4831b6 100644
--- a/tests/lib/public/contacts.php
+++ b/tests/lib/publicnamespace/ContactsTest.php
@@ -19,15 +19,17 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Contacts extends \Test\TestCase {
+namespace Test\PublicNamespace;
+
+class ContactsTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- OCP\Contacts::clear();
+ \OCP\Contacts::clear();
}
public function testDisabledIfEmpty() {
// pretty simple
- $this->assertFalse(OCP\Contacts::isEnabled());
+ $this->assertFalse(\OCP\Contacts::isEnabled());
}
public function testEnabledAfterRegister() {
@@ -41,19 +43,19 @@ class Test_Contacts extends \Test\TestCase {
->method('getKey');
// not enabled before register
- $this->assertFalse(OCP\Contacts::isEnabled());
+ $this->assertFalse(\OCP\Contacts::isEnabled());
// register the address book
- OCP\Contacts::registerAddressBook($stub);
+ \OCP\Contacts::registerAddressBook($stub);
// contacts api shall be enabled
- $this->assertTrue(OCP\Contacts::isEnabled());
+ $this->assertTrue(\OCP\Contacts::isEnabled());
// unregister the address book
- OCP\Contacts::unregisterAddressBook($stub);
+ \OCP\Contacts::unregisterAddressBook($stub);
// not enabled after register
- $this->assertFalse(OCP\Contacts::isEnabled());
+ $this->assertFalse(\OCP\Contacts::isEnabled());
}
public function testAddressBookEnumeration() {
@@ -69,8 +71,8 @@ class Test_Contacts extends \Test\TestCase {
->will($this->returnValue('A very simple Addressbook'));
// register the address book
- OCP\Contacts::registerAddressBook($stub);
- $all_books = OCP\Contacts::getAddressBooks();
+ \OCP\Contacts::registerAddressBook($stub);
+ $all_books = \OCP\Contacts::getAddressBooks();
$this->assertEquals(1, count($all_books));
$this->assertEquals('A very simple Addressbook', $all_books['SIMPLE_ADDRESS_BOOK']);
@@ -101,15 +103,15 @@ class Test_Contacts extends \Test\TestCase {
$stub2->expects($this->any())->method('search')->will($this->returnValue($searchResult2));
// register the address books
- OCP\Contacts::registerAddressBook($stub1);
- OCP\Contacts::registerAddressBook($stub2);
- $all_books = OCP\Contacts::getAddressBooks();
+ \OCP\Contacts::registerAddressBook($stub1);
+ \OCP\Contacts::registerAddressBook($stub2);
+ $all_books = \OCP\Contacts::getAddressBooks();
// assert the count - doesn't hurt
$this->assertEquals(2, count($all_books));
// perform the search
- $result = OCP\Contacts::search('x', array());
+ $result = \OCP\Contacts::search('x', array());
// we expect 4 hits
$this->assertEquals(4, count($result));
diff --git a/tests/lib/public/ocpconfig.php b/tests/lib/publicnamespace/OCPConfigTest.php
index 947d2b3c9ef..44fd234735e 100644
--- a/tests/lib/public/ocpconfig.php
+++ b/tests/lib/publicnamespace/OCPConfigTest.php
@@ -19,7 +19,9 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_OCPConfig extends \Test\TestCase {
+namespace Test\PublicNamespace;
+
+class OCPConfigTest extends \Test\TestCase {
public function testSetAppValueIfSetToNull() {
diff --git a/tests/lib/public/util.php b/tests/lib/publicnamespace/UtilTest.php
index ebc4f70079b..31d1f9fb0ee 100644
--- a/tests/lib/public/util.php
+++ b/tests/lib/publicnamespace/UtilTest.php
@@ -19,10 +19,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Public_Util extends \Test\TestCase {
+namespace Test\PublicNamespace;
+
+
+class UtilTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- OCP\Contacts::clear();
+ \OCP\Contacts::clear();
}
/**
diff --git a/tests/lib/repair/repaircollation.php b/tests/lib/repair/RepairCollationTest.php
index 4efa8ccc552..2e304a74abc 100644
--- a/tests/lib/repair/repaircollation.php
+++ b/tests/lib/repair/RepairCollationTest.php
@@ -1,4 +1,7 @@
<?php
+
+namespace Test\Repair;
+
use OCP\Migration\IOutput;
/**
@@ -25,7 +28,7 @@ class TestCollationRepair extends \OC\Repair\Collation {
*
* @see \OC\Repair\RepairMimeTypes
*/
-class TestRepairCollation extends \Test\TestCase {
+class RepairCollationTest extends \Test\TestCase {
/**
* @var TestCollationRepair
diff --git a/tests/lib/security/certificatemanager.php b/tests/lib/security/CertificateManagerTest.php
index e9ccea39efe..43206569cf4 100644
--- a/tests/lib/security/certificatemanager.php
+++ b/tests/lib/security/CertificateManagerTest.php
@@ -6,6 +6,8 @@
* See the COPYING-README file.
*/
+namespace Test\Security;
+
use \OC\Security\CertificateManager;
/**
diff --git a/tests/lib/security/certificate.php b/tests/lib/security/CertificateTest.php
index 82e91c71733..6f7d7d4a37f 100644
--- a/tests/lib/security/certificate.php
+++ b/tests/lib/security/CertificateTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Security;
+
use \OC\Security\Certificate;
class CertificateTest extends \Test\TestCase {
@@ -74,18 +76,18 @@ class CertificateTest extends \Test\TestCase {
}
public function testGetIssueDate() {
- $expected = new DateTime('2015-08-27 20:03:42 GMT');
+ $expected = new \DateTime('2015-08-27 20:03:42 GMT');
$this->assertEquals($expected->getTimestamp(), $this->goodCertificate->getIssueDate()->getTimestamp());
- $expected = new DateTime('2015-08-27 20:19:13 GMT');
+ $expected = new \DateTime('2015-08-27 20:19:13 GMT');
$this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getIssueDate()->getTimestamp());
}
public function testGetExpireDate() {
- $expected = new DateTime('2025-08-24 20:03:42 GMT');
+ $expected = new \DateTime('2025-08-24 20:03:42 GMT');
$this->assertEquals($expected->getTimestamp(), $this->goodCertificate->getExpireDate()->getTimestamp());
- $expected = new DateTime('2025-08-24 20:19:13 GMT');
+ $expected = new \DateTime('2025-08-24 20:19:13 GMT');
$this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getExpireDate()->getTimestamp());
- $expected = new DateTime('2014-08-28 09:12:43 GMT');
+ $expected = new \DateTime('2014-08-28 09:12:43 GMT');
$this->assertEquals($expected->getTimestamp(), $this->expiredCertificate->getExpireDate()->getTimestamp());
}
diff --git a/tests/lib/security/credentialsmanager.php b/tests/lib/security/CredentialsManagerTest.php
index 72f061e05bb..7eb4e4d7b1a 100644
--- a/tests/lib/security/credentialsmanager.php
+++ b/tests/lib/security/CredentialsManagerTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Security;
+
use \OCP\Security\ICrypto;
use \OCP\IDBConnection;
use \OC\Security\CredentialsManager;
diff --git a/tests/lib/security/crypto.php b/tests/lib/security/CryptoTest.php
index 1571cf89248..356d504f4b3 100644
--- a/tests/lib/security/crypto.php
+++ b/tests/lib/security/CryptoTest.php
@@ -6,6 +6,8 @@
* See the COPYING-README file.
*/
+namespace Test\Security;
+
use \OC\Security\Crypto;
class CryptoTest extends \Test\TestCase {
diff --git a/tests/lib/security/hasher.php b/tests/lib/security/HasherTest.php
index a6f7df5b79f..913f4d703e8 100644
--- a/tests/lib/security/hasher.php
+++ b/tests/lib/security/HasherTest.php
@@ -6,6 +6,8 @@
* See the COPYING-README file.
*/
+namespace Test\Security;
+
use OC\Security\Hasher;
/**
diff --git a/tests/lib/security/securerandom.php b/tests/lib/security/SecureRandomTest.php
index 526066d92ee..40431c89795 100644
--- a/tests/lib/security/securerandom.php
+++ b/tests/lib/security/SecureRandomTest.php
@@ -6,6 +6,8 @@
* See the COPYING-README file.
*/
+namespace Test\Security;
+
use \OC\Security\SecureRandom;
class SecureRandomTest extends \Test\TestCase {
diff --git a/tests/lib/security/trusteddomainhelper.php b/tests/lib/security/TrustedDomainHelperTest.php
index 3581211ce61..dfd51167cca 100644
--- a/tests/lib/security/trusteddomainhelper.php
+++ b/tests/lib/security/TrustedDomainHelperTest.php
@@ -6,6 +6,8 @@
* See the COPYING-README file.
*/
+namespace Test\Security;
+
use \OC\Security\TrustedDomainHelper;
use OCP\IConfig;
diff --git a/tests/lib/security/csp/ContentSecurityPolicyManagerTest.php b/tests/lib/security/csp/ContentSecurityPolicyManagerTest.php
index 975c35d3780..d463e7c648c 100644
--- a/tests/lib/security/csp/ContentSecurityPolicyManagerTest.php
+++ b/tests/lib/security/csp/ContentSecurityPolicyManagerTest.php
@@ -19,6 +19,9 @@
*
*/
+namespace Test\Security\CSP;
+
+
use OC\Security\CSP\ContentSecurityPolicyManager;
class ContentSecurityPolicyManagerTest extends \Test\TestCase {
diff --git a/tests/lib/security/csrf/CsrfTokenGeneratorTest.php b/tests/lib/security/csrf/CsrfTokenGeneratorTest.php
index be7434f514f..28b85c3951f 100644
--- a/tests/lib/security/csrf/CsrfTokenGeneratorTest.php
+++ b/tests/lib/security/csrf/CsrfTokenGeneratorTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Security\CSRF;
+
class CsrfTokenGeneratorTest extends \Test\TestCase {
/** @var \OCP\Security\ISecureRandom */
private $random;
diff --git a/tests/lib/security/csrf/CsrfTokenManagerTest.php b/tests/lib/security/csrf/CsrfTokenManagerTest.php
index 145fc03c51e..ab19a43e91e 100644
--- a/tests/lib/security/csrf/CsrfTokenManagerTest.php
+++ b/tests/lib/security/csrf/CsrfTokenManagerTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Security\CSRF;
+
class CsrfTokenManagerTest extends \Test\TestCase {
/** @var \OC\Security\CSRF\CsrfTokenManager */
private $csrfTokenManager;
diff --git a/tests/lib/security/csrf/CsrfTokenTest.php b/tests/lib/security/csrf/CsrfTokenTest.php
index 62e6ad112e7..da640ce5052 100644
--- a/tests/lib/security/csrf/CsrfTokenTest.php
+++ b/tests/lib/security/csrf/CsrfTokenTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Security\CSRF;
+
class CsrfTokenTest extends \Test\TestCase {
public function testGetEncryptedValue() {
$csrfToken = new \OC\Security\CSRF\CsrfToken('MyCsrfToken');
diff --git a/tests/lib/security/csrf/tokenstorage/SessionStorageTest.php b/tests/lib/security/csrf/tokenstorage/SessionStorageTest.php
index 3a83f6a8c00..550fa49e1b2 100644
--- a/tests/lib/security/csrf/tokenstorage/SessionStorageTest.php
+++ b/tests/lib/security/csrf/tokenstorage/SessionStorageTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Security\CSRF\TokenStorage;
+
class SessionStorageTest extends \Test\TestCase {
/** @var \OCP\ISession */
private $session;
diff --git a/tests/lib/share/MailNotificationsTest.php b/tests/lib/share/MailNotificationsTest.php
index f160fed57ae..0c951d11f88 100644
--- a/tests/lib/share/MailNotificationsTest.php
+++ b/tests/lib/share/MailNotificationsTest.php
@@ -19,6 +19,8 @@
*
*/
+namespace Test\Share;
+
use OC\Share\MailNotifications;
use OCP\IL10N;
use OCP\IUser;
@@ -33,15 +35,15 @@ use OCP\IURLGenerator;
class MailNotificationsTest extends \Test\TestCase {
/** @var IL10N */
private $l10n;
- /** @var IMailer | PHPUnit_Framework_MockObject_MockObject */
+ /** @var IMailer | \PHPUnit_Framework_MockObject_MockObject */
private $mailer;
/** @var ILogger */
private $logger;
- /** @var Defaults | PHPUnit_Framework_MockObject_MockObject */
+ /** @var Defaults | \PHPUnit_Framework_MockObject_MockObject */
private $defaults;
- /** @var IUser | PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUser | \PHPUnit_Framework_MockObject_MockObject */
private $user;
- /** @var IURLGenerator | PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
@@ -209,7 +211,7 @@ class MailNotificationsTest extends \Test\TestCase {
public function testSendInternalShareMail() {
$this->setupMailerMock('TestUser shared »welcome.txt« with you', ['recipient@owncloud.com' => 'Recipient'], false);
- /** @var MailNotifications | PHPUnit_Framework_MockObject_MockObject $mailNotifications */
+ /** @var MailNotifications | \PHPUnit_Framework_MockObject_MockObject $mailNotifications */
$mailNotifications = $this->getMock('OC\Share\MailNotifications',['getItemSharedWithUser'], [
$this->user,
$this->l10n,
@@ -286,7 +288,7 @@ class MailNotificationsTest extends \Test\TestCase {
->expects($this->once())
->method('send')
->with($message)
- ->will($this->throwException(new Exception('Some Exception Message')));
+ ->will($this->throwException(new \Exception('Some Exception Message')));
}
}
}
diff --git a/tests/lib/share/backend.php b/tests/lib/share/backend.php
index 9c0d7fcb020..c5007d1583b 100644
--- a/tests/lib/share/backend.php
+++ b/tests/lib/share/backend.php
@@ -19,7 +19,9 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Share_Backend implements OCP\Share_Backend {
+namespace Test\Share;
+
+class Backend implements \OCP\Share_Backend {
const FORMAT_SOURCE = 0;
const FORMAT_TARGET = 1;
diff --git a/tests/lib/share/helper.php b/tests/lib/share/helper.php
index eaa29c8cb90..3fe6389c408 100644
--- a/tests/lib/share/helper.php
+++ b/tests/lib/share/helper.php
@@ -19,11 +19,13 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace Test\Share;
+
/**
* @group DB
- * Class Test_Share_Helper
+ * Class Helper
*/
-class Test_Share_Helper extends \Test\TestCase {
+class Helper extends \Test\TestCase {
public function expireDateProvider() {
return array(
diff --git a/tests/lib/share/searchresultsorter.php b/tests/lib/share/searchresultsorter.php
index d91110f7a9a..6bee5dfe7f0 100644
--- a/tests/lib/share/searchresultsorter.php
+++ b/tests/lib/share/searchresultsorter.php
@@ -19,7 +19,9 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-class Test_Share_Search extends \Test\TestCase {
+namespace Test\Share;
+
+class SearchResultSorter extends \Test\TestCase {
public function testSort() {
$search = 'lin';
$sorter = new \OC\Share\SearchResultSorter($search, 'foobar');
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index a07e90effc3..355005bb586 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -19,12 +19,14 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace Test\Share;
+
/**
* Class Test_Share
*
* @group DB
*/
-class Test_Share extends \Test\TestCase {
+class Share extends \Test\TestCase {
protected $itemType;
protected $userBackend;
@@ -45,8 +47,8 @@ class Test_Share extends \Test\TestCase {
protected function setUp() {
parent::setUp();
- OC_User::clearBackends();
- OC_User::useBackend('dummy');
+ \OC_User::clearBackends();
+ \OC_User::useBackend('dummy');
$this->user1 = $this->getUniqueID('user1_');
$this->user2 = $this->getUniqueID('user2_');
$this->user3 = $this->getUniqueID('user3_');
@@ -61,24 +63,24 @@ class Test_Share extends \Test\TestCase {
\OC::$server->getUserManager()->createUser($this->user5, 'pass');
\OC::$server->getUserManager()->createUser($this->user6, 'pass'); // no group
\OC::$server->getUserManager()->createUser($this->groupAndUser, 'pass');
- OC_User::setUserId($this->user1);
- OC_Group::clearBackends();
- OC_Group::useBackend(new \Test\Util\Group\Dummy());
+ \OC_User::setUserId($this->user1);
+ \OC_Group::clearBackends();
+ \OC_Group::useBackend(new \Test\Util\Group\Dummy());
$this->group1 = $this->getUniqueID('group1_');
$this->group2 = $this->getUniqueID('group2_');
- OC_Group::createGroup($this->group1);
- OC_Group::createGroup($this->group2);
- OC_Group::createGroup($this->groupAndUser);
- OC_Group::addToGroup($this->user1, $this->group1);
- OC_Group::addToGroup($this->user2, $this->group1);
- OC_Group::addToGroup($this->user3, $this->group1);
- OC_Group::addToGroup($this->user2, $this->group2);
- OC_Group::addToGroup($this->user4, $this->group2);
- OC_Group::addToGroup($this->user2, $this->groupAndUser);
- OC_Group::addToGroup($this->user3, $this->groupAndUser);
- OCP\Share::registerBackend('test', 'Test_Share_Backend');
- OC_Hook::clear('OCP\\Share');
- OC::registerShareHooks();
+ \OC_Group::createGroup($this->group1);
+ \OC_Group::createGroup($this->group2);
+ \OC_Group::createGroup($this->groupAndUser);
+ \OC_Group::addToGroup($this->user1, $this->group1);
+ \OC_Group::addToGroup($this->user2, $this->group1);
+ \OC_Group::addToGroup($this->user3, $this->group1);
+ \OC_Group::addToGroup($this->user2, $this->group2);
+ \OC_Group::addToGroup($this->user4, $this->group2);
+ \OC_Group::addToGroup($this->user2, $this->groupAndUser);
+ \OC_Group::addToGroup($this->user3, $this->groupAndUser);
+ \OCP\Share::registerBackend('test', 'Test\Share\Backend');
+ \OC_Hook::clear('OCP\\Share');
+ \OC::registerShareHooks();
$this->resharing = \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_resharing', 'yes');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', 'yes');
@@ -90,7 +92,7 @@ class Test_Share extends \Test\TestCase {
}
protected function tearDown() {
- $query = OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?');
+ $query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `item_type` = ?');
$query->execute(array('test'));
\OC::$server->getAppConfig()->setValue('core', 'shareapi_allow_resharing', $this->resharing);
@@ -109,9 +111,9 @@ class Test_Share extends \Test\TestCase {
$user = \OC::$server->getUserManager()->get($this->groupAndUser);
if ($user !== null) { $user->delete(); }
- OC_Group::deleteGroup($this->group1);
- OC_Group::deleteGroup($this->group2);
- OC_Group::deleteGroup($this->groupAndUser);
+ \OC_Group::deleteGroup($this->group1);
+ \OC_Group::deleteGroup($this->group2);
+ \OC_Group::deleteGroup($this->groupAndUser);
$this->logout();
parent::tearDown();
@@ -126,8 +128,8 @@ class Test_Share extends \Test\TestCase {
public function testShareInvalidShareType() {
$message = 'Share type foobar is not valid for test.txt';
try {
- OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, \OCP\Constants::PERMISSION_READ);
- } catch (Exception $exception) {
+ \OCP\Share::shareItem('test', 'test.txt', 'foobar', $this->user2, \OCP\Constants::PERMISSION_READ);
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
}
@@ -135,72 +137,72 @@ class Test_Share extends \Test\TestCase {
public function testInvalidItemType() {
$message = 'Sharing backend for foobar not found';
try {
- OCP\Share::shareItem('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('foobar', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::getItemsSharedWith('foobar');
+ \OCP\Share::getItemsSharedWith('foobar');
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::getItemSharedWith('foobar', 'test.txt');
+ \OCP\Share::getItemSharedWith('foobar', 'test.txt');
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::getItemSharedWithBySource('foobar', 'test.txt');
+ \OCP\Share::getItemSharedWithBySource('foobar', 'test.txt');
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::getItemShared('foobar', 'test.txt');
+ \OCP\Share::getItemShared('foobar', 'test.txt');
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::unshare('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2);
+ \OCP\Share::unshare('foobar', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
try {
- OCP\Share::setPermissions('foobar', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_UPDATE);
+ \OCP\Share::setPermissions('foobar', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_UPDATE);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
}
protected function shareUserOneTestFileWithUserTwo() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared text.txt with user 2.'
);
$this->assertContains(
'test.txt',
- OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that test.txt is a shared file of user 1.'
);
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$this->assertContains(
'test.txt',
- OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that user 2 has access to test.txt after initial sharing.'
);
}
protected function shareUserTestFileAsLink() {
- OC_User::setUserId($this->user1);
- $result = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
+ \OC_User::setUserId($this->user1);
+ $result = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertTrue(is_string($result));
}
@@ -209,21 +211,21 @@ class Test_Share extends \Test\TestCase {
* @param string $receiver
*/
protected function shareUserTestFileWithUser($sharer, $receiver) {
- OC_User::setUserId($sharer);
+ \OC_User::setUserId($sharer);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $receiver, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE),
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $receiver, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE),
'Failed asserting that ' . $sharer . ' successfully shared text.txt with ' . $receiver . '.'
);
$this->assertContains(
'test.txt',
- OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that test.txt is a shared file of ' . $sharer . '.'
);
- OC_User::setUserId($receiver);
+ \OC_User::setUserId($receiver);
$this->assertContains(
'test.txt',
- OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that ' . $receiver . ' has access to test.txt after initial sharing.'
);
}
@@ -232,23 +234,23 @@ class Test_Share extends \Test\TestCase {
// Invalid shares
$message = 'Sharing test.txt failed, because you can not share with yourself';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
$message = 'Sharing test.txt failed, because the user foobar does not exist';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, 'foobar', \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, 'foobar', \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
$message = 'Sharing foobar failed, because the sharing backend for test could not find its source';
try {
- OCP\Share::shareItem('test', 'foobar', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'foobar', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
@@ -256,140 +258,140 @@ class Test_Share extends \Test\TestCase {
$this->shareUserOneTestFileWithUserTwo();
// Attempt to share again
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$message = 'Sharing test.txt failed, because this item is already shared with '.$this->user2;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Attempt to share back
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$message = 'Sharing failed, because the user '.$this->user1.' is the original sharer';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Unshare
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2));
// Attempt reshare without share permission
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user2);
+ $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because resharing is not allowed';
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Owner grants share and update permission
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_SHARE));
// Attempt reshare with escalated permissions
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$message = 'Sharing test.txt failed, because the permissions exceed permissions granted to '.$this->user2;
try {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Valid reshare
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE));
- $this->assertEquals(array('test.txt'), OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
- OC_User::setUserId($this->user3);
- $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE));
- $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE));
+ $this->assertEquals(array('test.txt'), \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE));
+ \OC_User::setUserId($this->user3);
+ $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE));
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_UPDATE), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
// Attempt to escalate permissions
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$message = 'Setting permissions for test.txt failed, because the permissions exceed permissions granted to '.$this->user2;
try {
- OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
+ \OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE);
$this->fail('Exception was expected: '.$message);
- } catch (Exception $exception) {
+ } catch (\Exception $exception) {
$this->assertEquals($message, $exception->getMessage());
}
// Remove update permission
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
- OC_User::setUserId($this->user2);
- $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
- OC_User::setUserId($this->user3);
- $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
+ \OC_User::setUserId($this->user2);
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
+ \OC_User::setUserId($this->user3);
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
// Remove share permission
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user2);
- $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_PERMISSIONS));
- OC_User::setUserId($this->user3);
- $this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt'));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user2);
+ $this->assertEquals(array(\OCP\Constants::PERMISSION_READ), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_PERMISSIONS));
+ \OC_User::setUserId($this->user3);
+ $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt'));
// Reshare again, and then have owner unshare
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::setPermissions('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
- OC_User::setUserId($this->user2);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::unshare('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2));
- OC_User::setUserId($this->user2);
- $this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt'));
- OC_User::setUserId($this->user3);
- $this->assertSame(array(), OCP\Share::getItemSharedWith('test', 'test.txt'));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::setPermissions('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_SHARE));
+ \OC_User::setUserId($this->user2);
+ $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2));
+ \OC_User::setUserId($this->user2);
+ $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt'));
+ \OC_User::setUserId($this->user3);
+ $this->assertSame(array(), \OCP\Share::getItemSharedWith('test', 'test.txt'));
// Attempt target conflict
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user3);
- $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user3);
+ $this->assertTrue(\OCP\Share::shareItem('test', 'share.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user2);
- $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
+ \OC_User::setUserId($this->user2);
+ $to_test = \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET);
$this->assertEquals(2, count($to_test));
$this->assertTrue(in_array('test.txt', $to_test));
$this->assertTrue(in_array('test1.txt', $to_test));
// Unshare from self
- $this->assertTrue(OCP\Share::unshareFromSelf('test', 'test.txt'));
- $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
+ $this->assertTrue(\OCP\Share::unshareFromSelf('test', 'test.txt'));
+ $this->assertEquals(array('test1.txt'), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET));
// Unshare from self via source
- $this->assertTrue(OCP\Share::unshareFromSelf('test', 'share.txt', true));
- $this->assertEquals(array(), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
+ $this->assertTrue(\OCP\Share::unshareFromSelf('test', 'share.txt', true));
+ $this->assertEquals(array(), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET));
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user3);
- $this->assertTrue(OCP\Share::shareItem('test', 'share.txt', OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
+ \OC_User::setUserId($this->user3);
+ $this->assertTrue(\OCP\Share::shareItem('test', 'share.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ));
- OC_User::setUserId($this->user2);
- $to_test = OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET);
+ \OC_User::setUserId($this->user2);
+ $to_test = \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET);
$this->assertEquals(2, count($to_test));
$this->assertTrue(in_array('test.txt', $to_test));
$this->assertTrue(in_array('test1.txt', $to_test));
// Remove user
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$user = \OC::$server->getUserManager()->get($this->user1);
if ($user !== null) { $user->delete(); }
- OC_User::setUserId($this->user2);
- $this->assertEquals(array('test1.txt'), OCP\Share::getItemsSharedWith('test', Test_Share_Backend::FORMAT_TARGET));
+ \OC_User::setUserId($this->user2);
+ $this->assertEquals(array('test1.txt'), \OCP\Share::getItemsSharedWith('test', Backend::FORMAT_TARGET));
}
public function testShareWithUserExpirationExpired() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->shareUserOneTestFileWithUserTwo();
$this->shareUserTestFileAsLink();
@@ -402,14 +404,14 @@ class Test_Share extends \Test\TestCase {
$query->bindValue(5, \OCP\Share::SHARE_TYPE_LINK);
$query->execute();
- $shares = OCP\Share::getItemsShared('test');
+ $shares = \OCP\Share::getItemsShared('test');
$this->assertSame(1, count($shares));
$share = reset($shares);
$this->assertSame(\OCP\Share::SHARE_TYPE_USER, $share['share_type']);
}
public function testGetShareFromOutsideFilesFolder() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$view = new \OC\Files\View('/' . $this->user1 . '/');
$view->mkdir('files/test');
$view->mkdir('files/test/sub');
@@ -422,41 +424,41 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared "test/sub" with user 2.'
);
- $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE);
+ $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE);
$this->assertNotEmpty($result);
- $result = OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2);
+ $result = \OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2);
$this->assertNotEmpty($result);
- $result = OCP\Share::getItemsSharedWithUser('folder', $this->user2);
+ $result = \OCP\Share::getItemsSharedWithUser('folder', $this->user2);
$this->assertNotEmpty($result);
// move to trash (keeps file id)
$view->rename('files/test', 'files_trashbin/files/test');
- $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE);
+ $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE);
$this->assertEmpty($result, 'Share must not be returned for files outside of "files"');
- $result = OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2);
+ $result = \OCP\Share::getItemSharedWithUser('folder', $fileId, $this->user2);
$this->assertEmpty($result, 'Share must not be returned for files outside of "files"');
- $result = OCP\Share::getItemsSharedWithUser('folder', $this->user2);
+ $result = \OCP\Share::getItemsSharedWithUser('folder', $this->user2);
$this->assertEmpty($result, 'Share must not be returned for files outside of "files"');
}
public function testSetExpireDateInPast() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->shareUserOneTestFileWithUserTwo();
$this->shareUserTestFileAsLink();
$setExpireDateFailed = false;
try {
$this->assertTrue(
- OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInPast, ''),
+ \OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInPast, ''),
'Failed asserting that user 1 successfully set an expiration date for the test.txt share.'
);
} catch (\Exception $e) {
@@ -467,17 +469,17 @@ class Test_Share extends \Test\TestCase {
}
public function testShareWithUserExpirationValid() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->shareUserOneTestFileWithUserTwo();
$this->shareUserTestFileAsLink();
$this->assertTrue(
- OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''),
+ \OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''),
'Failed asserting that user 1 successfully set an expiration date for the test.txt share.'
);
- $shares = OCP\Share::getItemsShared('test');
+ $shares = \OCP\Share::getItemsShared('test');
$this->assertSame(2, count($shares));
}
@@ -488,14 +490,14 @@ class Test_Share extends \Test\TestCase {
*/
public function testShareWithUserAndUserIsExcludedFromResharing() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL),
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared text.txt with user 4.'
);
$this->assertContains(
'test.txt',
- OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that test.txt is a shared file of user 1.'
);
@@ -503,9 +505,9 @@ class Test_Share extends \Test\TestCase {
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups_list', $this->group2);
\OC::$server->getAppConfig()->setValue('core', 'shareapi_exclude_groups', "yes");
- OC_User::setUserId($this->user4);
+ \OC_User::setUserId($this->user4);
- $share = OCP\Share::getItemSharedWith('test', 'test.txt');
+ $share = \OCP\Share::getItemSharedWith('test', 'test.txt');
$this->assertSame(\OCP\Constants::PERMISSION_ALL & ~\OCP\Constants::PERMISSION_SHARE, $share['permissions'],
'Failed asserting that user 4 is excluded from re-sharing');
@@ -516,7 +518,7 @@ class Test_Share extends \Test\TestCase {
}
public function testSharingAFolderThatIsSharedWithAGroupOfTheOwner() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$view = new \OC\Files\View('/' . $this->user1 . '/');
$view->mkdir('files/test');
$view->mkdir('files/test/sub1');
@@ -527,11 +529,11 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE),
'Failed asserting that user 1 successfully shared "test/sub1" with group 1.'
);
- $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE);
+ $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE);
$this->assertNotEmpty($result);
$this->assertEquals(\OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_CREATE, $result['permissions']);
@@ -540,17 +542,17 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared "test/sub1/sub2" with user 4.'
);
- $result = OCP\Share::getItemShared('folder', $fileId, Test_Share_Backend::FORMAT_SOURCE);
+ $result = \OCP\Share::getItemShared('folder', $fileId, Backend::FORMAT_SOURCE);
$this->assertNotEmpty($result);
$this->assertEquals(\OCP\Constants::PERMISSION_READ, $result['permissions']);
}
public function testSharingAFileInsideAFolderThatIsAlreadyShared() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$view = new \OC\Files\View('/' . $this->user1 . '/');
$view->mkdir('files/test');
$view->mkdir('files/test/sub1');
@@ -565,12 +567,12 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $folderId, OCP\Share::SHARE_TYPE_GROUP, $this->group2, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_UPDATE),
+ \OCP\Share::shareItem('folder', $folderId, \OCP\Share::SHARE_TYPE_GROUP, $this->group2, \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_UPDATE),
'Failed asserting that user 1 successfully shared "test/sub1" with group 2.'
);
$this->assertTrue(
- OCP\Share::shareItem('file', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
+ \OCP\Share::shareItem('file', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared "test/sub1/file.txt" with user 2.'
);
@@ -585,28 +587,28 @@ class Test_Share extends \Test\TestCase {
}
protected function shareUserOneTestFileWithGroupOne() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ),
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared text.txt with group 1.'
);
$this->assertContains(
'test.txt',
- OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemShared('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that test.txt is a shared file of user 1.'
);
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$this->assertContains(
'test.txt',
- OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that user 2 has access to test.txt after initial sharing.'
);
- OC_User::setUserId($this->user3);
+ \OC_User::setUserId($this->user3);
$this->assertContains(
'test.txt',
- OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'Failed asserting that user 3 has access to test.txt after initial sharing.'
);
}
@@ -616,11 +618,11 @@ class Test_Share extends \Test\TestCase {
* child entries
*/
public function testShareWithGroupThenUnshare() {
- OC_User::setUserId($this->user5);
- OCP\Share::shareItem(
+ \OC_User::setUserId($this->user5);
+ \OCP\Share::shareItem(
'test',
'test.txt',
- OCP\Share::SHARE_TYPE_GROUP,
+ \OCP\Share::SHARE_TYPE_GROUP,
$this->group1,
\OCP\Constants::PERMISSION_ALL
);
@@ -628,30 +630,30 @@ class Test_Share extends \Test\TestCase {
$targetUsers = array($this->user1, $this->user2, $this->user3);
foreach($targetUsers as $targetUser) {
- OC_User::setUserId($targetUser);
- $items = OCP\Share::getItemsSharedWithUser(
+ \OC_User::setUserId($targetUser);
+ $items = \OCP\Share::getItemsSharedWithUser(
'test',
$targetUser,
- Test_Share_Backend::FORMAT_TARGET
+ Backend::FORMAT_TARGET
);
$this->assertEquals(1, count($items));
}
- OC_User::setUserId($this->user5);
- OCP\Share::unshare(
+ \OC_User::setUserId($this->user5);
+ \OCP\Share::unshare(
'test',
'test.txt',
- OCP\Share::SHARE_TYPE_GROUP,
+ \OCP\Share::SHARE_TYPE_GROUP,
$this->group1
);
// verify that all were deleted
foreach($targetUsers as $targetUser) {
- OC_User::setUserId($targetUser);
- $items = OCP\Share::getItemsSharedWithUser(
+ \OC_User::setUserId($targetUser);
+ $items = \OCP\Share::getItemsSharedWithUser(
'test',
$targetUser,
- Test_Share_Backend::FORMAT_TARGET
+ Backend::FORMAT_TARGET
);
$this->assertEquals(0, count($items));
}
@@ -661,33 +663,33 @@ class Test_Share extends \Test\TestCase {
$this->shareUserTestFileWithUser($this->user1, $this->groupAndUser);
- OC_User::setUserId($this->groupAndUser);
+ \OC_User::setUserId($this->groupAndUser);
- $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'"groupAndUser"-User does not see the file but it was shared with him');
- OC_User::setUserId($this->user2);
- $this->assertEquals(array(), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OC_User::setUserId($this->user2);
+ $this->assertEquals(array(), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'User2 sees test.txt but it was only shared with the user "groupAndUser" and not with group');
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt'));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::unshareAll('test', 'test.txt'));
$this->assertTrue(
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, \OCP\Constants::PERMISSION_READ),
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->groupAndUser, \OCP\Constants::PERMISSION_READ),
'Failed asserting that user 1 successfully shared text.txt with group 1.'
);
- OC_User::setUserId($this->groupAndUser);
- $this->assertEquals(array(), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OC_User::setUserId($this->groupAndUser);
+ $this->assertEquals(array(), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'"groupAndUser"-User sees test.txt but it was only shared with the group "groupAndUser" and not with the user');
- OC_User::setUserId($this->user2);
- $this->assertEquals(array('test.txt'), OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ \OC_User::setUserId($this->user2);
+ $this->assertEquals(array('test.txt'), \OCP\Share::getItemSharedWith('test', 'test.txt', Backend::FORMAT_SOURCE),
'User2 does not see test.txt but it was shared with the group "groupAndUser"');
- OC_User::setUserId($this->user1);
- $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt'));
+ \OC_User::setUserId($this->user1);
+ $this->assertTrue(\OCP\Share::unshareAll('test', 'test.txt'));
}
@@ -696,7 +698,7 @@ class Test_Share extends \Test\TestCase {
* @return array
*/
protected function getShareByValidToken($token) {
- $row = OCP\Share::getShareByToken($token);
+ $row = \OCP\Share::getShareByToken($token);
$this->assertInternalType(
'array',
$row,
@@ -706,21 +708,21 @@ class Test_Share extends \Test\TestCase {
}
public function testGetItemSharedWithUser() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
//add dummy values to the share table
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` ('
.' `item_type`, `item_source`, `item_target`, `share_type`,'
.' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)');
- $args = array('test', 99, 'target1', OCP\Share::SHARE_TYPE_USER, $this->user2, $this->user1);
+ $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_USER, $this->user2, $this->user1);
$query->execute($args);
- $args = array('test', 99, 'target2', OCP\Share::SHARE_TYPE_USER, $this->user4, $this->user1);
+ $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_USER, $this->user4, $this->user1);
$query->execute($args);
- $args = array('test', 99, 'target3', OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user2);
+ $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user2);
$query->execute($args);
- $args = array('test', 99, 'target4', OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user4);
+ $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user3, $this->user4);
$query->execute($args);
- $args = array('test', 99, 'target4', OCP\Share::SHARE_TYPE_USER, $this->user6, $this->user4);
+ $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_USER, $this->user6, $this->user4);
$query->execute($args);
@@ -746,19 +748,19 @@ class Test_Share extends \Test\TestCase {
}
public function testGetItemSharedWithUserFromGroupShare() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
//add dummy values to the share table
$query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` ('
.' `item_type`, `item_source`, `item_target`, `share_type`,'
.' `share_with`, `uid_owner`) VALUES (?,?,?,?,?,?)');
- $args = array('test', 99, 'target1', OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user1);
+ $args = array('test', 99, 'target1', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user1);
$query->execute($args);
- $args = array('test', 99, 'target2', OCP\Share::SHARE_TYPE_GROUP, $this->group2, $this->user1);
+ $args = array('test', 99, 'target2', \OCP\Share::SHARE_TYPE_GROUP, $this->group2, $this->user1);
$query->execute($args);
- $args = array('test', 99, 'target3', OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user2);
+ $args = array('test', 99, 'target3', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user2);
$query->execute($args);
- $args = array('test', 99, 'target4', OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user4);
+ $args = array('test', 99, 'target4', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, $this->user4);
$query->execute($args);
// user2 is in group1 and group2
@@ -794,7 +796,7 @@ class Test_Share extends \Test\TestCase {
}
public function testGetShareSubItemsWhenUserNotInGroup() {
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_GROUP, $this->group1, \OCP\Constants::PERMISSION_READ);
$result = \OCP\Share::getItemsSharedWithUser('test', $this->user2);
$this->assertCount(1, $result);
@@ -831,8 +833,8 @@ class Test_Share extends \Test\TestCase {
}
public function testShareItemWithLink() {
- OC_User::setUserId($this->user1);
- $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
+ \OC_User::setUserId($this->user1);
+ $token = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
'string',
$token,
@@ -848,7 +850,7 @@ class Test_Share extends \Test\TestCase {
// testGetShareByTokenExpirationValid
$this->assertTrue(
- OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''),
+ \OCP\Share::setExpirationDate('test', 'test.txt', $this->dateInFuture, ''),
'Failed asserting that user 1 successfully set a future expiration date for the test.txt share.'
);
$row = $this->getShareByValidToken($token);
@@ -867,20 +869,20 @@ class Test_Share extends \Test\TestCase {
$query->execute();
$this->assertFalse(
- OCP\Share::getShareByToken($token),
+ \OCP\Share::getShareByToken($token),
'Failed asserting that an expired share could not be found.'
);
}
public function testShareItemWithLinkAndDefaultExpireDate() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$config = \OC::$server->getConfig();
$config->setAppValue('core', 'shareapi_default_expire_date', 'yes');
$config->setAppValue('core', 'shareapi_expire_after_n_days', '2');
- $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
+ $token = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
'string',
$token,
@@ -925,8 +927,8 @@ class Test_Share extends \Test\TestCase {
* @expectedException \OC\HintException
*/
public function testShareWithRemoteUserAndRemoteIsInvalid($remoteId) {
- OC_User::setUserId($this->user1);
- OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_REMOTE, $remoteId, \OCP\Constants::PERMISSION_ALL);
+ \OC_User::setUserId($this->user1);
+ \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $remoteId, \OCP\Constants::PERMISSION_ALL);
}
public function testUnshareAll() {
@@ -935,49 +937,49 @@ class Test_Share extends \Test\TestCase {
$this->shareUserTestFileWithUser($this->user3, $this->user4);
$this->shareUserOneTestFileWithGroupOne();
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->assertEquals(
array('test.txt', 'test.txt'),
- OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemsShared('test', Backend::FORMAT_SOURCE),
'Failed asserting that the test.txt file is shared exactly two times by user1.'
);
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$this->assertEquals(
array('test.txt'),
- OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemsShared('test', Backend::FORMAT_SOURCE),
'Failed asserting that the test.txt file is shared exactly once by user2.'
);
- OC_User::setUserId($this->user3);
+ \OC_User::setUserId($this->user3);
$this->assertEquals(
array('test.txt'),
- OCP\Share::getItemsShared('test', Test_Share_Backend::FORMAT_SOURCE),
+ \OCP\Share::getItemsShared('test', Backend::FORMAT_SOURCE),
'Failed asserting that the test.txt file is shared exactly once by user3.'
);
$this->assertTrue(
- OCP\Share::unshareAll('test', 'test.txt'),
+ \OCP\Share::unshareAll('test', 'test.txt'),
'Failed asserting that user 3 successfully unshared all shares of the test.txt share.'
);
$this->assertEquals(
array(),
- OCP\Share::getItemsShared('test'),
+ \OCP\Share::getItemsShared('test'),
'Failed asserting that the share of the test.txt file by user 3 has been removed.'
);
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$this->assertEquals(
array(),
- OCP\Share::getItemsShared('test'),
+ \OCP\Share::getItemsShared('test'),
'Failed asserting that both shares of the test.txt file by user 1 have been removed.'
);
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
$this->assertEquals(
array(),
- OCP\Share::getItemsShared('test'),
+ \OCP\Share::getItemsShared('test'),
'Failed asserting that the share of the test.txt file by user 2 has been removed.'
);
}
@@ -1154,13 +1156,13 @@ class Test_Share extends \Test\TestCase {
* is enforced by the settings.
*/
public function testClearExpireDateWhileEnforced() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
\OC::$server->getAppConfig()->setValue('core', 'shareapi_default_expire_date', 'yes');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_expire_after_n_days', '2');
\OC::$server->getAppConfig()->setValue('core', 'shareapi_enforce_expire_date', 'yes');
- $token = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
+ $token = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertInternalType(
'string',
$token,
@@ -1170,7 +1172,7 @@ class Test_Share extends \Test\TestCase {
$setExpireDateFailed = false;
try {
$this->assertTrue(
- OCP\Share::setExpirationDate('test', 'test.txt', '', ''),
+ \OCP\Share::setExpirationDate('test', 'test.txt', '', ''),
'Failed asserting that user 1 successfully set an expiration date for the test.txt share.'
);
} catch (\Exception $e) {
@@ -1187,7 +1189,7 @@ class Test_Share extends \Test\TestCase {
/**
* Cannot set password is there is no user
*
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage User not logged in
*/
public function testSetPasswordNoUser() {
@@ -1305,7 +1307,7 @@ class Test_Share extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage Cannot remove password
*
* Test removing a password when password is enforced
@@ -1358,7 +1360,7 @@ class Test_Share extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage Share not found
*
* Test modification of invaid share
@@ -1411,7 +1413,7 @@ class Test_Share extends \Test\TestCase {
}
/**
- * @expectedException Exception
+ * @expectedException \Exception
* @expectedExceptionMessage Cannot update share of a different user
*
* Test modification of share of another user
@@ -1509,7 +1511,7 @@ class Test_Share extends \Test\TestCase {
// Expiration date
$expireAt = time() + 2 * 24*60*60;
- $date = new DateTime();
+ $date = new \DateTime();
$date->setTimestamp($expireAt);
$date->setTime(0, 0, 0);
@@ -1517,20 +1519,20 @@ class Test_Share extends \Test\TestCase {
$this->shareUserTestFileWithUser($this->user1, $this->user2);
//User 2 shares as link
- OC_User::setUserId($this->user2);
- $result = OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
+ \OC_User::setUserId($this->user2);
+ $result = \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_LINK, null, \OCP\Constants::PERMISSION_READ);
$this->assertTrue(is_string($result));
//Check if expire date is correct
- $result = OCP\Share::getItemShared('test', 'test.txt');
+ $result = \OCP\Share::getItemShared('test', 'test.txt');
$this->assertCount(1, $result);
$result = reset($result);
$this->assertNotEmpty($result['expiration']);
- $expireDate = new DateTime($result['expiration']);
+ $expireDate = new \DateTime($result['expiration']);
$this->assertEquals($date, $expireDate);
//Unshare
- $this->assertTrue(OCP\Share::unshareAll('test', 'test.txt'));
+ $this->assertTrue(\OCP\Share::unshareAll('test', 'test.txt'));
//Reset config
$config->deleteAppValue('core', 'shareapi_default_expire_date');
@@ -1541,7 +1543,7 @@ class Test_Share extends \Test\TestCase {
* Test case for #17560
*/
public function testAccesToSharedSubFolder() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$view = new \OC\Files\View('/' . $this->user1 . '/');
$view->mkdir('files/folder1');
@@ -1550,11 +1552,11 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared "test" with user 2.'
);
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_ALL),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user3, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared "test" with user 3.'
);
@@ -1565,28 +1567,28 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user4, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared "test" with user 4.'
);
- $res = OCP\Share::getItemShared(
+ $res = \OCP\Share::getItemShared(
'folder',
$fileId,
- OCP\Share::FORMAT_NONE,
+ \OCP\Share::FORMAT_NONE,
null,
true
);
$this->assertCount(3, $res);
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user5, \OCP\Constants::PERMISSION_ALL),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user5, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared "test" with user 5.'
);
- $res = OCP\Share::getItemShared(
+ $res = \OCP\Share::getItemShared(
'folder',
$fileId,
- OCP\Share::FORMAT_NONE,
+ \OCP\Share::FORMAT_NONE,
null,
true
);
@@ -1594,7 +1596,7 @@ class Test_Share extends \Test\TestCase {
}
public function testShareWithSelfError() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$view = new \OC\Files\View('/' . $this->user1 . '/');
$view->mkdir('files/folder1');
@@ -1603,7 +1605,7 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
try {
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL);
$this->fail();
} catch (\Exception $e) {
$this->assertEquals('Sharing /folder1 failed, because you can not share with yourself', $e->getMessage());
@@ -1612,7 +1614,7 @@ class Test_Share extends \Test\TestCase {
public function testShareWithOwnerError() {
- OC_User::setUserId($this->user1);
+ \OC_User::setUserId($this->user1);
$view = new \OC\Files\View('/' . $this->user1 . '/');
$view->mkdir('files/folder1');
@@ -1621,13 +1623,13 @@ class Test_Share extends \Test\TestCase {
$fileId = $fileInfo->getId();
$this->assertTrue(
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL),
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_ALL),
'Failed asserting that user 1 successfully shared "test" with user 2.'
);
- OC_User::setUserId($this->user2);
+ \OC_User::setUserId($this->user2);
try {
- OCP\Share::shareItem('folder', $fileId, OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL);
+ \OCP\Share::shareItem('folder', $fileId, \OCP\Share::SHARE_TYPE_USER, $this->user1, \OCP\Constants::PERMISSION_ALL);
$this->fail();
} catch (\Exception $e) {
$this->assertEquals('Sharing failed, because the user ' . $this->user1 . ' is the original sharer', $e->getMessage());
diff --git a/tests/lib/updater/versioncheck.php b/tests/lib/updater/VersionCheckTest.php
index 2122ca28800..13851338eef 100644
--- a/tests/lib/updater/versioncheck.php
+++ b/tests/lib/updater/VersionCheckTest.php
@@ -20,7 +20,7 @@
*
*/
-namespace OC;
+namespace Test\Update;
use OC\Updater\VersionCheck;
use OCP\IConfig;
diff --git a/tests/lib/user/avataruserdummy.php b/tests/lib/user/avataruserdummy.php
index 086adb6043f..123825de50f 100644
--- a/tests/lib/user/avataruserdummy.php
+++ b/tests/lib/user/avataruserdummy.php
@@ -20,8 +20,10 @@
*
*/
-class Avatar_User_Dummy extends \Test\Util\User\Dummy {
+namespace Test\User;
+
+class AvatarUserDummy extends \Test\Util\User\Dummy {
public function canChangeAvatar($uid) {
return true;
}
-} \ No newline at end of file
+}
diff --git a/tests/lib/user/backend.php b/tests/lib/user/backend.php
index d5bbbe9f406..85ccbac913c 100644
--- a/tests/lib/user/backend.php
+++ b/tests/lib/user/backend.php
@@ -20,6 +20,8 @@
*
*/
+namespace Test\User;
+
/**
* Abstract class to provide the basis of backend-specific unit test classes.
*
@@ -30,7 +32,7 @@
* For an example see /tests/lib/user/dummy.php
*/
-abstract class Test_User_Backend extends \Test\TestCase {
+abstract class Backend extends \Test\TestCase {
/**
* @var \OC\User\Backend $backend
*/
diff --git a/tests/lib/user/database.php b/tests/lib/user/database.php
index 0dea037ad78..76d6226a7fd 100644
--- a/tests/lib/user/database.php
+++ b/tests/lib/user/database.php
@@ -20,12 +20,14 @@
*
*/
+namespace Test\User;
+
/**
* Class Test_User_Database
*
* @group DB
*/
-class Test_User_Database extends Test_User_Backend {
+class Database extends Backend {
/** @var array */
private $users;
diff --git a/tests/lib/user/dummy.php b/tests/lib/user/dummy.php
index c6c79d7a860..50382aa8fe6 100644
--- a/tests/lib/user/dummy.php
+++ b/tests/lib/user/dummy.php
@@ -20,7 +20,9 @@
*
*/
-class Test_User_Dummy extends Test_User_Backend {
+namespace Test\User;
+
+class Dummy extends Backend {
protected function setUp() {
parent::setUp();
$this->backend=new \Test\Util\User\Dummy();
diff --git a/tests/lib/user/session.php b/tests/lib/user/session.php
index 710d5ae20b3..444735b854f 100644
--- a/tests/lib/user/session.php
+++ b/tests/lib/user/session.php
@@ -477,4 +477,36 @@ class Session extends \Test\TestCase {
$this->assertEquals($users['bar'], $userSession->getUser());
}
+ public function testTryTokenLoginWithDisabledUser() {
+ $manager = $this->getMockBuilder('\OC\User\Manager')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $session = new Memory('');
+ $token = $this->getMock('\OC\Authentication\Token\IToken');
+ $user = $this->getMock('\OCP\IUser');
+ $userSession = new \OC\User\Session($manager, $session, $this->timeFactory, $this->defaultProvider);
+ $request = $this->getMock('\OCP\IRequest');
+
+ $request->expects($this->once())
+ ->method('getHeader')
+ ->with('Authorization')
+ ->will($this->returnValue('token xxxxx'));
+ $this->defaultProvider->expects($this->once())
+ ->method('validateToken')
+ ->with('xxxxx')
+ ->will($this->returnValue($token));
+ $token->expects($this->once())
+ ->method('getUID')
+ ->will($this->returnValue('user123'));
+ $manager->expects($this->once())
+ ->method('get')
+ ->with('user123')
+ ->will($this->returnValue($user));
+ $user->expects($this->once())
+ ->method('isEnabled')
+ ->will($this->returnValue(false));
+
+ $this->assertFalse($userSession->tryTokenLogin($request));
+ }
+
}
diff --git a/tests/lib/user/user.php b/tests/lib/user/user.php
index 0a972f7bdaa..71be3691003 100644
--- a/tests/lib/user/user.php
+++ b/tests/lib/user/user.php
@@ -121,7 +121,7 @@ class User extends \Test\TestCase {
* @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
*/
require_once 'avataruserdummy.php';
- $backend = $this->getMock('Avatar_User_Dummy');
+ $backend = $this->getMock('Test\User\AvatarUserDummy');
$backend->expects($this->once())
->method('canChangeAvatar')
->with($this->equalTo('foo'))
@@ -146,7 +146,7 @@ class User extends \Test\TestCase {
* @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
*/
require_once 'avataruserdummy.php';
- $backend = $this->getMock('Avatar_User_Dummy');
+ $backend = $this->getMock('Test\User\AvatarUserDummy');
$backend->expects($this->once())
->method('canChangeAvatar')
->with($this->equalTo('foo'))
@@ -171,7 +171,7 @@ class User extends \Test\TestCase {
* @var \OC\User\Backend | \PHPUnit_Framework_MockObject_MockObject $backend
*/
require_once 'avataruserdummy.php';
- $backend = $this->getMock('Avatar_User_Dummy');
+ $backend = $this->getMock('Test\User\AvatarUserDummy');
$backend->expects($this->never())
->method('canChangeAvatar');