aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-09-16 15:13:29 +0200
committerGitHub <noreply@github.com>2024-09-16 15:13:29 +0200
commit13088b745a7b3cd0d81aae63c0c1ff9028cafbf6 (patch)
treebdd5a6afa92350a2b0586db66c637ae5188731d0 /tests
parent34a9e48827b3a03da48699d32c6138c2c89c139f (diff)
parentcfed24cb0254caf570b2a520979a83435a677cc8 (diff)
downloadnextcloud-server-13088b745a7b3cd0d81aae63c0c1ff9028cafbf6.tar.gz
nextcloud-server-13088b745a7b3cd0d81aae63c0c1ff9028cafbf6.zip
Merge branch 'master' into fix-nc-env-inclusionfix-nc-env-inclusion
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Command/Config/App/DeleteConfigTest.php2
-rw-r--r--tests/Core/Command/Config/App/GetConfigTest.php8
-rw-r--r--tests/Core/Command/Config/App/SetConfigTest.php16
-rw-r--r--tests/Core/Command/Config/ImportTest.php12
-rw-r--r--tests/Core/Command/Config/ListConfigsTest.php2
-rw-r--r--tests/Core/Command/Config/System/DeleteConfigTest.php4
-rw-r--r--tests/Core/Command/Config/System/GetConfigTest.php2
-rw-r--r--tests/Core/Command/Config/System/SetConfigTest.php8
-rw-r--r--tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php24
-rw-r--r--tests/Core/Command/Encryption/DecryptAllTest.php12
-rw-r--r--tests/Core/Command/Encryption/DisableTest.php2
-rw-r--r--tests/Core/Command/Encryption/EnableTest.php2
-rw-r--r--tests/Core/Command/Encryption/EncryptAllTest.php14
-rw-r--r--tests/Core/Command/Encryption/SetDefaultModuleTest.php4
-rw-r--r--tests/Core/Command/Group/AddTest.php4
-rw-r--r--tests/Core/Command/Group/AddUserTest.php6
-rw-r--r--tests/Core/Command/Group/DeleteTest.php8
-rw-r--r--tests/Core/Command/Group/InfoTest.php4
-rw-r--r--tests/Core/Command/Group/ListCommandTest.php70
-rw-r--r--tests/Core/Command/Group/RemoveUserTest.php6
-rw-r--r--tests/Core/Command/Log/FileTest.php8
-rw-r--r--tests/Core/Command/Log/ManageTest.php20
-rw-r--r--tests/Core/Command/Maintenance/DataFingerprintTest.php2
-rw-r--r--tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php8
-rw-r--r--tests/Core/Command/Maintenance/ModeTest.php4
-rw-r--r--tests/Core/Command/Maintenance/UpdateTheme.php2
-rw-r--r--tests/Core/Command/Preview/RepairTest.php4
-rw-r--r--tests/Core/Command/SystemTag/AddTest.php4
-rw-r--r--tests/Core/Command/SystemTag/DeleteTest.php4
-rw-r--r--tests/Core/Command/SystemTag/EditTest.php10
-rw-r--r--tests/Core/Command/SystemTag/ListCommandTest.php2
-rw-r--r--tests/Core/Command/TwoFactorAuth/CleanupTest.php4
-rw-r--r--tests/Core/Command/TwoFactorAuth/DisableTest.php12
-rw-r--r--tests/Core/Command/TwoFactorAuth/EnableTest.php12
-rw-r--r--tests/Core/Command/TwoFactorAuth/EnforceTest.php24
-rw-r--r--tests/Core/Command/TwoFactorAuth/StateTest.php12
-rw-r--r--tests/Core/Command/User/AuthTokens/DeleteTest.php12
-rw-r--r--tests/Core/Command/User/DeleteTest.php4
-rw-r--r--tests/Core/Command/User/DisableTest.php4
-rw-r--r--tests/Core/Command/User/EnableTest.php4
-rw-r--r--tests/Core/Command/User/LastSeenTest.php4
-rw-r--r--tests/Core/Command/User/SettingTest.php12
-rw-r--r--tests/Core/Controller/AppPasswordControllerTest.php14
-rw-r--r--tests/Core/Controller/AutoCompleteControllerTest.php10
-rw-r--r--tests/Core/Controller/AvatarControllerTest.php60
-rw-r--r--tests/Core/Controller/ChangePasswordControllerTest.php10
-rw-r--r--tests/Core/Controller/ClientFlowLoginControllerTest.php20
-rw-r--r--tests/Core/Controller/ClientFlowLoginV2ControllerTest.php26
-rw-r--r--tests/Core/Controller/ContactsMenuControllerTest.php6
-rw-r--r--tests/Core/Controller/CssControllerTest.php10
-rw-r--r--tests/Core/Controller/GuestAvatarControllerTest.php2
-rw-r--r--tests/Core/Controller/JsControllerTest.php10
-rw-r--r--tests/Core/Controller/LoginControllerTest.php25
-rw-r--r--tests/Core/Controller/LostControllerTest.php84
-rw-r--r--tests/Core/Controller/NavigationControllerTest.php8
-rw-r--r--tests/Core/Controller/OCSControllerTest.php14
-rw-r--r--tests/Core/Controller/PreviewControllerTest.php19
-rw-r--r--tests/Core/Controller/TwoFactorChallengeControllerTest.php20
-rw-r--r--tests/Core/Controller/UserControllerTest.php2
-rw-r--r--tests/Core/Controller/WellKnownControllerTest.php6
-rw-r--r--tests/Core/Controller/WipeControllerTest.php4
-rw-r--r--tests/Core/Data/LoginFlowV2CredentialsTest.php6
-rw-r--r--tests/Core/Middleware/TwoFactorMiddlewareTest.php18
-rw-r--r--tests/Core/Service/LoginFlowV2ServiceUnitTest.php26
-rw-r--r--tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php12
-rw-r--r--tests/Test/Repair/Owncloud/CleanPreviewsTest.php6
-rw-r--r--tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php16
-rw-r--r--tests/apps.php13
-rw-r--r--tests/data/app/expected-info.json5
-rw-r--r--tests/data/app/navigation-one-item.json5
-rw-r--r--tests/data/app/navigation-two-items.json5
-rw-r--r--tests/data/app/valid-info.xml1
-rw-r--r--tests/data/emails/new-account-email-custom.html18
-rw-r--r--tests/data/emails/new-account-email-single-button.html10
-rw-r--r--tests/data/emails/new-account-email.html18
-rw-r--r--tests/lib/APITest.php84
-rw-r--r--tests/lib/Accounts/AccountManagerTest.php10
-rw-r--r--tests/lib/Accounts/AccountPropertyCollectionTest.php16
-rw-r--r--tests/lib/Accounts/AccountPropertyTest.php14
-rw-r--r--tests/lib/Accounts/AccountTest.php12
-rw-r--r--tests/lib/Accounts/HooksTest.php2
-rw-r--r--tests/lib/Activity/ManagerTest.php20
-rw-r--r--tests/lib/AllConfigTest.php68
-rw-r--r--tests/lib/App/AppManagerTest.php211
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleBase.php6
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleFetcherTest.php6
-rw-r--r--tests/lib/App/AppStore/Bundles/EducationBundleTest.php3
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php6
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php10
-rw-r--r--tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php4
-rw-r--r--tests/lib/App/AppStore/Fetcher/FetcherBase.php18
-rw-r--r--tests/lib/App/AppStore/Version/VersionParserTest.php6
-rw-r--r--tests/lib/App/AppStore/Version/VersionTest.php4
-rw-r--r--tests/lib/App/CompareVersionTest.php6
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php14
-rw-r--r--tests/lib/App/InfoParserTest.php4
-rw-r--r--tests/lib/App/PlatformRepositoryTest.php2
-rw-r--r--tests/lib/AppConfigTest.php20
-rw-r--r--tests/lib/AppFramework/AppTest.php20
-rw-r--r--tests/lib/AppFramework/Bootstrap/CoordinatorTest.php2
-rw-r--r--tests/lib/AppFramework/Controller/ApiControllerTest.php2
-rw-r--r--tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php8
-rw-r--r--tests/lib/AppFramework/Controller/ControllerTest.php18
-rw-r--r--tests/lib/AppFramework/Controller/OCSControllerTest.php10
-rw-r--r--tests/lib/AppFramework/Controller/PublicShareControllerTest.php4
-rw-r--r--tests/lib/AppFramework/Db/EntityTest.php55
-rw-r--r--tests/lib/AppFramework/Db/QBMapperTest.php10
-rw-r--r--tests/lib/AppFramework/DependencyInjection/DIContainerTest.php12
-rw-r--r--tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php8
-rw-r--r--tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php366
-rw-r--r--tests/lib/AppFramework/Http/DataResponseTest.php8
-rw-r--r--tests/lib/AppFramework/Http/DispatcherTest.php32
-rw-r--r--tests/lib/AppFramework/Http/DownloadResponseTest.php4
-rw-r--r--tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php371
-rw-r--r--tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php26
-rw-r--r--tests/lib/AppFramework/Http/FeaturePolicyTest.php26
-rw-r--r--tests/lib/AppFramework/Http/FileDisplayResponseTest.php10
-rw-r--r--tests/lib/AppFramework/Http/HttpTest.php6
-rw-r--r--tests/lib/AppFramework/Http/JSONResponseTest.php14
-rw-r--r--tests/lib/AppFramework/Http/OutputTest.php6
-rw-r--r--tests/lib/AppFramework/Http/PublicTemplateResponseTest.php12
-rw-r--r--tests/lib/AppFramework/Http/RedirectResponseTest.php4
-rw-r--r--tests/lib/AppFramework/Http/RequestStream.php4
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php158
-rw-r--r--tests/lib/AppFramework/Http/ResponseTest.php42
-rw-r--r--tests/lib/AppFramework/Http/StreamResponseTest.php8
-rw-r--r--tests/lib/AppFramework/Http/TemplateResponseTest.php12
-rw-r--r--tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php10
-rw-r--r--tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php10
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php34
-rw-r--r--tests/lib/AppFramework/Middleware/MiddlewareTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php2
-rw-r--r--tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php8
-rw-r--r--tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php30
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php33
-rw-r--r--tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php30
-rw-r--r--tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php4
-rw-r--r--tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php14
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php12
-rw-r--r--tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php35
-rw-r--r--tests/lib/AppFramework/OCS/BaseResponseTest.php2
-rw-r--r--tests/lib/AppFramework/OCS/V2ResponseTest.php38
-rw-r--r--tests/lib/AppFramework/Routing/RoutingTest.php42
-rw-r--r--tests/lib/AppFramework/Services/AppConfigTest.php186
-rw-r--r--tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php34
-rw-r--r--tests/lib/AppFramework/Utility/SimpleContainerTest.php32
-rw-r--r--tests/lib/AppTest.php26
-rw-r--r--tests/lib/Archive/TestBase.php18
-rw-r--r--tests/lib/Authentication/Events/RemoteWipeFinishedTest.php2
-rw-r--r--tests/lib/Authentication/Events/RemoteWipeStartedTest.php2
-rw-r--r--tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php8
-rw-r--r--tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php18
-rw-r--r--tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php6
-rw-r--r--tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php2
-rw-r--r--tests/lib/Authentication/Login/CompleteLoginCommandTest.php2
-rw-r--r--tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php4
-rw-r--r--tests/lib/Authentication/Login/EmailLoginCommandTest.php12
-rw-r--r--tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php6
-rw-r--r--tests/lib/Authentication/Login/LoggedInCheckCommandTest.php4
-rw-r--r--tests/lib/Authentication/Login/PreLoginHookCommandTest.php2
-rw-r--r--tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php4
-rw-r--r--tests/lib/Authentication/Login/TwoFactorCommandTest.php16
-rw-r--r--tests/lib/Authentication/Login/UidLoginCommandTest.php4
-rw-r--r--tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php2
-rw-r--r--tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php6
-rw-r--r--tests/lib/Authentication/LoginCredentials/CredentialsTest.php6
-rw-r--r--tests/lib/Authentication/LoginCredentials/StoreTest.php20
-rw-r--r--tests/lib/Authentication/Token/ManagerTest.php50
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php30
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php71
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenTest.php4
-rw-r--r--tests/lib/Authentication/Token/RemoteWipeTest.php6
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php12
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php8
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php44
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php18
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php6
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php12
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php10
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/RegistryTest.php10
-rw-r--r--tests/lib/AutoLoaderTest.php14
-rw-r--r--tests/lib/Avatar/AvatarManagerTest.php22
-rw-r--r--tests/lib/Avatar/GuestAvatarTest.php4
-rw-r--r--tests/lib/Avatar/UserAvatarTest.php35
-rw-r--r--tests/lib/BackgroundJob/JobListTest.php22
-rw-r--r--tests/lib/BackgroundJob/JobTest.php4
-rw-r--r--tests/lib/BackgroundJob/QueuedJobTest.php2
-rw-r--r--tests/lib/BackgroundJob/TimedJobTest.php6
-rw-r--r--tests/lib/Cache/CappedMemoryCacheTest.php6
-rw-r--r--tests/lib/Cache/FileCacheTest.php6
-rw-r--r--tests/lib/Cache/TestCache.php4
-rw-r--r--tests/lib/Calendar/ManagerTest.php14
-rw-r--r--tests/lib/CapabilitiesManagerTest.php14
-rw-r--r--tests/lib/Collaboration/Collaborators/GroupPluginTest.php14
-rw-r--r--tests/lib/Collaboration/Collaborators/LookupPluginTest.php16
-rw-r--r--tests/lib/Collaboration/Collaborators/MailPluginTest.php32
-rw-r--r--tests/lib/Collaboration/Collaborators/RemotePluginTest.php16
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchResultTest.php8
-rw-r--r--tests/lib/Collaboration/Collaborators/SearchTest.php6
-rw-r--r--tests/lib/Collaboration/Collaborators/UserPluginTest.php44
-rw-r--r--tests/lib/Command/AsyncBusTest.php22
-rw-r--r--tests/lib/Command/Integrity/SignAppTest.php14
-rw-r--r--tests/lib/Command/Integrity/SignCoreTest.php12
-rw-r--r--tests/lib/Comments/CommentTest.php12
-rw-r--r--tests/lib/Comments/ManagerTest.php104
-rw-r--r--tests/lib/ConfigTest.php18
-rw-r--r--tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php4
-rw-r--r--tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php6
-rw-r--r--tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php12
-rw-r--r--tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php34
-rw-r--r--tests/lib/Contacts/ContactsMenu/EntryTest.php12
-rw-r--r--tests/lib/Contacts/ContactsMenu/ManagerTest.php10
-rw-r--r--tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php4
-rw-r--r--tests/lib/ContactsManagerTest.php20
-rw-r--r--tests/lib/DB/ConnectionFactoryTest.php6
-rw-r--r--tests/lib/DB/MigrationsTest.php235
-rw-r--r--tests/lib/DB/MigratorTest.php28
-rw-r--r--tests/lib/DB/OCPostgreSqlPlatformTest.php8
-rw-r--r--tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php14
-rw-r--r--tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php41
-rw-r--r--tests/lib/DB/QueryBuilder/FunctionBuilderTest.php34
-rw-r--r--tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php78
-rw-r--r--tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php222
-rw-r--r--tests/lib/DB/QueryBuilder/QueryBuilderTest.php163
-rw-r--r--tests/lib/DB/QueryBuilder/QuoteHelperTest.php4
-rw-r--r--tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php128
-rw-r--r--tests/lib/DateTimeFormatterTest.php18
-rw-r--r--tests/lib/Diagnostics/EventLoggerTest.php22
-rw-r--r--tests/lib/Diagnostics/QueryLoggerTest.php6
-rw-r--r--tests/lib/DirectEditing/ManagerTest.php12
-rw-r--r--tests/lib/EmojiHelperTest.php6148
-rw-r--r--tests/lib/Encryption/DecryptAllTest.php22
-rw-r--r--tests/lib/Encryption/EncryptionWrapperTest.php10
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php36
-rw-r--r--tests/lib/Encryption/ManagerTest.php20
-rw-r--r--tests/lib/Encryption/UpdateTest.php8
-rw-r--r--tests/lib/Encryption/UtilTest.php16
-rw-r--r--tests/lib/ErrorHandlerTest.php2
-rw-r--r--tests/lib/Federation/CloudIdTest.php2
-rw-r--r--tests/lib/Files/AppData/AppDataTest.php6
-rw-r--r--tests/lib/Files/AppData/FactoryTest.php2
-rw-r--r--tests/lib/Files/Cache/CacheTest.php99
-rw-r--r--tests/lib/Files/Cache/HomeCacheTest.php4
-rw-r--r--tests/lib/Files/Cache/LocalRootScannerTest.php4
-rw-r--r--tests/lib/Files/Cache/PropagatorTest.php14
-rw-r--r--tests/lib/Files/Cache/ScannerTest.php36
-rw-r--r--tests/lib/Files/Cache/SearchBuilderTest.php2
-rw-r--r--tests/lib/Files/Cache/UpdaterLegacyTest.php18
-rw-r--r--tests/lib/Files/Cache/UpdaterTest.php18
-rw-r--r--tests/lib/Files/Cache/WatcherTest.php10
-rw-r--r--tests/lib/Files/Cache/Wrapper/CacheJailTest.php26
-rw-r--r--tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php6
-rw-r--r--tests/lib/Files/Config/UserMountCacheTest.php85
-rw-r--r--tests/lib/Files/EtagTest.php2
-rw-r--r--tests/lib/Files/FileInfoTest.php4
-rw-r--r--tests/lib/Files/FilenameValidatorTest.php287
-rw-r--r--tests/lib/Files/FilesystemTest.php36
-rw-r--r--tests/lib/Files/Mount/ManagerTest.php4
-rw-r--r--tests/lib/Files/Mount/MountPointTest.php4
-rw-r--r--tests/lib/Files/Mount/MountTest.php6
-rw-r--r--tests/lib/Files/Mount/ObjectHomeMountProviderTest.php14
-rw-r--r--tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php4
-rw-r--r--tests/lib/Files/Mount/RootMountProviderTest.php50
-rw-r--r--tests/lib/Files/Node/FileTest.php20
-rw-r--r--tests/lib/Files/Node/FolderTest.php60
-rw-r--r--tests/lib/Files/Node/HookConnectorTest.php8
-rw-r--r--tests/lib/Files/Node/IntegrationTest.php10
-rw-r--r--tests/lib/Files/Node/NodeTest.php54
-rw-r--r--tests/lib/Files/Node/RootTest.php12
-rw-r--r--tests/lib/Files/ObjectStore/AzureTest.php2
-rw-r--r--tests/lib/Files/ObjectStore/MapperTest.php2
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php6
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php24
-rw-r--r--tests/lib/Files/ObjectStore/ObjectStoreTest.php14
-rw-r--r--tests/lib/Files/ObjectStore/S3Test.php14
-rw-r--r--tests/lib/Files/ObjectStore/SwiftTest.php2
-rw-r--r--tests/lib/Files/PathVerificationTest.php63
-rw-r--r--tests/lib/Files/Search/QueryOptimizer/CombinedTests.php110
-rw-r--r--tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php8
-rw-r--r--tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php74
-rw-r--r--tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php46
-rw-r--r--tests/lib/Files/Search/SearchIntegrationTest.php8
-rw-r--r--tests/lib/Files/SimpleFS/InMemoryFileTest.php18
-rw-r--r--tests/lib/Files/SimpleFS/SimpleFileTest.php22
-rw-r--r--tests/lib/Files/SimpleFS/SimpleFolderTest.php16
-rw-r--r--tests/lib/Files/Storage/CommonTest.php73
-rw-r--r--tests/lib/Files/Storage/HomeTest.php6
-rw-r--r--tests/lib/Files/Storage/LocalTest.php24
-rw-r--r--tests/lib/Files/Storage/Storage.php82
-rw-r--r--tests/lib/Files/Storage/StorageFactoryTest.php6
-rw-r--r--tests/lib/Files/Storage/Wrapper/AvailabilityTest.php14
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncodingTest.php28
-rw-r--r--tests/lib/Files/Storage/Wrapper/EncryptionTest.php34
-rw-r--r--tests/lib/Files/Storage/Wrapper/JailTest.php6
-rw-r--r--tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php2
-rw-r--r--tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php32
-rw-r--r--tests/lib/Files/Storage/Wrapper/QuotaTest.php36
-rw-r--r--tests/lib/Files/Storage/Wrapper/WrapperTest.php2
-rw-r--r--tests/lib/Files/Stream/EncryptionTest.php26
-rw-r--r--tests/lib/Files/Stream/HashWrapperTest.php2
-rw-r--r--tests/lib/Files/Stream/QuotaTest.php28
-rw-r--r--tests/lib/Files/Type/DetectionTest.php2
-rw-r--r--tests/lib/Files/Type/LoaderTest.php8
-rw-r--r--tests/lib/Files/Utils/ScannerTest.php12
-rw-r--r--tests/lib/Files/ViewTest.php215
-rw-r--r--tests/lib/GlobalScale/ConfigTest.php6
-rw-r--r--tests/lib/Group/Backend.php10
-rw-r--r--tests/lib/Group/GroupTest.php34
-rw-r--r--tests/lib/Group/ManagerTest.php133
-rw-r--r--tests/lib/Group/MetaDataTest.php22
-rw-r--r--tests/lib/HelperStorageTest.php14
-rw-r--r--tests/lib/Hooks/BasicEmitterTest.php36
-rw-r--r--tests/lib/Http/Client/ClientServiceTest.php4
-rw-r--r--tests/lib/Http/Client/DnsPinMiddlewareTest.php16
-rw-r--r--tests/lib/Http/Client/NegativeDnsCacheTest.php6
-rw-r--r--tests/lib/Http/Client/ResponseTest.php8
-rw-r--r--tests/lib/Http/WellKnown/JrdResponseTest.php4
-rw-r--r--tests/lib/Http/WellKnown/RequestManagerTest.php12
-rw-r--r--tests/lib/ImageTest.php151
-rw-r--r--tests/lib/InfoXmlTest.php14
-rw-r--r--tests/lib/InitialStateServiceTest.php2
-rw-r--r--tests/lib/InstallerTest.php20
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php474
-rw-r--r--tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php8
-rw-r--r--tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php4
-rw-r--r--tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php10
-rw-r--r--tests/lib/L10N/FactoryTest.php92
-rw-r--r--tests/lib/L10N/L10nTest.php32
-rw-r--r--tests/lib/L10N/LanguageIteratorTest.php2
-rw-r--r--tests/lib/LargeFileHelperGetFileSizeTest.php4
-rw-r--r--tests/lib/LargeFileHelperTest.php10
-rw-r--r--tests/lib/LegacyHelperTest.php166
-rw-r--r--tests/lib/Lock/DBLockingProviderTest.php4
-rw-r--r--tests/lib/Lock/LockingProvider.php46
-rw-r--r--tests/lib/Lock/NonCachingDBLockingProviderTest.php2
-rw-r--r--tests/lib/Lockdown/Filesystem/NoFSTest.php2
-rw-r--r--tests/lib/Lockdown/Filesystem/NullCacheTest.php40
-rw-r--r--tests/lib/Lockdown/Filesystem/NullStorageTest.php72
-rw-r--r--tests/lib/Lockdown/LockdownManagerTest.php6
-rw-r--r--tests/lib/Log/ExceptionSerializerTest.php4
-rw-r--r--tests/lib/Log/FileTest.php20
-rw-r--r--tests/lib/Log/LogFactoryTest.php10
-rw-r--r--tests/lib/Log/PsrLoggerAdapterTest.php88
-rw-r--r--tests/lib/LoggerTest.php108
-rw-r--r--tests/lib/Mail/EMailTemplateTest.php10
-rw-r--r--tests/lib/Mail/MailerTest.php25
-rw-r--r--tests/lib/Mail/MessageTest.php34
-rw-r--r--tests/lib/Mail/Provider/AddressTest.php46
-rw-r--r--tests/lib/Mail/Provider/AttachmentTest.php71
-rw-r--r--tests/lib/Mail/Provider/ManagerTest.php189
-rw-r--r--tests/lib/Mail/Provider/MessageTest.php163
-rw-r--r--tests/lib/Memcache/APCuTest.php4
-rw-r--r--tests/lib/Memcache/Cache.php55
-rw-r--r--tests/lib/Memcache/CasTraitTest.php4
-rw-r--r--tests/lib/Memcache/FactoryTest.php10
-rw-r--r--tests/lib/Memcache/MemcachedTest.php2
-rw-r--r--tests/lib/Memcache/RedisTest.php6
-rw-r--r--tests/lib/MemoryInfoTest.php4
-rw-r--r--tests/lib/Migration/BackgroundRepairTest.php8
-rw-r--r--tests/lib/NaturalSortTest.php4
-rw-r--r--tests/lib/NavigationManagerTest.php262
-rw-r--r--tests/lib/Notification/ActionTest.php18
-rw-r--r--tests/lib/Notification/NotificationTest.php62
-rw-r--r--tests/lib/OCS/ApiHelperTest.php54
-rw-r--r--tests/lib/OCS/DiscoveryServiceTest.php10
-rw-r--r--tests/lib/OCS/MapStatusCodeTest.php29
-rw-r--r--tests/lib/OCS/ProviderTest.php8
-rw-r--r--tests/lib/Preview/BackgroundCleanupJobTest.php18
-rw-r--r--tests/lib/Preview/GeneratorTest.php31
-rw-r--r--tests/lib/Preview/HEICTest.php2
-rw-r--r--tests/lib/Preview/Provider.php2
-rw-r--r--tests/lib/PublicNamespace/UtilTest.php2
-rw-r--r--tests/lib/Remote/Api/OCSTest.php6
-rw-r--r--tests/lib/Remote/InstanceTest.php8
-rw-r--r--tests/lib/Repair/CleanTagsTest.php18
-rw-r--r--tests/lib/Repair/ClearFrontendCachesTest.php2
-rw-r--r--tests/lib/Repair/ClearGeneratedAvatarCacheTest.php8
-rw-r--r--tests/lib/Repair/NC11/FixMountStoragesTest.php114
-rw-r--r--tests/lib/Repair/OldGroupMembershipSharesTest.php2
-rw-r--r--tests/lib/Repair/RepairCollationTest.php13
-rw-r--r--tests/lib/Repair/RepairDavSharesTest.php2
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php4
-rw-r--r--tests/lib/Repair/RepairMimeTypesTest.php8
-rw-r--r--tests/lib/RepairTest.php8
-rw-r--r--tests/lib/RichObjectStrings/DefinitionsTest.php4
-rw-r--r--tests/lib/RichObjectStrings/ValidatorTest.php25
-rw-r--r--tests/lib/Route/RouterTest.php14
-rw-r--r--tests/lib/Security/Bruteforce/ThrottlerTest.php4
-rw-r--r--tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php2
-rw-r--r--tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php6
-rw-r--r--tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php27
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php4
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenManagerTest.php28
-rw-r--r--tests/lib/Security/CSRF/CsrfTokenTest.php6
-rw-r--r--tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php14
-rw-r--r--tests/lib/Security/CertificateManagerTest.php29
-rw-r--r--tests/lib/Security/CertificateTest.php20
-rw-r--r--tests/lib/Security/CredentialsManagerTest.php2
-rw-r--r--tests/lib/Security/CryptoTest.php16
-rw-r--r--tests/lib/Security/Events/GenerateSecurePasswordEventTest.php33
-rw-r--r--tests/lib/Security/Events/ValidatePasswordPolicyEventTest.php28
-rw-r--r--tests/lib/Security/FeaturePolicy/AddFeaturePolicyEventTest.php2
-rw-r--r--tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php4
-rw-r--r--tests/lib/Security/HasherTest.php24
-rw-r--r--tests/lib/Security/IdentityProof/KeyTest.php4
-rw-r--r--tests/lib/Security/IdentityProof/ManagerTest.php10
-rw-r--r--tests/lib/Security/IdentityProof/SignerTest.php8
-rw-r--r--tests/lib/Security/Ip/RemoteAddressTest.php77
-rw-r--r--tests/lib/Security/Normalizer/IpAddressTest.php4
-rw-r--r--tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php8
-rw-r--r--tests/lib/Security/RateLimiting/LimiterTest.php8
-rw-r--r--tests/lib/Security/SecureRandomTest.php10
-rw-r--r--tests/lib/Security/TrustedDomainHelperTest.php6
-rw-r--r--tests/lib/Security/VerificationToken/VerificationTokenTest.php20
-rw-r--r--tests/lib/ServerTest.php8
-rw-r--r--tests/lib/Session/CryptoSessionDataTest.php2
-rw-r--r--tests/lib/Session/CryptoWrappingTest.php2
-rw-r--r--tests/lib/Session/MemoryTest.php6
-rw-r--r--tests/lib/Session/Session.php16
-rw-r--r--tests/lib/Settings/ManagerTest.php18
-rw-r--r--tests/lib/Settings/SectionTest.php6
-rw-r--r--tests/lib/SetupTest.php10
-rw-r--r--tests/lib/Share/Backend.php2
-rw-r--r--tests/lib/Share/HelperTest.php4
-rw-r--r--tests/lib/Share/ShareTest.php4
-rw-r--r--tests/lib/Share20/DefaultShareProviderTest.php177
-rw-r--r--tests/lib/Share20/LegacyHooksTest.php12
-rw-r--r--tests/lib/Share20/ManagerTest.php252
-rw-r--r--tests/lib/Share20/ShareByMailProviderTest.php6
-rw-r--r--tests/lib/Share20/ShareHelperTest.php8
-rw-r--r--tests/lib/Share20/ShareTest.php14
-rw-r--r--tests/lib/SubAdminTest.php28
-rw-r--r--tests/lib/Support/Subscription/RegistryTest.php22
-rw-r--r--tests/lib/SystemTag/SystemTagManagerTest.php36
-rw-r--r--tests/lib/SystemTag/SystemTagObjectMapperTest.php35
-rw-r--r--tests/lib/TagsTest.php24
-rw-r--r--tests/lib/TaskProcessing/TaskProcessingTest.php224
-rw-r--r--tests/lib/TempManagerTest.php26
-rw-r--r--tests/lib/Template/CSSResourceLocatorTest.php2
-rw-r--r--tests/lib/Template/JSCombinerTest.php36
-rw-r--r--tests/lib/Template/JSResourceLocatorTest.php8
-rw-r--r--tests/lib/Template/ResourceLocatorTest.php6
-rw-r--r--tests/lib/TemplateFunctionsTest.php50
-rw-r--r--tests/lib/TestCase.php7
-rw-r--r--tests/lib/TextProcessing/TextProcessingTest.php20
-rw-r--r--tests/lib/Updater/ChangesCheckTest.php16
-rw-r--r--tests/lib/Updater/ReleaseMetadataTest.php209
-rw-r--r--tests/lib/Updater/VersionCheckTest.php20
-rw-r--r--tests/lib/UpdaterTest.php2
-rw-r--r--tests/lib/UrlGeneratorTest.php22
-rw-r--r--tests/lib/User/Backend.php6
-rw-r--r--tests/lib/User/DatabaseTest.php10
-rw-r--r--tests/lib/User/ManagerTest.php56
-rw-r--r--tests/lib/User/SessionTest.php78
-rw-r--r--tests/lib/User/UserTest.php70
-rw-r--r--tests/lib/UtilCheckServerTest.php34
-rw-r--r--tests/lib/UtilTest.php150
-rw-r--r--tests/preseed-config.php21
-rw-r--r--tests/startsessionlistener.php2
459 files changed, 10496 insertions, 8274 deletions
diff --git a/tests/Core/Command/Config/App/DeleteConfigTest.php b/tests/Core/Command/Config/App/DeleteConfigTest.php
index 643c7ca3ca1..ebbbb15e1b6 100644
--- a/tests/Core/Command/Config/App/DeleteConfigTest.php
+++ b/tests/Core/Command/Config/App/DeleteConfigTest.php
@@ -80,7 +80,7 @@ class DeleteConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
- public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage) {
+ public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage): void {
$this->config->expects(($checkIfExists) ? $this->once() : $this->never())
->method('getAppKeys')
->with('app-name')
diff --git a/tests/Core/Command/Config/App/GetConfigTest.php b/tests/Core/Command/Config/App/GetConfigTest.php
index 79b79ea5576..c1a6265db40 100644
--- a/tests/Core/Command/Config/App/GetConfigTest.php
+++ b/tests/Core/Command/Config/App/GetConfigTest.php
@@ -94,7 +94,7 @@ class GetConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
- public function testGet($configName, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage) {
+ public function testGet($configName, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage): void {
if (!$expectedReturn) {
if ($configExists) {
$this->config->expects($this->once())
@@ -106,9 +106,9 @@ class GetConfigTest extends TestCase {
if (!$configExists) {
$this->config->expects($this->once())
- ->method('getDetails')
- ->with('app-name', $configName)
- ->willThrowException(new AppConfigUnknownKeyException());
+ ->method('getDetails')
+ ->with('app-name', $configName)
+ ->willThrowException(new AppConfigUnknownKeyException());
}
$this->consoleInput->expects($this->exactly(2))
diff --git a/tests/Core/Command/Config/App/SetConfigTest.php b/tests/Core/Command/Config/App/SetConfigTest.php
index 5c7e856f6fa..1d599bf3234 100644
--- a/tests/Core/Command/Config/App/SetConfigTest.php
+++ b/tests/Core/Command/Config/App/SetConfigTest.php
@@ -72,20 +72,20 @@ class SetConfigTest extends TestCase {
* @param bool $updated
* @param string $expectedMessage
*/
- public function testSet($configName, $newValue, $configExists, $updateOnly, $updated, $expectedMessage) {
+ public function testSet($configName, $newValue, $configExists, $updateOnly, $updated, $expectedMessage): void {
$this->config->expects($this->any())
- ->method('hasKey')
- ->with('app-name', $configName)
- ->willReturn($configExists);
+ ->method('hasKey')
+ ->with('app-name', $configName)
+ ->willReturn($configExists);
if (!$configExists) {
$this->config->expects($this->any())
- ->method('getValueType')
- ->willThrowException(new AppConfigUnknownKeyException());
+ ->method('getValueType')
+ ->willThrowException(new AppConfigUnknownKeyException());
} else {
$this->config->expects($this->any())
- ->method('getValueType')
- ->willReturn(IAppConfig::VALUE_MIXED);
+ ->method('getValueType')
+ ->willReturn(IAppConfig::VALUE_MIXED);
}
if ($updated) {
diff --git a/tests/Core/Command/Config/ImportTest.php b/tests/Core/Command/Config/ImportTest.php
index 91485955e60..0077f84f82b 100644
--- a/tests/Core/Command/Config/ImportTest.php
+++ b/tests/Core/Command/Config/ImportTest.php
@@ -53,7 +53,7 @@ class ImportTest extends TestCase {
*
* @param mixed $configValue
*/
- public function testValidateAppsArray($configValue) {
+ public function testValidateAppsArray($configValue): void {
$this->invokePrivate($this->command, 'validateAppsArray', [['app' => ['name' => $configValue]]]);
$this->assertTrue(true, 'Asserting that no exception is thrown');
}
@@ -72,7 +72,7 @@ class ImportTest extends TestCase {
*
* @param mixed $configValue
*/
- public function testValidateAppsArrayThrows($configValue) {
+ public function testValidateAppsArrayThrows($configValue): void {
try {
$this->invokePrivate($this->command, 'validateAppsArray', [['app' => ['name' => $configValue]]]);
$this->fail('Did not throw expected UnexpectedValueException');
@@ -102,7 +102,7 @@ class ImportTest extends TestCase {
*
* @param mixed $configValue
*/
- public function testCheckTypeRecursively($configValue) {
+ public function testCheckTypeRecursively($configValue): void {
$this->invokePrivate($this->command, 'checkTypeRecursively', [$configValue, 'name']);
$this->assertTrue(true, 'Asserting that no exception is thrown');
}
@@ -121,7 +121,7 @@ class ImportTest extends TestCase {
*
* @param mixed $configValue
*/
- public function testCheckTypeRecursivelyThrows($configValue) {
+ public function testCheckTypeRecursivelyThrows($configValue): void {
try {
$this->invokePrivate($this->command, 'checkTypeRecursively', [$configValue, 'name']);
$this->fail('Did not throw expected UnexpectedValueException');
@@ -143,7 +143,7 @@ class ImportTest extends TestCase {
*
* @param array $configArray
*/
- public function testValidateArray($configArray) {
+ public function testValidateArray($configArray): void {
$this->invokePrivate($this->command, 'validateArray', [$configArray]);
$this->assertTrue(true, 'Asserting that no exception is thrown');
}
@@ -162,7 +162,7 @@ class ImportTest extends TestCase {
* @param mixed $configArray
* @param string $expectedException
*/
- public function testValidateArrayThrows($configArray, $expectedException) {
+ public function testValidateArrayThrows($configArray, $expectedException): void {
try {
$this->invokePrivate($this->command, 'validateArray', [$configArray]);
$this->fail('Did not throw expected UnexpectedValueException');
diff --git a/tests/Core/Command/Config/ListConfigsTest.php b/tests/Core/Command/Config/ListConfigsTest.php
index 8b6fdf39192..0cee870d45c 100644
--- a/tests/Core/Command/Config/ListConfigsTest.php
+++ b/tests/Core/Command/Config/ListConfigsTest.php
@@ -262,7 +262,7 @@ class ListConfigsTest extends TestCase {
* @param bool $private
* @param string $expected
*/
- public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected) {
+ public function testList($app, $systemConfigs, $systemConfigMap, $appConfig, $private, $expected): void {
$this->systemConfig->expects($this->any())
->method('getKeys')
->willReturn($systemConfigs);
diff --git a/tests/Core/Command/Config/System/DeleteConfigTest.php b/tests/Core/Command/Config/System/DeleteConfigTest.php
index 9b5b018687e..872079ef4c2 100644
--- a/tests/Core/Command/Config/System/DeleteConfigTest.php
+++ b/tests/Core/Command/Config/System/DeleteConfigTest.php
@@ -80,7 +80,7 @@ class DeleteConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
- public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage) {
+ public function testDelete($configName, $configExists, $checkIfExists, $expectedReturn, $expectedMessage): void {
$this->systemConfig->expects(($checkIfExists) ? $this->once() : $this->never())
->method('getKeys')
->willReturn($configExists ? [$configName] : []);
@@ -175,7 +175,7 @@ class DeleteConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
- public function testArrayDelete(array $configNames, $configKeyExists, $checkIfKeyExists, $configValue, $updateValue, $expectedReturn, $expectedMessage) {
+ public function testArrayDelete(array $configNames, $configKeyExists, $checkIfKeyExists, $configValue, $updateValue, $expectedReturn, $expectedMessage): void {
$this->systemConfig->expects(($checkIfKeyExists) ? $this->once() : $this->never())
->method('getKeys')
->willReturn($configKeyExists ? [$configNames[0]] : []);
diff --git a/tests/Core/Command/Config/System/GetConfigTest.php b/tests/Core/Command/Config/System/GetConfigTest.php
index db96331680b..f05d0e384ee 100644
--- a/tests/Core/Command/Config/System/GetConfigTest.php
+++ b/tests/Core/Command/Config/System/GetConfigTest.php
@@ -99,7 +99,7 @@ class GetConfigTest extends TestCase {
* @param int $expectedReturn
* @param string $expectedMessage
*/
- public function testGet($configNames, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage) {
+ public function testGet($configNames, $value, $configExists, $defaultValue, $hasDefault, $outputFormat, $expectedReturn, $expectedMessage): void {
if (is_array($configNames)) {
$configName = $configNames[0];
} else {
diff --git a/tests/Core/Command/Config/System/SetConfigTest.php b/tests/Core/Command/Config/System/SetConfigTest.php
index d5c54a5e720..2905af5c3d7 100644
--- a/tests/Core/Command/Config/System/SetConfigTest.php
+++ b/tests/Core/Command/Config/System/SetConfigTest.php
@@ -55,7 +55,7 @@ class SetConfigTest extends TestCase {
* @param mixed $existingData
* @param mixed $expectedValue
*/
- public function testSet($configNames, $newValue, $existingData, $expectedValue) {
+ public function testSet($configNames, $newValue, $existingData, $expectedValue): void {
$this->systemConfig->expects($this->once())
->method('setValue')
->with($configNames[0], $expectedValue);
@@ -88,7 +88,7 @@ class SetConfigTest extends TestCase {
/**
* @dataProvider setUpdateOnlyProvider
*/
- public function testSetUpdateOnly($configNames, $existingData) {
+ public function testSetUpdateOnly($configNames, $existingData): void {
$this->expectException(\UnexpectedValueException::class);
$this->systemConfig->expects($this->never())
@@ -135,7 +135,7 @@ class SetConfigTest extends TestCase {
/**
* @dataProvider castValueProvider
*/
- public function testCastValue($value, $type, $expectedValue) {
+ public function testCastValue($value, $type, $expectedValue): void {
$this->assertSame($expectedValue,
$this->invokePrivate($this->command, 'castValue', [$value, $type])
);
@@ -156,7 +156,7 @@ class SetConfigTest extends TestCase {
/**
* @dataProvider castValueInvalidProvider
*/
- public function testCastValueInvalid($value, $type) {
+ public function testCastValueInvalid($value, $type): void {
$this->expectException(\InvalidArgumentException::class);
$this->invokePrivate($this->command, 'castValue', [$value, $type]);
diff --git a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
index 4334994e8d3..b124a27f9ab 100644
--- a/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
+++ b/tests/Core/Command/Encryption/ChangeKeyStorageRootTest.php
@@ -32,7 +32,7 @@ class ChangeKeyStorageRootTest extends TestCase {
/** @var IConfig | \PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var Util | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var Util | \PHPUnit\Framework\MockObject\MockObject */
protected $util;
/** @var QuestionHelper | \PHPUnit\Framework\MockObject\MockObject */
@@ -79,7 +79,7 @@ class ChangeKeyStorageRootTest extends TestCase {
/**
* @dataProvider dataTestExecute
*/
- public function testExecute($newRoot, $answer, $successMoveKey) {
+ public function testExecute($newRoot, $answer, $successMoveKey): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
[
@@ -132,7 +132,7 @@ class ChangeKeyStorageRootTest extends TestCase {
];
}
- public function testMoveAllKeys() {
+ public function testMoveAllKeys(): void {
/** @var \OC\Core\Command\Encryption\ChangeKeyStorageRoot $changeKeyStorageRoot */
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
@@ -152,7 +152,7 @@ class ChangeKeyStorageRootTest extends TestCase {
$this->invokePrivate($changeKeyStorageRoot, 'moveAllKeys', ['oldRoot', 'newRoot', $this->outputInterface]);
}
- public function testPrepareNewRoot() {
+ public function testPrepareNewRoot(): void {
$this->view->expects($this->once())->method('is_dir')->with('newRoot')
->willReturn(true);
@@ -169,7 +169,7 @@ class ChangeKeyStorageRootTest extends TestCase {
* @param bool $dirExists
* @param bool $couldCreateFile
*/
- public function testPrepareNewRootException($dirExists, $couldCreateFile) {
+ public function testPrepareNewRootException($dirExists, $couldCreateFile): void {
$this->expectException(\Exception::class);
$this->view->expects($this->once())->method('is_dir')->with('newRoot')
@@ -194,7 +194,7 @@ class ChangeKeyStorageRootTest extends TestCase {
* @param bool $targetExists
* @param bool $executeRename
*/
- public function testMoveSystemKeys($dirExists, $targetExists, $executeRename) {
+ public function testMoveSystemKeys($dirExists, $targetExists, $executeRename): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
[
@@ -213,7 +213,7 @@ class ChangeKeyStorageRootTest extends TestCase {
if ($executeRename) {
$this->view->expects($this->once())->method('rename')
- ->with('oldRoot/files_encryption', 'newRoot/files_encryption');
+ ->with('oldRoot/files_encryption', 'newRoot/files_encryption');
} else {
$this->view->expects($this->never())->method('rename');
}
@@ -231,7 +231,7 @@ class ChangeKeyStorageRootTest extends TestCase {
}
- public function testMoveUserKeys() {
+ public function testMoveUserKeys(): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
[
@@ -261,7 +261,7 @@ class ChangeKeyStorageRootTest extends TestCase {
* @param bool $targetExists
* @param bool $shouldRename
*/
- public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename) {
+ public function testMoveUserEncryptionFolder($userExists, $isDir, $targetExists, $shouldRename): void {
$changeKeyStorageRoot = $this->getMockBuilder('OC\Core\Command\Encryption\ChangeKeyStorageRoot')
->setConstructorArgs(
[
@@ -309,7 +309,7 @@ class ChangeKeyStorageRootTest extends TestCase {
/**
* @dataProvider dataTestPrepareParentFolder
*/
- public function testPrepareParentFolder($path, $pathExists) {
+ public function testPrepareParentFolder($path, $pathExists): void {
$this->view->expects($this->any())->method('file_exists')
->willReturnCallback(
function ($fileExistsPath) use ($path, $pathExists) {
@@ -341,7 +341,7 @@ class ChangeKeyStorageRootTest extends TestCase {
];
}
- public function testTargetExists() {
+ public function testTargetExists(): void {
$this->view->expects($this->once())->method('file_exists')->with('path')
->willReturn(false);
@@ -351,7 +351,7 @@ class ChangeKeyStorageRootTest extends TestCase {
}
- public function testTargetExistsException() {
+ public function testTargetExistsException(): void {
$this->expectException(\Exception::class);
$this->view->expects($this->once())->method('file_exists')->with('path')
diff --git a/tests/Core/Command/Encryption/DecryptAllTest.php b/tests/Core/Command/Encryption/DecryptAllTest.php
index 3ae14a3e12d..6ed4cbbea99 100644
--- a/tests/Core/Command/Encryption/DecryptAllTest.php
+++ b/tests/Core/Command/Encryption/DecryptAllTest.php
@@ -20,13 +20,13 @@ class DecryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */
protected $config;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */
protected $encryptionManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */
protected $appManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
protected $consoleInput;
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
@@ -70,7 +70,7 @@ class DecryptAllTest extends TestCase {
->with('files_trashbin')->willReturn(true);
}
- public function testMaintenanceAndTrashbin() {
+ public function testMaintenanceAndTrashbin(): void {
// on construct we enable single-user-mode and disable the trash bin
// on destruct we disable single-user-mode again and enable the trash bin
$this->config->expects($this->exactly(2))
@@ -108,7 +108,7 @@ class DecryptAllTest extends TestCase {
/**
* @dataProvider dataTestExecute
*/
- public function testExecute($encryptionEnabled, $continue) {
+ public function testExecute($encryptionEnabled, $continue): void {
$instance = new DecryptAll(
$this->encryptionManager,
$this->appManager,
@@ -162,7 +162,7 @@ class DecryptAllTest extends TestCase {
}
- public function testExecuteFailure() {
+ public function testExecuteFailure(): void {
$this->expectException(\Exception::class);
$instance = new DecryptAll(
diff --git a/tests/Core/Command/Encryption/DisableTest.php b/tests/Core/Command/Encryption/DisableTest.php
index 6c962399e11..913d03a8850 100644
--- a/tests/Core/Command/Encryption/DisableTest.php
+++ b/tests/Core/Command/Encryption/DisableTest.php
@@ -52,7 +52,7 @@ class DisableTest extends TestCase {
* @param bool $isUpdating
* @param string $expectedString
*/
- public function testDisable($oldStatus, $isUpdating, $expectedString) {
+ public function testDisable($oldStatus, $isUpdating, $expectedString): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('core', 'encryption_enabled', $this->anything())
diff --git a/tests/Core/Command/Encryption/EnableTest.php b/tests/Core/Command/Encryption/EnableTest.php
index b535c80b0a8..2d463452add 100644
--- a/tests/Core/Command/Encryption/EnableTest.php
+++ b/tests/Core/Command/Encryption/EnableTest.php
@@ -65,7 +65,7 @@ class EnableTest extends TestCase {
* @param string $expectedString
* @param string $expectedDefaultModuleString
*/
- public function testEnable($oldStatus, $defaultModule, $availableModules, $isUpdating, $expectedString, $expectedDefaultModuleString) {
+ public function testEnable($oldStatus, $defaultModule, $availableModules, $isUpdating, $expectedString, $expectedDefaultModuleString): void {
if ($isUpdating) {
$this->config->expects($this->once())
->method('setAppValue')
diff --git a/tests/Core/Command/Encryption/EncryptAllTest.php b/tests/Core/Command/Encryption/EncryptAllTest.php
index 83eeb5abdaa..933f919ba7f 100644
--- a/tests/Core/Command/Encryption/EncryptAllTest.php
+++ b/tests/Core/Command/Encryption/EncryptAllTest.php
@@ -21,13 +21,13 @@ class EncryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IConfig */
protected $config;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IManager */
protected $encryptionManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\App\IAppManager */
protected $appManager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
protected $consoleInput;
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
@@ -39,7 +39,7 @@ class EncryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\Encryption\IEncryptionModule */
protected $encryptionModule;
- /** @var EncryptAll */
+ /** @var EncryptAll */
protected $command;
protected function setUp(): void {
@@ -67,7 +67,7 @@ class EncryptAllTest extends TestCase {
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
}
- public function testEncryptAll() {
+ public function testEncryptAll(): void {
// trash bin needs to be disabled in order to avoid adding dummy files to the users
// trash bin which gets deleted during the encryption process
$this->appManager->expects($this->once())->method('disableApp')->with('files_trashbin');
@@ -89,7 +89,7 @@ class EncryptAllTest extends TestCase {
/**
* @dataProvider dataTestExecute
*/
- public function testExecute($answer, $askResult) {
+ public function testExecute($answer, $askResult): void {
$command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper);
$this->encryptionManager->expects($this->once())->method('isEnabled')->willReturn(true);
@@ -115,7 +115,7 @@ class EncryptAllTest extends TestCase {
}
- public function testExecuteException() {
+ public function testExecuteException(): void {
$this->expectException(\Exception::class);
$command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper);
diff --git a/tests/Core/Command/Encryption/SetDefaultModuleTest.php b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
index 9c4259fb04e..0a2c2a81c28 100644
--- a/tests/Core/Command/Encryption/SetDefaultModuleTest.php
+++ b/tests/Core/Command/Encryption/SetDefaultModuleTest.php
@@ -60,7 +60,7 @@ class SetDefaultModuleTest extends TestCase {
* @param bool $updateSuccess
* @param string $expectedString
*/
- public function testSetDefaultModule($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString) {
+ public function testSetDefaultModule($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void {
$this->consoleInput->expects($this->once())
->method('getArgument')
->with('module')
@@ -98,7 +98,7 @@ class SetDefaultModuleTest extends TestCase {
* @param bool $updateSuccess
* @param string $expectedString
*/
- public function testMaintenanceMode($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString) {
+ public function testMaintenanceMode($oldModule, $newModule, $updateModule, $updateSuccess, $expectedString): void {
$this->consoleInput->expects($this->never())
->method('getArgument')
->with('module')
diff --git a/tests/Core/Command/Group/AddTest.php b/tests/Core/Command/Group/AddTest.php
index 76ef4a74f6a..c953199766f 100644
--- a/tests/Core/Command/Group/AddTest.php
+++ b/tests/Core/Command/Group/AddTest.php
@@ -43,7 +43,7 @@ class AddTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testGroupExists() {
+ public function testGroupExists(): void {
$gid = 'myGroup';
$group = $this->createMock(IGroup::class);
$this->groupManager->method('get')
@@ -59,7 +59,7 @@ class AddTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testAdd() {
+ public function testAdd(): void {
$gid = 'myGroup';
$group = $this->createMock(IGroup::class);
$group->method('getGID')
diff --git a/tests/Core/Command/Group/AddUserTest.php b/tests/Core/Command/Group/AddUserTest.php
index 8c8f4902a16..4bbf54f7b3f 100644
--- a/tests/Core/Command/Group/AddUserTest.php
+++ b/tests/Core/Command/Group/AddUserTest.php
@@ -51,7 +51,7 @@ class AddUserTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testNoGroup() {
+ public function testNoGroup(): void {
$this->groupManager->method('get')
->with('myGroup')
->willReturn(null);
@@ -63,7 +63,7 @@ class AddUserTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testNoUser() {
+ public function testNoUser(): void {
$group = $this->createMock(IGroup::class);
$this->groupManager->method('get')
->with('myGroup')
@@ -80,7 +80,7 @@ class AddUserTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testAdd() {
+ public function testAdd(): void {
$group = $this->createMock(IGroup::class);
$this->groupManager->method('get')
->with('myGroup')
diff --git a/tests/Core/Command/Group/DeleteTest.php b/tests/Core/Command/Group/DeleteTest.php
index fe1aaff64bc..4b4f16feb76 100644
--- a/tests/Core/Command/Group/DeleteTest.php
+++ b/tests/Core/Command/Group/DeleteTest.php
@@ -36,7 +36,7 @@ class DeleteTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testDoesNotExists() {
+ public function testDoesNotExists(): void {
$gid = 'myGroup';
$this->input->method('getArgument')
->willReturnCallback(function ($arg) use ($gid) {
@@ -58,7 +58,7 @@ class DeleteTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testDeleteAdmin() {
+ public function testDeleteAdmin(): void {
$gid = 'admin';
$this->input->method('getArgument')
->willReturnCallback(function ($arg) use ($gid) {
@@ -77,7 +77,7 @@ class DeleteTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testDeleteFailed() {
+ public function testDeleteFailed(): void {
$gid = 'myGroup';
$this->input->method('getArgument')
->willReturnCallback(function ($arg) use ($gid) {
@@ -103,7 +103,7 @@ class DeleteTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testDelete() {
+ public function testDelete(): void {
$gid = 'myGroup';
$this->input->method('getArgument')
->willReturnCallback(function ($arg) use ($gid) {
diff --git a/tests/Core/Command/Group/InfoTest.php b/tests/Core/Command/Group/InfoTest.php
index 6f5a9cce02b..869b6741866 100644
--- a/tests/Core/Command/Group/InfoTest.php
+++ b/tests/Core/Command/Group/InfoTest.php
@@ -39,7 +39,7 @@ class InfoTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testDoesNotExists() {
+ public function testDoesNotExists(): void {
$gid = 'myGroup';
$this->input->method('getArgument')
->willReturnCallback(function ($arg) use ($gid) {
@@ -59,7 +59,7 @@ class InfoTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testInfo() {
+ public function testInfo(): void {
$gid = 'myGroup';
$this->input->method('getArgument')
->willReturnCallback(function ($arg) use ($gid) {
diff --git a/tests/Core/Command/Group/ListCommandTest.php b/tests/Core/Command/Group/ListCommandTest.php
index e4e91ce1458..93d472af388 100644
--- a/tests/Core/Command/Group/ListCommandTest.php
+++ b/tests/Core/Command/Group/ListCommandTest.php
@@ -40,7 +40,7 @@ class ListCommandTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testExecute() {
+ public function testExecute(): void {
$group1 = $this->createMock(IGroup::class);
$group1->method('getGID')->willReturn('group1');
$group2 = $this->createMock(IGroup::class);
@@ -90,30 +90,35 @@ class ListCommandTest extends TestCase {
->with(
$this->equalTo($this->input),
$this->equalTo($this->output),
- [
- 'group1' => [
- 'user1',
- 'user2',
- ],
- 'group2' => [
- ],
- 'group3' => [
- 'user1',
- 'user3',
+ $this->callback(
+ fn ($iterator) => iterator_to_array($iterator) === [
+ 'group1' => [
+ 'user1',
+ 'user2',
+ ],
+ 'group2' => [
+ ],
+ 'group3' => [
+ 'user1',
+ 'user3',
+ ]
]
- ]
+ )
);
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testInfo() {
+ public function testInfo(): void {
$group1 = $this->createMock(IGroup::class);
$group1->method('getGID')->willReturn('group1');
+ $group1->method('getDisplayName')->willReturn('Group 1');
$group2 = $this->createMock(IGroup::class);
$group2->method('getGID')->willReturn('group2');
+ $group2->method('getDisplayName')->willReturn('Group 2');
$group3 = $this->createMock(IGroup::class);
$group3->method('getGID')->willReturn('group3');
+ $group3->method('getDisplayName')->willReturn('Group 3');
$user = $this->createMock(IUser::class);
@@ -166,26 +171,31 @@ class ListCommandTest extends TestCase {
->with(
$this->equalTo($this->input),
$this->equalTo($this->output),
- [
- 'group1' => [
- 'backends' => ['Database'],
- 'users' => [
- 'user1',
- 'user2',
+ $this->callback(
+ fn ($iterator) => iterator_to_array($iterator) === [
+ 'group1' => [
+ 'displayName' => 'Group 1',
+ 'backends' => ['Database'],
+ 'users' => [
+ 'user1',
+ 'user2',
+ ],
],
- ],
- 'group2' => [
- 'backends' => ['Database'],
- 'users' => [],
- ],
- 'group3' => [
- 'backends' => ['LDAP'],
- 'users' => [
- 'user1',
- 'user3',
+ 'group2' => [
+ 'displayName' => 'Group 2',
+ 'backends' => ['Database'],
+ 'users' => [],
],
+ 'group3' => [
+ 'displayName' => 'Group 3',
+ 'backends' => ['LDAP'],
+ 'users' => [
+ 'user1',
+ 'user3',
+ ],
+ ]
]
- ]
+ )
);
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
diff --git a/tests/Core/Command/Group/RemoveUserTest.php b/tests/Core/Command/Group/RemoveUserTest.php
index 47c782b6f44..98fe41784f1 100644
--- a/tests/Core/Command/Group/RemoveUserTest.php
+++ b/tests/Core/Command/Group/RemoveUserTest.php
@@ -51,7 +51,7 @@ class RemoveUserTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testNoGroup() {
+ public function testNoGroup(): void {
$this->groupManager->method('get')
->with('myGroup')
->willReturn(null);
@@ -63,7 +63,7 @@ class RemoveUserTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testNoUser() {
+ public function testNoUser(): void {
$group = $this->createMock(IGroup::class);
$this->groupManager->method('get')
->with('myGroup')
@@ -80,7 +80,7 @@ class RemoveUserTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testAdd() {
+ public function testAdd(): void {
$group = $this->createMock(IGroup::class);
$this->groupManager->method('get')
->with('myGroup')
diff --git a/tests/Core/Command/Log/FileTest.php b/tests/Core/Command/Log/FileTest.php
index 35db7c6d718..08ff01e019d 100644
--- a/tests/Core/Command/Log/FileTest.php
+++ b/tests/Core/Command/Log/FileTest.php
@@ -36,7 +36,7 @@ class FileTest extends TestCase {
$this->command = new File($config);
}
- public function testEnable() {
+ public function testEnable(): void {
$this->config->method('getSystemValue')->willReturnArgument(1);
$this->consoleInput->method('getOption')
->willReturnMap([
@@ -49,7 +49,7 @@ class FileTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testChangeFile() {
+ public function testChangeFile(): void {
$this->config->method('getSystemValue')->willReturnArgument(1);
$this->consoleInput->method('getOption')
->willReturnMap([
@@ -74,7 +74,7 @@ class FileTest extends TestCase {
/**
* @dataProvider changeRotateSizeProvider
*/
- public function testChangeRotateSize($optionValue, $configValue) {
+ public function testChangeRotateSize($optionValue, $configValue): void {
$this->config->method('getSystemValue')->willReturnArgument(1);
$this->consoleInput->method('getOption')
->willReturnMap([
@@ -87,7 +87,7 @@ class FileTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testGetConfiguration() {
+ public function testGetConfiguration(): void {
$this->config->method('getSystemValue')
->willReturnMap([
['log_type', 'file', 'log_type_value'],
diff --git a/tests/Core/Command/Log/ManageTest.php b/tests/Core/Command/Log/ManageTest.php
index 5cba6dd626f..b354bb17076 100644
--- a/tests/Core/Command/Log/ManageTest.php
+++ b/tests/Core/Command/Log/ManageTest.php
@@ -36,7 +36,7 @@ class ManageTest extends TestCase {
$this->command = new Manage($config);
}
- public function testChangeBackend() {
+ public function testChangeBackend(): void {
$this->consoleInput->method('getOption')
->willReturnMap([
['backend', 'syslog']
@@ -48,7 +48,7 @@ class ManageTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testChangeLevel() {
+ public function testChangeLevel(): void {
$this->consoleInput->method('getOption')
->willReturnMap([
['level', 'debug']
@@ -60,7 +60,7 @@ class ManageTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testChangeTimezone() {
+ public function testChangeTimezone(): void {
$this->consoleInput->method('getOption')
->willReturnMap([
['timezone', 'UTC']
@@ -73,14 +73,14 @@ class ManageTest extends TestCase {
}
- public function testValidateBackend() {
+ public function testValidateBackend(): void {
$this->expectException(\InvalidArgumentException::class);
self::invokePrivate($this->command, 'validateBackend', ['notabackend']);
}
- public function testValidateTimezone() {
+ public function testValidateTimezone(): void {
$this->expectException(\Exception::class);
// this might need to be changed when humanity colonises Mars
@@ -102,14 +102,14 @@ class ManageTest extends TestCase {
/**
* @dataProvider convertLevelStringProvider
*/
- public function testConvertLevelString($levelString, $expectedInt) {
+ public function testConvertLevelString($levelString, $expectedInt): void {
$this->assertEquals($expectedInt,
self::invokePrivate($this->command, 'convertLevelString', [$levelString])
);
}
- public function testConvertLevelStringInvalid() {
+ public function testConvertLevelStringInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
self::invokePrivate($this->command, 'convertLevelString', ['abc']);
@@ -128,20 +128,20 @@ class ManageTest extends TestCase {
/**
* @dataProvider convertLevelNumberProvider
*/
- public function testConvertLevelNumber($levelNum, $expectedString) {
+ public function testConvertLevelNumber($levelNum, $expectedString): void {
$this->assertEquals($expectedString,
self::invokePrivate($this->command, 'convertLevelNumber', [$levelNum])
);
}
- public function testConvertLevelNumberInvalid() {
+ public function testConvertLevelNumberInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
self::invokePrivate($this->command, 'convertLevelNumber', [11]);
}
- public function testGetConfiguration() {
+ public function testGetConfiguration(): void {
$this->config->expects($this->exactly(3))
->method('getSystemValue')
->withConsecutive(
diff --git a/tests/Core/Command/Maintenance/DataFingerprintTest.php b/tests/Core/Command/Maintenance/DataFingerprintTest.php
index 03cf37b8f48..3d56d891bef 100644
--- a/tests/Core/Command/Maintenance/DataFingerprintTest.php
+++ b/tests/Core/Command/Maintenance/DataFingerprintTest.php
@@ -39,7 +39,7 @@ class DataFingerprintTest extends TestCase {
$this->command = new DataFingerprint($this->config, $this->timeFactory);
}
- public function testSetFingerPrint() {
+ public function testSetFingerPrint(): void {
$this->timeFactory->expects($this->once())
->method('getTime')
->willReturn(42);
diff --git a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
index a4169907167..d8c82de19ac 100644
--- a/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
+++ b/tests/Core/Command/Maintenance/Mimetype/UpdateDBTest.php
@@ -46,7 +46,7 @@ class UpdateDBTest extends TestCase {
$this->command = new UpdateDB($this->detector, $this->loader);
}
- public function testNoop() {
+ public function testNoop(): void {
$this->consoleInput->method('getOption')
->with('repair-filecache')
->willReturn(false);
@@ -74,7 +74,7 @@ class UpdateDBTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testAddMimetype() {
+ public function testAddMimetype(): void {
$this->consoleInput->method('getOption')
->with('repair-filecache')
->willReturn(false);
@@ -115,7 +115,7 @@ class UpdateDBTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testSkipComments() {
+ public function testSkipComments(): void {
$this->detector->expects($this->once())
->method('getAllMappings')
->willReturn([
@@ -127,7 +127,7 @@ class UpdateDBTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testRepairFilecache() {
+ public function testRepairFilecache(): void {
$this->consoleInput->method('getOption')
->with('repair-filecache')
->willReturn(true);
diff --git a/tests/Core/Command/Maintenance/ModeTest.php b/tests/Core/Command/Maintenance/ModeTest.php
index 458699649b2..59b8bbfc045 100644
--- a/tests/Core/Command/Maintenance/ModeTest.php
+++ b/tests/Core/Command/Maintenance/ModeTest.php
@@ -115,7 +115,7 @@ class ModeTest extends TestCase {
* @param string $option The command option.
* @param bool $currentMaintenanceState The current maintenance state.
* @param null|bool $expectedMaintenanceState
- * The expected maintenance state. Null for no change.
+ * The expected maintenance state. Null for no change.
* @param string $expectedOutput The expected command output.
* @throws \Exception
*/
@@ -124,7 +124,7 @@ class ModeTest extends TestCase {
bool $currentMaintenanceState,
$expectedMaintenanceState,
string $expectedOutput
- ) {
+ ): void {
$this->config->expects($this->any())
->method('getSystemValueBool')
->willReturn($currentMaintenanceState);
diff --git a/tests/Core/Command/Maintenance/UpdateTheme.php b/tests/Core/Command/Maintenance/UpdateTheme.php
index 25229b8997a..41b95d358d3 100644
--- a/tests/Core/Command/Maintenance/UpdateTheme.php
+++ b/tests/Core/Command/Maintenance/UpdateTheme.php
@@ -42,7 +42,7 @@ class UpdateThemeTest extends TestCase {
$this->command = new UpdateTheme($this->detector, $this->cacheFactory);
}
- public function testThemeUpdate() {
+ public function testThemeUpdate(): void {
$this->consoleInput->method('getOption')
->with('maintenance:theme:update')
->willReturn(true);
diff --git a/tests/Core/Command/Preview/RepairTest.php b/tests/Core/Command/Preview/RepairTest.php
index b257c59d9d2..e54f4dde3ad 100644
--- a/tests/Core/Command/Preview/RepairTest.php
+++ b/tests/Core/Command/Preview/RepairTest.php
@@ -116,7 +116,7 @@ class RepairTest extends TestCase {
/**
* @dataProvider emptyTestDataProvider
*/
- public function testEmptyExecute($directoryNames, $expectedOutput) {
+ public function testEmptyExecute($directoryNames, $expectedOutput): void {
$previewFolder = $this->getMockBuilder(Folder::class)
->getMock();
$directories = array_map(function ($element) {
@@ -147,7 +147,7 @@ class RepairTest extends TestCase {
->willReturn($directories);
$this->rootFolder->expects($this->once())
->method('get')
- ->with("appdata_/preview")
+ ->with('appdata_/preview')
->willReturn($previewFolder);
$this->repair->run($this->input, $this->output);
diff --git a/tests/Core/Command/SystemTag/AddTest.php b/tests/Core/Command/SystemTag/AddTest.php
index 921b875dc4e..4dd0df7ffe0 100644
--- a/tests/Core/Command/SystemTag/AddTest.php
+++ b/tests/Core/Command/SystemTag/AddTest.php
@@ -40,7 +40,7 @@ class AddTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testExecute() {
+ public function testExecute(): void {
$tagId = '42';
$tagName = 'wichtig';
$tagAccess = 'public';
@@ -82,7 +82,7 @@ class AddTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testAlreadyExists() {
+ public function testAlreadyExists(): void {
$tagId = '42';
$tagName = 'wichtig';
$tagAccess = 'public';
diff --git a/tests/Core/Command/SystemTag/DeleteTest.php b/tests/Core/Command/SystemTag/DeleteTest.php
index a2ec3767272..78d073db6d6 100644
--- a/tests/Core/Command/SystemTag/DeleteTest.php
+++ b/tests/Core/Command/SystemTag/DeleteTest.php
@@ -39,7 +39,7 @@ class DeleteTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testExecute() {
+ public function testExecute(): void {
$tagId = 69;
$this->input->method('getArgument')
@@ -57,7 +57,7 @@ class DeleteTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testNotFound() {
+ public function testNotFound(): void {
$tagId = 69;
$this->input->method('getArgument')
diff --git a/tests/Core/Command/SystemTag/EditTest.php b/tests/Core/Command/SystemTag/EditTest.php
index 4273d666ff5..1857da25ab0 100644
--- a/tests/Core/Command/SystemTag/EditTest.php
+++ b/tests/Core/Command/SystemTag/EditTest.php
@@ -40,7 +40,7 @@ class EditTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testExecute() {
+ public function testExecute(): void {
$tagId = '5';
$tagName = 'unwichtige Dateien';
$newTagName = 'moderat wichtige Dateien';
@@ -93,7 +93,7 @@ class EditTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testAlreadyExists() {
+ public function testAlreadyExists(): void {
$tagId = '5';
$tagName = 'unwichtige Dateien';
$tagUserVisible = false;
@@ -157,7 +157,7 @@ class EditTest extends TestCase {
$this->invokePrivate($this->command, 'execute', [$this->input, $this->output]);
}
- public function testNotFound() {
+ public function testNotFound(): void {
$tagId = '404';
$this->input->method('getArgument')
@@ -169,8 +169,8 @@ class EditTest extends TestCase {
});
$this->systemTagManager->method('getTagsByIds')
- ->with($tagId)
- ->willReturn([]);
+ ->with($tagId)
+ ->willReturn([]);
$this->output->expects($this->once())
->method('writeln')
diff --git a/tests/Core/Command/SystemTag/ListCommandTest.php b/tests/Core/Command/SystemTag/ListCommandTest.php
index c7e213a782c..9f4c4072ffc 100644
--- a/tests/Core/Command/SystemTag/ListCommandTest.php
+++ b/tests/Core/Command/SystemTag/ListCommandTest.php
@@ -39,7 +39,7 @@ class ListCommandTest extends TestCase {
$this->output = $this->createMock(OutputInterface::class);
}
- public function testExecute() {
+ public function testExecute(): void {
$tag1 = $this->createMock(ISystemTag::class);
$tag1->method('getId')->willReturn('1');
$tag1->method('getName')->willReturn('public_tag');
diff --git a/tests/Core/Command/TwoFactorAuth/CleanupTest.php b/tests/Core/Command/TwoFactorAuth/CleanupTest.php
index 8f082d76856..1d4731ff0c2 100644
--- a/tests/Core/Command/TwoFactorAuth/CleanupTest.php
+++ b/tests/Core/Command/TwoFactorAuth/CleanupTest.php
@@ -36,7 +36,7 @@ class CleanupTest extends TestCase {
$this->cmd = new CommandTester($cmd);
}
- public function testCleanup() {
+ public function testCleanup(): void {
$this->registry->expects($this->once())
->method('cleanUp')
->with('u2f');
@@ -47,6 +47,6 @@ class CleanupTest extends TestCase {
$this->assertEquals(0, $rc);
$output = $this->cmd->getDisplay();
- $this->assertStringContainsString("All user-provider associations for provider u2f have been removed", $output);
+ $this->assertStringContainsString('All user-provider associations for provider u2f have been removed', $output);
}
}
diff --git a/tests/Core/Command/TwoFactorAuth/DisableTest.php b/tests/Core/Command/TwoFactorAuth/DisableTest.php
index 4c1db3b1dc2..ab6b10f8964 100644
--- a/tests/Core/Command/TwoFactorAuth/DisableTest.php
+++ b/tests/Core/Command/TwoFactorAuth/DisableTest.php
@@ -37,7 +37,7 @@ class DisableTest extends TestCase {
$this->command = new CommandTester($cmd);
}
- public function testInvalidUID() {
+ public function testInvalidUID(): void {
$this->userManager->expects($this->once())
->method('get')
->with('nope')
@@ -49,10 +49,10 @@ class DisableTest extends TestCase {
]);
$this->assertEquals(1, $rc);
- $this->assertStringContainsString("Invalid UID", $this->command->getDisplay());
+ $this->assertStringContainsString('Invalid UID', $this->command->getDisplay());
}
- public function testEnableNotSupported() {
+ public function testEnableNotSupported(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')
@@ -69,10 +69,10 @@ class DisableTest extends TestCase {
]);
$this->assertEquals(2, $rc);
- $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay());
+ $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay());
}
- public function testEnabled() {
+ public function testEnabled(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')
@@ -89,6 +89,6 @@ class DisableTest extends TestCase {
]);
$this->assertEquals(0, $rc);
- $this->assertStringContainsString("Two-factor provider totp disabled for user ricky", $this->command->getDisplay());
+ $this->assertStringContainsString('Two-factor provider totp disabled for user ricky', $this->command->getDisplay());
}
}
diff --git a/tests/Core/Command/TwoFactorAuth/EnableTest.php b/tests/Core/Command/TwoFactorAuth/EnableTest.php
index 79755b9984d..7c34d6692c5 100644
--- a/tests/Core/Command/TwoFactorAuth/EnableTest.php
+++ b/tests/Core/Command/TwoFactorAuth/EnableTest.php
@@ -37,7 +37,7 @@ class EnableTest extends TestCase {
$this->command = new CommandTester($cmd);
}
- public function testInvalidUID() {
+ public function testInvalidUID(): void {
$this->userManager->expects($this->once())
->method('get')
->with('nope')
@@ -49,10 +49,10 @@ class EnableTest extends TestCase {
]);
$this->assertEquals(1, $rc);
- $this->assertStringContainsString("Invalid UID", $this->command->getDisplay());
+ $this->assertStringContainsString('Invalid UID', $this->command->getDisplay());
}
- public function testEnableNotSupported() {
+ public function testEnableNotSupported(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')
@@ -69,10 +69,10 @@ class EnableTest extends TestCase {
]);
$this->assertEquals(2, $rc);
- $this->assertStringContainsString("The provider does not support this operation", $this->command->getDisplay());
+ $this->assertStringContainsString('The provider does not support this operation', $this->command->getDisplay());
}
- public function testEnabled() {
+ public function testEnabled(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')
@@ -89,6 +89,6 @@ class EnableTest extends TestCase {
]);
$this->assertEquals(0, $rc);
- $this->assertStringContainsString("Two-factor provider totp enabled for user belle", $this->command->getDisplay());
+ $this->assertStringContainsString('Two-factor provider totp enabled for user belle', $this->command->getDisplay());
}
}
diff --git a/tests/Core/Command/TwoFactorAuth/EnforceTest.php b/tests/Core/Command/TwoFactorAuth/EnforceTest.php
index 073ea7dede8..03118772377 100644
--- a/tests/Core/Command/TwoFactorAuth/EnforceTest.php
+++ b/tests/Core/Command/TwoFactorAuth/EnforceTest.php
@@ -32,7 +32,7 @@ class EnforceTest extends TestCase {
$this->command = new CommandTester($command);
}
- public function testEnforce() {
+ public function testEnforce(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('setState')
->with($this->equalTo(new EnforcementState(true)));
@@ -46,10 +46,10 @@ class EnforceTest extends TestCase {
$this->assertEquals(0, $rc);
$display = $this->command->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display);
+ $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display);
}
- public function testEnforceForOneGroup() {
+ public function testEnforceForOneGroup(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('setState')
->with($this->equalTo(new EnforcementState(true, ['twofactorers'])));
@@ -64,10 +64,10 @@ class EnforceTest extends TestCase {
$this->assertEquals(0, $rc);
$display = $this->command->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is enforced for members of the group(s) twofactorers", $display);
+ $this->assertStringContainsString('Two-factor authentication is enforced for members of the group(s) twofactorers', $display);
}
- public function testEnforceForAllExceptOneGroup() {
+ public function testEnforceForAllExceptOneGroup(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('setState')
->with($this->equalTo(new EnforcementState(true, [], ['yoloers'])));
@@ -82,10 +82,10 @@ class EnforceTest extends TestCase {
$this->assertEquals(0, $rc);
$display = $this->command->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is enforced for all users, except members of yoloers", $display);
+ $this->assertStringContainsString('Two-factor authentication is enforced for all users, except members of yoloers', $display);
}
- public function testDisableEnforced() {
+ public function testDisableEnforced(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('setState')
->with(new EnforcementState(false));
@@ -99,10 +99,10 @@ class EnforceTest extends TestCase {
$this->assertEquals(0, $rc);
$display = $this->command->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is not enforced", $display);
+ $this->assertStringContainsString('Two-factor authentication is not enforced', $display);
}
- public function testCurrentStateEnabled() {
+ public function testCurrentStateEnabled(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('getState')
->willReturn(new EnforcementState(true));
@@ -111,10 +111,10 @@ class EnforceTest extends TestCase {
$this->assertEquals(0, $rc);
$display = $this->command->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is enforced for all users", $display);
+ $this->assertStringContainsString('Two-factor authentication is enforced for all users', $display);
}
- public function testCurrentStateDisabled() {
+ public function testCurrentStateDisabled(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('getState')
->willReturn(new EnforcementState(false));
@@ -123,6 +123,6 @@ class EnforceTest extends TestCase {
$this->assertEquals(0, $rc);
$display = $this->command->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is not enforced", $display);
+ $this->assertStringContainsString('Two-factor authentication is not enforced', $display);
}
}
diff --git a/tests/Core/Command/TwoFactorAuth/StateTest.php b/tests/Core/Command/TwoFactorAuth/StateTest.php
index 23cb21f75d6..f4ca3c4e031 100644
--- a/tests/Core/Command/TwoFactorAuth/StateTest.php
+++ b/tests/Core/Command/TwoFactorAuth/StateTest.php
@@ -37,16 +37,16 @@ class StateTest extends TestCase {
$this->cmd = new CommandTester($cmd);
}
- public function testWrongUID() {
+ public function testWrongUID(): void {
$this->cmd->execute([
'uid' => 'nope',
]);
$output = $this->cmd->getDisplay();
- $this->assertStringContainsString("Invalid UID", $output);
+ $this->assertStringContainsString('Invalid UID', $output);
}
- public function testStateNoProvidersActive() {
+ public function testStateNoProvidersActive(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')
@@ -66,10 +66,10 @@ class StateTest extends TestCase {
]);
$output = $this->cmd->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is not enabled for user eldora", $output);
+ $this->assertStringContainsString('Two-factor authentication is not enabled for user eldora', $output);
}
- public function testStateOneProviderActive() {
+ public function testStateOneProviderActive(): void {
$user = $this->createMock(IUser::class);
$this->userManager->expects($this->once())
->method('get')
@@ -89,6 +89,6 @@ class StateTest extends TestCase {
]);
$output = $this->cmd->getDisplay();
- $this->assertStringContainsString("Two-factor authentication is enabled for user mohamed", $output);
+ $this->assertStringContainsString('Two-factor authentication is enabled for user mohamed', $output);
}
}
diff --git a/tests/Core/Command/User/AuthTokens/DeleteTest.php b/tests/Core/Command/User/AuthTokens/DeleteTest.php
index bd82475b206..8588c1d5d54 100644
--- a/tests/Core/Command/User/AuthTokens/DeleteTest.php
+++ b/tests/Core/Command/User/AuthTokens/DeleteTest.php
@@ -37,7 +37,7 @@ class DeleteTest extends TestCase {
$this->command = new Delete($tokenProvider);
}
- public function testDeleteTokenById() {
+ public function testDeleteTokenById(): void {
$this->consoleInput->expects($this->exactly(2))
->method('getArgument')
->withConsecutive(['uid'], ['id'])
@@ -56,7 +56,7 @@ class DeleteTest extends TestCase {
$this->assertSame(Command::SUCCESS, $result);
}
- public function testDeleteTokenByIdRequiresTokenId() {
+ public function testDeleteTokenByIdRequiresTokenId(): void {
$this->consoleInput->expects($this->exactly(2))
->method('getArgument')
->withConsecutive(['uid'], ['id'])
@@ -75,7 +75,7 @@ class DeleteTest extends TestCase {
$this->assertSame(Command::FAILURE, $result);
}
- public function testDeleteTokensLastUsedBefore() {
+ public function testDeleteTokensLastUsedBefore(): void {
$this->consoleInput->expects($this->exactly(2))
->method('getArgument')
->withConsecutive(['uid'], ['id'])
@@ -94,7 +94,7 @@ class DeleteTest extends TestCase {
$this->assertSame(Command::SUCCESS, $result);
}
- public function testLastUsedBeforeAcceptsIso8601Expanded() {
+ public function testLastUsedBeforeAcceptsIso8601Expanded(): void {
$this->consoleInput->expects($this->exactly(2))
->method('getArgument')
->withConsecutive(['uid'], ['id'])
@@ -113,7 +113,7 @@ class DeleteTest extends TestCase {
$this->assertSame(Command::SUCCESS, $result);
}
- public function testLastUsedBeforeAcceptsYmd() {
+ public function testLastUsedBeforeAcceptsYmd(): void {
$this->consoleInput->expects($this->exactly(2))
->method('getArgument')
->withConsecutive(['uid'], ['id'])
@@ -132,7 +132,7 @@ class DeleteTest extends TestCase {
$this->assertSame(Command::SUCCESS, $result);
}
- public function testIdAndLastUsedBeforeAreMutuallyExclusive() {
+ public function testIdAndLastUsedBeforeAreMutuallyExclusive(): void {
$this->consoleInput->expects($this->exactly(2))
->method('getArgument')
->withConsecutive(['uid'], ['id'])
diff --git a/tests/Core/Command/User/DeleteTest.php b/tests/Core/Command/User/DeleteTest.php
index 74b98b0246a..42244412d9f 100644
--- a/tests/Core/Command/User/DeleteTest.php
+++ b/tests/Core/Command/User/DeleteTest.php
@@ -52,7 +52,7 @@ class DeleteTest extends TestCase {
* @param bool $deleteSuccess
* @param string $expectedString
*/
- public function testValidUser($deleteSuccess, $expectedString) {
+ public function testValidUser($deleteSuccess, $expectedString): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
->method('delete')
@@ -75,7 +75,7 @@ class DeleteTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testInvalidUser() {
+ public function testInvalidUser(): void {
$this->userManager->expects($this->once())
->method('get')
->with('user')
diff --git a/tests/Core/Command/User/DisableTest.php b/tests/Core/Command/User/DisableTest.php
index a080eb9379a..1e464ca93a5 100644
--- a/tests/Core/Command/User/DisableTest.php
+++ b/tests/Core/Command/User/DisableTest.php
@@ -34,7 +34,7 @@ class DisableTest extends TestCase {
$this->command = new Disable($this->userManager);
}
- public function testValidUser() {
+ public function testValidUser(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('setEnabled')
@@ -57,7 +57,7 @@ class DisableTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testInvalidUser() {
+ public function testInvalidUser(): void {
$this->userManager->expects($this->once())
->method('get')
->with('user')
diff --git a/tests/Core/Command/User/EnableTest.php b/tests/Core/Command/User/EnableTest.php
index 39af10f2ef3..b590530d93d 100644
--- a/tests/Core/Command/User/EnableTest.php
+++ b/tests/Core/Command/User/EnableTest.php
@@ -34,7 +34,7 @@ class EnableTest extends TestCase {
$this->command = new Enable($this->userManager);
}
- public function testValidUser() {
+ public function testValidUser(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->once())
->method('setEnabled')
@@ -57,7 +57,7 @@ class EnableTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testInvalidUser() {
+ public function testInvalidUser(): void {
$this->userManager->expects($this->once())
->method('get')
->with('user')
diff --git a/tests/Core/Command/User/LastSeenTest.php b/tests/Core/Command/User/LastSeenTest.php
index 1146c0664d4..014c981112e 100644
--- a/tests/Core/Command/User/LastSeenTest.php
+++ b/tests/Core/Command/User/LastSeenTest.php
@@ -51,7 +51,7 @@ class LastSeenTest extends TestCase {
* @param int $lastSeen
* @param string $expectedString
*/
- public function testValidUser($lastSeen, $expectedString) {
+ public function testValidUser($lastSeen, $expectedString): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->once())
->method('getLastLogin')
@@ -74,7 +74,7 @@ class LastSeenTest extends TestCase {
self::invokePrivate($this->command, 'execute', [$this->consoleInput, $this->consoleOutput]);
}
- public function testInvalidUser() {
+ public function testInvalidUser(): void {
$this->userManager->expects($this->once())
->method('get')
->with('user')
diff --git a/tests/Core/Command/User/SettingTest.php b/tests/Core/Command/User/SettingTest.php
index 7be9bd27ecb..6848b0bb350 100644
--- a/tests/Core/Command/User/SettingTest.php
+++ b/tests/Core/Command/User/SettingTest.php
@@ -185,7 +185,7 @@ class SettingTest extends TestCase {
* @param mixed $user
* @param string $expectedException
*/
- public function testCheckInput($arguments, $options, $parameterOptions, $user, $expectedException) {
+ public function testCheckInput($arguments, $options, $parameterOptions, $user, $expectedException): void {
$this->consoleInput->expects($this->any())
->method('getArgument')
->willReturnMap($arguments);
@@ -214,7 +214,7 @@ class SettingTest extends TestCase {
}
}
- public function testCheckInputExceptionCatch() {
+ public function testCheckInputExceptionCatch(): void {
$command = $this->getCommand(['checkInput']);
$command->expects($this->once())
->method('checkInput')
@@ -244,7 +244,7 @@ class SettingTest extends TestCase {
* @param string $expectedLine
* @param int $expectedReturn
*/
- public function testExecuteDelete($value, $errorIfNotExists, $expectedLine, $expectedReturn) {
+ public function testExecuteDelete($value, $errorIfNotExists, $expectedLine, $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
'checkInput',
@@ -308,7 +308,7 @@ class SettingTest extends TestCase {
* @param string $expectedLine
* @param int $expectedReturn
*/
- public function testExecuteSet($value, $updateOnly, $expectedLine, $expectedReturn) {
+ public function testExecuteSet($value, $updateOnly, $expectedLine, $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
'checkInput',
@@ -375,7 +375,7 @@ class SettingTest extends TestCase {
* @param string $expectedLine
* @param int $expectedReturn
*/
- public function testExecuteGet($value, $defaultValue, $expectedLine, $expectedReturn) {
+ public function testExecuteGet($value, $defaultValue, $expectedLine, $expectedReturn): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
'checkInput',
@@ -425,7 +425,7 @@ class SettingTest extends TestCase {
$this->assertEquals($expectedReturn, $this->invokePrivate($command, 'execute', [$this->consoleInput, $this->consoleOutput]));
}
- public function testExecuteList() {
+ public function testExecuteList(): void {
$command = $this->getCommand([
'writeArrayInOutputFormat',
'checkInput',
diff --git a/tests/Core/Controller/AppPasswordControllerTest.php b/tests/Core/Controller/AppPasswordControllerTest.php
index 6b7b023ab2e..f0246561145 100644
--- a/tests/Core/Controller/AppPasswordControllerTest.php
+++ b/tests/Core/Controller/AppPasswordControllerTest.php
@@ -86,7 +86,7 @@ class AppPasswordControllerTest extends TestCase {
);
}
- public function testGetAppPasswordWithAppPassword() {
+ public function testGetAppPasswordWithAppPassword(): void {
$this->session->method('exists')
->with('app_password')
->willReturn(true);
@@ -96,7 +96,7 @@ class AppPasswordControllerTest extends TestCase {
$this->controller->getAppPassword();
}
- public function testGetAppPasswordNoLoginCreds() {
+ public function testGetAppPasswordNoLoginCreds(): void {
$this->session->method('exists')
->with('app_password')
->willReturn(false);
@@ -108,7 +108,7 @@ class AppPasswordControllerTest extends TestCase {
$this->controller->getAppPassword();
}
- public function testGetAppPassword() {
+ public function testGetAppPassword(): void {
$credentials = $this->createMock(ICredentials::class);
$this->session->method('exists')
@@ -149,7 +149,7 @@ class AppPasswordControllerTest extends TestCase {
$this->controller->getAppPassword();
}
- public function testGetAppPasswordNoPassword() {
+ public function testGetAppPasswordNoPassword(): void {
$credentials = $this->createMock(ICredentials::class);
$this->session->method('exists')
@@ -190,7 +190,7 @@ class AppPasswordControllerTest extends TestCase {
$this->controller->getAppPassword();
}
- public function testDeleteAppPasswordNoAppPassword() {
+ public function testDeleteAppPasswordNoAppPassword(): void {
$this->session->method('exists')
->with('app_password')
->willReturn(false);
@@ -200,7 +200,7 @@ class AppPasswordControllerTest extends TestCase {
$this->controller->deleteAppPassword();
}
- public function testDeleteAppPasswordFails() {
+ public function testDeleteAppPasswordFails(): void {
$this->session->method('exists')
->with('app_password')
->willReturn(true);
@@ -217,7 +217,7 @@ class AppPasswordControllerTest extends TestCase {
$this->controller->deleteAppPassword();
}
- public function testDeleteAppPasswordSuccess() {
+ public function testDeleteAppPasswordSuccess(): void {
$this->session->method('exists')
->with('app_password')
->willReturn(true);
diff --git a/tests/Core/Controller/AutoCompleteControllerTest.php b/tests/Core/Controller/AutoCompleteControllerTest.php
index e2797181097..23bd03be7af 100644
--- a/tests/Core/Controller/AutoCompleteControllerTest.php
+++ b/tests/Core/Controller/AutoCompleteControllerTest.php
@@ -15,13 +15,13 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class AutoCompleteControllerTest extends TestCase {
- /** @var ISearch|MockObject */
+ /** @var ISearch|MockObject */
protected $collaboratorSearch;
- /** @var IManager|MockObject */
+ /** @var IManager|MockObject */
protected $autoCompleteManager;
- /** @var IEventDispatcher|MockObject */
+ /** @var IEventDispatcher|MockObject */
protected $dispatcher;
- /** @var AutoCompleteController */
+ /** @var AutoCompleteController */
protected $controller;
protected function setUp(): void {
@@ -156,7 +156,7 @@ class AutoCompleteControllerTest extends TestCase {
/**
* @dataProvider searchDataProvider
*/
- public function testGet(array $searchResults, array $expected, string $searchTerm, ?string $itemType, ?string $itemId, ?string $sorter) {
+ public function testGet(array $searchResults, array $expected, string $searchTerm, ?string $itemType, ?string $itemId, ?string $sorter): void {
$this->collaboratorSearch->expects($this->once())
->method('search')
->willReturn([$searchResults, false]);
diff --git a/tests/Core/Controller/AvatarControllerTest.php b/tests/Core/Controller/AvatarControllerTest.php
index b000482e29a..3a1123c940b 100644
--- a/tests/Core/Controller/AvatarControllerTest.php
+++ b/tests/Core/Controller/AvatarControllerTest.php
@@ -128,7 +128,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Fetch an avatar if a user has no avatar
*/
- public function testGetAvatarNoAvatar() {
+ public function testGetAvatarNoAvatar(): void {
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$this->avatarMock->method('getFile')->will($this->throwException(new NotFoundException()));
$response = $this->avatarController->getAvatar('userId', 32);
@@ -140,7 +140,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Fetch the user's avatar
*/
- public function testGetAvatar() {
+ public function testGetAvatar(): void {
$this->avatarMock->method('getFile')->willReturn($this->avatarFile);
$this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock);
$this->avatarMock->expects($this->once())
@@ -161,7 +161,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Fetch the user's avatar
*/
- public function testGetGeneratedAvatar() {
+ public function testGetGeneratedAvatar(): void {
$this->avatarMock->method('getFile')->willReturn($this->avatarFile);
$this->avatarManager->method('getAvatar')->with('userId')->willReturn($this->avatarMock);
@@ -179,7 +179,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Fetch the avatar of a non-existing user
*/
- public function testGetAvatarNoUser() {
+ public function testGetAvatarNoUser(): void {
$this->avatarManager
->method('getAvatar')
->with('userDoesNotExist')
@@ -276,7 +276,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Remove an avatar
*/
- public function testDeleteAvatar() {
+ public function testDeleteAvatar(): void {
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$response = $this->avatarController->deleteAvatar();
@@ -286,13 +286,13 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test what happens if the removing of the avatar fails
*/
- public function testDeleteAvatarException() {
- $this->avatarMock->method('remove')->will($this->throwException(new \Exception("foo")));
+ public function testDeleteAvatarException(): void {
+ $this->avatarMock->method('remove')->will($this->throwException(new \Exception('foo')));
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$this->logger->expects($this->once())
->method('error')
- ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']);
+ ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']);
$expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expectedResponse, $this->avatarController->deleteAvatar());
}
@@ -300,7 +300,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Trying to get a tmp avatar when it is not available. 404
*/
- public function testTmpAvatarNoTmp() {
+ public function testTmpAvatarNoTmp(): void {
$response = $this->avatarController->getTmpAvatar();
$this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus());
}
@@ -308,7 +308,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Fetch tmp avatar
*/
- public function testTmpAvatarValid() {
+ public function testTmpAvatarValid(): void {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$response = $this->avatarController->getTmpAvatar();
@@ -319,7 +319,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* When trying to post a new avatar a path or image should be posted.
*/
- public function testPostAvatarNoPathOrImage() {
+ public function testPostAvatarNoPathOrImage(): void {
$response = $this->avatarController->postAvatar(null);
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus());
@@ -328,9 +328,9 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test a correct post of an avatar using POST
*/
- public function testPostAvatarFile() {
+ public function testPostAvatarFile(): void {
//Create temp file
- $fileName = tempnam('', "avatarTest");
+ $fileName = tempnam('', 'avatarTest');
$copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.jpg', $fileName);
$this->assertTrue($copyRes);
@@ -353,7 +353,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test invalid post os an avatar using POST
*/
- public function testPostAvatarInvalidFile() {
+ public function testPostAvatarInvalidFile(): void {
//Create request return
$reqRet = ['error' => [1], 'tmp_name' => ['foo']];
$this->request->method('getUploadedFile')->willReturn($reqRet);
@@ -366,9 +366,9 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Check what happens when we upload a GIF
*/
- public function testPostAvatarFileGif() {
+ public function testPostAvatarFileGif(): void {
//Create temp file
- $fileName = tempnam('', "avatarTest");
+ $fileName = tempnam('', 'avatarTest');
$copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.gif', $fileName);
$this->assertTrue($copyRes);
@@ -390,7 +390,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test posting avatar from existing file
*/
- public function testPostAvatarFromFile() {
+ public function testPostAvatarFromFile(): void {
//Mock node API call
$file = $this->getMockBuilder('OCP\Files\File')
->disableOriginalConstructor()->getMock();
@@ -414,7 +414,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test posting avatar from existing folder
*/
- public function testPostAvatarFromNoFile() {
+ public function testPostAvatarFromNoFile(): void {
$file = $this->getMockBuilder('OCP\Files\Node')->getMock();
$userFolder = $this->getMockBuilder('OCP\Files\Folder')->getMock();
$this->rootFolder->method('getUserFolder')->with('userid')->willReturn($userFolder);
@@ -430,7 +430,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->assertEquals(['data' => ['message' => 'Please select a file.']], $response->getData());
}
- public function testPostAvatarInvalidType() {
+ public function testPostAvatarInvalidType(): void {
$file = $this->getMockBuilder('OCP\Files\File')
->disableOriginalConstructor()->getMock();
$file->expects($this->never())
@@ -446,7 +446,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->assertEquals($expectedResponse, $this->avatarController->postAvatar('avatar.jpg'));
}
- public function testPostAvatarNotPermittedException() {
+ public function testPostAvatarNotPermittedException(): void {
$file = $this->getMockBuilder('OCP\Files\File')
->disableOriginalConstructor()->getMock();
$file->expects($this->once())
@@ -466,10 +466,10 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test what happens if the upload of the avatar fails
*/
- public function testPostAvatarException() {
+ public function testPostAvatarException(): void {
$this->cache->expects($this->once())
->method('set')
- ->will($this->throwException(new \Exception("foo")));
+ ->will($this->throwException(new \Exception('foo')));
$file = $this->getMockBuilder('OCP\Files\File')
->disableOriginalConstructor()->getMock();
$file->expects($this->once())
@@ -484,7 +484,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('error')
- ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']);
+ ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']);
$expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_OK);
$this->assertEquals($expectedResponse, $this->avatarController->postAvatar('avatar.jpg'));
}
@@ -493,7 +493,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test invalid crop argument
*/
- public function testPostCroppedAvatarInvalidCrop() {
+ public function testPostCroppedAvatarInvalidCrop(): void {
$response = $this->avatarController->postCroppedAvatar([]);
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus());
@@ -502,7 +502,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test no tmp avatar to crop
*/
- public function testPostCroppedAvatarNoTmpAvatar() {
+ public function testPostCroppedAvatarNoTmpAvatar(): void {
$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]);
$this->assertEquals(Http::STATUS_BAD_REQUEST, $response->getStatus());
@@ -511,7 +511,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test with non square crop
*/
- public function testPostCroppedAvatarNoSquareCrop() {
+ public function testPostCroppedAvatarNoSquareCrop(): void {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->avatarMock->method('set')->will($this->throwException(new \OC\NotSquareException));
@@ -524,7 +524,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Check for proper reply on proper crop argument
*/
- public function testPostCroppedAvatarValidCrop() {
+ public function testPostCroppedAvatarValidCrop(): void {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->avatarManager->method('getAvatar')->willReturn($this->avatarMock);
$response = $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 10]);
@@ -536,7 +536,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Test what happens if the cropping of the avatar fails
*/
- public function testPostCroppedAvatarException() {
+ public function testPostCroppedAvatarException(): void {
$this->cache->method('get')->willReturn(file_get_contents(\OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->avatarMock->method('set')->will($this->throwException(new \Exception('foo')));
@@ -544,7 +544,7 @@ class AvatarControllerTest extends \Test\TestCase {
$this->logger->expects($this->once())
->method('error')
- ->with('foo', ['exception' => new \Exception("foo"), 'app' => 'core']);
+ ->with('foo', ['exception' => new \Exception('foo'), 'app' => 'core']);
$expectedResponse = new Http\JSONResponse(['data' => ['message' => 'An error occurred. Please contact your admin.']], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expectedResponse, $this->avatarController->postCroppedAvatar(['x' => 0, 'y' => 0, 'w' => 10, 'h' => 11]));
}
@@ -553,7 +553,7 @@ class AvatarControllerTest extends \Test\TestCase {
/**
* Check for proper reply on proper crop argument
*/
- public function testFileTooBig() {
+ public function testFileTooBig(): void {
$fileName = \OC::$SERVERROOT.'/tests/data/testimage.jpg';
//Create request return
$reqRet = ['error' => [0], 'tmp_name' => [$fileName], 'size' => [21 * 1024 * 1024]];
diff --git a/tests/Core/Controller/ChangePasswordControllerTest.php b/tests/Core/Controller/ChangePasswordControllerTest.php
index 93fb4196d35..a806b091477 100644
--- a/tests/Core/Controller/ChangePasswordControllerTest.php
+++ b/tests/Core/Controller/ChangePasswordControllerTest.php
@@ -60,7 +60,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
);
}
- public function testChangePersonalPasswordWrongPassword() {
+ public function testChangePersonalPasswordWrongPassword(): void {
$this->userSession->expects($this->once())
->method('getLoginName')
->willReturn($this->loginName);
@@ -82,7 +82,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
$this->assertEquals($expects, $actual);
}
- public function testChangePersonalPasswordCommonPassword() {
+ public function testChangePersonalPasswordCommonPassword(): void {
$this->userSession->expects($this->once())
->method('getLoginName')
->willReturn($this->loginName);
@@ -109,7 +109,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
$this->assertEquals($expects, $actual);
}
- public function testChangePersonalPasswordNoNewPassword() {
+ public function testChangePersonalPasswordNoNewPassword(): void {
$this->userSession->expects($this->once())
->method('getLoginName')
->willReturn($this->loginName);
@@ -132,7 +132,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
$this->assertEquals($expects, $res->getData());
}
- public function testChangePersonalPasswordCantSetPassword() {
+ public function testChangePersonalPasswordCantSetPassword(): void {
$this->userSession->expects($this->once())
->method('getLoginName')
->willReturn($this->loginName);
@@ -159,7 +159,7 @@ class ChangePasswordControllerTest extends \Test\TestCase {
$this->assertEquals($expects, $actual);
}
- public function testChangePersonalPassword() {
+ public function testChangePersonalPassword(): void {
$this->userSession->expects($this->once())
->method('getLoginName')
->willReturn($this->loginName);
diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php
index 98f09f0f18c..a38f73c85a6 100644
--- a/tests/Core/Controller/ClientFlowLoginControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php
@@ -102,7 +102,7 @@ class ClientFlowLoginControllerTest extends TestCase {
);
}
- public function testShowAuthPickerPageNoClientOrOauthRequest() {
+ public function testShowAuthPickerPageNoClientOrOauthRequest(): void {
$expected = new StandaloneTemplateResponse(
'core',
'error',
@@ -121,7 +121,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage());
}
- public function testShowAuthPickerPageWithOcsHeader() {
+ public function testShowAuthPickerPageWithOcsHeader(): void {
$this->request
->method('getHeader')
->withConsecutive(
@@ -183,7 +183,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage());
}
- public function testShowAuthPickerPageWithOauth() {
+ public function testShowAuthPickerPageWithOauth(): void {
$this->request
->method('getHeader')
->withConsecutive(
@@ -253,7 +253,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage('MyClientIdentifier'));
}
- public function testGenerateAppPasswordWithInvalidToken() {
+ public function testGenerateAppPasswordWithInvalidToken(): void {
$this->session
->expects($this->once())
->method('get')
@@ -276,7 +276,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
}
- public function testGenerateAppPasswordWithSessionNotAvailableException() {
+ public function testGenerateAppPasswordWithSessionNotAvailableException(): void {
$this->session
->expects($this->once())
->method('get')
@@ -296,7 +296,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
}
- public function testGenerateAppPasswordWithInvalidTokenException() {
+ public function testGenerateAppPasswordWithInvalidTokenException(): void {
$this->session
->expects($this->once())
->method('get')
@@ -321,7 +321,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken'));
}
- public function testGeneratePasswordWithPassword() {
+ public function testGeneratePasswordWithPassword(): void {
$this->session
->expects($this->once())
->method('get')
@@ -405,7 +405,7 @@ class ClientFlowLoginControllerTest extends TestCase {
* ["https://example.com/redirect.php?hello=world", "https://example.com/redirect.php?hello=world&state=MyOauthState&code=MyAccessCode"]
*
*/
- public function testGeneratePasswordWithPasswordForOauthClient($redirectUri, $redirectUrl) {
+ public function testGeneratePasswordWithPasswordForOauthClient($redirectUri, $redirectUrl): void {
$this->session
->method('get')
->withConsecutive(
@@ -490,7 +490,7 @@ class ClientFlowLoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->clientFlowLoginController->generateAppPassword('MyStateToken', 'MyClientIdentifier'));
}
- public function testGeneratePasswordWithoutPassword() {
+ public function testGeneratePasswordWithoutPassword(): void {
$this->session
->expects($this->once())
->method('get')
@@ -621,7 +621,7 @@ class ClientFlowLoginControllerTest extends TestCase {
* @param string $protocol
* @param string $expected
*/
- public function testGeneratePasswordWithHttpsProxy(array $headers, $protocol, $expected) {
+ public function testGeneratePasswordWithHttpsProxy(array $headers, $protocol, $expected): void {
$this->session
->expects($this->once())
->method('get')
diff --git a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
index eefa2982c74..093b8a3442d 100644
--- a/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
+++ b/tests/Core/Controller/ClientFlowLoginV2ControllerTest.php
@@ -70,7 +70,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
);
}
- public function testPollInvalid() {
+ public function testPollInvalid(): void {
$this->loginFlowV2Service->method('poll')
->with('token')
->willThrowException(new LoginFlowV2NotFoundException());
@@ -81,7 +81,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_NOT_FOUND, $result->getStatus());
}
- public function testPollValid() {
+ public function testPollValid(): void {
$creds = new LoginFlowV2Credentials('server', 'login', 'pass');
$this->loginFlowV2Service->method('poll')
->with('token')
@@ -93,7 +93,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_OK, $result->getStatus());
}
- public function testLandingInvalid() {
+ public function testLandingInvalid(): void {
$this->session->expects($this->never())
->method($this->anything());
@@ -107,7 +107,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertInstanceOf(Http\StandaloneTemplateResponse::class, $result);
}
- public function testLandingValid() {
+ public function testLandingValid(): void {
$this->session->expects($this->once())
->method('set')
->with('client.flow.v2.login.token', 'token');
@@ -127,7 +127,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame('https://server/path', $result->getRedirectURL());
}
- public function testShowAuthPickerNoLoginToken() {
+ public function testShowAuthPickerNoLoginToken(): void {
$this->session->method('get')
->willReturn(null);
@@ -136,7 +136,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testShowAuthPickerInvalidLoginToken() {
+ public function testShowAuthPickerInvalidLoginToken(): void {
$this->session->method('get')
->with('client.flow.v2.login.token')
->willReturn('loginToken');
@@ -150,7 +150,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testShowAuthPickerValidLoginToken() {
+ public function testShowAuthPickerValidLoginToken(): void {
$this->session->method('get')
->with('client.flow.v2.login.token')
->willReturn('loginToken');
@@ -176,7 +176,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testGrantPageInvalidStateToken() {
+ public function testGrantPageInvalidStateToken(): void {
$this->session->method('get')
->willReturnCallback(function ($name) {
return null;
@@ -186,7 +186,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testGrantPageInvalidLoginToken() {
+ public function testGrantPageInvalidLoginToken(): void {
$this->session->method('get')
->willReturnCallback(function ($name) {
if ($name === 'client.flow.v2.state.token') {
@@ -206,7 +206,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testGrantPageValid() {
+ public function testGrantPageValid(): void {
$this->session->method('get')
->willReturnCallback(function ($name) {
if ($name === 'client.flow.v2.state.token') {
@@ -236,7 +236,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
}
- public function testGenerateAppPasswordInvalidStateToken() {
+ public function testGenerateAppPasswordInvalidStateToken(): void {
$this->session->method('get')
->willReturnCallback(function ($name) {
return null;
@@ -246,7 +246,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testGenerateAppPassworInvalidLoginToken() {
+ public function testGenerateAppPassworInvalidLoginToken(): void {
$this->session->method('get')
->willReturnCallback(function ($name) {
if ($name === 'client.flow.v2.state.token') {
@@ -266,7 +266,7 @@ class ClientFlowLoginV2ControllerTest extends TestCase {
$this->assertSame(Http::STATUS_FORBIDDEN, $result->getStatus());
}
- public function testGenerateAppPassworValid() {
+ public function testGenerateAppPassworValid(): void {
$this->session->method('get')
->willReturnCallback(function ($name) {
if ($name === 'client.flow.v2.state.token') {
diff --git a/tests/Core/Controller/ContactsMenuControllerTest.php b/tests/Core/Controller/ContactsMenuControllerTest.php
index d688ea6682f..aa20e6726e2 100644
--- a/tests/Core/Controller/ContactsMenuControllerTest.php
+++ b/tests/Core/Controller/ContactsMenuControllerTest.php
@@ -35,7 +35,7 @@ class ContactsMenuControllerTest extends TestCase {
$this->controller = new ContactsMenuController($request, $this->userSession, $this->contactsManager);
}
- public function testIndex() {
+ public function testIndex(): void {
$user = $this->createMock(IUser::class);
$entries = [
$this->createMock(IEntry::class),
@@ -54,7 +54,7 @@ class ContactsMenuControllerTest extends TestCase {
$this->assertEquals($entries, $response);
}
- public function testFindOne() {
+ public function testFindOne(): void {
$user = $this->createMock(IUser::class);
$entry = $this->createMock(IEntry::class);
$this->userSession->expects($this->once())
@@ -70,7 +70,7 @@ class ContactsMenuControllerTest extends TestCase {
$this->assertEquals($entry, $response);
}
- public function testFindOne404() {
+ public function testFindOne404(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
diff --git a/tests/Core/Controller/CssControllerTest.php b/tests/Core/Controller/CssControllerTest.php
index 8064f36cddb..cae6f7989c4 100644
--- a/tests/Core/Controller/CssControllerTest.php
+++ b/tests/Core/Controller/CssControllerTest.php
@@ -56,7 +56,7 @@ class CssControllerTest extends TestCase {
);
}
- public function testNoCssFolderForApp() {
+ public function testNoCssFolderForApp(): void {
$this->appData->method('getFolder')
->with('myapp')
->willThrowException(new NotFoundException());
@@ -67,7 +67,7 @@ class CssControllerTest extends TestCase {
}
- public function testNoCssFile() {
+ public function testNoCssFile(): void {
$folder = $this->createMock(ISimpleFolder::class);
$this->appData->method('getFolder')
->with('myapp')
@@ -81,7 +81,7 @@ class CssControllerTest extends TestCase {
$this->assertInstanceOf(NotFoundResponse::class, $result);
}
- public function testGetFile() {
+ public function testGetFile(): void {
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
$file->method('getName')->willReturn('my name');
@@ -105,7 +105,7 @@ class CssControllerTest extends TestCase {
$this->assertEquals($expected, $result);
}
- public function testGetGzipFile() {
+ public function testGetGzipFile(): void {
$folder = $this->createMock(ISimpleFolder::class);
$gzipFile = $this->createMock(ISimpleFile::class);
$gzipFile->method('getName')->willReturn('my name');
@@ -134,7 +134,7 @@ class CssControllerTest extends TestCase {
$this->assertEquals($expected, $result);
}
- public function testGetGzipFileNotFound() {
+ public function testGetGzipFileNotFound(): void {
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
$file->method('getName')->willReturn('my name');
diff --git a/tests/Core/Controller/GuestAvatarControllerTest.php b/tests/Core/Controller/GuestAvatarControllerTest.php
index b2f60665948..1ad9e49f858 100644
--- a/tests/Core/Controller/GuestAvatarControllerTest.php
+++ b/tests/Core/Controller/GuestAvatarControllerTest.php
@@ -71,7 +71,7 @@ class GuestAvatarControllerTest extends \Test\TestCase {
/**
* Tests getAvatar returns the guest avatar.
*/
- public function testGetAvatar() {
+ public function testGetAvatar(): void {
$this->avatarManager->expects($this->once())
->method('getGuestAvatar')
->with('Peter')
diff --git a/tests/Core/Controller/JsControllerTest.php b/tests/Core/Controller/JsControllerTest.php
index 5aa853e4ed0..1500ed6eacf 100644
--- a/tests/Core/Controller/JsControllerTest.php
+++ b/tests/Core/Controller/JsControllerTest.php
@@ -56,7 +56,7 @@ class JsControllerTest extends TestCase {
);
}
- public function testNoCssFolderForApp() {
+ public function testNoCssFolderForApp(): void {
$this->appData->method('getFolder')
->with('myapp')
->willThrowException(new NotFoundException());
@@ -67,7 +67,7 @@ class JsControllerTest extends TestCase {
}
- public function testNoCssFile() {
+ public function testNoCssFile(): void {
$folder = $this->createMock(ISimpleFolder::class);
$this->appData->method('getFolder')
->with('myapp')
@@ -81,7 +81,7 @@ class JsControllerTest extends TestCase {
$this->assertInstanceOf(NotFoundResponse::class, $result);
}
- public function testGetFile() {
+ public function testGetFile(): void {
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
$file->method('getName')->willReturn('my name');
@@ -105,7 +105,7 @@ class JsControllerTest extends TestCase {
$this->assertEquals($expected, $result);
}
- public function testGetGzipFile() {
+ public function testGetGzipFile(): void {
$folder = $this->createMock(ISimpleFolder::class);
$gzipFile = $this->createMock(ISimpleFile::class);
$gzipFile->method('getName')->willReturn('my name');
@@ -134,7 +134,7 @@ class JsControllerTest extends TestCase {
$this->assertEquals($expected, $result);
}
- public function testGetGzipFileNotFound() {
+ public function testGetGzipFileNotFound(): void {
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
$file->method('getName')->willReturn('my name');
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php
index 8fe24f156f6..a5ff6fd61a5 100644
--- a/tests/Core/Controller/LoginControllerTest.php
+++ b/tests/Core/Controller/LoginControllerTest.php
@@ -129,7 +129,7 @@ class LoginControllerTest extends TestCase {
);
}
- public function testLogoutWithoutToken() {
+ public function testLogoutWithoutToken(): void {
$this->request
->expects($this->once())
->method('getCookie')
@@ -156,7 +156,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->loginController->logout());
}
- public function testLogoutNoClearSiteData() {
+ public function testLogoutNoClearSiteData(): void {
$this->request
->expects($this->once())
->method('getCookie')
@@ -179,7 +179,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->loginController->logout());
}
- public function testLogoutWithToken() {
+ public function testLogoutWithToken(): void {
$this->request
->expects($this->once())
->method('getCookie')
@@ -216,7 +216,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expected, $this->loginController->logout());
}
- public function testShowLoginFormForLoggedInUsers() {
+ public function testShowLoginFormForLoggedInUsers(): void {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
@@ -230,7 +230,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', ''));
}
- public function testShowLoginFormWithErrorsInSession() {
+ public function testShowLoginFormWithErrorsInSession(): void {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
@@ -285,7 +285,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('', ''));
}
- public function testShowLoginFormForFlowAuth() {
+ public function testShowLoginFormForFlowAuth(): void {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
@@ -332,7 +332,7 @@ class LoginControllerTest extends TestCase {
* @dataProvider passwordResetDataProvider
*/
public function testShowLoginFormWithPasswordResetOption($canChangePassword,
- $expectedResult) {
+ $expectedResult): void {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
@@ -381,7 +381,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $this->loginController->showLoginForm('LdapUser', ''));
}
- public function testShowLoginFormForUserNamed0() {
+ public function testShowLoginFormForUserNamed0(): void {
$this->userSession
->expects($this->once())
->method('isLoggedIn')
@@ -468,7 +468,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expected, $response);
}
- public function testLoginWithValidCredentials() {
+ public function testLoginWithValidCredentials(): void {
$user = 'MyUserName';
$password = 'secret';
$loginChain = $this->createMock(LoginChain::class);
@@ -520,11 +520,10 @@ class LoginControllerTest extends TestCase {
$response = $this->loginController->tryLogin($loginChain, 'Jane', $password, $originalUrl);
$expected = new RedirectResponse('');
- $expected->throttle(['user' => 'Jane']);
$this->assertEquals($expected, $response);
}
- public function testLoginWithoutPassedCsrfCheckAndLoggedIn() {
+ public function testLoginWithoutPassedCsrfCheckAndLoggedIn(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -561,7 +560,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expected, $response);
}
- public function testLoginWithValidCredentialsAndRedirectUrl() {
+ public function testLoginWithValidCredentialsAndRedirectUrl(): void {
$user = 'MyUserName';
$password = 'secret';
$redirectUrl = 'https://next.cloud/apps/mail';
@@ -595,7 +594,7 @@ class LoginControllerTest extends TestCase {
$this->assertEquals($expected, $response);
}
- public function testToNotLeakLoginName() {
+ public function testToNotLeakLoginName(): void {
$loginChain = $this->createMock(LoginChain::class);
$this->request
->expects($this->once())
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 1e1771f7a15..2a99c9f9d16 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -138,7 +138,7 @@ class LostControllerTest extends TestCase {
);
}
- public function testResetFormTokenError() {
+ public function testResetFormTokenError(): void {
$this->userManager->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
@@ -160,7 +160,7 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testResetFormValidToken() {
+ public function testResetFormValidToken(): void {
$this->userManager->method('get')
->with('ValidTokenUser')
->willReturn($this->existingUser);
@@ -188,7 +188,7 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testEmailUnsuccessful() {
+ public function testEmailUnsuccessful(): void {
$existingUser = 'ExistingUser';
$nonExistingUser = 'NonExistingUser';
$this->userManager
@@ -230,12 +230,12 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testEmailSuccessful() {
+ public function testEmailSuccessful(): void {
$this->userManager
- ->expects($this->any())
- ->method('get')
- ->with('ExistingUser')
- ->willReturn($this->existingUser);
+ ->expects($this->any())
+ ->method('get')
+ ->with('ExistingUser')
+ ->willReturn($this->existingUser);
$this->verificationToken->expects($this->once())
->method('create')
->willReturn('ThisIsMaybeANotSoSecretToken!');
@@ -287,17 +287,17 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testEmailWithMailSuccessful() {
+ public function testEmailWithMailSuccessful(): void {
$this->userManager
- ->expects($this->any())
- ->method('get')
- ->with('test@example.com')
- ->willReturn(null);
+ ->expects($this->any())
+ ->method('get')
+ ->with('test@example.com')
+ ->willReturn(null);
$this->userManager
- ->expects($this->any())
- ->method('getByEmail')
- ->with('test@example.com')
- ->willReturn([$this->existingUser]);
+ ->expects($this->any())
+ ->method('getByEmail')
+ ->with('test@example.com')
+ ->willReturn([$this->existingUser]);
$this->verificationToken->expects($this->once())
->method('create')
->willReturn('ThisIsMaybeANotSoSecretToken!');
@@ -349,12 +349,12 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testEmailCantSendException() {
+ public function testEmailCantSendException(): void {
$this->userManager
- ->expects($this->any())
- ->method('get')
- ->with('ExistingUser')
- ->willReturn($this->existingUser);
+ ->expects($this->any())
+ ->method('get')
+ ->with('ExistingUser')
+ ->willReturn($this->existingUser);
$this->verificationToken->expects($this->once())
->method('create')
->willReturn('ThisIsMaybeANotSoSecretToken!');
@@ -409,7 +409,7 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testSetPasswordUnsuccessful() {
+ public function testSetPasswordUnsuccessful(): void {
$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
@@ -435,7 +435,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testSetPasswordSuccessful() {
+ public function testSetPasswordSuccessful(): void {
$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
@@ -463,7 +463,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testSetPasswordExpiredToken() {
+ public function testSetPasswordExpiredToken(): void {
$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('encryptedData');
@@ -482,7 +482,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testSetPasswordInvalidDataInDb() {
+ public function testSetPasswordInvalidDataInDb(): void {
$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('invalidEncryptedData');
@@ -502,7 +502,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testIsSetPasswordWithoutTokenFailing() {
+ public function testIsSetPasswordWithoutTokenFailing(): void {
$this->config->method('getUserValue')
->with('ValidTokenUser', 'core', 'lostpassword', null)
->willReturn('aValidtoken');
@@ -521,7 +521,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testSetPasswordForDisabledUser() {
+ public function testSetPasswordForDisabledUser(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('isEnabled')
@@ -551,7 +551,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testSendEmailNoEmail() {
+ public function testSendEmailNoEmail(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('isEnabled')
@@ -574,7 +574,7 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testSetPasswordEncryptionDontProceedPerUserKey() {
+ public function testSetPasswordEncryptionDontProceedPerUserKey(): void {
/** @var IEncryptionModule|MockObject $encryptionModule */
$encryptionModule = $this->createMock(IEncryptionModule::class);
$encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(true);
@@ -587,7 +587,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testSetPasswordDontProceedMasterKey() {
+ public function testSetPasswordDontProceedMasterKey(): void {
$encryptionModule = $this->createMock(IEncryptionModule::class);
$encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(false);
$this->encryptionManager->expects($this->once())->method('getEncryptionModules')
@@ -615,7 +615,7 @@ class LostControllerTest extends TestCase {
$this->assertSame($expectedResponse, $response->getData());
}
- public function testTwoUsersWithSameEmail() {
+ public function testTwoUsersWithSameEmail(): void {
$user1 = $this->createMock(IUser::class);
$user1->expects($this->any())
->method('getEMailAddress')
@@ -707,12 +707,12 @@ class LostControllerTest extends TestCase {
$this->assertInstanceOf(IUser::class, $result);
}
- public function testTrimEmailInput() {
+ public function testTrimEmailInput(): void {
$this->userManager
- ->expects($this->once())
- ->method('getByEmail')
- ->with('test@example.com')
- ->willReturn([$this->existingUser]);
+ ->expects($this->once())
+ ->method('getByEmail')
+ ->with('test@example.com')
+ ->willReturn([$this->existingUser]);
$this->mailer
->expects($this->once())
@@ -724,12 +724,12 @@ class LostControllerTest extends TestCase {
$this->assertEquals($expectedResponse, $response);
}
- public function testUsernameInput() {
+ public function testUsernameInput(): void {
$this->userManager
- ->expects($this->once())
- ->method('get')
- ->with('ExistingUser')
- ->willReturn($this->existingUser);
+ ->expects($this->once())
+ ->method('get')
+ ->with('ExistingUser')
+ ->willReturn($this->existingUser);
$this->mailer
->expects($this->once())
diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php
index 0d7c91d3034..4995bd2fed0 100644
--- a/tests/Core/Controller/NavigationControllerTest.php
+++ b/tests/Core/Controller/NavigationControllerTest.php
@@ -48,7 +48,7 @@ class NavigationControllerTest extends TestCase {
];
}
/** @dataProvider dataGetNavigation */
- public function testGetAppNavigation($absolute) {
+ public function testGetAppNavigation($absolute): void {
$this->navigationManager->expects($this->once())
->method('getAll')
->with('link')
@@ -77,7 +77,7 @@ class NavigationControllerTest extends TestCase {
}
/** @dataProvider dataGetNavigation */
- public function testGetSettingsNavigation($absolute) {
+ public function testGetSettingsNavigation($absolute): void {
$this->navigationManager->expects($this->once())
->method('getAll')
->with('settings')
@@ -108,7 +108,7 @@ class NavigationControllerTest extends TestCase {
}
}
- public function testGetAppNavigationEtagMatch() {
+ public function testGetAppNavigationEtagMatch(): void {
$navigation = [ ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ];
$this->request->expects($this->once())
->method('getHeader')
@@ -123,7 +123,7 @@ class NavigationControllerTest extends TestCase {
$this->assertEquals(Http::STATUS_NOT_MODIFIED, $actual->getStatus());
}
- public function testGetSettingsNavigationEtagMatch() {
+ public function testGetSettingsNavigationEtagMatch(): void {
$navigation = [ ['id' => 'logout', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ];
$this->request->expects($this->once())
->method('getHeader')
diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php
index 19b87a97359..6fc5f54b8ef 100644
--- a/tests/Core/Controller/OCSControllerTest.php
+++ b/tests/Core/Controller/OCSControllerTest.php
@@ -68,7 +68,7 @@ class OCSControllerTest extends TestCase {
return new DataResponse($data);
}
- public function testGetCapabilities() {
+ public function testGetCapabilities(): void {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(true);
@@ -101,7 +101,7 @@ class OCSControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->getCapabilities());
}
- public function testGetCapabilitiesPublic() {
+ public function testGetCapabilitiesPublic(): void {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(false);
@@ -135,7 +135,7 @@ class OCSControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->getCapabilities());
}
- public function testPersonCheckValid() {
+ public function testPersonCheckValid(): void {
$this->userManager->method('checkPassword')
->with(
$this->equalTo('user'),
@@ -150,7 +150,7 @@ class OCSControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->personCheck('user', 'pass'));
}
- public function testPersonInvalid() {
+ public function testPersonInvalid(): void {
$this->userManager->method('checkPassword')
->with(
$this->equalTo('user'),
@@ -162,7 +162,7 @@ class OCSControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->personCheck('user', 'wrongpass'));
}
- public function testPersonNoLogin() {
+ public function testPersonNoLogin(): void {
$this->userManager->method('checkPassword')
->with(
$this->equalTo('user'),
@@ -173,7 +173,7 @@ class OCSControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->personCheck('', ''));
}
- public function testGetIdentityProofWithNotExistingUser() {
+ public function testGetIdentityProofWithNotExistingUser(): void {
$this->userManager
->expects($this->once())
->method('get')
@@ -184,7 +184,7 @@ class OCSControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->getIdentityProof('NotExistingUser'));
}
- public function testGetIdentityProof() {
+ public function testGetIdentityProof(): void {
$user = $this->createMock(IUser::class);
$key = $this->createMock(Key::class);
$this->userManager
diff --git a/tests/Core/Controller/PreviewControllerTest.php b/tests/Core/Controller/PreviewControllerTest.php
index d330c1d5209..4274f15e8ed 100644
--- a/tests/Core/Controller/PreviewControllerTest.php
+++ b/tests/Core/Controller/PreviewControllerTest.php
@@ -49,28 +49,28 @@ class PreviewControllerTest extends \Test\TestCase {
);
}
- public function testInvalidFile() {
+ public function testInvalidFile(): void {
$res = $this->controller->getPreview('');
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testInvalidWidth() {
+ public function testInvalidWidth(): void {
$res = $this->controller->getPreview('file', 0);
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testInvalidHeight() {
+ public function testInvalidHeight(): void {
$res = $this->controller->getPreview('file', 10, 0);
$expected = new DataResponse([], Http::STATUS_BAD_REQUEST);
$this->assertEquals($expected, $res);
}
- public function testFileNotFound() {
+ public function testFileNotFound(): void {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
->with($this->equalTo($this->userId))
@@ -86,7 +86,7 @@ class PreviewControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $res);
}
- public function testNotAFile() {
+ public function testNotAFile(): void {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
->with($this->equalTo($this->userId))
@@ -103,7 +103,7 @@ class PreviewControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $res);
}
- public function testNoPreviewAndNoIcon() {
+ public function testNoPreviewAndNoIcon(): void {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
->with($this->equalTo($this->userId))
@@ -124,7 +124,7 @@ class PreviewControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $res);
}
- public function testForbiddenFile() {
+ public function testForbiddenFile(): void {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
->with($this->equalTo($this->userId))
@@ -148,7 +148,7 @@ class PreviewControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $res);
}
- public function testNoPreview() {
+ public function testNoPreview(): void {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
->with($this->equalTo($this->userId))
@@ -180,13 +180,14 @@ class PreviewControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $res);
}
- public function testValidPreview() {
+ public function testValidPreview(): void {
$userFolder = $this->createMock(Folder::class);
$this->rootFolder->method('getUserFolder')
->with($this->equalTo($this->userId))
->willReturn($userFolder);
$file = $this->createMock(File::class);
+ $file->method('getId')->willReturn(123);
$userFolder->method('get')
->with($this->equalTo('file'))
->willReturn($file);
diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
index f003975b359..11e18bd622a 100644
--- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php
+++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php
@@ -75,7 +75,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
->willReturn('logoutAttribute');
}
- public function testSelectChallenge() {
+ public function testSelectChallenge(): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$p1 = $this->createMock(IActivatableAtLogin::class);
$p1->method('getId')->willReturn('p1');
@@ -109,7 +109,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->selectChallenge('/some/url'));
}
- public function testShowChallenge() {
+ public function testShowChallenge(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
$provider->method('getId')->willReturn('myprovider');
@@ -160,7 +160,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->showChallenge('myprovider', '/re/dir/ect/url'));
}
- public function testShowInvalidChallenge() {
+ public function testShowInvalidChallenge(): void {
$user = $this->createMock(IUser::class);
$providerSet = new ProviderSet([], false);
@@ -181,7 +181,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->showChallenge('myprovider', 'redirect/url'));
}
- public function testSolveChallenge() {
+ public function testSolveChallenge(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
@@ -206,7 +206,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
}
- public function testSolveValidChallengeAndRedirect() {
+ public function testSolveValidChallengeAndRedirect(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
@@ -231,7 +231,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', 'redirect%20url'));
}
- public function testSolveChallengeInvalidProvider() {
+ public function testSolveChallengeInvalidProvider(): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$this->userSession->expects($this->once())
@@ -251,7 +251,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
}
- public function testSolveInvalidChallenge() {
+ public function testSolveInvalidChallenge(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
@@ -285,10 +285,10 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token', '/url'));
}
- public function testSolveChallengeTwoFactorException() {
+ public function testSolveChallengeTwoFactorException(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
- $exception = new TwoFactorException("2FA failed");
+ $exception = new TwoFactorException('2FA failed');
$this->userSession->expects($this->once())
->method('getUser')
@@ -353,7 +353,7 @@ class TwoFactorChallengeControllerTest extends TestCase {
$this->assertEquals($expected, $response);
}
- public function testSetUpInvalidProvider() {
+ public function testSetUpInvalidProvider(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
->method('getUser')
diff --git a/tests/Core/Controller/UserControllerTest.php b/tests/Core/Controller/UserControllerTest.php
index 09a22913fdc..979c723dd85 100644
--- a/tests/Core/Controller/UserControllerTest.php
+++ b/tests/Core/Controller/UserControllerTest.php
@@ -31,7 +31,7 @@ class UserControllerTest extends TestCase {
);
}
- public function testGetDisplayNames() {
+ public function testGetDisplayNames(): void {
$user = $this->createMock(IUser::class);
$user->method('getDisplayName')
->willReturn('FooDisplay Name');
diff --git a/tests/Core/Controller/WellKnownControllerTest.php b/tests/Core/Controller/WellKnownControllerTest.php
index 99c693c78b7..35606dc6384 100644
--- a/tests/Core/Controller/WellKnownControllerTest.php
+++ b/tests/Core/Controller/WellKnownControllerTest.php
@@ -40,7 +40,7 @@ class WellKnownControllerTest extends TestCase {
}
public function testHandleNotProcessed(): void {
- $httpResponse = $this->controller->handle("nodeinfo");
+ $httpResponse = $this->controller->handle('nodeinfo');
self::assertInstanceOf(JSONResponse::class, $httpResponse);
self::assertArrayHasKey('X-NEXTCLOUD-WELL-KNOWN', $httpResponse->getHeaders());
@@ -55,14 +55,14 @@ class WellKnownControllerTest extends TestCase {
$this->manager->expects(self::once())
->method('process')
->with(
- "nodeinfo",
+ 'nodeinfo',
$this->request
)->willReturn($response);
$jsonResponse->expects(self::once())
->method('addHeader')
->willReturnSelf();
- $httpResponse = $this->controller->handle("nodeinfo");
+ $httpResponse = $this->controller->handle('nodeinfo');
self::assertInstanceOf(JSONResponse::class, $httpResponse);
}
diff --git a/tests/Core/Controller/WipeControllerTest.php b/tests/Core/Controller/WipeControllerTest.php
index f07fe4c9282..2cd315db5bf 100644
--- a/tests/Core/Controller/WipeControllerTest.php
+++ b/tests/Core/Controller/WipeControllerTest.php
@@ -50,7 +50,7 @@ class WipeControllerTest extends TestCase {
*
* @dataProvider dataTest
*/
- public function testCheckWipe(bool $valid, bool $couldPerform, bool $result) {
+ public function testCheckWipe(bool $valid, bool $couldPerform, bool $result): void {
if (!$valid) {
$this->remoteWipe->method('start')
->with('mytoken')
@@ -79,7 +79,7 @@ class WipeControllerTest extends TestCase {
*
* @dataProvider dataTest
*/
- public function testWipeDone(bool $valid, bool $couldPerform, bool $result) {
+ public function testWipeDone(bool $valid, bool $couldPerform, bool $result): void {
if (!$valid) {
$this->remoteWipe->method('finish')
->with('mytoken')
diff --git a/tests/Core/Data/LoginFlowV2CredentialsTest.php b/tests/Core/Data/LoginFlowV2CredentialsTest.php
index 0bb32f1c967..41575f33a9c 100644
--- a/tests/Core/Data/LoginFlowV2CredentialsTest.php
+++ b/tests/Core/Data/LoginFlowV2CredentialsTest.php
@@ -20,20 +20,20 @@ class LoginFlowV2CredentialsTest extends TestCase {
$this->fixture = new LoginFlowV2Credentials('server', 'login', 'pass');
}
- public function testImplementsJsonSerializable() {
+ public function testImplementsJsonSerializable(): void {
$this->assertTrue($this->fixture instanceof JsonSerializable);
}
/**
* Test getter functions.
*/
- public function testGetter() {
+ public function testGetter(): void {
$this->assertEquals('server', $this->fixture->getServer());
$this->assertEquals('login', $this->fixture->getLoginName());
$this->assertEquals('pass', $this->fixture->getAppPassword());
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$this->assertEquals(
[
'server' => 'server',
diff --git a/tests/Core/Middleware/TwoFactorMiddlewareTest.php b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
index a245845a674..6b8bf1c76e0 100644
--- a/tests/Core/Middleware/TwoFactorMiddlewareTest.php
+++ b/tests/Core/Middleware/TwoFactorMiddlewareTest.php
@@ -82,7 +82,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->controller = $this->createMock(Controller::class);
}
- public function testBeforeControllerNotLoggedIn() {
+ public function testBeforeControllerNotLoggedIn(): void {
$this->userSession->expects($this->once())
->method('isLoggedIn')
->willReturn(false);
@@ -93,7 +93,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->middleware->beforeController($this->controller, 'index');
}
- public function testBeforeSetupController() {
+ public function testBeforeSetupController(): void {
$user = $this->createMock(IUser::class);
$controller = $this->createMock(ALoginSetupController::class);
$this->userSession->expects($this->any())
@@ -108,7 +108,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->middleware->beforeController($controller, 'create');
}
- public function testBeforeControllerNoTwoFactorCheckNeeded() {
+ public function testBeforeControllerNoTwoFactorCheckNeeded(): void {
$user = $this->createMock(IUser::class);
$this->userSession->expects($this->once())
@@ -126,7 +126,7 @@ class TwoFactorMiddlewareTest extends TestCase {
}
- public function testBeforeControllerTwoFactorAuthRequired() {
+ public function testBeforeControllerTwoFactorAuthRequired(): void {
$this->expectException(TwoFactorAuthRequiredException::class);
$user = $this->createMock(IUser::class);
@@ -150,7 +150,7 @@ class TwoFactorMiddlewareTest extends TestCase {
}
- public function testBeforeControllerUserAlreadyLoggedIn() {
+ public function testBeforeControllerUserAlreadyLoggedIn(): void {
$this->expectException(UserAlreadyLoggedInException::class);
$user = $this->createMock(IUser::class);
@@ -179,7 +179,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->middleware->beforeController($twoFactorChallengeController, 'index');
}
- public function testAfterExceptionTwoFactorAuthRequired() {
+ public function testAfterExceptionTwoFactorAuthRequired(): void {
$ex = new TwoFactorAuthRequiredException();
$this->urlGenerator->expects($this->once())
@@ -191,7 +191,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
}
- public function testAfterException() {
+ public function testAfterException(): void {
$ex = new UserAlreadyLoggedInException();
$this->urlGenerator->expects($this->once())
@@ -203,7 +203,7 @@ class TwoFactorMiddlewareTest extends TestCase {
$this->assertEquals($expected, $this->middleware->afterException($this->controller, 'index', $ex));
}
- public function testRequires2FASetupDoneAnnotated() {
+ public function testRequires2FASetupDoneAnnotated(): void {
$user = $this->createMock(IUser::class);
$this->reflector
@@ -250,7 +250,7 @@ class TwoFactorMiddlewareTest extends TestCase {
/**
* @dataProvider dataRequires2FASetupDone
*/
- public function testRequires2FASetupDone(array $providers, bool $missingProviders, bool $expectEception) {
+ public function testRequires2FASetupDone(array $providers, bool $missingProviders, bool $expectEception): void {
$user = $this->createMock(IUser::class);
$this->reflector
diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
index 2e6407d4c00..2fb61a2ef08 100644
--- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
+++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
@@ -127,7 +127,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
* Tests for poll
*/
- public function testPollApptokenCouldNotBeDecrypted() {
+ public function testPollApptokenCouldNotBeDecrypted(): void {
$this->expectException(LoginFlowV2NotFoundException::class);
$this->expectExceptionMessage('Apptoken could not be decrypted');
@@ -148,7 +148,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
$this->subjectUnderTest->poll('');
}
- public function testPollInvalidToken() {
+ public function testPollInvalidToken(): void {
$this->expectException(LoginFlowV2NotFoundException::class);
$this->expectExceptionMessage('Invalid token');
@@ -159,14 +159,14 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
$this->subjectUnderTest->poll('');
}
- public function testPollTokenNotYetReady() {
+ public function testPollTokenNotYetReady(): void {
$this->expectException(LoginFlowV2NotFoundException::class);
$this->expectExceptionMessage('Token not yet ready');
$this->subjectUnderTest->poll('');
}
- public function testPollRemoveDataFromDb() {
+ public function testPollRemoveDataFromDb(): void {
[$encrypted, $privateKey] = $this->getOpenSSLEncryptedPublicAndPrivateKey('test_pass');
$this->crypto->expects($this->once())
@@ -208,7 +208,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
* Tests for getByLoginToken
*/
- public function testGetByLoginToken() {
+ public function testGetByLoginToken(): void {
$loginFlowV2 = new LoginFlowV2();
$loginFlowV2->setLoginName('test_login');
$loginFlowV2->setServer('test_server');
@@ -226,7 +226,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
$this->assertEquals('test', $result->getAppPassword());
}
- public function testGetByLoginTokenLoginTokenInvalid() {
+ public function testGetByLoginTokenLoginTokenInvalid(): void {
$this->expectException(LoginFlowV2NotFoundException::class);
$this->expectExceptionMessage('Login token invalid');
@@ -241,7 +241,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
* Tests for startLoginFlow
*/
- public function testStartLoginFlow() {
+ public function testStartLoginFlow(): void {
$loginFlowV2 = new LoginFlowV2();
$this->mapper->expects($this->once())
@@ -254,7 +254,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
$this->assertTrue($this->subjectUnderTest->startLoginFlow('test_token'));
}
- public function testStartLoginFlowDoesNotExistException() {
+ public function testStartLoginFlowDoesNotExistException(): void {
$this->mapper->expects($this->once())
->method('getByLoginToken')
->willThrowException(new DoesNotExistException(''));
@@ -266,7 +266,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
* If an exception not of type DoesNotExistException is thrown,
* it is expected that it is not being handled by startLoginFlow.
*/
- public function testStartLoginFlowException() {
+ public function testStartLoginFlowException(): void {
$this->expectException(Exception::class);
$this->mapper->expects($this->once())
@@ -280,7 +280,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
* Tests for flowDone
*/
- public function testFlowDone() {
+ public function testFlowDone(): void {
[,, $publicKey] = $this->getOpenSSLEncryptedPublicAndPrivateKey('test_pass');
$loginFlowV2 = new LoginFlowV2();
@@ -340,7 +340,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
$this->assertEquals('server', $loginFlowV2->getServer());
}
- public function testFlowDoneDoesNotExistException() {
+ public function testFlowDoneDoesNotExistException(): void {
$this->mapper->expects($this->once())
->method('getByLoginToken')
->willThrowException(new DoesNotExistException(''));
@@ -354,7 +354,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
$this->assertFalse($result);
}
- public function testFlowDonePasswordlessTokenException() {
+ public function testFlowDonePasswordlessTokenException(): void {
$this->tokenProvider->expects($this->once())
->method('getToken')
->willThrowException(new InvalidTokenException(''));
@@ -372,7 +372,7 @@ class LoginFlowV2ServiceUnitTest extends TestCase {
* Tests for createTokens
*/
- public function testCreateTokens() {
+ public function testCreateTokens(): void {
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->willReturn($this->returnCallback(function ($key) {
diff --git a/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php b/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
index 3d102c8f279..64db9459390 100644
--- a/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
+++ b/tests/Test/Repair/Owncloud/CleanPreviewsBackgroundJobTest.php
@@ -32,7 +32,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
/** @var CleanPreviewsBackgroundJob */
private $job;
- /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IUserManager|\PHPUnit_Framework_MockObject_MockObject */
private $userManager;
public function setUp(): void {
@@ -55,7 +55,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
);
}
- public function testCleanupPreviewsUnfinished() {
+ public function testCleanupPreviewsUnfinished(): void {
$userFolder = $this->createMock(Folder::class);
$userRoot = $this->createMock(Folder::class);
$thumbnailFolder = $this->createMock(Folder::class);
@@ -100,7 +100,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$this->job->run(['uid' => 'myuid']);
}
- public function testCleanupPreviewsFinished() {
+ public function testCleanupPreviewsFinished(): void {
$userFolder = $this->createMock(Folder::class);
$userRoot = $this->createMock(Folder::class);
$thumbnailFolder = $this->createMock(Folder::class);
@@ -143,7 +143,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
}
- public function testNoUserFolder() {
+ public function testNoUserFolder(): void {
$this->rootFolder->method('getUserFolder')
->with($this->equalTo('myuid'))
->willThrowException(new NotFoundException());
@@ -158,7 +158,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$this->job->run(['uid' => 'myuid']);
}
- public function testNoThumbnailFolder() {
+ public function testNoThumbnailFolder(): void {
$userFolder = $this->createMock(Folder::class);
$userRoot = $this->createMock(Folder::class);
@@ -182,7 +182,7 @@ class CleanPreviewsBackgroundJobTest extends TestCase {
$this->job->run(['uid' => 'myuid']);
}
- public function testNotPermittedToDelete() {
+ public function testNotPermittedToDelete(): void {
$userFolder = $this->createMock(Folder::class);
$userRoot = $this->createMock(Folder::class);
$thumbnailFolder = $this->createMock(Folder::class);
diff --git a/tests/Test/Repair/Owncloud/CleanPreviewsTest.php b/tests/Test/Repair/Owncloud/CleanPreviewsTest.php
index 10d2e5d216c..02f257a89b3 100644
--- a/tests/Test/Repair/Owncloud/CleanPreviewsTest.php
+++ b/tests/Test/Repair/Owncloud/CleanPreviewsTest.php
@@ -41,11 +41,11 @@ class CleanPreviewsTest extends TestCase {
);
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame('Add preview cleanup background jobs', $this->repair->getName());
}
- public function testRun() {
+ public function testRun(): void {
$user1 = $this->createMock(IUser::class);
$user1->method('getUID')
->willReturn('user1');
@@ -92,7 +92,7 @@ class CleanPreviewsTest extends TestCase {
}
- public function testRunAlreadyDoone() {
+ public function testRunAlreadyDoone(): void {
$this->userManager->expects($this->never())
->method($this->anything());
diff --git a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
index 856adde5c95..5bfd2e1e6d0 100644
--- a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
+++ b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
@@ -33,7 +33,7 @@ class UpdateLanguageCodesTest extends TestCase {
$this->config = $this->createMock(IConfig::class);
}
- public function testRun() {
+ public function testRun(): void {
$users = [
['userid' => 'user1', 'configvalue' => 'fi_FI'],
['userid' => 'user2', 'configvalue' => 'de'],
@@ -48,12 +48,12 @@ class UpdateLanguageCodesTest extends TestCase {
// insert test data
$qb = $this->connection->getQueryBuilder();
$qb->insert('preferences')
- ->values([
- 'userid' => $qb->createParameter('userid'),
- 'appid' => $qb->createParameter('appid'),
- 'configkey' => $qb->createParameter('configkey'),
- 'configvalue' => $qb->createParameter('configvalue'),
- ]);
+ ->values([
+ 'userid' => $qb->createParameter('userid'),
+ 'appid' => $qb->createParameter('appid'),
+ 'configkey' => $qb->createParameter('configkey'),
+ 'configvalue' => $qb->createParameter('configvalue'),
+ ]);
foreach ($users as $user) {
$qb->setParameters([
'userid' => $user['userid'],
@@ -131,7 +131,7 @@ class UpdateLanguageCodesTest extends TestCase {
}
}
- public function testSecondRun() {
+ public function testSecondRun(): void {
/** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $outputMock */
$outputMock = $this->createMock(IOutput::class);
$outputMock->expects($this->never())
diff --git a/tests/apps.php b/tests/apps.php
index 5388e28ee43..c2015fecda9 100644
--- a/tests/apps.php
+++ b/tests/apps.php
@@ -18,7 +18,7 @@ function loadDirectory($path): void {
return;
}
- while ($name = readdir($dh)) {
+ while (($name = readdir($dh)) !== false) {
if ($name[0] === '.') {
continue;
}
@@ -44,10 +44,15 @@ function getSubclasses($parentClassName): array {
}
$apps = OC_App::getEnabledApps();
+$appManager = \OCP\Server::get(\OCP\App\IAppManager::class);
foreach ($apps as $app) {
- $dir = OC_App::getAppPath($app);
- if (is_dir($dir . '/tests')) {
- loadDirectory($dir . '/tests');
+ try {
+ $dir = $appManager->getAppPath($app);
+ if (is_dir($dir . '/tests')) {
+ loadDirectory($dir . '/tests');
+ }
+ } catch (\OCP\App\AppPathNotFoundException) {
+ /* ignore */
}
}
diff --git a/tests/data/app/expected-info.json b/tests/data/app/expected-info.json
index 8527f18a2c0..c3ea27af7d3 100644
--- a/tests/data/app/expected-info.json
+++ b/tests/data/app/expected-info.json
@@ -65,7 +65,10 @@
"min-version": "7.0.1",
"max-version": "8"
}
- }
+ },
+ "backend": [
+ "caldav"
+ ]
},
"repair-steps": {
"install": [],
diff --git a/tests/data/app/navigation-one-item.json b/tests/data/app/navigation-one-item.json
index c9002da6b0d..2bd81461586 100644
--- a/tests/data/app/navigation-one-item.json
+++ b/tests/data/app/navigation-one-item.json
@@ -29,7 +29,8 @@
"min-version": "16",
"max-version": "16"
}
- }
+ },
+ "backend": []
},
"background-jobs": [
"OCA\\Activity\\BackgroundJob\\EmailNotification",
@@ -82,4 +83,4 @@
"uninstall": []
},
"two-factor-providers": []
-} \ No newline at end of file
+}
diff --git a/tests/data/app/navigation-two-items.json b/tests/data/app/navigation-two-items.json
index a7579217238..4b081d3bbd9 100644
--- a/tests/data/app/navigation-two-items.json
+++ b/tests/data/app/navigation-two-items.json
@@ -29,7 +29,8 @@
"min-version": "16",
"max-version": "16"
}
- }
+ },
+ "backend": []
},
"background-jobs": [
"OCA\\Activity\\BackgroundJob\\EmailNotification",
@@ -88,4 +89,4 @@
"uninstall": []
},
"two-factor-providers": []
-} \ No newline at end of file
+}
diff --git a/tests/data/app/valid-info.xml b/tests/data/app/valid-info.xml
index 9044c00f353..d2569788399 100644
--- a/tests/data/app/valid-info.xml
+++ b/tests/data/app/valid-info.xml
@@ -34,5 +34,6 @@
<lib>curl</lib>
<os>Linux</os>
<owncloud min-version="7.0.1" max-version="8" />
+ <backend>caldav</backend>
</dependencies>
</info>
diff --git a/tests/data/emails/new-account-email-custom.html b/tests/data/emails/new-account-email-custom.html
index e1c9fd4fb4f..990c4dc48e8 100644
--- a/tests/data/emails/new-account-email-custom.html
+++ b/tests/data/emails/new-account-email-custom.html
@@ -23,7 +23,7 @@
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="background-color:#0082c9;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto">
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto" width="252" height="120">
</center>
</tr>
</tbody>
@@ -107,26 +107,26 @@
<tr style="padding:0;text-align:left;vertical-align:top">
<th style="Margin:0;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
<center data-parsed="" style="min-width:490px;width:100%">
- <table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;max-height:60px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#0082c9;background-color:#0082c9;color:#fefefe;">
+ <table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#0082c9;background-color:#0082c9;color:#fefefe;">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #0082c9;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
- <a href="https://example.org/resetPassword/123" style="Margin:0;border:0 solid #0082c9;border-radius:2px;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:1.3;margin:0;padding:10px 25px 10px 25px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #0082c9;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <a href="https://example.org/resetPassword/123" style="Margin:0;border:0 solid #0082c9;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
- <table class="button btn default secondary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;max-height:40px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto">
+ <table class="button btn default secondary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;background-color: #ccc;margin:0 0 30px 0;max-height:40px;max-width:300px;padding:1px;border-radius:8px;text-align:center;vertical-align:top;width:auto">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;background:#777;border:0 solid #777;border-collapse:collapse!important;color:#fefefe;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
- <a href="https://nextcloud.com/install/#install-clients" style="Margin:0;background-color:#fff;border:0 solid #777;border-radius:2px;color:#6C6C6C!important;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:1.3;margin:0;outline:1px solid #CBCBCB;padding:10px 25px 10px 25px;text-align:left;text-decoration:none">Install Client</a>
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #777;border-collapse:collapse!important;color:#fefefe;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <a href="https://nextcloud.com/install/#install-clients" style="Margin:0;background-color:#fff;border:0 solid #777;color:#6C6C6C!important;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;border-radius: 7px;padding:8px;text-align:left;text-decoration:none">Install Client</a>
</td>
</tr>
</table>
diff --git a/tests/data/emails/new-account-email-single-button.html b/tests/data/emails/new-account-email-single-button.html
index 35ad9b14a1c..ee5f0582464 100644
--- a/tests/data/emails/new-account-email-single-button.html
+++ b/tests/data/emails/new-account-email-single-button.html
@@ -23,7 +23,7 @@
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="background-color:#0082c9;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto">
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto" width="252" height="120">
</center>
</tr>
</tbody>
@@ -107,13 +107,13 @@
<tr style="padding:0;text-align:left;vertical-align:top">
<th style="Margin:0;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
<center data-parsed="" style="min-width:490px;width:100%">
- <table class="button btn default primary float-center" style="Margin:0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0;max-height:60px;padding:0;text-align:center;vertical-align:top;width:auto;background:#0082c9;color:#fefefe;background-color:#0082c9;">
+ <table class="button btn default primary float-center" style="Margin:0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0;border-radius:8px;padding:0;text-align:center;vertical-align:top;width:auto;background:#0082c9;color:#fefefe;background-color:#0082c9;">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #0082c9;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
- <a href="https://example.org/resetPassword/123" style="Margin:0;border:0 solid #0082c9;border-radius:2px;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:1.3;margin:0;padding:10px 25px 10px 25px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #0082c9;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <a href="https://example.org/resetPassword/123" style="Margin:0;border:0 solid #0082c9;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
</td>
</tr>
</table>
diff --git a/tests/data/emails/new-account-email.html b/tests/data/emails/new-account-email.html
index e879f441206..db95a533337 100644
--- a/tests/data/emails/new-account-email.html
+++ b/tests/data/emails/new-account-email.html
@@ -23,7 +23,7 @@
<tbody>
<tr style="padding:0;text-align:left;vertical-align:top">
<center data-parsed="" style="background-color:#0082c9;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
- <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto">
+ <img class="logo float-center" src="https://example.org/img/logo-mail-header.png" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto" width="252" height="120">
</center>
</tr>
</tbody>
@@ -107,26 +107,26 @@
<tr style="padding:0;text-align:left;vertical-align:top">
<th style="Margin:0;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
<center data-parsed="" style="min-width:490px;width:100%">
- <table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;max-height:60px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#0082c9;background-color:#0082c9;color:#fefefe;">
+ <table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#0082c9;background-color:#0082c9;color:#fefefe;">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #0082c9;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
- <a href="https://example.org/resetPassword/123" style="Margin:0;border:0 solid #0082c9;border-radius:2px;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:1.3;margin:0;padding:10px 25px 10px 25px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #0082c9;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <a href="https://example.org/resetPassword/123" style="Margin:0;border:0 solid #0082c9;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
- <table class="button btn default secondary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;max-height:40px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto">
+ <table class="button btn default secondary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;background-color: #ccc;margin:0 0 30px 0;max-height:40px;max-width:300px;padding:1px;border-radius:8px;text-align:center;vertical-align:top;width:auto">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
<tr style="padding:0;text-align:left;vertical-align:top">
- <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;background:#777;border:0 solid #777;border-collapse:collapse!important;color:#fefefe;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
- <a href="https://nextcloud.com/install/#install-clients" style="Margin:0;background-color:#fff;border:0 solid #777;border-radius:2px;color:#6C6C6C!important;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:1.3;margin:0;outline:1px solid #CBCBCB;padding:10px 25px 10px 25px;text-align:left;text-decoration:none">Install Client</a>
+ <td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #777;border-collapse:collapse!important;color:#fefefe;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
+ <a href="https://nextcloud.com/install/#install-clients" style="Margin:0;background-color:#fff;border:0 solid #777;color:#6C6C6C!important;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;border-radius: 7px;padding:8px;text-align:left;text-decoration:none">Install Client</a>
</td>
</tr>
</table>
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php
deleted file mode 100644
index f7ac3aed4b7..00000000000
--- a/tests/lib/APITest.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-namespace Test;
-
-use OCP\IRequest;
-
-class APITest extends \Test\TestCase {
- // Helps build a response variable
-
- /**
- * @param string $message
- */
- public function buildResponse($shipped, $data, $code, $message = null) {
- $resp = new \OC\OCS\Result($data, $code, $message);
- $resp->addHeader('KEY', 'VALUE');
- return [
- 'shipped' => $shipped,
- 'response' => $resp,
- 'app' => $this->getUniqueID('testapp_'),
- ];
- }
-
- // Validate details of the result
-
- /**
- * @param \OC\OCS\Result $result
- */
- public function checkResult($result, $success) {
- // Check response is of correct type
- $this->assertInstanceOf(\OC\OCS\Result::class, $result);
- // Check if it succeeded
- /** @var $result \OC\OCS\Result */
- $this->assertEquals($success, $result->succeeded());
- }
-
- /**
- * @return array
- */
- public function versionDataScriptNameProvider() {
- return [
- // Valid script name
- [
- '/master/ocs/v2.php',
- true,
- ],
-
- // Invalid script names
- [
- '/master/ocs/v2.php/someInvalidPathName',
- false,
- ],
- [
- '/master/ocs/v1.php',
- false,
- ],
- [
- '',
- false,
- ],
- ];
- }
-
- /**
- * @dataProvider versionDataScriptNameProvider
- * @param string $scriptName
- * @param bool $expected
- */
- public function testIsV2($scriptName, $expected) {
- $request = $this->getMockBuilder(IRequest::class)
- ->disableOriginalConstructor()
- ->getMock();
- $request
- ->expects($this->once())
- ->method('getScriptName')
- ->willReturn($scriptName);
-
- $this->assertEquals($expected, $this->invokePrivate(new \OC_API, 'isV2', [$request]));
- }
-}
diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php
index da31c77abc6..ee3c8df0a70 100644
--- a/tests/lib/Accounts/AccountManagerTest.php
+++ b/tests/lib/Accounts/AccountManagerTest.php
@@ -56,7 +56,7 @@ class AccountManagerTest extends TestCase {
/** @var IConfig|MockObject */
private $config;
- /** @var IEventDispatcher|MockObject */
+ /** @var IEventDispatcher|MockObject */
private $eventDispatcher;
/** @var IJobList|MockObject */
@@ -474,7 +474,7 @@ class AccountManagerTest extends TestCase {
* @dataProvider dataTrueFalse
*
*/
- public function testUpdateUser(array $newData, array $oldData, bool $insertNew, bool $updateExisting) {
+ public function testUpdateUser(array $newData, array $oldData, bool $insertNew, bool $updateExisting): void {
$accountManager = $this->getInstance(['getUser', 'insertNewUser', 'updateExistingUser']);
/** @var IUser $user */
$user = $this->createMock(IUser::class);
@@ -516,7 +516,7 @@ class AccountManagerTest extends TestCase {
];
}
- public function testAddMissingDefaults() {
+ public function testAddMissingDefaults(): void {
$user = $this->createMock(IUser::class);
$this->config
@@ -635,7 +635,7 @@ class AccountManagerTest extends TestCase {
$this->assertSame($expected, $result);
}
- public function testGetAccount() {
+ public function testGetAccount(): void {
$accountManager = $this->getInstance(['getUser']);
/** @var IUser $user */
$user = $this->createMock(IUser::class);
@@ -879,7 +879,7 @@ class AccountManagerTest extends TestCase {
$result = $this->invokePrivate($this->accountManager, 'buildDefaultUserRecord', [$user]);
$resultProperties = array_column($result, 'name');
- $this->assertEmpty(array_diff($resultProperties, IAccountManager::ALLOWED_PROPERTIES), "Building default user record returned non-allowed properties");
+ $this->assertEmpty(array_diff($resultProperties, IAccountManager::ALLOWED_PROPERTIES), 'Building default user record returned non-allowed properties');
foreach ($expectedResultScopes as $expectedResultScopeKey => $expectedResultScopeValue) {
$resultScope = $result[array_search($expectedResultScopeKey, $resultProperties)]['scope'];
$this->assertEquals($expectedResultScopeValue, $resultScope, "The result scope doesn't follow the value set into the config or defaults correctly.");
diff --git a/tests/lib/Accounts/AccountPropertyCollectionTest.php b/tests/lib/Accounts/AccountPropertyCollectionTest.php
index 83a39dca94f..fa4db10d3d9 100644
--- a/tests/lib/Accounts/AccountPropertyCollectionTest.php
+++ b/tests/lib/Accounts/AccountPropertyCollectionTest.php
@@ -40,7 +40,7 @@ class AccountPropertyCollectionTest extends TestCase {
return $mock;
}
- public function testSetAndGetProperties() {
+ public function testSetAndGetProperties(): void {
$propsBefore = $this->collection->getProperties();
$this->assertIsArray($propsBefore);
$this->assertEmpty($propsBefore);
@@ -57,7 +57,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->assertCount(count($props), $propsAfter);
}
- public function testSetPropertiesMixedInvalid() {
+ public function testSetPropertiesMixedInvalid(): void {
$props = [
$this->makePropertyMock(self::COLLECTION_NAME),
$this->makePropertyMock('sneaky_property'),
@@ -68,7 +68,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->collection->setProperties($props);
}
- public function testAddProperty() {
+ public function testAddProperty(): void {
$props = [
$this->makePropertyMock(self::COLLECTION_NAME),
$this->makePropertyMock(self::COLLECTION_NAME),
@@ -84,7 +84,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->assertNotFalse(array_search($additionalProperty, $propsAfter, true));
}
- public function testAddPropertyInvalid() {
+ public function testAddPropertyInvalid(): void {
$props = [
$this->makePropertyMock(self::COLLECTION_NAME),
$this->makePropertyMock(self::COLLECTION_NAME),
@@ -106,7 +106,7 @@ class AccountPropertyCollectionTest extends TestCase {
}
}
- public function testRemoveProperty() {
+ public function testRemoveProperty(): void {
$additionalProperty = $this->makePropertyMock(self::COLLECTION_NAME);
$props = [
$this->makePropertyMock(self::COLLECTION_NAME),
@@ -125,7 +125,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->assertFalse(array_search($additionalProperty, $propsAfter, true));
}
- public function testRemovePropertyNotFound() {
+ public function testRemovePropertyNotFound(): void {
$additionalProperty = $this->makePropertyMock(self::COLLECTION_NAME);
$props = [
$this->makePropertyMock(self::COLLECTION_NAME),
@@ -142,7 +142,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->assertCount(count($propsBefore), $propsAfter);
}
- public function testRemovePropertyByValue() {
+ public function testRemovePropertyByValue(): void {
$additionalProperty = $this->makePropertyMock(self::COLLECTION_NAME);
$additionalProperty->expects($this->any())
->method('getValue')
@@ -169,7 +169,7 @@ class AccountPropertyCollectionTest extends TestCase {
$this->assertFalse(array_search($additionalPropertyTwo, $propsAfter, true));
}
- public function testRemovePropertyByValueNotFound() {
+ public function testRemovePropertyByValueNotFound(): void {
$additionalProperty = $this->makePropertyMock(self::COLLECTION_NAME);
$additionalProperty->expects($this->any())
->method('getValue')
diff --git a/tests/lib/Accounts/AccountPropertyTest.php b/tests/lib/Accounts/AccountPropertyTest.php
index f8aefccdbaa..5df66eaa117 100644
--- a/tests/lib/Accounts/AccountPropertyTest.php
+++ b/tests/lib/Accounts/AccountPropertyTest.php
@@ -16,7 +16,7 @@ use Test\TestCase;
* @package Test\Accounts
*/
class AccountPropertyTest extends TestCase {
- public function testConstructor() {
+ public function testConstructor(): void {
$accountProperty = new AccountProperty(
IAccountManager::PROPERTY_WEBSITE,
'https://example.com',
@@ -30,7 +30,7 @@ class AccountPropertyTest extends TestCase {
$this->assertEquals(IAccountManager::VERIFIED, $accountProperty->getVerified());
}
- public function testSetValue() {
+ public function testSetValue(): void {
$accountProperty = new AccountProperty(
IAccountManager::PROPERTY_WEBSITE,
'https://example.com',
@@ -43,7 +43,7 @@ class AccountPropertyTest extends TestCase {
$this->assertEquals('https://example.org', $actualReturn->getValue());
}
- public function testSetScope() {
+ public function testSetScope(): void {
$accountProperty = new AccountProperty(
IAccountManager::PROPERTY_WEBSITE,
'https://example.com',
@@ -77,7 +77,7 @@ class AccountPropertyTest extends TestCase {
/**
* @dataProvider scopesProvider
*/
- public function testSetScopeMapping(string $storedScope, ?string $returnedScope) {
+ public function testSetScopeMapping(string $storedScope, ?string $returnedScope): void {
if ($returnedScope === null) {
$this->expectException(\InvalidArgumentException::class);
}
@@ -91,7 +91,7 @@ class AccountPropertyTest extends TestCase {
$this->assertEquals($returnedScope, $accountProperty->getScope());
}
- public function testSetVerified() {
+ public function testSetVerified(): void {
$accountProperty = new AccountProperty(
IAccountManager::PROPERTY_WEBSITE,
'https://example.com',
@@ -104,7 +104,7 @@ class AccountPropertyTest extends TestCase {
$this->assertEquals(IAccountManager::NOT_VERIFIED, $actualReturn->getVerified());
}
- public function testSetVerificationData() {
+ public function testSetVerificationData(): void {
$accountProperty = new AccountProperty(
IAccountManager::PROPERTY_WEBSITE,
'https://example.com',
@@ -118,7 +118,7 @@ class AccountPropertyTest extends TestCase {
$this->assertEquals($token, $actualReturn->getVerificationData());
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$accountProperty = new AccountProperty(
IAccountManager::PROPERTY_WEBSITE,
'https://example.com',
diff --git a/tests/lib/Accounts/AccountTest.php b/tests/lib/Accounts/AccountTest.php
index d9242b073af..34653bd864a 100644
--- a/tests/lib/Accounts/AccountTest.php
+++ b/tests/lib/Accounts/AccountTest.php
@@ -19,13 +19,13 @@ use Test\TestCase;
* @package Test\Accounts
*/
class AccountTest extends TestCase {
- public function testConstructor() {
+ public function testConstructor(): void {
$user = $this->createMock(IUser::class);
$account = new Account($user);
$this->assertEquals($user, $account->getUser());
}
- public function testSetProperty() {
+ public function testSetProperty(): void {
$user = $this->createMock(IUser::class);
$property = new AccountProperty(IAccountManager::PROPERTY_WEBSITE, 'https://example.com', IAccountManager::SCOPE_PUBLISHED, IAccountManager::NOT_VERIFIED, '');
$account = new Account($user);
@@ -33,7 +33,7 @@ class AccountTest extends TestCase {
$this->assertEquals($property, $account->getProperty(IAccountManager::PROPERTY_WEBSITE));
}
- public function testGetAndGetAllProperties() {
+ public function testGetAndGetAllProperties(): void {
$user = $this->createMock(IUser::class);
$properties = [
IAccountManager::PROPERTY_WEBSITE => new AccountProperty(IAccountManager::PROPERTY_WEBSITE, 'https://example.com', IAccountManager::SCOPE_PUBLISHED, IAccountManager::NOT_VERIFIED, ''),
@@ -53,7 +53,7 @@ class AccountTest extends TestCase {
$this->assertEquals(array_values($properties), \iterator_to_array($account->getAllProperties()));
}
- public function testSetAllPropertiesFromJson() {
+ public function testSetAllPropertiesFromJson(): void {
$user = $this->createMock(IUser::class);
$properties = [
IAccountManager::PROPERTY_DISPLAYNAME => new AccountProperty(IAccountManager::PROPERTY_DISPLAYNAME, 'Steve', IAccountManager::SCOPE_FEDERATED, IAccountManager::NOT_VERIFIED, ''),
@@ -78,7 +78,7 @@ class AccountTest extends TestCase {
$this->assertEquals($properties, $account->jsonSerialize());
}
- public function testGetFilteredProperties() {
+ public function testGetFilteredProperties(): void {
$user = $this->createMock(IUser::class);
$properties = [
IAccountManager::PROPERTY_WEBSITE => new AccountProperty(IAccountManager::PROPERTY_WEBSITE, 'https://example.com', IAccountManager::SCOPE_PUBLISHED, IAccountManager::NOT_VERIFIED, ''),
@@ -124,7 +124,7 @@ class AccountTest extends TestCase {
);
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$user = $this->createMock(IUser::class);
$properties = [
IAccountManager::PROPERTY_WEBSITE => new AccountProperty(IAccountManager::PROPERTY_WEBSITE, 'https://example.com', IAccountManager::SCOPE_PUBLISHED, IAccountManager::NOT_VERIFIED, ''),
diff --git a/tests/lib/Accounts/HooksTest.php b/tests/lib/Accounts/HooksTest.php
index df9420140d3..75772089f43 100644
--- a/tests/lib/Accounts/HooksTest.php
+++ b/tests/lib/Accounts/HooksTest.php
@@ -51,7 +51,7 @@ class HooksTest extends TestCase {
* @param $setDisplayName
* @param $error
*/
- public function testChangeUserHook($params, $data, $setEmail, $setDisplayName, $error) {
+ public function testChangeUserHook($params, $data, $setEmail, $setDisplayName, $error): void {
if ($error) {
$this->accountManager->expects($this->never())->method('updateAccount');
} else {
diff --git a/tests/lib/Activity/ManagerTest.php b/tests/lib/Activity/ManagerTest.php
index 223021fa66a..bb73aea4f6d 100644
--- a/tests/lib/Activity/ManagerTest.php
+++ b/tests/lib/Activity/ManagerTest.php
@@ -56,14 +56,14 @@ class ManagerTest extends TestCase {
$this->assertNotEmpty(self::invokePrivate($this->activityManager, 'getConsumers'));
}
- public function testGetConsumers() {
+ public function testGetConsumers(): void {
$consumers = self::invokePrivate($this->activityManager, 'getConsumers');
$this->assertNotEmpty($consumers);
}
- public function testGetConsumersInvalidConsumer() {
+ public function testGetConsumersInvalidConsumer(): void {
$this->expectException(\InvalidArgumentException::class);
$this->activityManager->registerConsumer(function () {
@@ -90,7 +90,7 @@ class ManagerTest extends TestCase {
* @param string $token
* @param array $users
*/
- public function testGetUserFromTokenThrowInvalidToken($token, $users) {
+ public function testGetUserFromTokenThrowInvalidToken($token, $users): void {
$this->expectException(\UnexpectedValueException::class);
$this->mockRSSToken($token, $token, $users);
@@ -112,7 +112,7 @@ class ManagerTest extends TestCase {
* @param string $token
* @param string $expected
*/
- public function testGetUserFromToken($userLoggedIn, $token, $expected) {
+ public function testGetUserFromToken($userLoggedIn, $token, $expected): void {
if ($userLoggedIn !== null) {
$this->mockUserSession($userLoggedIn);
}
@@ -152,7 +152,7 @@ class ManagerTest extends TestCase {
}
- public function testPublishExceptionNoApp() {
+ public function testPublishExceptionNoApp(): void {
$this->expectException(IncompleteActivityException::class);
$event = $this->activityManager->generateEvent();
@@ -160,7 +160,7 @@ class ManagerTest extends TestCase {
}
- public function testPublishExceptionNoType() {
+ public function testPublishExceptionNoType(): void {
$this->expectException(IncompleteActivityException::class);
$event = $this->activityManager->generateEvent();
@@ -169,7 +169,7 @@ class ManagerTest extends TestCase {
}
- public function testPublishExceptionNoAffectedUser() {
+ public function testPublishExceptionNoAffectedUser(): void {
$this->expectException(IncompleteActivityException::class);
$event = $this->activityManager->generateEvent();
@@ -179,7 +179,7 @@ class ManagerTest extends TestCase {
}
- public function testPublishExceptionNoSubject() {
+ public function testPublishExceptionNoSubject(): void {
$this->expectException(IncompleteActivityException::class);
$event = $this->activityManager->generateEvent();
@@ -201,7 +201,7 @@ class ManagerTest extends TestCase {
* @param string|null $author
* @param string $expected
*/
- public function testPublish($author, $expected) {
+ public function testPublish($author, $expected): void {
if ($author !== null) {
$authorObject = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
@@ -239,7 +239,7 @@ class ManagerTest extends TestCase {
$this->activityManager->publish($event);
}
- public function testPublishAllManually() {
+ public function testPublishAllManually(): void {
$event = $this->activityManager->generateEvent();
$event->setApp('test_app')
->setType('test_type')
diff --git a/tests/lib/AllConfigTest.php b/tests/lib/AllConfigTest.php
index c703c47c94e..f8b2e8e857f 100644
--- a/tests/lib/AllConfigTest.php
+++ b/tests/lib/AllConfigTest.php
@@ -19,7 +19,7 @@ use OC\SystemConfig;
use OCP\IDBConnection;
class AllConfigTest extends \Test\TestCase {
- /** @var \OCP\IDBConnection */
+ /** @var \OCP\IDBConnection */
protected $connection;
protected function getConfig($systemConfig = null, $connection = null) {
@@ -37,7 +37,7 @@ class AllConfigTest extends \Test\TestCase {
return new \OC\AllConfig($systemConfig, $connection);
}
- public function testDeleteUserValue() {
+ public function testDeleteUserValue(): void {
$config = $this->getConfig();
// preparation - add something to the database
@@ -58,7 +58,7 @@ class AllConfigTest extends \Test\TestCase {
$this->assertEquals(0, $actualCount, 'There was one value in the database and after the tests there should be no entry left.');
}
- public function testSetUserValue() {
+ public function testSetUserValue(): void {
$selectAllSQL = 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?';
$config = $this->getConfig();
@@ -91,7 +91,7 @@ class AllConfigTest extends \Test\TestCase {
$config->deleteUserValue('userSet', 'appSet', 'keySet');
}
- public function testSetUserValueWithPreCondition() {
+ public function testSetUserValueWithPreCondition(): void {
$config = $this->getConfig();
$selectAllSQL = 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?';
@@ -138,7 +138,7 @@ class AllConfigTest extends \Test\TestCase {
* @dataProvider dataSetUserValueUnexpectedValue
* @param mixed $value
*/
- public function testSetUserValueUnexpectedValue($value) {
+ public function testSetUserValueUnexpectedValue($value): void {
$this->expectException(\UnexpectedValueException::class);
$config = $this->getConfig();
@@ -146,7 +146,7 @@ class AllConfigTest extends \Test\TestCase {
}
- public function testSetUserValueWithPreConditionFailure() {
+ public function testSetUserValueWithPreConditionFailure(): void {
$this->expectException(\OCP\PreConditionNotMetException::class);
$config = $this->getConfig();
@@ -182,7 +182,43 @@ class AllConfigTest extends \Test\TestCase {
$config->deleteUserValue('userPreCond1', 'appPreCond', 'keyPreCond');
}
- public function testSetUserValueUnchanged() {
+ public function testSetUserValueWithPreConditionFailureWhenResultStillMatches(): void {
+ $this->expectException(\OCP\PreConditionNotMetException::class);
+
+ $config = $this->getConfig();
+
+ $selectAllSQL = 'SELECT `userid`, `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?';
+
+ $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond');
+
+ $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll();
+
+ $this->assertCount(1, $result);
+ $this->assertEquals([
+ 'userid' => 'userPreCond1',
+ 'appid' => 'appPreCond',
+ 'configkey' => 'keyPreCond',
+ 'configvalue' => 'valuePreCond'
+ ], $result[0]);
+
+ // test if the method throws with invalid precondition when the value is the same
+ $config->setUserValue('userPreCond1', 'appPreCond', 'keyPreCond', 'valuePreCond', 'valuePreCond3');
+
+ $result = $this->connection->executeQuery($selectAllSQL, ['userPreCond1'])->fetchAll();
+
+ $this->assertCount(1, $result);
+ $this->assertEquals([
+ 'userid' => 'userPreCond1',
+ 'appid' => 'appPreCond',
+ 'configkey' => 'keyPreCond',
+ 'configvalue' => 'valuePreCond'
+ ], $result[0]);
+
+ // cleanup
+ $config->deleteUserValue('userPreCond1', 'appPreCond', 'keyPreCond');
+ }
+
+ public function testSetUserValueUnchanged(): void {
// TODO - FIXME until the dependency injection is handled properly (in AllConfig)
$this->markTestSkipped('Skipped because this is just testable if database connection can be injected');
@@ -207,7 +243,7 @@ class AllConfigTest extends \Test\TestCase {
$config->setUserValue('userSetUnchanged', 'appSetUnchanged', 'keySetUnchanged', 'valueSetUnchanged');
}
- public function testGetUserValue() {
+ public function testGetUserValue(): void {
$config = $this->getConfig();
// setup - it therefore relies on the successful execution of the previous test
@@ -245,7 +281,7 @@ class AllConfigTest extends \Test\TestCase {
$this->assertEquals(0, count($result));
}
- public function testGetUserKeys() {
+ public function testGetUserKeys(): void {
$config = $this->getConfig();
// preparation - add something to the database
@@ -276,7 +312,7 @@ class AllConfigTest extends \Test\TestCase {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
- public function testGetUserKeysAllInts() {
+ public function testGetUserKeysAllInts(): void {
$config = $this->getConfig();
// preparation - add something to the database
@@ -301,7 +337,7 @@ class AllConfigTest extends \Test\TestCase {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
- public function testGetUserValueDefault() {
+ public function testGetUserValueDefault(): void {
$config = $this->getConfig();
$this->assertEquals('', $config->getUserValue('userGetUnset', 'appGetUnset', 'keyGetUnset'));
@@ -309,7 +345,7 @@ class AllConfigTest extends \Test\TestCase {
$this->assertEquals('foobar', $config->getUserValue('userGetUnset', 'appGetUnset', 'keyGetUnset', 'foobar'));
}
- public function testGetUserValueForUsers() {
+ public function testGetUserValueForUsers(): void {
$config = $this->getConfig();
// preparation - add something to the database
@@ -350,7 +386,7 @@ class AllConfigTest extends \Test\TestCase {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
- public function testDeleteAllUserValues() {
+ public function testDeleteAllUserValues(): void {
$config = $this->getConfig();
// preparation - add something to the database
@@ -384,7 +420,7 @@ class AllConfigTest extends \Test\TestCase {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
- public function testDeleteAppFromAllUsers() {
+ public function testDeleteAppFromAllUsers(): void {
$config = $this->getConfig();
// preparation - add something to the database
@@ -427,7 +463,7 @@ class AllConfigTest extends \Test\TestCase {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
- public function testGetUsersForUserValue() {
+ public function testGetUsersForUserValue(): void {
// mock the check for the database to run the correct SQL statements for each database type
$systemConfig = $this->getMockBuilder('\OC\SystemConfig')
->disableOriginalConstructor()
@@ -458,7 +494,7 @@ class AllConfigTest extends \Test\TestCase {
$this->connection->executeUpdate('DELETE FROM `*PREFIX*preferences`');
}
- public function testGetUsersForUserValueCaseInsensitive() {
+ public function testGetUsersForUserValueCaseInsensitive(): void {
// mock the check for the database to run the correct SQL statements for each database type
$systemConfig = $this->createMock(SystemConfig::class);
$config = $this->getConfig($systemConfig);
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index c38cadf8e38..5c79a75bf0d 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -142,7 +142,7 @@ class AppManagerTest extends TestCase {
/**
* @dataProvider dataGetAppIcon
*/
- public function testGetAppIcon($callback, ?bool $dark, string|null $expected) {
+ public function testGetAppIcon($callback, ?bool $dark, string|null $expected): void {
$this->urlGenerator->expects($this->atLeastOnce())
->method('imagePath')
->willReturnCallback($callback);
@@ -229,7 +229,7 @@ class AppManagerTest extends TestCase {
];
}
- public function testEnableApp() {
+ public function testEnableApp(): void {
// making sure "files_trashbin" is disabled
if ($this->manager->isEnabledForUser('files_trashbin')) {
$this->manager->disableApp('files_trashbin');
@@ -239,13 +239,13 @@ class AppManagerTest extends TestCase {
$this->assertEquals('yes', $this->appConfig->getValue('files_trashbin', 'enabled', 'no'));
}
- public function testDisableApp() {
+ public function testDisableApp(): void {
$this->eventDispatcher->expects($this->once())->method('dispatchTyped')->with(new AppDisableEvent('files_trashbin'));
$this->manager->disableApp('files_trashbin');
$this->assertEquals('no', $this->appConfig->getValue('files_trashbin', 'enabled', 'no'));
}
- public function testNotEnableIfNotInstalled() {
+ public function testNotEnableIfNotInstalled(): void {
try {
$this->manager->enableApp('some_random_name_which_i_hope_is_not_an_app');
$this->assertFalse(true, 'If this line is reached the expected exception is not thrown.');
@@ -259,7 +259,7 @@ class AppManagerTest extends TestCase {
));
}
- public function testEnableAppForGroups() {
+ public function testEnableAppForGroups(): void {
$group1 = $this->createMock(IGroup::class);
$group1->method('getGID')
->willReturn('group1');
@@ -312,7 +312,7 @@ class AppManagerTest extends TestCase {
*
* @param array $appInfo
*/
- public function testEnableAppForGroupsAllowedTypes(array $appInfo) {
+ public function testEnableAppForGroupsAllowedTypes(array $appInfo): void {
$group1 = $this->createMock(IGroup::class);
$group1->method('getGID')
->willReturn('group1');
@@ -341,7 +341,7 @@ class AppManagerTest extends TestCase {
$manager->expects($this->once())
->method('getAppPath')
->with('test')
- ->willReturn(null);
+ ->willReturn('');
$manager->expects($this->once())
->method('getAppInfo')
@@ -370,7 +370,7 @@ class AppManagerTest extends TestCase {
* @param string $type
*
*/
- public function testEnableAppForGroupsForbiddenTypes($type) {
+ public function testEnableAppForGroupsForbiddenTypes($type): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('test can\'t be enabled for groups.');
@@ -402,7 +402,7 @@ class AppManagerTest extends TestCase {
$manager->expects($this->once())
->method('getAppPath')
->with('test')
- ->willReturn(null);
+ ->willReturn('');
$manager->expects($this->once())
->method('getAppInfo')
@@ -416,17 +416,17 @@ class AppManagerTest extends TestCase {
$manager->enableAppForGroups('test', $groups);
}
- public function testIsInstalledEnabled() {
+ public function testIsInstalledEnabled(): void {
$this->appConfig->setValue('test', 'enabled', 'yes');
$this->assertTrue($this->manager->isInstalled('test'));
}
- public function testIsInstalledDisabled() {
+ public function testIsInstalledDisabled(): void {
$this->appConfig->setValue('test', 'enabled', 'no');
$this->assertFalse($this->manager->isInstalled('test'));
}
- public function testIsInstalledEnabledForGroups() {
+ public function testIsInstalledEnabledForGroups(): void {
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertTrue($this->manager->isInstalled('test'));
}
@@ -439,23 +439,23 @@ class AppManagerTest extends TestCase {
return $user;
}
- public function testIsEnabledForUserEnabled() {
+ public function testIsEnabledForUserEnabled(): void {
$this->appConfig->setValue('test', 'enabled', 'yes');
$user = $this->newUser('user1');
$this->assertTrue($this->manager->isEnabledForUser('test', $user));
}
- public function testIsEnabledForUserDisabled() {
+ public function testIsEnabledForUserDisabled(): void {
$this->appConfig->setValue('test', 'enabled', 'no');
$user = $this->newUser('user1');
$this->assertFalse($this->manager->isEnabledForUser('test', $user));
}
- public function testGetAppPath() {
+ public function testGetAppPath(): void {
$this->assertEquals(\OC::$SERVERROOT . '/apps/files', $this->manager->getAppPath('files'));
}
- public function testGetAppPathSymlink() {
+ public function testGetAppPathSymlink(): void {
$fakeAppDirname = sha1(uniqid('test', true));
$fakeAppPath = sys_get_temp_dir() . '/' . $fakeAppDirname;
$fakeAppLink = \OC::$SERVERROOT . '/' . $fakeAppDirname;
@@ -484,12 +484,12 @@ class AppManagerTest extends TestCase {
$this->assertEquals($fakeAppLink . '/test-test-app', $generatedAppPath);
}
- public function testGetAppPathFail() {
+ public function testGetAppPathFail(): void {
$this->expectException(AppPathNotFoundException::class);
$this->manager->getAppPath('testnotexisting');
}
- public function testIsEnabledForUserEnabledForGroup() {
+ public function testIsEnabledForUserEnabledForGroup(): void {
$user = $this->newUser('user1');
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
@@ -500,7 +500,7 @@ class AppManagerTest extends TestCase {
$this->assertTrue($this->manager->isEnabledForUser('test', $user));
}
- public function testIsEnabledForUserDisabledForGroup() {
+ public function testIsEnabledForUserDisabledForGroup(): void {
$user = $this->newUser('user1');
$this->groupManager->expects($this->once())
->method('getUserGroupIds')
@@ -511,12 +511,12 @@ class AppManagerTest extends TestCase {
$this->assertFalse($this->manager->isEnabledForUser('test', $user));
}
- public function testIsEnabledForUserLoggedOut() {
+ public function testIsEnabledForUserLoggedOut(): void {
$this->appConfig->setValue('test', 'enabled', '["foo"]');
$this->assertFalse($this->manager->isEnabledForUser('test'));
}
- public function testIsEnabledForUserLoggedIn() {
+ public function testIsEnabledForUserLoggedIn(): void {
$user = $this->newUser('user1');
$this->userSession->expects($this->once())
@@ -531,7 +531,7 @@ class AppManagerTest extends TestCase {
$this->assertTrue($this->manager->isEnabledForUser('test'));
}
- public function testGetInstalledApps() {
+ public function testGetInstalledApps(): void {
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
@@ -554,7 +554,7 @@ class AppManagerTest extends TestCase {
$this->assertEquals($apps, $this->manager->getInstalledApps());
}
- public function testGetAppsForUser() {
+ public function testGetAppsForUser(): void {
$user = $this->newUser('user1');
$this->groupManager->expects($this->any())
->method('getUserGroupIds')
@@ -584,7 +584,7 @@ class AppManagerTest extends TestCase {
$this->assertEquals($enabled, $this->manager->getEnabledAppsForUser($user));
}
- public function testGetAppsNeedingUpgrade() {
+ public function testGetAppsNeedingUpgrade(): void {
/** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
@@ -642,7 +642,7 @@ class AppManagerTest extends TestCase {
$this->assertEquals('test4', $apps[1]['id']);
}
- public function testGetIncompatibleApps() {
+ public function testGetIncompatibleApps(): void {
/** @var AppManager|MockObject $manager */
$manager = $this->getMockBuilder(AppManager::class)
->setConstructorArgs([
@@ -694,7 +694,7 @@ class AppManagerTest extends TestCase {
$this->assertEquals('test3', $apps[1]['id']);
}
- public function testGetEnabledAppsForGroup() {
+ public function testGetEnabledAppsForGroup(): void {
$group = $this->createMock(IGroup::class);
$group->expects($this->any())
->method('getGID')
@@ -723,7 +723,7 @@ class AppManagerTest extends TestCase {
$this->assertEquals($enabled, $this->manager->getEnabledAppsForGroup($group));
}
- public function testGetAppRestriction() {
+ public function testGetAppRestriction(): void {
$this->appConfig->setValue('test1', 'enabled', 'yes');
$this->appConfig->setValue('test2', 'enabled', 'no');
$this->appConfig->setValue('test3', 'enabled', '["foo"]');
@@ -733,156 +733,51 @@ class AppManagerTest extends TestCase {
$this->assertEquals(['foo'], $this->manager->getAppRestriction('test3'));
}
- public function provideDefaultApps(): array {
+ public static function isBackendRequiredDataProvider(): array {
return [
- // none specified, default to files
+ // backend available
[
- '',
- '',
- '{}',
+ 'caldav',
+ ['app1' => ['caldav']],
true,
- 'files',
],
- // none specified, without fallback
[
- '',
- '',
- '{}',
- false,
- '',
- ],
- // unexisting or inaccessible app specified, default to files
- [
- 'unexist',
- '',
- '{}',
+ 'caldav',
+ ['app1' => [], 'app2' => ['foo'], 'app3' => ['caldav']],
true,
- 'files',
],
- // unexisting or inaccessible app specified, without fallbacks
+ // backend not available
[
- 'unexist',
- '',
- '{}',
+ 'caldav',
+ ['app3' => [], 'app1' => ['foo'], 'app2' => ['bar', 'baz']],
false,
- '',
- ],
- // non-standard app
- [
- 'settings',
- '',
- '{}',
- true,
- 'settings',
],
- // non-standard app, without fallback
+ // no app available
[
- 'settings',
- '',
- '{}',
+ 'caldav',
+ [],
false,
- 'settings',
- ],
- // non-standard app with fallback
- [
- 'unexist,settings',
- '',
- '{}',
- true,
- 'settings',
- ],
- // system default app and user apporder
- [
- // system default is settings
- 'unexist,settings',
- '',
- // apporder says default app is files (order is lower)
- '{"files_id":{"app":"files","order":1},"settings_id":{"app":"settings","order":2}}',
- true,
- // system default should override apporder
- 'settings'
- ],
- // user-customized defaultapp
- [
- '',
- 'files',
- '',
- true,
- 'files',
- ],
- // user-customized defaultapp with systemwide
- [
- 'unexist,settings',
- 'files',
- '',
- true,
- 'files',
- ],
- // user-customized defaultapp with system wide and apporder
- [
- 'unexist,settings',
- 'files',
- '{"settings_id":{"app":"settings","order":1},"files_id":{"app":"files","order":2}}',
- true,
- 'files',
- ],
- // user-customized apporder fallback
- [
- '',
- '',
- '{"settings_id":{"app":"settings","order":1},"files":{"app":"files","order":2}}',
- true,
- 'settings',
- ],
- // user-customized apporder fallback with missing app key (entries added by closures does not always have an app key set (Nextcloud 27 spreed app for example))
- [
- '',
- '',
- '{"spreed":{"order":1},"files":{"app":"files","order":2}}',
- true,
- 'files',
- ],
- // user-customized apporder, but called without fallback
- [
- '',
- '',
- '{"settings":{"app":"settings","order":1},"files":{"app":"files","order":2}}',
- false,
- '',
- ],
- // user-customized apporder with an app that has multiple routes
- [
- '',
- '',
- '{"settings_id":{"app":"settings","order":1},"settings_id_2":{"app":"settings","order":3},"id_files":{"app":"files","order":2}}',
- true,
- 'settings',
],
];
}
/**
- * @dataProvider provideDefaultApps
+ * @dataProvider isBackendRequiredDataProvider
*/
- public function testGetDefaultAppForUser($defaultApps, $userDefaultApps, $userApporder, $withFallbacks, $expectedApp) {
- $user = $this->newUser('user1');
-
- $this->userSession->expects($this->once())
- ->method('getUser')
- ->willReturn($user);
-
- $this->config->expects($this->once())
- ->method('getSystemValueString')
- ->with('defaultapp', $this->anything())
- ->willReturn($defaultApps);
+ public function testIsBackendRequired(
+ string $backend,
+ array $appBackends,
+ bool $expected,
+ ): void {
+ $appInfoData = array_map(
+ static fn (array $backends) => ['dependencies' => ['backend' => $backends]],
+ $appBackends,
+ );
- $this->config->expects($this->atLeastOnce())
- ->method('getUserValue')
- ->willReturnMap([
- ['user1', 'core', 'defaultapp', '', $userDefaultApps],
- ['user1', 'core', 'apporder', '[]', $userApporder],
- ]);
+ $reflection = new \ReflectionClass($this->manager);
+ $property = $reflection->getProperty('appInfos');
+ $property->setValue($this->manager, $appInfoData);
- $this->assertEquals($expectedApp, $this->manager->getDefaultAppForUser(null, $withFallbacks));
+ $this->assertEquals($expected, $this->manager->isBackendRequired($backend));
}
}
diff --git a/tests/lib/App/AppStore/Bundles/BundleBase.php b/tests/lib/App/AppStore/Bundles/BundleBase.php
index 4c31c49cdb1..28fb8a7736b 100644
--- a/tests/lib/App/AppStore/Bundles/BundleBase.php
+++ b/tests/lib/App/AppStore/Bundles/BundleBase.php
@@ -31,15 +31,15 @@ abstract class BundleBase extends TestCase {
});
}
- public function testGetIdentifier() {
+ public function testGetIdentifier(): void {
$this->assertSame($this->bundleIdentifier, $this->bundle->getIdentifier());
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame($this->bundleName, $this->bundle->getName());
}
- public function testGetAppIdentifiers() {
+ public function testGetAppIdentifiers(): void {
$this->assertSame($this->bundleAppIds, $this->bundle->getAppIdentifiers());
}
}
diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
index 484b81b5197..225dd78a1b4 100644
--- a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
+++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
@@ -32,7 +32,7 @@ class BundleFetcherTest extends TestCase {
);
}
- public function testGetBundles() {
+ public function testGetBundles(): void {
$expected = [
new EnterpriseBundle($this->l10n),
new HubBundle($this->l10n),
@@ -44,13 +44,13 @@ class BundleFetcherTest extends TestCase {
$this->assertEquals($expected, $this->bundleFetcher->getBundles());
}
- public function testGetBundleByIdentifier() {
+ public function testGetBundleByIdentifier(): void {
$this->assertEquals(new EnterpriseBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('EnterpriseBundle'));
$this->assertEquals(new GroupwareBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('GroupwareBundle'));
}
- public function testGetBundleByIdentifierWithException() {
+ public function testGetBundleByIdentifierWithException(): void {
$this->expectException(\BadMethodCallException::class);
$this->expectExceptionMessage('Bundle with specified identifier does not exist');
diff --git a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php
index a4508e6156b..50942d8df97 100644
--- a/tests/lib/App/AppStore/Bundles/EducationBundleTest.php
+++ b/tests/lib/App/AppStore/Bundles/EducationBundleTest.php
@@ -13,7 +13,7 @@ class EducationBundleTest extends BundleBase {
parent::setUp();
$this->bundle = new EducationBundle($this->l10n);
$this->bundleIdentifier = 'EducationBundle';
- $this->bundleName = 'Education Edition';
+ $this->bundleName = 'Education bundle';
$this->bundleAppIds = [
'dashboard',
'circles',
@@ -21,6 +21,7 @@ class EducationBundleTest extends BundleBase {
'announcementcenter',
'quota_warning',
'user_saml',
+ 'whiteboard',
];
}
}
diff --git a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
index 82f40043971..fdc8b45cf70 100644
--- a/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppDiscoverFetcherTest.php
@@ -34,7 +34,7 @@ class AppDiscoverFetcherTest extends FetcherBase {
);
}
- public function testAppstoreDisabled() {
+ public function testAppstoreDisabled(): void {
$this->config
->method('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
@@ -50,7 +50,7 @@ class AppDiscoverFetcherTest extends FetcherBase {
$this->assertEquals([], $this->fetcher->get());
}
- public function testNoInternet() {
+ public function testNoInternet(): void {
$this->config
->method('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
@@ -74,7 +74,7 @@ class AppDiscoverFetcherTest extends FetcherBase {
/**
* @dataProvider dataGetETag
*/
- public function testGetEtag(string|null $expected, bool $throws, string $content = '') {
+ public function testGetEtag(string|null $expected, bool $throws, string $content = ''): void {
$folder = $this->createMock(ISimpleFolder::class);
if (!$throws) {
$file = $this->createMock(ISimpleFile::class);
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index 9a04c11a1f3..61fe24be1a9 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1856,7 +1856,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
->willReturn('stable');
}
- public function testGetWithFilter() {
+ public function testGetWithFilter(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
@@ -1939,7 +1939,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
$this->assertEquals(self::$expectedResponse['data'], $this->fetcher->get());
}
- public function testAppstoreDisabled() {
+ public function testAppstoreDisabled(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
@@ -1966,7 +1966,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
}
- public function testNoInternet() {
+ public function testNoInternet(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
@@ -1994,7 +1994,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
$this->assertEquals([], $this->fetcher->get());
}
- public function testSetVersion() {
+ public function testSetVersion(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
@@ -2078,7 +2078,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
$this->assertEquals(self::$expectedResponse['data'], $this->fetcher->get());
}
- public function testGetAppsAllowlist() {
+ public function testGetAppsAllowlist(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
index b7dbf6eccd8..0beb68bf03a 100644
--- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
@@ -24,7 +24,7 @@ class CategoryFetcherTest extends FetcherBase {
);
}
- public function testAppstoreDisabled() {
+ public function testAppstoreDisabled(): void {
$this->config
->method('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
@@ -40,7 +40,7 @@ class CategoryFetcherTest extends FetcherBase {
$this->assertEquals([], $this->fetcher->get());
}
- public function testNoInternet() {
+ public function testNoInternet(): void {
$this->config
->method('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
index f2bc981d4a6..95129b3114d 100644
--- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php
+++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
@@ -59,7 +59,7 @@ abstract class FetcherBase extends TestCase {
$this->registry = $this->createMock(IRegistry::class);
}
- public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
+ public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
@@ -100,7 +100,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame($expected, $this->fetcher->get());
}
- public function testGetWithNotExistingFileAndUpToDateTimestampAndVersion() {
+ public function testGetWithNotExistingFileAndUpToDateTimestampAndVersion(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
@@ -175,7 +175,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame($expected, $this->fetcher->get());
}
- public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() {
+ public function testGetWithAlreadyExistingFileAndOutdatedTimestamp(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
@@ -249,7 +249,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame($expected, $this->fetcher->get());
}
- public function testGetWithAlreadyExistingFileAndNoVersion() {
+ public function testGetWithAlreadyExistingFileAndNoVersion(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
@@ -322,7 +322,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame($expected, $this->fetcher->get());
}
- public function testGetWithAlreadyExistingFileAndOutdatedVersion() {
+ public function testGetWithAlreadyExistingFileAndOutdatedVersion(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
@@ -394,7 +394,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame($expected, $this->fetcher->get());
}
- public function testGetWithExceptionInClient() {
+ public function testGetWithExceptionInClient(): void {
$this->config->method('getSystemValueString')
->willReturnArgument(1);
$this->config->method('getSystemValueBool')
@@ -430,7 +430,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame([], $this->fetcher->get());
}
- public function testGetMatchingETag() {
+ public function testGetMatchingETag(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
@@ -509,7 +509,7 @@ abstract class FetcherBase extends TestCase {
$this->assertSame($expected, $this->fetcher->get());
}
- public function testGetNoMatchingETag() {
+ public function testGetNoMatchingETag(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
@@ -594,7 +594,7 @@ abstract class FetcherBase extends TestCase {
}
- public function testFetchAfterUpgradeNoETag() {
+ public function testFetchAfterUpgradeNoETag(): void {
$this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
diff --git a/tests/lib/App/AppStore/Version/VersionParserTest.php b/tests/lib/App/AppStore/Version/VersionParserTest.php
index c461bf7c6cf..5bd9ee16b39 100644
--- a/tests/lib/App/AppStore/Version/VersionParserTest.php
+++ b/tests/lib/App/AppStore/Version/VersionParserTest.php
@@ -62,12 +62,12 @@ class VersionParserTest extends TestCase {
* @param Version $expected
*/
public function testGetVersion($input,
- Version $expected) {
+ Version $expected): void {
$this->assertEquals($expected, $this->versionParser->getVersion($input));
}
- public function testGetVersionException() {
+ public function testGetVersionException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Version cannot be parsed: BogusVersion');
@@ -75,7 +75,7 @@ class VersionParserTest extends TestCase {
}
- public function testGetVersionExceptionWithMultiple() {
+ public function testGetVersionExceptionWithMultiple(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Version cannot be parsed: >=8.2 <=9.1a');
diff --git a/tests/lib/App/AppStore/Version/VersionTest.php b/tests/lib/App/AppStore/Version/VersionTest.php
index 68da79fdc8d..7fece37cf5f 100644
--- a/tests/lib/App/AppStore/Version/VersionTest.php
+++ b/tests/lib/App/AppStore/Version/VersionTest.php
@@ -10,12 +10,12 @@ use OC\App\AppStore\Version\Version;
use Test\TestCase;
class VersionTest extends TestCase {
- public function testGetMinimumVersion() {
+ public function testGetMinimumVersion(): void {
$version = new Version('9', '10');
$this->assertSame('9', $version->getMinimumVersion());
}
- public function testGetMaximumVersion() {
+ public function testGetMaximumVersion(): void {
$version = new Version('9', '10');
$this->assertSame('10', $version->getMaximumVersion());
}
diff --git a/tests/lib/App/CompareVersionTest.php b/tests/lib/App/CompareVersionTest.php
index b9af3a96b22..0d020428fed 100644
--- a/tests/lib/App/CompareVersionTest.php
+++ b/tests/lib/App/CompareVersionTest.php
@@ -58,21 +58,21 @@ class CompareVersionTest extends TestCase {
* @dataProvider comparisonData
*/
public function testComparison(string $actualVersion, string $requiredVersion,
- string $comparator, bool $expected) {
+ string $comparator, bool $expected): void {
$isCompatible = $this->compare->isCompatible($actualVersion, $requiredVersion,
$comparator);
$this->assertEquals($expected, $isCompatible);
}
- public function testInvalidServerVersion() {
+ public function testInvalidServerVersion(): void {
$actualVersion = '13';
$this->expectException(InvalidArgumentException::class);
$this->compare->isCompatible($actualVersion, '13.0.0');
}
- public function testInvalidRequiredVersion() {
+ public function testInvalidRequiredVersion(): void {
$actualVersion = '13.0.0';
$this->expectException(InvalidArgumentException::class);
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index 1b9c977e737..31eeb77d7e5 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -46,7 +46,7 @@ class DependencyAnalyzerTest extends TestCase {
->method('getLibraryVersion')
->willReturnCallback(function ($lib) {
if ($lib === 'curl') {
- return "2.3.4";
+ return '2.3.4';
}
return null;
});
@@ -74,7 +74,7 @@ class DependencyAnalyzerTest extends TestCase {
* @param string $maxVersion
* @param string $intSize
*/
- public function testPhpVersion($expectedMissing, $minVersion, $maxVersion, $intSize) {
+ public function testPhpVersion($expectedMissing, $minVersion, $maxVersion, $intSize): void {
$app = [
'dependencies' => [
'php' => []
@@ -100,7 +100,7 @@ class DependencyAnalyzerTest extends TestCase {
* @param $expectedMissing
* @param $databases
*/
- public function testDatabases($expectedMissing, $databases) {
+ public function testDatabases($expectedMissing, $databases): void {
$app = [
'dependencies' => [
]
@@ -120,7 +120,7 @@ class DependencyAnalyzerTest extends TestCase {
* @param string $expectedMissing
* @param string|null $commands
*/
- public function testCommand($expectedMissing, $commands) {
+ public function testCommand($expectedMissing, $commands): void {
$app = [
'dependencies' => [
]
@@ -139,7 +139,7 @@ class DependencyAnalyzerTest extends TestCase {
* @param $expectedMissing
* @param $libs
*/
- public function testLibs($expectedMissing, $libs) {
+ public function testLibs($expectedMissing, $libs): void {
$app = [
'dependencies' => [
]
@@ -159,7 +159,7 @@ class DependencyAnalyzerTest extends TestCase {
* @param $expectedMissing
* @param $oss
*/
- public function testOS($expectedMissing, $oss) {
+ public function testOS($expectedMissing, $oss): void {
$app = [
'dependencies' => []
];
@@ -178,7 +178,7 @@ class DependencyAnalyzerTest extends TestCase {
* @param $expectedMissing
* @param $oc
*/
- public function testOC($expectedMissing, $oc) {
+ public function testOC($expectedMissing, $oc): void {
$app = [
'dependencies' => []
];
diff --git a/tests/lib/App/InfoParserTest.php b/tests/lib/App/InfoParserTest.php
index 9affe3ff9ae..914741d05b1 100644
--- a/tests/lib/App/InfoParserTest.php
+++ b/tests/lib/App/InfoParserTest.php
@@ -34,14 +34,14 @@ class InfoParserTest extends TestCase {
/**
* @dataProvider providesInfoXml
*/
- public function testParsingValidXmlWithoutCache($expectedJson, $xmlFile) {
+ public function testParsingValidXmlWithoutCache($expectedJson, $xmlFile): void {
$this->parserTest($expectedJson, $xmlFile);
}
/**
* @dataProvider providesInfoXml
*/
- public function testParsingValidXmlWithCache($expectedJson, $xmlFile) {
+ public function testParsingValidXmlWithCache($expectedJson, $xmlFile): void {
$this->parserTest($expectedJson, $xmlFile, self::$cache);
}
diff --git a/tests/lib/App/PlatformRepositoryTest.php b/tests/lib/App/PlatformRepositoryTest.php
index e1eb7b16b40..921d24159c9 100644
--- a/tests/lib/App/PlatformRepositoryTest.php
+++ b/tests/lib/App/PlatformRepositoryTest.php
@@ -14,7 +14,7 @@ class PlatformRepositoryTest extends \Test\TestCase {
* @param $expected
* @param $input
*/
- public function testVersion($input, $expected) {
+ public function testVersion($input, $expected): void {
$pr = new OC\App\PlatformRepository();
$normalizedVersion = $pr->normalizeVersion($input);
$this->assertEquals($expected, $normalizedVersion);
diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php
index f82f3b45b32..e6929484dc5 100644
--- a/tests/lib/AppConfigTest.php
+++ b/tests/lib/AppConfigTest.php
@@ -32,7 +32,7 @@ class AppConfigTest extends TestCase {
/**
* @var array<string, array<array<string, string, int, bool, bool>>>
- * [appId => [configKey, configValue, valueType, lazy, sensitive]]
+ * [appId => [configKey, configValue, valueType, lazy, sensitive]]
*/
private array $baseStruct =
[
@@ -168,7 +168,7 @@ class AppConfigTest extends TestCase {
/**
* @param bool $preLoading TRUE will preload the 'fast' cache, which is the normal behavior of usual
- * IAppConfig
+ * IAppConfig
*
* @return IAppConfig
*/
@@ -438,7 +438,7 @@ class AppConfigTest extends TestCase {
$this->assertSame('value', $config->getValueString('non-sensitive-app', 'non-lazy-key', 'default', lazy: true));
}
- public function testGetValueInt() {
+ public function testGetValueInt(): void {
$config = $this->generateAppConfig();
$this->assertSame(42, $config->getValueInt('typed', 'int', 0));
}
@@ -448,7 +448,7 @@ class AppConfigTest extends TestCase {
$this->assertSame(1, $config->getValueInt('typed-1', 'int', 1));
}
- public function testGetValueIntOnNonExistentKeyReturnsDefault() {
+ public function testGetValueIntOnNonExistentKeyReturnsDefault(): void {
$config = $this->generateAppConfig();
$this->assertSame(2, $config->getValueInt('typed', 'int-2', 2));
}
@@ -459,7 +459,7 @@ class AppConfigTest extends TestCase {
$config->getValueInt('typed', 'float');
}
- public function testGetValueFloat() {
+ public function testGetValueFloat(): void {
$config = $this->generateAppConfig();
$this->assertSame(3.14, $config->getValueFloat('typed', 'float', 0));
}
@@ -469,7 +469,7 @@ class AppConfigTest extends TestCase {
$this->assertSame(1.11, $config->getValueFloat('typed-1', 'float', 1.11));
}
- public function testGetValueFloatOnNonExistentKeyReturnsDefault() {
+ public function testGetValueFloatOnNonExistentKeyReturnsDefault(): void {
$config = $this->generateAppConfig();
$this->assertSame(2.22, $config->getValueFloat('typed', 'float-2', 2.22));
}
@@ -1367,7 +1367,7 @@ class AppConfigTest extends TestCase {
$key = self::getUniqueID('secret');
$appConfig = $this->generateAppConfig();
- $secret = md5((string) time());
+ $secret = md5((string)time());
$appConfig->setValueString('testapp', $key, $secret, sensitive: true);
$this->assertConfigValueNotEquals('testapp', $key, $secret);
@@ -1385,7 +1385,7 @@ class AppConfigTest extends TestCase {
public function testMigratingNonSensitiveValueToSensitiveWithSetValue(): void {
$key = self::getUniqueID('secret');
$appConfig = $this->generateAppConfig();
- $secret = sha1((string) time());
+ $secret = sha1((string)time());
// Unencrypted
$appConfig->setValueString('testapp', $key, $secret);
@@ -1413,7 +1413,7 @@ class AppConfigTest extends TestCase {
public function testUpdateSensitiveValueToNonSensitiveWithUpdateSensitive(): void {
$key = self::getUniqueID('secret');
$appConfig = $this->generateAppConfig();
- $secret = sha1((string) time());
+ $secret = sha1((string)time());
// Encrypted
$appConfig->setValueString('testapp', $key, $secret, sensitive: true);
@@ -1427,7 +1427,7 @@ class AppConfigTest extends TestCase {
public function testUpdateNonSensitiveValueToSensitiveWithUpdateSensitive(): void {
$key = self::getUniqueID('secret');
$appConfig = $this->generateAppConfig();
- $secret = sha1((string) time());
+ $secret = sha1((string)time());
// Unencrypted
$appConfig->setValueString('testapp', $key, $secret);
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index 48f95564a22..3c535a4bf7a 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -71,7 +71,7 @@ class AppTest extends \Test\TestCase {
}
- public function testControllerNameAndMethodAreBeingPassed() {
+ public function testControllerNameAndMethodAreBeingPassed(): void {
$return = ['HTTP/2.0 200 OK', [], [], null, new Response()];
$this->dispatcher->expects($this->once())
->method('dispatch')
@@ -87,19 +87,19 @@ class AppTest extends \Test\TestCase {
}
- public function testBuildAppNamespace() {
+ public function testBuildAppNamespace(): void {
$ns = App::buildAppNamespace('someapp');
$this->assertEquals('OCA\Someapp', $ns);
}
- public function testBuildAppNamespaceCore() {
+ public function testBuildAppNamespaceCore(): void {
$ns = App::buildAppNamespace('someapp', 'OC\\');
$this->assertEquals('OC\Someapp', $ns);
}
- public function testBuildAppNamespaceInfoXml() {
+ public function testBuildAppNamespaceInfoXml(): void {
$ns = App::buildAppNamespace('namespacetestapp', 'OCA\\');
$this->assertEquals('OCA\NameSpaceTestApp', $ns);
}
@@ -111,7 +111,7 @@ class AppTest extends \Test\TestCase {
}
- public function testOutputIsPrinted() {
+ public function testOutputIsPrinted(): void {
$return = ['HTTP/2.0 200 OK', [], [], $this->output, new Response()];
$this->dispatcher->expects($this->once())
->method('dispatch')
@@ -134,7 +134,7 @@ class AppTest extends \Test\TestCase {
/**
* @dataProvider dataNoOutput
*/
- public function testNoOutput(string $statusCode) {
+ public function testNoOutput(string $statusCode): void {
$return = [$statusCode, [], [], $this->output, new Response()];
$this->dispatcher->expects($this->once())
->method('dispatch')
@@ -150,7 +150,7 @@ class AppTest extends \Test\TestCase {
}
- public function testCallbackIsCalled() {
+ public function testCallbackIsCalled(): void {
$mock = $this->getMockBuilder('OCP\AppFramework\Http\ICallbackResponse')
->getMock();
@@ -165,7 +165,7 @@ class AppTest extends \Test\TestCase {
App::main($this->controllerName, $this->controllerMethod, $this->container, []);
}
- public function testCoreApp() {
+ public function testCoreApp(): void {
$this->container['AppName'] = 'core';
$this->container['OC\Core\Controller\Foo'] = $this->controller;
$this->container['urlParams'] = ['_route' => 'not-profiler'];
@@ -183,7 +183,7 @@ class AppTest extends \Test\TestCase {
App::main('Foo', $this->controllerMethod, $this->container);
}
- public function testSettingsApp() {
+ public function testSettingsApp(): void {
$this->container['AppName'] = 'settings';
$this->container['OCA\Settings\Controller\Foo'] = $this->controller;
$this->container['urlParams'] = ['_route' => 'not-profiler'];
@@ -201,7 +201,7 @@ class AppTest extends \Test\TestCase {
App::main('Foo', $this->controllerMethod, $this->container);
}
- public function testApp() {
+ public function testApp(): void {
$this->container['AppName'] = 'bar';
$this->container['OCA\Bar\Controller\Foo'] = $this->controller;
$this->container['urlParams'] = ['_route' => 'not-profiler'];
diff --git a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php
index ce07a628773..05e7a1b71c7 100644
--- a/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php
+++ b/tests/lib/AppFramework/Bootstrap/CoordinatorTest.php
@@ -77,7 +77,7 @@ class CoordinatorTest extends TestCase {
$this->serverContainer->expects($this->once())
->method('query')
->with(\OCA\Settings\AppInfo\Application::class)
- ->willThrowException(new QueryException(""));
+ ->willThrowException(new QueryException(''));
$this->logger->expects($this->once())
->method('error');
diff --git a/tests/lib/AppFramework/Controller/ApiControllerTest.php b/tests/lib/AppFramework/Controller/ApiControllerTest.php
index 6dea9938225..9dd980f975f 100644
--- a/tests/lib/AppFramework/Controller/ApiControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ApiControllerTest.php
@@ -21,7 +21,7 @@ class ApiControllerTest extends \Test\TestCase {
/** @var ChildApiController */
protected $controller;
- public function testCors() {
+ public function testCors(): void {
$request = new Request(
['server' => ['HTTP_ORIGIN' => 'test']],
$this->createMock(IRequestId::class),
diff --git a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
index bec1b7a2a63..d6e0321023e 100644
--- a/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/AuthPublicShareControllerTest.php
@@ -51,13 +51,13 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
])->getMock();
}
- public function testShowAuthenticate() {
+ public function testShowAuthenticate(): void {
$expects = new TemplateResponse('core', 'publicshareauth', [], 'guest');
$this->assertEquals($expects, $this->controller->showAuthenticate());
}
- public function testAuthenticateAuthenticated() {
+ public function testAuthenticateAuthenticated(): void {
$this->controller->method('isAuthenticated')
->willReturn(true);
@@ -74,7 +74,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
$this->assertSame('myLink!', $result->getRedirectURL());
}
- public function testAuthenticateInvalidPassword() {
+ public function testAuthenticateInvalidPassword(): void {
$this->controller->setToken('token');
$this->controller->method('isPasswordProtected')
->willReturn(true);
@@ -94,7 +94,7 @@ class AuthPublicShareControllerTest extends \Test\TestCase {
$this->assertEquals($expects, $result);
}
- public function testAuthenticateValidPassword() {
+ public function testAuthenticateValidPassword(): void {
$this->controller->setToken('token');
$this->controller->method('isPasswordProtected')
->willReturn(true);
diff --git a/tests/lib/AppFramework/Controller/ControllerTest.php b/tests/lib/AppFramework/Controller/ControllerTest.php
index 044b554d014..7c466e3a5b7 100644
--- a/tests/lib/AppFramework/Controller/ControllerTest.php
+++ b/tests/lib/AppFramework/Controller/ControllerTest.php
@@ -70,8 +70,8 @@ class ControllerTest extends \Test\TestCase {
->setConstructorArgs(['test'])
->getMock();
$this->app->expects($this->any())
- ->method('getAppName')
- ->willReturn('apptemplate_advanced');
+ ->method('getAppName')
+ ->willReturn('apptemplate_advanced');
$this->controller = new ChildController($this->app, $request);
$this->overwriteService(IRequest::class, $request);
@@ -79,21 +79,21 @@ class ControllerTest extends \Test\TestCase {
}
- public function testFormatResonseInvalidFormat() {
+ public function testFormatResonseInvalidFormat(): void {
$this->expectException(\DomainException::class);
$this->controller->buildResponse(null, 'test');
}
- public function testFormat() {
+ public function testFormat(): void {
$response = $this->controller->buildResponse(['hi'], 'json');
$this->assertEquals(['hi'], $response->getData());
}
- public function testFormatDataResponseJSON() {
+ public function testFormatDataResponseJSON(): void {
$expectedHeaders = [
'test' => 'something',
'Cache-Control' => 'no-cache, no-store, must-revalidate',
@@ -113,7 +113,7 @@ class ControllerTest extends \Test\TestCase {
}
- public function testCustomFormatter() {
+ public function testCustomFormatter(): void {
$response = $this->controller->custom('hi');
$response = $this->controller->buildResponse($response, 'json');
@@ -121,14 +121,14 @@ class ControllerTest extends \Test\TestCase {
}
- public function testDefaultResponderToJSON() {
+ public function testDefaultResponderToJSON(): void {
$responder = $this->controller->getResponderByHTTPHeader('*/*');
$this->assertEquals('json', $responder);
}
- public function testResponderAcceptHeaderParsed() {
+ public function testResponderAcceptHeaderParsed(): void {
$responder = $this->controller->getResponderByHTTPHeader(
'*/*, application/tom, application/json'
);
@@ -137,7 +137,7 @@ class ControllerTest extends \Test\TestCase {
}
- public function testResponderAcceptHeaderParsedUpperCase() {
+ public function testResponderAcceptHeaderParsedUpperCase(): void {
$responder = $this->controller->getResponderByHTTPHeader(
'*/*, apPlication/ToM, application/json'
);
diff --git a/tests/lib/AppFramework/Controller/OCSControllerTest.php b/tests/lib/AppFramework/Controller/OCSControllerTest.php
index ea86c01a364..027881074c9 100644
--- a/tests/lib/AppFramework/Controller/OCSControllerTest.php
+++ b/tests/lib/AppFramework/Controller/OCSControllerTest.php
@@ -20,7 +20,7 @@ class ChildOCSController extends OCSController {
class OCSControllerTest extends \Test\TestCase {
- public function testCors() {
+ public function testCors(): void {
$request = new Request(
[
'server' => [
@@ -45,7 +45,7 @@ class OCSControllerTest extends \Test\TestCase {
}
- public function testXML() {
+ public function testXML(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
@@ -74,7 +74,7 @@ class OCSControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $response->render());
}
- public function testJSON() {
+ public function testJSON(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
@@ -91,7 +91,7 @@ class OCSControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $response->render());
}
- public function testXMLV2() {
+ public function testXMLV2(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
@@ -118,7 +118,7 @@ class OCSControllerTest extends \Test\TestCase {
$this->assertEquals($expected, $response->render());
}
- public function testJSONV2() {
+ public function testJSONV2(): void {
$controller = new ChildOCSController('app', new Request(
[],
$this->createMock(IRequestId::class),
diff --git a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
index be28843b03f..f8430d42ef1 100644
--- a/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
+++ b/tests/lib/AppFramework/Controller/PublicShareControllerTest.php
@@ -50,7 +50,7 @@ class PublicShareControllerTest extends \Test\TestCase {
$this->session = $this->createMock(ISession::class);
}
- public function testGetToken() {
+ public function testGetToken(): void {
$controller = new TestController('app', $this->request, $this->session, 'hash', false);
$controller->setToken('test');
@@ -73,7 +73,7 @@ class PublicShareControllerTest extends \Test\TestCase {
/**
* @dataProvider dataIsAuthenticated
*/
- public function testIsAuthenticatedNotPasswordProtected(bool $protected, string $token1, string $token2, string $hash1, string $hash2, bool $expected) {
+ public function testIsAuthenticatedNotPasswordProtected(bool $protected, string $token1, string $token2, string $hash1, string $hash2, bool $expected): void {
$controller = new TestController('app', $this->request, $this->session, $hash2, $protected);
$this->session->method('get')
diff --git a/tests/lib/AppFramework/Db/EntityTest.php b/tests/lib/AppFramework/Db/EntityTest.php
index a521b480f8f..8e6e6dcd645 100644
--- a/tests/lib/AppFramework/Db/EntityTest.php
+++ b/tests/lib/AppFramework/Db/EntityTest.php
@@ -27,7 +27,6 @@ use PHPUnit\Framework\Constraint\IsType;
* @method void setTrueOrFalse(bool $trueOrFalse)
* @method bool getAnotherBool()
* @method bool isAnotherBool()
- * @method void setAnotherBool(bool $anotherBool)
* @method string getLongText()
* @method void setLongText(string $longText)
*/
@@ -47,6 +46,10 @@ class TestEntity extends Entity {
$this->addType('longText', 'blob');
$this->name = $name;
}
+
+ public function setAnotherBool(bool $anotherBool): void {
+ parent::setAnotherBool($anotherBool);
+ }
}
@@ -59,7 +62,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testResetUpdatedFields() {
+ public function testResetUpdatedFields(): void {
$entity = new TestEntity();
$entity->setId(3);
$entity->resetUpdatedFields();
@@ -68,19 +71,21 @@ class EntityTest extends \Test\TestCase {
}
- public function testFromRow() {
+ public function testFromRow(): void {
$row = [
'pre_name' => 'john',
- 'email' => 'john@something.com'
+ 'email' => 'john@something.com',
+ 'another_bool' => 1,
];
$this->entity = TestEntity::fromRow($row);
$this->assertEquals($row['pre_name'], $this->entity->getPreName());
$this->assertEquals($row['email'], $this->entity->getEmail());
+ $this->assertEquals($row['another_bool'], $this->entity->getAnotherBool());
}
- public function testGetSetId() {
+ public function testGetSetId(): void {
$id = 3;
$this->entity->setId(3);
@@ -88,28 +93,28 @@ class EntityTest extends \Test\TestCase {
}
- public function testColumnToPropertyNoReplacement() {
+ public function testColumnToPropertyNoReplacement(): void {
$column = 'my';
$this->assertEquals('my',
$this->entity->columnToProperty($column));
}
- public function testColumnToProperty() {
+ public function testColumnToProperty(): void {
$column = 'my_attribute';
$this->assertEquals('myAttribute',
$this->entity->columnToProperty($column));
}
- public function testPropertyToColumnNoReplacement() {
+ public function testPropertyToColumnNoReplacement(): void {
$property = 'my';
$this->assertEquals('my',
$this->entity->propertyToColumn($property));
}
- public function testSetterMarksFieldUpdated() {
+ public function testSetterMarksFieldUpdated(): void {
$this->entity->setId(3);
$this->assertContains('id', array_keys($this->entity->getUpdatedFields()));
@@ -117,7 +122,7 @@ class EntityTest extends \Test\TestCase {
- public function testCallShouldOnlyWorkForGetterSetter() {
+ public function testCallShouldOnlyWorkForGetterSetter(): void {
$this->expectException(\BadFunctionCallException::class);
$this->entity->something();
@@ -125,21 +130,21 @@ class EntityTest extends \Test\TestCase {
- public function testGetterShouldFailIfAttributeNotDefined() {
+ public function testGetterShouldFailIfAttributeNotDefined(): void {
$this->expectException(\BadFunctionCallException::class);
$this->entity->getTest();
}
- public function testSetterShouldFailIfAttributeNotDefined() {
+ public function testSetterShouldFailIfAttributeNotDefined(): void {
$this->expectException(\BadFunctionCallException::class);
$this->entity->setTest();
}
- public function testFromRowShouldNotAssignEmptyArray() {
+ public function testFromRowShouldNotAssignEmptyArray(): void {
$row = [];
$entity2 = new TestEntity();
@@ -148,7 +153,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testIdGetsConvertedToInt() {
+ public function testIdGetsConvertedToInt(): void {
$row = ['id' => '4'];
$this->entity = TestEntity::fromRow($row);
@@ -156,7 +161,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testSetType() {
+ public function testSetType(): void {
$row = ['testId' => '4'];
$this->entity = TestEntity::fromRow($row);
@@ -164,7 +169,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testFromParams() {
+ public function testFromParams(): void {
$params = [
'testId' => 4,
'email' => 'john@doe'
@@ -177,7 +182,7 @@ class EntityTest extends \Test\TestCase {
$this->assertTrue($entity instanceof TestEntity);
}
- public function testSlugify() {
+ public function testSlugify(): void {
$entity = new TestEntity();
$entity->setName('Slugify this!');
$this->assertEquals('slugify-this', $entity->slugify('name'));
@@ -186,20 +191,20 @@ class EntityTest extends \Test\TestCase {
}
- public function testSetterCasts() {
+ public function testSetterCasts(): void {
$entity = new TestEntity();
$entity->setId('3');
$this->assertSame(3, $entity->getId());
}
- public function testSetterDoesNotCastOnNull() {
+ public function testSetterDoesNotCastOnNull(): void {
$entity = new TestEntity();
$entity->setId(null);
$this->assertSame(null, $entity->getId());
}
- public function testSetterConvertsResourcesToStringProperly() {
+ public function testSetterConvertsResourcesToStringProperly(): void {
$string = 'Definitely a string';
$stream = fopen('php://memory', 'r+');
fwrite($stream, $string);
@@ -212,7 +217,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testGetFieldTypes() {
+ public function testGetFieldTypes(): void {
$entity = new TestEntity();
$this->assertEquals([
'id' => 'integer',
@@ -224,20 +229,20 @@ class EntityTest extends \Test\TestCase {
}
- public function testGetItInt() {
+ public function testGetItInt(): void {
$entity = new TestEntity();
$entity->setId(3);
$this->assertEquals('integer', gettype($entity->getId()));
}
- public function testFieldsNotMarkedUpdatedIfNothingChanges() {
+ public function testFieldsNotMarkedUpdatedIfNothingChanges(): void {
$entity = new TestEntity('hey');
$entity->setName('hey');
$this->assertEquals(0, count($entity->getUpdatedFields()));
}
- public function testIsGetter() {
+ public function testIsGetter(): void {
$entity = new TestEntity();
$entity->setTrueOrFalse(false);
$entity->setAnotherBool(false);
@@ -246,7 +251,7 @@ class EntityTest extends \Test\TestCase {
}
- public function testIsGetterShoudFailForOtherType() {
+ public function testIsGetterShoudFailForOtherType(): void {
$this->expectException(\BadFunctionCallException::class);
$entity = new TestEntity();
diff --git a/tests/lib/AppFramework/Db/QBMapperTest.php b/tests/lib/AppFramework/Db/QBMapperTest.php
index f984d977df5..f08beca05ca 100644
--- a/tests/lib/AppFramework/Db/QBMapperTest.php
+++ b/tests/lib/AppFramework/Db/QBMapperTest.php
@@ -108,7 +108,7 @@ class QBMapperTest extends \Test\TestCase {
}
- public function testInsertEntityParameterTypeMapping() {
+ public function testInsertEntityParameterTypeMapping(): void {
$entity = new QBTestEntity();
$entity->setIntProp(123);
$entity->setBoolProp(true);
@@ -145,7 +145,7 @@ class QBMapperTest extends \Test\TestCase {
}
- public function testUpdateEntityParameterTypeMapping() {
+ public function testUpdateEntityParameterTypeMapping(): void {
$entity = new QBTestEntity();
$entity->setId(789);
$entity->setIntProp(123);
@@ -153,7 +153,7 @@ class QBMapperTest extends \Test\TestCase {
$entity->setStringProp('string');
$entity->setIntegerProp(456);
$entity->setBooleanProp(false);
- $entity->setJsonProp(["hello" => "world"]);
+ $entity->setJsonProp(['hello' => 'world']);
$idParam = $this->qb->createNamedParameter('id', IQueryBuilder::PARAM_INT);
$intParam = $this->qb->createNamedParameter('int_prop', IQueryBuilder::PARAM_INT);
@@ -171,7 +171,7 @@ class QBMapperTest extends \Test\TestCase {
[$this->equalTo('string'), $this->equalTo(IQueryBuilder::PARAM_STR)],
[$this->equalTo(456), $this->equalTo(IQueryBuilder::PARAM_INT)],
[$this->equalTo(false), $this->equalTo(IQueryBuilder::PARAM_BOOL)],
- [$this->equalTo(["hello" => "world"]), $this->equalTo(IQueryBuilder::PARAM_JSON)],
+ [$this->equalTo(['hello' => 'world']), $this->equalTo(IQueryBuilder::PARAM_JSON)],
[$this->equalTo(789), $this->equalTo(IQueryBuilder::PARAM_INT)],
);
@@ -195,7 +195,7 @@ class QBMapperTest extends \Test\TestCase {
}
- public function testGetParameterTypeForProperty() {
+ public function testGetParameterTypeForProperty(): void {
$entity = new QBTestEntity();
$intType = $this->mapper->getParameterTypeForPropertyForTest($entity, 'intProp');
diff --git a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
index 94264f0de02..f3d2cff1ffd 100644
--- a/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
+++ b/tests/lib/AppFramework/DependencyInjection/DIContainerTest.php
@@ -35,24 +35,24 @@ class DIContainerTest extends \Test\TestCase {
}
- public function testProvidesRequest() {
+ public function testProvidesRequest(): void {
$this->assertTrue(isset($this->container['Request']));
}
- public function testProvidesMiddlewareDispatcher() {
+ public function testProvidesMiddlewareDispatcher(): void {
$this->assertTrue(isset($this->container['MiddlewareDispatcher']));
}
- public function testProvidesAppName() {
+ public function testProvidesAppName(): void {
$this->assertTrue(isset($this->container['AppName']));
}
- public function testAppNameIsSetCorrectly() {
+ public function testAppNameIsSetCorrectly(): void {
$this->assertEquals('name', $this->container['AppName']);
}
- public function testMiddlewareDispatcherIncludesSecurityMiddleware() {
+ public function testMiddlewareDispatcherIncludesSecurityMiddleware(): void {
$this->container['Request'] = new Request(
['method' => 'GET'],
$this->createMock(IRequestId::class),
@@ -135,7 +135,7 @@ class DIContainerTest extends \Test\TestCase {
$this->fail('Bootstrap registered middleware not found');
}
- public function testInvalidAppClass() {
+ public function testInvalidAppClass(): void {
$this->expectException(QueryException::class);
$this->container->query('\OCA\Name\Foo');
}
diff --git a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
index ad126ad99e2..54c691d2392 100644
--- a/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
+++ b/tests/lib/AppFramework/DependencyInjection/DIIntergrationTests.php
@@ -48,7 +48,7 @@ class DIIntergrationTests extends TestCase {
$this->container = new DIContainer('App1', [], $this->server);
}
- public function testInjectFromServer() {
+ public function testInjectFromServer(): void {
$this->server->registerService(Interface1::class, function () {
return new ClassA1();
});
@@ -64,7 +64,7 @@ class DIIntergrationTests extends TestCase {
$this->assertSame(ClassA1::class, get_class($res->interface1));
}
- public function testInjectDepFromServer() {
+ public function testInjectDepFromServer(): void {
$this->server->registerService(Interface1::class, function () {
return new ClassA1();
});
@@ -80,7 +80,7 @@ class DIIntergrationTests extends TestCase {
$this->assertSame(ClassA1::class, get_class($res->interface1));
}
- public function testOverwriteDepFromServer() {
+ public function testOverwriteDepFromServer(): void {
$this->server->registerService(Interface1::class, function () {
return new ClassA1();
});
@@ -100,7 +100,7 @@ class DIIntergrationTests extends TestCase {
$this->assertSame(ClassA2::class, get_class($res->interface1));
}
- public function testIgnoreOverwriteInServerClass() {
+ public function testIgnoreOverwriteInServerClass(): void {
$this->server->registerService(Interface1::class, function () {
return new ClassA1();
});
diff --git a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php
index ba3aacd5424..aa2b29418e4 100644
--- a/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php
+++ b/tests/lib/AppFramework/Http/ContentSecurityPolicyTest.php
@@ -23,400 +23,400 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$this->contentSecurityPolicy = new ContentSecurityPolicy();
}
- public function testGetPolicyDefault() {
+ public function testGetPolicyDefault(): void {
$defaultPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->assertSame($defaultPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' www.owncloud.com;style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyScriptDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' www.nextcloud.com;style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' www.owncloud.com www.owncloud.org;style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyScriptDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' www.nextcloud.com www.nextcloud.org;style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowScriptDomain() {
+ public function testGetPolicyDisallowScriptDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowScriptDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowScriptDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowScriptDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' www.owncloud.com;style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowScriptDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' www.nextcloud.com;style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowScriptDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowScriptDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowScriptDomainMultipleStacked() {
+ public function testGetPolicyDisallowScriptDomainMultipleStacked(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowScriptDomain('www.owncloud.org')->disallowScriptDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowScriptDomain('www.nextcloud.org')->disallowScriptDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptDisallowEval() {
+ public function testGetPolicyScriptDisallowEval(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->allowEvalScript(false);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.owncloud.com 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyStyleDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.nextcloud.com 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.owncloud.com www.owncloud.org 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyStyleDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.nextcloud.com www.nextcloud.org 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowStyleDomain() {
+ public function testGetPolicyDisallowStyleDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowStyleDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.owncloud.com 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowStyleDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.nextcloud.com 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowStyleDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowStyleDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowStyleDomainMultipleStacked() {
+ public function testGetPolicyDisallowStyleDomainMultipleStacked(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowStyleDomain('www.owncloud.org')->disallowStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowStyleDomain('www.nextcloud.org')->disallowStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleAllowInline() {
+ public function testGetPolicyStyleAllowInline(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->allowInlineStyle(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleAllowInlineWithDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.owncloud.com 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyStyleAllowInlineWithDomain(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' www.nextcloud.com 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleDisallowInline() {
+ public function testGetPolicyStyleDisallowInline(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->allowInlineStyle(false);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyImageDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: www.owncloud.com;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyImageDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: www.nextcloud.com;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyImageDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: www.owncloud.com www.owncloud.org;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyImageDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: www.nextcloud.com www.nextcloud.org;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowImageDomain() {
+ public function testGetPolicyDisallowImageDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowImageDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowImageDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowImageDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: www.owncloud.com;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowImageDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob: www.nextcloud.com;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowImageDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowImageDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowImageDomainMultipleStakes() {
+ public function testGetPolicyDisallowImageDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowImageDomain('www.owncloud.org')->disallowImageDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowImageDomain('www.nextcloud.org')->disallowImageDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFontDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data: www.owncloud.com;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyFontDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data: www.nextcloud.com;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFontDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data: www.owncloud.com www.owncloud.org;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyFontDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data: www.nextcloud.com www.nextcloud.org;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFontDomain() {
+ public function testGetPolicyDisallowFontDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFontDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFontDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFontDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data: www.owncloud.com;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowFontDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data: www.nextcloud.com;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFontDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFontDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFontDomainMultipleStakes() {
+ public function testGetPolicyDisallowFontDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFontDomain('www.owncloud.org')->disallowFontDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFontDomain('www.nextcloud.org')->disallowFontDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyConnectDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self' www.owncloud.com;media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyConnectDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self' www.nextcloud.com;media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyConnectDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self' www.owncloud.com www.owncloud.org;media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyConnectDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self' www.nextcloud.com www.nextcloud.org;media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowConnectDomain() {
+ public function testGetPolicyDisallowConnectDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowConnectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowConnectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowConnectDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self' www.owncloud.com;media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowConnectDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self' www.nextcloud.com;media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowConnectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowConnectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowConnectDomainMultipleStakes() {
+ public function testGetPolicyDisallowConnectDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowConnectDomain('www.owncloud.org')->disallowConnectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowConnectDomain('www.nextcloud.org')->disallowConnectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyMediaDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self' www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyMediaDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self' www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyMediaDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self' www.owncloud.com www.owncloud.org;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyMediaDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self' www.nextcloud.com www.nextcloud.org;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowMediaDomain() {
+ public function testGetPolicyDisallowMediaDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowMediaDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowMediaDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowMediaDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self' www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowMediaDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self' www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowMediaDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowMediaDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowMediaDomainMultipleStakes() {
+ public function testGetPolicyDisallowMediaDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowMediaDomain('www.owncloud.org')->disallowMediaDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowMediaDomain('www.nextcloud.org')->disallowMediaDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyObjectDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';object-src www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyObjectDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';object-src www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyObjectDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';object-src www.owncloud.com www.owncloud.org;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyObjectDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';object-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowObjectDomain() {
+ public function testGetPolicyDisallowObjectDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowObjectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowObjectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowObjectDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';object-src www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowObjectDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';object-src www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowObjectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowObjectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowObjectDomainMultipleStakes() {
+ public function testGetPolicyDisallowObjectDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowObjectDomain('www.owncloud.org')->disallowObjectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowObjectDomain('www.nextcloud.org')->disallowObjectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetAllowedFrameDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetAllowedFrameDomain(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFrameDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src www.owncloud.com www.owncloud.org;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyFrameDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameDomain() {
+ public function testGetPolicyDisallowFrameDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFrameDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFrameDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowFrameDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-src www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFrameDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFrameDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameDomainMultipleStakes() {
+ public function testGetPolicyDisallowFrameDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFrameDomain('www.owncloud.org')->disallowFrameDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFrameDomain('www.nextcloud.org')->disallowFrameDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetAllowedChildSrcDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';child-src child.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetAllowedChildSrcDomain(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';child-src child.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyChildSrcValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';child-src child.owncloud.com child.owncloud.org;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyChildSrcValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';child-src child.nextcloud.com child.nextcloud.org;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.owncloud.com');
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowChildSrcDomain() {
+ public function testGetPolicyDisallowChildSrcDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowChildSrcDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';child-src www.owncloud.com;frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyDisallowChildSrcDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';child-src www.nextcloud.com;frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowChildSrcDomainMultipleStakes() {
+ public function testGetPolicyDisallowChildSrcDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.org')->disallowChildSrcDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.org')->disallowChildSrcDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetAllowedFrameAncestorDomain() {
+ public function testGetAllowedFrameAncestorDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self' sub.nextcloud.com;form-action 'self'";
$this->contentSecurityPolicy->addAllowedFrameAncestorDomain('sub.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFrameAncestorValidMultiple() {
+ public function testGetPolicyFrameAncestorValidMultiple(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self' sub.nextcloud.com foo.nextcloud.com;form-action 'self'";
$this->contentSecurityPolicy->addAllowedFrameAncestorDomain('sub.nextcloud.com');
@@ -424,7 +424,7 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameAncestorDomain() {
+ public function testGetPolicyDisallowFrameAncestorDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->addAllowedFrameAncestorDomain('www.nextcloud.com');
@@ -432,7 +432,7 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameAncestorDomainMultiple() {
+ public function testGetPolicyDisallowFrameAncestorDomainMultiple(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self' www.nextcloud.com;form-action 'self'";
$this->contentSecurityPolicy->addAllowedFrameAncestorDomain('www.nextcloud.com');
@@ -440,48 +440,48 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameAncestorDomainMultipleStakes() {
+ public function testGetPolicyDisallowFrameAncestorDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.org')->disallowChildSrcDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.org')->disallowChildSrcDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyUnsafeEval() {
+ public function testGetPolicyUnsafeEval(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' 'unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->allowEvalScript(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyUnsafeWasmEval() {
+ public function testGetPolicyUnsafeWasmEval(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' 'wasm-unsafe-eval';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->allowEvalWasm(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyNonce() {
- $nonce = 'my-nonce';
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-".base64_encode($nonce) . "';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyNonce(): void {
+ $nonce = base64_encode('my-nonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-$nonce';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->useJsNonce($nonce);
$this->contentSecurityPolicy->useStrictDynamicOnScripts(false);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyNonceDefault() {
- $nonce = 'my-nonce';
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-".base64_encode($nonce) . "';script-src-elem 'strict-dynamic' 'nonce-".base64_encode($nonce) . "';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyNonceDefault(): void {
+ $nonce = base64_encode('my-nonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-$nonce';script-src-elem 'strict-dynamic' 'nonce-$nonce';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->useJsNonce($nonce);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyNonceStrictDynamic() {
- $nonce = 'my-nonce';
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-".base64_encode($nonce) . "';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyNonceStrictDynamic(): void {
+ $nonce = base64_encode('my-nonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-$nonce';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->useJsNonce($nonce);
$this->contentSecurityPolicy->useStrictDynamic(true);
@@ -489,23 +489,23 @@ class ContentSecurityPolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyNonceStrictDynamicDefault() {
- $nonce = 'my-nonce';
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-".base64_encode($nonce) . "';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
+ public function testGetPolicyNonceStrictDynamicDefault(): void {
+ $nonce = base64_encode('my-nonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-$nonce';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->useJsNonce($nonce);
$this->contentSecurityPolicy->useStrictDynamic(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStrictDynamicOnScriptsOff() {
+ public function testGetPolicyStrictDynamicOnScriptsOff(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->useStrictDynamicOnScripts(false);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStrictDynamicAndStrictDynamicOnScripts() {
+ public function testGetPolicyStrictDynamicAndStrictDynamicOnScripts(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';style-src 'self' 'unsafe-inline';img-src 'self' data: blob:;font-src 'self' data:;connect-src 'self';media-src 'self';frame-ancestors 'self';form-action 'self'";
$this->contentSecurityPolicy->useStrictDynamic(true);
diff --git a/tests/lib/AppFramework/Http/DataResponseTest.php b/tests/lib/AppFramework/Http/DataResponseTest.php
index 39f7e76ea0c..7ae19e7d5d8 100644
--- a/tests/lib/AppFramework/Http/DataResponseTest.php
+++ b/tests/lib/AppFramework/Http/DataResponseTest.php
@@ -24,7 +24,7 @@ class DataResponseTest extends \Test\TestCase {
}
- public function testSetData() {
+ public function testSetData(): void {
$params = ['hi', 'yo'];
$this->response->setData($params);
@@ -32,7 +32,7 @@ class DataResponseTest extends \Test\TestCase {
}
- public function testConstructorAllowsToSetData() {
+ public function testConstructorAllowsToSetData(): void {
$data = ['hi'];
$code = 300;
$response = new DataResponse($data, $code);
@@ -42,7 +42,7 @@ class DataResponseTest extends \Test\TestCase {
}
- public function testConstructorAllowsToSetHeaders() {
+ public function testConstructorAllowsToSetHeaders(): void {
$data = ['hi'];
$code = 300;
$headers = ['test' => 'something'];
@@ -63,7 +63,7 @@ class DataResponseTest extends \Test\TestCase {
}
- public function testChainability() {
+ public function testChainability(): void {
$params = ['hi', 'yo'];
$this->response->setData($params)
->setStatus(Http::STATUS_NOT_FOUND);
diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php
index cb32302d4be..94bcfcc4af2 100644
--- a/tests/lib/AppFramework/Http/DispatcherTest.php
+++ b/tests/lib/AppFramework/Http/DispatcherTest.php
@@ -77,19 +77,19 @@ class DispatcherTest extends \Test\TestCase {
/** @var Dispatcher */
private $dispatcher;
private $controllerMethod;
- /** @var Controller|MockObject */
+ /** @var Controller|MockObject */
private $controller;
private $response;
- /** @var IRequest|MockObject */
+ /** @var IRequest|MockObject */
private $request;
private $lastModified;
private $etag;
- /** @var Http|MockObject */
+ /** @var Http|MockObject */
private $http;
private $reflector;
- /** @var IConfig|MockObject */
+ /** @var IConfig|MockObject */
private $config;
- /** @var LoggerInterface|MockObject */
+ /** @var LoggerInterface|MockObject */
private $logger;
/** @var IEventLogger|MockObject */
private $eventLogger;
@@ -230,7 +230,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testDispatcherReturnsArrayWith2Entries() {
+ public function testDispatcherReturnsArrayWith2Entries(): void {
$this->setMiddlewareExpectations('');
$response = $this->dispatcher->dispatch($this->controller, $this->controllerMethod);
@@ -240,7 +240,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testHeadersAndOutputAreReturned() {
+ public function testHeadersAndOutputAreReturned(): void {
$out = 'yo';
$httpHeaders = 'Http';
$responseHeaders = ['hell' => 'yeah'];
@@ -255,7 +255,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testExceptionCallsAfterException() {
+ public function testExceptionCallsAfterException(): void {
$out = 'yo';
$httpHeaders = 'Http';
$responseHeaders = ['hell' => 'yeah'];
@@ -270,7 +270,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testExceptionThrowsIfCanNotBeHandledByAfterException() {
+ public function testExceptionThrowsIfCanNotBeHandledByAfterException(): void {
$out = 'yo';
$httpHeaders = 'Http';
$responseHeaders = ['hell' => 'yeah'];
@@ -286,7 +286,7 @@ class DispatcherTest extends \Test\TestCase {
private function dispatcherPassthrough() {
$this->middlewareDispatcher->expects($this->once())
- ->method('beforeController');
+ ->method('beforeController');
$this->middlewareDispatcher->expects($this->once())
->method('afterController')
->willReturnCallback(function ($a, $b, $in) {
@@ -300,7 +300,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testControllerParametersInjected() {
+ public function testControllerParametersInjected(): void {
$this->request = new Request(
[
'post' => [
@@ -332,7 +332,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testControllerParametersInjectedDefaultOverwritten() {
+ public function testControllerParametersInjectedDefaultOverwritten(): void {
$this->request = new Request(
[
'post' => [
@@ -366,7 +366,7 @@ class DispatcherTest extends \Test\TestCase {
- public function testResponseTransformedByUrlFormat() {
+ public function testResponseTransformedByUrlFormat(): void {
$this->request = new Request(
[
'post' => [
@@ -401,7 +401,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testResponseTransformsDataResponse() {
+ public function testResponseTransformsDataResponse(): void {
$this->request = new Request(
[
'post' => [
@@ -436,7 +436,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testResponseTransformedByAcceptHeader() {
+ public function testResponseTransformedByAcceptHeader(): void {
$this->request = new Request(
[
'post' => [
@@ -472,7 +472,7 @@ class DispatcherTest extends \Test\TestCase {
}
- public function testResponsePrimarilyTransformedByParameterFormat() {
+ public function testResponsePrimarilyTransformedByParameterFormat(): void {
$this->request = new Request(
[
'post' => [
diff --git a/tests/lib/AppFramework/Http/DownloadResponseTest.php b/tests/lib/AppFramework/Http/DownloadResponseTest.php
index 425e5ecde1f..8ac5954e00d 100644
--- a/tests/lib/AppFramework/Http/DownloadResponseTest.php
+++ b/tests/lib/AppFramework/Http/DownloadResponseTest.php
@@ -19,7 +19,7 @@ class DownloadResponseTest extends \Test\TestCase {
parent::setUp();
}
- public function testHeaders() {
+ public function testHeaders(): void {
$response = new ChildDownloadResponse('file', 'content');
$headers = $response->getHeaders();
@@ -30,7 +30,7 @@ class DownloadResponseTest extends \Test\TestCase {
/**
* @dataProvider filenameEncodingProvider
*/
- public function testFilenameEncoding(string $input, string $expected) {
+ public function testFilenameEncoding(string $input, string $expected): void {
$response = new ChildDownloadResponse($input, 'content');
$headers = $response->getHeaders();
diff --git a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php
index 7d64b37b3c0..3110f632fa7 100644
--- a/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php
+++ b/tests/lib/AppFramework/Http/EmptyContentSecurityPolicyTest.php
@@ -23,470 +23,475 @@ class EmptyContentSecurityPolicyTest extends \Test\TestCase {
$this->contentSecurityPolicy = new EmptyContentSecurityPolicy();
}
- public function testGetPolicyDefault() {
+ public function testGetPolicyDefault(): void {
$defaultPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
$this->assertSame($defaultPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyScriptDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyScriptDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowScriptDomain() {
+ public function testGetPolicyDisallowScriptDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowScriptDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowScriptDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowScriptDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowScriptDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowScriptDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowScriptDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowScriptDomainMultipleStacked() {
+ public function testGetPolicyDisallowScriptDomainMultipleStacked(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedScriptDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowScriptDomain('www.owncloud.org')->disallowScriptDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowScriptDomain('www.nextcloud.org')->disallowScriptDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptAllowEval() {
+ public function testGetPolicyScriptAllowEval(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'unsafe-eval';frame-ancestors 'none'";
$this->contentSecurityPolicy->allowEvalScript(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyScriptAllowWasmEval() {
+ public function testGetPolicyScriptAllowWasmEval(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'wasm-unsafe-eval';frame-ancestors 'none'";
$this->contentSecurityPolicy->allowEvalWasm(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyStyleDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyStyleDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowStyleDomain() {
+ public function testGetPolicyDisallowStyleDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowStyleDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowStyleDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowStyleDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowStyleDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowStyleDomainMultipleStacked() {
+ public function testGetPolicyDisallowStyleDomainMultipleStacked(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowStyleDomain('www.owncloud.org')->disallowStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowStyleDomain('www.nextcloud.org')->disallowStyleDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleAllowInline() {
+ public function testGetPolicyStyleAllowInline(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src 'unsafe-inline';frame-ancestors 'none'";
$this->contentSecurityPolicy->allowInlineStyle(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleAllowInlineWithDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.owncloud.com 'unsafe-inline';frame-ancestors 'none'";
+ public function testGetPolicyStyleAllowInlineWithDomain(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';style-src www.nextcloud.com 'unsafe-inline';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedStyleDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedStyleDomain('www.nextcloud.com');
$this->contentSecurityPolicy->allowInlineStyle(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyStyleDisallowInline() {
+ public function testGetPolicyStyleDisallowInline(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
$this->contentSecurityPolicy->allowInlineStyle(false);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyImageDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';img-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyImageDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';img-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyImageDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';img-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyImageDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';img-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowImageDomain() {
+ public function testGetPolicyDisallowImageDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowImageDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowImageDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowImageDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';img-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowImageDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';img-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowImageDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowImageDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowImageDomainMultipleStakes() {
+ public function testGetPolicyDisallowImageDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedImageDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowImageDomain('www.owncloud.org')->disallowImageDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedImageDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowImageDomain('www.nextcloud.org')->disallowImageDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFontDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';font-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyFontDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';font-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFontDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';font-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyFontDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';font-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFontDomain() {
+ public function testGetPolicyDisallowFontDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFontDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFontDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFontDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';font-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowFontDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';font-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFontDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFontDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFontDomainMultipleStakes() {
+ public function testGetPolicyDisallowFontDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFontDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFontDomain('www.owncloud.org')->disallowFontDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFontDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFontDomain('www.nextcloud.org')->disallowFontDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyConnectDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';connect-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyConnectDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';connect-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyConnectDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';connect-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyConnectDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';connect-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowConnectDomain() {
+ public function testGetPolicyDisallowConnectDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowConnectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowConnectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowConnectDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';connect-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowConnectDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';connect-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowConnectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowConnectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowConnectDomainMultipleStakes() {
+ public function testGetPolicyDisallowConnectDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedConnectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowConnectDomain('www.owncloud.org')->disallowConnectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedConnectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowConnectDomain('www.nextcloud.org')->disallowConnectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyMediaDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';media-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyMediaDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';media-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyMediaDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';media-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyMediaDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';media-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowMediaDomain() {
+ public function testGetPolicyDisallowMediaDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowMediaDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowMediaDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowMediaDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';media-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowMediaDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';media-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowMediaDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowMediaDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowMediaDomainMultipleStakes() {
+ public function testGetPolicyDisallowMediaDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedMediaDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowMediaDomain('www.owncloud.org')->disallowMediaDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedMediaDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowMediaDomain('www.nextcloud.org')->disallowMediaDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyObjectDomainValid() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';object-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyObjectDomainValid(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';object-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyObjectDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';object-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyObjectDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';object-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowObjectDomain() {
+ public function testGetPolicyDisallowObjectDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowObjectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowObjectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowObjectDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';object-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowObjectDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';object-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowObjectDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowObjectDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowObjectDomainMultipleStakes() {
+ public function testGetPolicyDisallowObjectDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedObjectDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowObjectDomain('www.owncloud.org')->disallowObjectDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedObjectDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowObjectDomain('www.nextcloud.org')->disallowObjectDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetAllowedFrameDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetAllowedFrameDomain(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyFrameDomainValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-src www.owncloud.com www.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyFrameDomainValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-src www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameDomain() {
+ public function testGetPolicyDisallowFrameDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFrameDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFrameDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowFrameDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFrameDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFrameDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowFrameDomainMultipleStakes() {
+ public function testGetPolicyDisallowFrameDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedFrameDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowFrameDomain('www.owncloud.org')->disallowFrameDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedFrameDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowFrameDomain('www.nextcloud.org')->disallowFrameDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetAllowedChildSrcDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';child-src child.owncloud.com;frame-ancestors 'none'";
+ public function testGetAllowedChildSrcDomain(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';child-src child.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyChildSrcValidMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';child-src child.owncloud.com child.owncloud.org;frame-ancestors 'none'";
+ public function testGetPolicyChildSrcValidMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';child-src child.nextcloud.com child.nextcloud.org;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.owncloud.com');
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.nextcloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('child.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowChildSrcDomain() {
+ public function testGetPolicyDisallowChildSrcDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowChildSrcDomainMultiple() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';child-src www.owncloud.com;frame-ancestors 'none'";
+ public function testGetPolicyDisallowChildSrcDomainMultiple(): void {
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';child-src www.nextcloud.com;frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.org');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyDisallowChildSrcDomainMultipleStakes() {
+ public function testGetPolicyDisallowChildSrcDomainMultipleStakes(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
- $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.owncloud.com');
- $this->contentSecurityPolicy->disallowChildSrcDomain('www.owncloud.org')->disallowChildSrcDomain('www.owncloud.com');
+ $this->contentSecurityPolicy->addAllowedChildSrcDomain('www.nextcloud.com');
+ $this->contentSecurityPolicy->disallowChildSrcDomain('www.nextcloud.org')->disallowChildSrcDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithJsNonceAndScriptDomains() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-TXlKc05vbmNl' www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
+ public function testGetPolicyWithJsNonceAndScriptDomains(): void {
+ $nonce = base64_encode('MyJsNonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-$nonce' www.nextcloud.com www.nextcloud.org;frame-ancestors 'none'";
$this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
- $this->contentSecurityPolicy->useJsNonce('MyJsNonce');
+ $this->contentSecurityPolicy->useJsNonce($nonce);
$this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.org');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithJsNonceAndStrictDynamic() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-TXlKc05vbmNl' www.nextcloud.com;frame-ancestors 'none'";
+ public function testGetPolicyWithJsNonceAndStrictDynamic(): void {
+ $nonce = base64_encode('MyJsNonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-$nonce' www.nextcloud.com;frame-ancestors 'none'";
$this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
$this->contentSecurityPolicy->useStrictDynamic(true);
- $this->contentSecurityPolicy->useJsNonce('MyJsNonce');
+ $this->contentSecurityPolicy->useJsNonce($nonce);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithJsNonceAndStrictDynamicAndStrictDynamicOnScripts() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-TXlKc05vbmNl' www.nextcloud.com;frame-ancestors 'none'";
+ public function testGetPolicyWithJsNonceAndStrictDynamicAndStrictDynamicOnScripts(): void {
+ $nonce = base64_encode('MyJsNonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'strict-dynamic' 'nonce-$nonce' www.nextcloud.com;frame-ancestors 'none'";
$this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
$this->contentSecurityPolicy->useStrictDynamic(true);
$this->contentSecurityPolicy->useStrictDynamicOnScripts(true);
- $this->contentSecurityPolicy->useJsNonce('MyJsNonce');
+ $this->contentSecurityPolicy->useJsNonce($nonce);
// Should be same as `testGetPolicyWithJsNonceAndStrictDynamic` because of fallback
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithJsNonceAndStrictDynamicOnScripts() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-TXlKc05vbmNl' www.nextcloud.com;script-src-elem 'strict-dynamic' 'nonce-TXlKc05vbmNl' www.nextcloud.com;frame-ancestors 'none'";
+ public function testGetPolicyWithJsNonceAndStrictDynamicOnScripts(): void {
+ $nonce = base64_encode('MyJsNonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-$nonce' www.nextcloud.com;script-src-elem 'strict-dynamic' 'nonce-$nonce' www.nextcloud.com;frame-ancestors 'none'";
$this->contentSecurityPolicy->addAllowedScriptDomain('www.nextcloud.com');
$this->contentSecurityPolicy->useStrictDynamicOnScripts(true);
- $this->contentSecurityPolicy->useJsNonce('MyJsNonce');
+ $this->contentSecurityPolicy->useJsNonce($nonce);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithStrictDynamicOnScripts() {
+ public function testGetPolicyWithStrictDynamicOnScripts(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'";
$this->contentSecurityPolicy->useStrictDynamicOnScripts(true);
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithJsNonceAndSelfScriptDomain() {
- $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-TXlKc05vbmNl';frame-ancestors 'none'";
+ public function testGetPolicyWithJsNonceAndSelfScriptDomain(): void {
+ $nonce = base64_encode('MyJsNonce');
+ $expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'nonce-$nonce';frame-ancestors 'none'";
- $this->contentSecurityPolicy->useJsNonce('MyJsNonce');
+ $this->contentSecurityPolicy->useJsNonce($nonce);
$this->contentSecurityPolicy->addAllowedScriptDomain("'self'");
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithoutJsNonceAndSelfScriptDomain() {
+ public function testGetPolicyWithoutJsNonceAndSelfScriptDomain(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self';frame-ancestors 'none'";
$this->contentSecurityPolicy->addAllowedScriptDomain("'self'");
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithReportUri() {
+ public function testGetPolicyWithReportUri(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none';report-uri https://my-report-uri.com";
- $this->contentSecurityPolicy->addReportTo("https://my-report-uri.com");
+ $this->contentSecurityPolicy->addReportTo('https://my-report-uri.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
- public function testGetPolicyWithMultipleReportUri() {
+ public function testGetPolicyWithMultipleReportUri(): void {
$expectedPolicy = "default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none';report-uri https://my-report-uri.com https://my-other-report-uri.com";
- $this->contentSecurityPolicy->addReportTo("https://my-report-uri.com");
- $this->contentSecurityPolicy->addReportTo("https://my-other-report-uri.com");
+ $this->contentSecurityPolicy->addReportTo('https://my-report-uri.com');
+ $this->contentSecurityPolicy->addReportTo('https://my-other-report-uri.com');
$this->assertSame($expectedPolicy, $this->contentSecurityPolicy->buildPolicy());
}
}
diff --git a/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php b/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php
index ca65fcd978c..71342485552 100644
--- a/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php
+++ b/tests/lib/AppFramework/Http/EmptyFeaturePolicyTest.php
@@ -19,19 +19,19 @@ class EmptyFeaturePolicyTest extends \Test\TestCase {
$this->policy = new EmptyFeaturePolicy();
}
- public function testGetPolicyDefault() {
+ public function testGetPolicyDefault(): void {
$defaultPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'";
$this->assertSame($defaultPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyAutoplayDomainValid() {
+ public function testGetPolicyAutoplayDomainValid(): void {
$expectedPolicy = "autoplay www.nextcloud.com;camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedAutoplayDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyAutoplayDomainValidMultiple() {
+ public function testGetPolicyAutoplayDomainValidMultiple(): void {
$expectedPolicy = "autoplay www.nextcloud.com www.nextcloud.org;camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedAutoplayDomain('www.nextcloud.com');
@@ -39,14 +39,14 @@ class EmptyFeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyCameraDomainValid() {
+ public function testGetPolicyCameraDomainValid(): void {
$expectedPolicy = "autoplay 'none';camera www.nextcloud.com;fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedCameraDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyCameraDomainValidMultiple() {
+ public function testGetPolicyCameraDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'none';camera www.nextcloud.com www.nextcloud.org;fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedCameraDomain('www.nextcloud.com');
@@ -54,14 +54,14 @@ class EmptyFeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyFullScreenDomainValid() {
+ public function testGetPolicyFullScreenDomainValid(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen www.nextcloud.com;geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedFullScreenDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyFullScreenDomainValidMultiple() {
+ public function testGetPolicyFullScreenDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen www.nextcloud.com www.nextcloud.org;geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedFullScreenDomain('www.nextcloud.com');
@@ -69,14 +69,14 @@ class EmptyFeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyGeoLocationDomainValid() {
+ public function testGetPolicyGeoLocationDomainValid(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation www.nextcloud.com;microphone 'none';payment 'none'";
$this->policy->addAllowedGeoLocationDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyGeoLocationDomainValidMultiple() {
+ public function testGetPolicyGeoLocationDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation www.nextcloud.com www.nextcloud.org;microphone 'none';payment 'none'";
$this->policy->addAllowedGeoLocationDomain('www.nextcloud.com');
@@ -84,14 +84,14 @@ class EmptyFeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyMicrophoneDomainValid() {
+ public function testGetPolicyMicrophoneDomainValid(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone www.nextcloud.com;payment 'none'";
$this->policy->addAllowedMicrophoneDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyMicrophoneDomainValidMultiple() {
+ public function testGetPolicyMicrophoneDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone www.nextcloud.com www.nextcloud.org;payment 'none'";
$this->policy->addAllowedMicrophoneDomain('www.nextcloud.com');
@@ -99,14 +99,14 @@ class EmptyFeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyPaymentDomainValid() {
+ public function testGetPolicyPaymentDomainValid(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment www.nextcloud.com";
$this->policy->addAllowedPaymentDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyPaymentDomainValidMultiple() {
+ public function testGetPolicyPaymentDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment www.nextcloud.com www.nextcloud.org";
$this->policy->addAllowedPaymentDomain('www.nextcloud.com');
diff --git a/tests/lib/AppFramework/Http/FeaturePolicyTest.php b/tests/lib/AppFramework/Http/FeaturePolicyTest.php
index ce6a87406e8..6ea990fb111 100644
--- a/tests/lib/AppFramework/Http/FeaturePolicyTest.php
+++ b/tests/lib/AppFramework/Http/FeaturePolicyTest.php
@@ -19,19 +19,19 @@ class FeaturePolicyTest extends \Test\TestCase {
$this->policy = new FeaturePolicy();
}
- public function testGetPolicyDefault() {
+ public function testGetPolicyDefault(): void {
$defaultPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation 'none';microphone 'none';payment 'none'";
$this->assertSame($defaultPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyAutoplayDomainValid() {
+ public function testGetPolicyAutoplayDomainValid(): void {
$expectedPolicy = "autoplay 'self' www.nextcloud.com;camera 'none';fullscreen 'self';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedAutoplayDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyAutoplayDomainValidMultiple() {
+ public function testGetPolicyAutoplayDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'self' www.nextcloud.com www.nextcloud.org;camera 'none';fullscreen 'self';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedAutoplayDomain('www.nextcloud.com');
@@ -39,14 +39,14 @@ class FeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyCameraDomainValid() {
+ public function testGetPolicyCameraDomainValid(): void {
$expectedPolicy = "autoplay 'self';camera www.nextcloud.com;fullscreen 'self';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedCameraDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyCameraDomainValidMultiple() {
+ public function testGetPolicyCameraDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'self';camera www.nextcloud.com www.nextcloud.org;fullscreen 'self';geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedCameraDomain('www.nextcloud.com');
@@ -54,14 +54,14 @@ class FeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyFullScreenDomainValid() {
+ public function testGetPolicyFullScreenDomainValid(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self' www.nextcloud.com;geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedFullScreenDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyFullScreenDomainValidMultiple() {
+ public function testGetPolicyFullScreenDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self' www.nextcloud.com www.nextcloud.org;geolocation 'none';microphone 'none';payment 'none'";
$this->policy->addAllowedFullScreenDomain('www.nextcloud.com');
@@ -69,14 +69,14 @@ class FeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyGeoLocationDomainValid() {
+ public function testGetPolicyGeoLocationDomainValid(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation www.nextcloud.com;microphone 'none';payment 'none'";
$this->policy->addAllowedGeoLocationDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyGeoLocationDomainValidMultiple() {
+ public function testGetPolicyGeoLocationDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation www.nextcloud.com www.nextcloud.org;microphone 'none';payment 'none'";
$this->policy->addAllowedGeoLocationDomain('www.nextcloud.com');
@@ -84,14 +84,14 @@ class FeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyMicrophoneDomainValid() {
+ public function testGetPolicyMicrophoneDomainValid(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation 'none';microphone www.nextcloud.com;payment 'none'";
$this->policy->addAllowedMicrophoneDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyMicrophoneDomainValidMultiple() {
+ public function testGetPolicyMicrophoneDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation 'none';microphone www.nextcloud.com www.nextcloud.org;payment 'none'";
$this->policy->addAllowedMicrophoneDomain('www.nextcloud.com');
@@ -99,14 +99,14 @@ class FeaturePolicyTest extends \Test\TestCase {
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyPaymentDomainValid() {
+ public function testGetPolicyPaymentDomainValid(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation 'none';microphone 'none';payment www.nextcloud.com";
$this->policy->addAllowedPaymentDomain('www.nextcloud.com');
$this->assertSame($expectedPolicy, $this->policy->buildPolicy());
}
- public function testGetPolicyPaymentDomainValidMultiple() {
+ public function testGetPolicyPaymentDomainValidMultiple(): void {
$expectedPolicy = "autoplay 'self';camera 'none';fullscreen 'self';geolocation 'none';microphone 'none';payment www.nextcloud.com www.nextcloud.org";
$this->policy->addAllowedPaymentDomain('www.nextcloud.com');
diff --git a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php
index a75c6fdd591..5f602b2e1c6 100644
--- a/tests/lib/AppFramework/Http/FileDisplayResponseTest.php
+++ b/tests/lib/AppFramework/Http/FileDisplayResponseTest.php
@@ -34,23 +34,23 @@ class FileDisplayResponseTest extends \Test\TestCase {
$this->response = new FileDisplayResponse($this->file);
}
- public function testHeader() {
+ public function testHeader(): void {
$headers = $this->response->getHeaders();
$this->assertArrayHasKey('Content-Disposition', $headers);
$this->assertSame('inline; filename="myFileName"', $headers['Content-Disposition']);
}
- public function testETag() {
+ public function testETag(): void {
$this->assertSame('myETag', $this->response->getETag());
}
- public function testLastModified() {
+ public function testLastModified(): void {
$lastModified = $this->response->getLastModified();
$this->assertNotNull($lastModified);
$this->assertSame(1464825600, $lastModified->getTimestamp());
}
- public function test304() {
+ public function test304(): void {
$output = $this->getMockBuilder('OCP\AppFramework\Http\IOutput')
->disableOriginalConstructor()
->getMock();
@@ -67,7 +67,7 @@ class FileDisplayResponseTest extends \Test\TestCase {
}
- public function testNon304() {
+ public function testNon304(): void {
$output = $this->getMockBuilder('OCP\AppFramework\Http\IOutput')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/AppFramework/Http/HttpTest.php b/tests/lib/AppFramework/Http/HttpTest.php
index 46d2bb9d17a..d3ec8438554 100644
--- a/tests/lib/AppFramework/Http/HttpTest.php
+++ b/tests/lib/AppFramework/Http/HttpTest.php
@@ -26,19 +26,19 @@ class HttpTest extends \Test\TestCase {
}
- public function testProtocol() {
+ public function testProtocol(): void {
$header = $this->http->getStatusHeader(Http::STATUS_TEMPORARY_REDIRECT);
$this->assertEquals('HTTP/1.1 307 Temporary Redirect', $header);
}
- public function testProtocol10() {
+ public function testProtocol10(): void {
$this->http = new Http($this->server, 'HTTP/1.0');
$header = $this->http->getStatusHeader(Http::STATUS_OK);
$this->assertEquals('HTTP/1.0 200 OK', $header);
}
- public function testTempRedirectBecomesFoundInHttp10() {
+ public function testTempRedirectBecomesFoundInHttp10(): void {
$http = new Http([], 'HTTP/1.0');
$header = $http->getStatusHeader(Http::STATUS_TEMPORARY_REDIRECT);
diff --git a/tests/lib/AppFramework/Http/JSONResponseTest.php b/tests/lib/AppFramework/Http/JSONResponseTest.php
index bacc5999348..175ed852c7b 100644
--- a/tests/lib/AppFramework/Http/JSONResponseTest.php
+++ b/tests/lib/AppFramework/Http/JSONResponseTest.php
@@ -23,13 +23,13 @@ class JSONResponseTest extends \Test\TestCase {
}
- public function testHeader() {
+ public function testHeader(): void {
$headers = $this->json->getHeaders();
$this->assertEquals('application/json; charset=utf-8', $headers['Content-Type']);
}
- public function testSetData() {
+ public function testSetData(): void {
$params = ['hi', 'yo'];
$this->json->setData($params);
@@ -37,7 +37,7 @@ class JSONResponseTest extends \Test\TestCase {
}
- public function testSetRender() {
+ public function testSetRender(): void {
$params = ['test' => 'hi'];
$this->json->setData($params);
@@ -65,13 +65,13 @@ class JSONResponseTest extends \Test\TestCase {
* @param array $input
* @param string $expected
*/
- public function testRender(array $input, $expected) {
+ public function testRender(array $input, $expected): void {
$this->json->setData($input);
$this->assertEquals($expected, $this->json->render());
}
- public function testRenderWithNonUtf8Encoding() {
+ public function testRenderWithNonUtf8Encoding(): void {
$this->expectException(\JsonException::class);
$this->expectExceptionMessage('Malformed UTF-8 characters, possibly incorrectly encoded');
@@ -80,7 +80,7 @@ class JSONResponseTest extends \Test\TestCase {
$this->json->render();
}
- public function testConstructorAllowsToSetData() {
+ public function testConstructorAllowsToSetData(): void {
$data = ['hi'];
$code = 300;
$response = new JSONResponse($data, $code);
@@ -90,7 +90,7 @@ class JSONResponseTest extends \Test\TestCase {
$this->assertEquals($code, $response->getStatus());
}
- public function testChainability() {
+ public function testChainability(): void {
$params = ['hi', 'yo'];
$this->json->setData($params)
->setStatus(Http::STATUS_NOT_FOUND);
diff --git a/tests/lib/AppFramework/Http/OutputTest.php b/tests/lib/AppFramework/Http/OutputTest.php
index cad49ae77ba..58b17c08141 100644
--- a/tests/lib/AppFramework/Http/OutputTest.php
+++ b/tests/lib/AppFramework/Http/OutputTest.php
@@ -9,19 +9,19 @@ namespace Test\AppFramework\Http;
use OC\AppFramework\Http\Output;
class OutputTest extends \Test\TestCase {
- public function testSetOutput() {
+ public function testSetOutput(): void {
$this->expectOutputString('foo');
$output = new Output('');
$output->setOutput('foo');
}
- public function testSetReadfile() {
+ public function testSetReadfile(): void {
$this->expectOutputString(file_get_contents(__FILE__));
$output = new Output('');
$output->setReadfile(__FILE__);
}
- public function testSetReadfileStream() {
+ public function testSetReadfileStream(): void {
$this->expectOutputString(file_get_contents(__FILE__));
$output = new Output('');
$output->setReadfile(fopen(__FILE__, 'r'));
diff --git a/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php b/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php
index fbed0746751..d963705bc24 100644
--- a/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php
+++ b/tests/lib/AppFramework/Http/PublicTemplateResponseTest.php
@@ -12,13 +12,12 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use Test\TestCase;
class PublicTemplateResponseTest extends TestCase {
- public function testSetParamsConstructor() {
+ public function testSetParamsConstructor(): void {
$template = new PublicTemplateResponse('app', 'home', ['key' => 'value']);
- $this->assertContains('core/js/public/publicpage', \OC_Util::$scripts);
$this->assertEquals(['key' => 'value'], $template->getParams());
}
- public function testAdditionalElements() {
+ public function testAdditionalElements(): void {
$template = new PublicTemplateResponse('app', 'home', ['key' => 'value']);
$template->setHeaderTitle('Header');
$template->setHeaderDetails('Details');
@@ -27,7 +26,7 @@ class PublicTemplateResponseTest extends TestCase {
$this->assertEquals('Details', $template->getHeaderDetails());
}
- public function testActionSingle() {
+ public function testActionSingle(): void {
$actions = [
new Http\Template\SimpleMenuAction('link', 'Download', 'download', 'downloadLink', 0)
];
@@ -40,7 +39,7 @@ class PublicTemplateResponseTest extends TestCase {
}
- public function testActionMultiple() {
+ public function testActionMultiple(): void {
$actions = [
new Http\Template\SimpleMenuAction('link1', 'Download1', 'download1', 'downloadLink1', 100),
new Http\Template\SimpleMenuAction('link2', 'Download2', 'download2', 'downloadLink2', 20),
@@ -55,9 +54,8 @@ class PublicTemplateResponseTest extends TestCase {
}
- public function testGetRenderAs() {
+ public function testGetRenderAs(): void {
$template = new PublicTemplateResponse('app', 'home', ['key' => 'value']);
- $this->assertContains('core/js/public/publicpage', \OC_Util::$scripts);
$this->assertEquals(['key' => 'value'], $template->getParams());
$this->assertEquals('public', $template->getRenderAs());
}
diff --git a/tests/lib/AppFramework/Http/RedirectResponseTest.php b/tests/lib/AppFramework/Http/RedirectResponseTest.php
index dd0142b77a7..f6319782e79 100644
--- a/tests/lib/AppFramework/Http/RedirectResponseTest.php
+++ b/tests/lib/AppFramework/Http/RedirectResponseTest.php
@@ -23,7 +23,7 @@ class RedirectResponseTest extends \Test\TestCase {
}
- public function testHeaders() {
+ public function testHeaders(): void {
$headers = $this->response->getHeaders();
$this->assertEquals('/url', $headers['Location']);
$this->assertEquals(Http::STATUS_SEE_OTHER,
@@ -31,7 +31,7 @@ class RedirectResponseTest extends \Test\TestCase {
}
- public function testGetRedirectUrl() {
+ public function testGetRedirectUrl(): void {
$this->assertEquals('/url', $this->response->getRedirectUrl());
}
}
diff --git a/tests/lib/AppFramework/Http/RequestStream.php b/tests/lib/AppFramework/Http/RequestStream.php
index 99f664b48ac..91259b26c9f 100644
--- a/tests/lib/AppFramework/Http/RequestStream.php
+++ b/tests/lib/AppFramework/Http/RequestStream.php
@@ -17,7 +17,7 @@ class RequestStream {
public function stream_open(string $path, string $mode, int $options, ?string &$opened_path): bool {
$url = parse_url($path);
- $this->varname = $url["host"] ?? '';
+ $this->varname = $url['host'] ?? '';
$this->position = 0;
return true;
@@ -104,7 +104,7 @@ class RequestStream {
public function stream_metadata(string $path, int $option, $var): bool {
if ($option == STREAM_META_TOUCH) {
$url = parse_url($path);
- $varname = $url["host"] ?? '';
+ $varname = $url['host'] ?? '';
if (!isset($GLOBALS[$varname])) {
$GLOBALS[$varname] = '';
}
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index f0e1f459028..1c7f07580cc 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -47,7 +47,7 @@ class RequestTest extends \Test\TestCase {
parent::tearDown();
}
- public function testRequestAccessors() {
+ public function testRequestAccessors(): void {
$vars = [
'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'],
'method' => 'GET',
@@ -77,7 +77,7 @@ class RequestTest extends \Test\TestCase {
}
// urlParams has precedence over POST which has precedence over GET
- public function testPrecedence() {
+ public function testPrecedence(): void {
$vars = [
'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'],
'post' => ['name' => 'Jane Doe', 'nickname' => 'Janey'],
@@ -100,7 +100,7 @@ class RequestTest extends \Test\TestCase {
- public function testImmutableArrayAccess() {
+ public function testImmutableArrayAccess(): void {
$this->expectException(\RuntimeException::class);
$vars = [
@@ -120,7 +120,7 @@ class RequestTest extends \Test\TestCase {
}
- public function testImmutableMagicAccess() {
+ public function testImmutableMagicAccess(): void {
$this->expectException(\RuntimeException::class);
$vars = [
@@ -140,7 +140,7 @@ class RequestTest extends \Test\TestCase {
}
- public function testGetTheMethodRight() {
+ public function testGetTheMethodRight(): void {
$this->expectException(\LogicException::class);
$vars = [
@@ -159,7 +159,7 @@ class RequestTest extends \Test\TestCase {
$request->post;
}
- public function testTheMethodIsRight() {
+ public function testTheMethodIsRight(): void {
$vars = [
'get' => ['name' => 'John Q. Public', 'nickname' => 'Joey'],
'method' => 'GET',
@@ -179,7 +179,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('Joey', $result['nickname']);
}
- public function testJsonPost() {
+ public function testJsonPost(): void {
global $data;
$data = '{"name": "John Q. Public", "nickname": "Joey"}';
$vars = [
@@ -203,7 +203,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('Joey', $request['nickname']);
}
- public function testScimJsonPost() {
+ public function testScimJsonPost(): void {
global $data;
$data = '{"userName":"testusername", "displayName":"Example User"}';
$vars = [
@@ -227,7 +227,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('Example User', $request['displayName']);
}
- public function testCustomJsonPost() {
+ public function testCustomJsonPost(): void {
global $data;
$data = '{"propertyA":"sometestvalue", "propertyB":"someothertestvalue"}';
@@ -262,7 +262,7 @@ class RequestTest extends \Test\TestCase {
/**
* @dataProvider notJsonDataProvider
*/
- public function testNotJsonPost($testData) {
+ public function testNotJsonPost($testData): void {
global $data;
$data = $testData;
$vars = [
@@ -283,7 +283,7 @@ class RequestTest extends \Test\TestCase {
// ensure there's no error attempting to decode the content
}
- public function testNotScimJsonPost() {
+ public function testNotScimJsonPost(): void {
global $data;
$data = 'this is not valid scim json';
$vars = [
@@ -304,7 +304,7 @@ class RequestTest extends \Test\TestCase {
// ensure there's no error attempting to decode the content
}
- public function testNotCustomJsonPost() {
+ public function testNotCustomJsonPost(): void {
global $data;
$data = 'this is not valid json';
$vars = [
@@ -325,7 +325,7 @@ class RequestTest extends \Test\TestCase {
// ensure there's no error attempting to decode the content
}
- public function testPatch() {
+ public function testPatch(): void {
global $data;
$data = http_build_query(['name' => 'John Q. Public', 'nickname' => 'Joey'], '', '&');
@@ -349,7 +349,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('Joey', $result['nickname']);
}
- public function testJsonPatchAndPut() {
+ public function testJsonPatchAndPut(): void {
global $data;
// PUT content
@@ -395,7 +395,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame(null, $result['nickname']);
}
- public function testScimJsonPatchAndPut() {
+ public function testScimJsonPatchAndPut(): void {
global $data;
// PUT content
@@ -441,7 +441,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame(null, $result['displayName']);
}
- public function testCustomJsonPatchAndPut() {
+ public function testCustomJsonPatchAndPut(): void {
global $data;
// PUT content
@@ -487,7 +487,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame(null, $result['propertyB']);
}
- public function testPutStream() {
+ public function testPutStream(): void {
global $data;
$data = file_get_contents(__DIR__ . '/../../../data/testimage.png');
@@ -522,7 +522,7 @@ class RequestTest extends \Test\TestCase {
}
- public function testSetUrlParameters() {
+ public function testSetUrlParameters(): void {
$vars = [
'post' => [],
'method' => 'POST',
@@ -771,7 +771,7 @@ class RequestTest extends \Test\TestCase {
* @param mixed $input
* @param string $expected
*/
- public function testGetHttpProtocol($input, $expected) {
+ public function testGetHttpProtocol($input, $expected): void {
$request = new Request(
[
'server' => [
@@ -787,7 +787,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame($expected, $request->getHttpProtocol());
}
- public function testGetServerProtocolWithOverride() {
+ public function testGetServerProtocolWithOverride(): void {
$this->config
->expects($this->exactly(3))
->method('getSystemValueString')
@@ -807,7 +807,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('customProtocol', $request->getServerProtocol());
}
- public function testGetServerProtocolWithProtoValid() {
+ public function testGetServerProtocolWithProtoValid(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -848,7 +848,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('http', $requestHttp->getServerProtocol());
}
- public function testGetServerProtocolWithHttpsServerValueOn() {
+ public function testGetServerProtocolWithHttpsServerValueOn(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -869,7 +869,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('https', $request->getServerProtocol());
}
- public function testGetServerProtocolWithHttpsServerValueOff() {
+ public function testGetServerProtocolWithHttpsServerValueOff(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -890,7 +890,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('http', $request->getServerProtocol());
}
- public function testGetServerProtocolWithHttpsServerValueEmpty() {
+ public function testGetServerProtocolWithHttpsServerValueEmpty(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -911,7 +911,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('http', $request->getServerProtocol());
}
- public function testGetServerProtocolDefault() {
+ public function testGetServerProtocolDefault(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -928,7 +928,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('http', $request->getServerProtocol());
}
- public function testGetServerProtocolBehindLoadBalancers() {
+ public function testGetServerProtocolBehindLoadBalancers(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -961,7 +961,7 @@ class RequestTest extends \Test\TestCase {
* @param array $userAgent
* @param bool $matches
*/
- public function testUserAgent($testAgent, $userAgent, $matches) {
+ public function testUserAgent($testAgent, $userAgent, $matches): void {
$request = new Request(
[
'server' => [
@@ -983,7 +983,7 @@ class RequestTest extends \Test\TestCase {
* @param array $userAgent
* @param bool $matches
*/
- public function testUndefinedUserAgent($testAgent, $userAgent, $matches) {
+ public function testUndefinedUserAgent($testAgent, $userAgent, $matches): void {
$request = new Request(
[],
$this->requestId,
@@ -1174,7 +1174,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame($version, $matches[1]);
}
- public function testInsecureServerHostServerNameHeader() {
+ public function testInsecureServerHostServerNameHeader(): void {
$request = new Request(
[
'server' => [
@@ -1190,7 +1190,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('from.server.name:8080', $request->getInsecureServerHost());
}
- public function testInsecureServerHostHttpHostHeader() {
+ public function testInsecureServerHostHttpHostHeader(): void {
$request = new Request(
[
'server' => [
@@ -1207,7 +1207,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('from.host.header:8080', $request->getInsecureServerHost());
}
- public function testInsecureServerHostHttpFromForwardedHeaderSingle() {
+ public function testInsecureServerHostHttpFromForwardedHeaderSingle(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -1236,7 +1236,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('from.forwarded.host:8080', $request->getInsecureServerHost());
}
- public function testInsecureServerHostHttpFromForwardedHeaderStacked() {
+ public function testInsecureServerHostHttpFromForwardedHeaderStacked(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -1265,7 +1265,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('from.forwarded.host2:8080', $request->getInsecureServerHost());
}
- public function testGetServerHostWithOverwriteHost() {
+ public function testGetServerHostWithOverwriteHost(): void {
$this->config
->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
@@ -1289,7 +1289,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('my.overwritten.host', $request->getServerHost());
}
- public function testGetServerHostWithTrustedDomain() {
+ public function testGetServerHostWithTrustedDomain(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -1318,7 +1318,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('my.trusted.host', $request->getServerHost());
}
- public function testGetServerHostWithUntrustedDomain() {
+ public function testGetServerHostWithUntrustedDomain(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -1347,7 +1347,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame('my.trusted.host', $request->getServerHost());
}
- public function testGetServerHostWithNoTrustedDomain() {
+ public function testGetServerHostWithNoTrustedDomain(): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) {
@@ -1390,7 +1390,7 @@ class RequestTest extends \Test\TestCase {
* @param $expected
* @param $trustedDomain
*/
- public function testGetServerHostTrustedDomain($expected, $trustedDomain) {
+ public function testGetServerHostTrustedDomain($expected, $trustedDomain): void {
$this->config
->method('getSystemValue')
->willReturnCallback(function ($key, $default) use ($trustedDomain) {
@@ -1419,7 +1419,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame($expected, $request->getServerHost());
}
- public function testGetOverwriteHostDefaultNull() {
+ public function testGetOverwriteHostDefaultNull(): void {
$this->config
->expects($this->once())
->method('getSystemValueString')
@@ -1436,7 +1436,7 @@ class RequestTest extends \Test\TestCase {
$this->assertNull(self::invokePrivate($request, 'getOverwriteHost'));
}
- public function testGetOverwriteHostWithOverwrite() {
+ public function testGetOverwriteHostWithOverwrite(): void {
$this->config
->expects($this->exactly(3))
->method('getSystemValueString')
@@ -1457,7 +1457,7 @@ class RequestTest extends \Test\TestCase {
}
- public function testGetPathInfoNotProcessible() {
+ public function testGetPathInfoNotProcessible(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('The requested uri(/foo.php) cannot be processed by the script \'/var/www/index.php\')');
@@ -1478,7 +1478,7 @@ class RequestTest extends \Test\TestCase {
}
- public function testGetRawPathInfoNotProcessible() {
+ public function testGetRawPathInfoNotProcessible(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('The requested uri(/foo.php) cannot be processed by the script \'/var/www/index.php\')');
@@ -1504,7 +1504,7 @@ class RequestTest extends \Test\TestCase {
* @param string $scriptName
* @param string $expected
*/
- public function testGetPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected) {
+ public function testGetPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected): void {
$request = new Request(
[
'server' => [
@@ -1527,7 +1527,7 @@ class RequestTest extends \Test\TestCase {
* @param string $scriptName
* @param string $expected
*/
- public function testGetRawPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected) {
+ public function testGetRawPathInfoWithoutSetEnvGeneric($requestUri, $scriptName, $expected): void {
$request = new Request(
[
'server' => [
@@ -1550,7 +1550,7 @@ class RequestTest extends \Test\TestCase {
* @param string $scriptName
* @param string $expected
*/
- public function testGetRawPathInfoWithoutSetEnv($requestUri, $scriptName, $expected) {
+ public function testGetRawPathInfoWithoutSetEnv($requestUri, $scriptName, $expected): void {
$request = new Request(
[
'server' => [
@@ -1573,7 +1573,7 @@ class RequestTest extends \Test\TestCase {
* @param string $scriptName
* @param string $expected
*/
- public function testGetPathInfoWithoutSetEnv($requestUri, $scriptName, $expected) {
+ public function testGetPathInfoWithoutSetEnv($requestUri, $scriptName, $expected): void {
$request = new Request(
[
'server' => [
@@ -1623,7 +1623,7 @@ class RequestTest extends \Test\TestCase {
];
}
- public function testGetRequestUriWithoutOverwrite() {
+ public function testGetRequestUriWithoutOverwrite(): void {
$this->config
->expects($this->once())
->method('getSystemValueString')
@@ -1655,7 +1655,7 @@ class RequestTest extends \Test\TestCase {
/**
* @dataProvider providesGetRequestUriWithOverwriteData
*/
- public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot, $overwriteCondAddr, $remoteAddr = '') {
+ public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot, $overwriteCondAddr, $remoteAddr = ''): void {
$this->config
->expects($this->exactly(2))
->method('getSystemValueString')
@@ -1688,7 +1688,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame($expectedUri, $request->getRequestUri());
}
- public function testPassesCSRFCheckWithGet() {
+ public function testPassesCSRFCheckWithGet(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1718,7 +1718,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesCSRFCheck());
}
- public function testPassesCSRFCheckWithPost() {
+ public function testPassesCSRFCheckWithPost(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1748,7 +1748,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesCSRFCheck());
}
- public function testPassesCSRFCheckWithHeader() {
+ public function testPassesCSRFCheckWithHeader(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1778,7 +1778,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesCSRFCheck());
}
- public function testPassesCSRFCheckWithGetAndWithoutCookies() {
+ public function testPassesCSRFCheckWithGetAndWithoutCookies(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1802,7 +1802,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesCSRFCheck());
}
- public function testPassesCSRFCheckWithPostAndWithoutCookies() {
+ public function testPassesCSRFCheckWithPostAndWithoutCookies(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1826,7 +1826,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesCSRFCheck());
}
- public function testPassesCSRFCheckWithHeaderAndWithoutCookies() {
+ public function testPassesCSRFCheckWithHeaderAndWithoutCookies(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1850,7 +1850,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesCSRFCheck());
}
- public function testFailsCSRFCheckWithHeaderAndNotAllChecksPassing() {
+ public function testFailsCSRFCheckWithHeaderAndNotAllChecksPassing(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1877,7 +1877,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesCSRFCheck());
}
- public function testPassesStrictCookieCheckWithAllCookiesAndStrict() {
+ public function testPassesStrictCookieCheckWithAllCookiesAndStrict(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName', 'getCookieParams'])
@@ -1909,7 +1909,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesStrictCookieCheck());
}
- public function testFailsStrictCookieCheckWithAllCookiesAndMissingStrict() {
+ public function testFailsStrictCookieCheckWithAllCookiesAndMissingStrict(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName', 'getCookieParams'])
@@ -1941,7 +1941,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesStrictCookieCheck());
}
- public function testGetCookieParams() {
+ public function testGetCookieParams(): void {
/** @var Request $request */
$request = $this->getMockBuilder(Request::class)
->setMethods(['getScriptName'])
@@ -1957,7 +1957,7 @@ class RequestTest extends \Test\TestCase {
$this->assertSame(session_get_cookie_params(), $actual);
}
- public function testPassesStrictCookieCheckWithAllCookies() {
+ public function testPassesStrictCookieCheckWithAllCookies(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -1982,7 +1982,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesStrictCookieCheck());
}
- public function testPassesStrictCookieCheckWithRandomCookies() {
+ public function testPassesStrictCookieCheckWithRandomCookies(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2005,7 +2005,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesStrictCookieCheck());
}
- public function testFailsStrictCookieCheckWithSessionCookie() {
+ public function testFailsStrictCookieCheckWithSessionCookie(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2028,7 +2028,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesStrictCookieCheck());
}
- public function testFailsStrictCookieCheckWithRememberMeCookie() {
+ public function testFailsStrictCookieCheckWithRememberMeCookie(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2051,7 +2051,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesStrictCookieCheck());
}
- public function testFailsCSRFCheckWithPostAndWithCookies() {
+ public function testFailsCSRFCheckWithPostAndWithCookies(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2078,7 +2078,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesCSRFCheck());
}
- public function testFailStrictCookieCheckWithOnlyLaxCookie() {
+ public function testFailStrictCookieCheckWithOnlyLaxCookie(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2102,7 +2102,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesStrictCookieCheck());
}
- public function testFailStrictCookieCheckWithOnlyStrictCookie() {
+ public function testFailStrictCookieCheckWithOnlyStrictCookie(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2126,7 +2126,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesStrictCookieCheck());
}
- public function testPassesLaxCookieCheck() {
+ public function testPassesLaxCookieCheck(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2150,7 +2150,7 @@ class RequestTest extends \Test\TestCase {
$this->assertTrue($request->passesLaxCookieCheck());
}
- public function testFailsLaxCookieCheckWithOnlyStrictCookie() {
+ public function testFailsLaxCookieCheckWithOnlyStrictCookie(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2174,7 +2174,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesLaxCookieCheck());
}
- public function testSkipCookieCheckForOCSRequests() {
+ public function testSkipCookieCheckForOCSRequests(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2214,7 +2214,7 @@ class RequestTest extends \Test\TestCase {
* @dataProvider invalidTokenDataProvider
* @param string $invalidToken
*/
- public function testPassesCSRFCheckWithInvalidToken($invalidToken) {
+ public function testPassesCSRFCheckWithInvalidToken($invalidToken): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2241,7 +2241,7 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesCSRFCheck());
}
- public function testPassesCSRFCheckWithoutTokenFail() {
+ public function testPassesCSRFCheckWithoutTokenFail(): void {
/** @var Request $request */
$request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
->setMethods(['getScriptName'])
@@ -2256,4 +2256,24 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesCSRFCheck());
}
+
+ public function testPassesCSRFCheckWithOCSAPIRequestHeader(): void {
+ /** @var Request $request */
+ $request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
+ ->setMethods(['getScriptName'])
+ ->setConstructorArgs([
+ [
+ 'server' => [
+ 'HTTP_OCS_APIREQUEST' => 'true',
+ ],
+ ],
+ $this->requestId,
+ $this->config,
+ $this->csrfTokenManager,
+ $this->stream
+ ])
+ ->getMock();
+
+ $this->assertTrue($request->passesCSRFCheck());
+ }
}
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php
index d01d29e7071..28614b14b40 100644
--- a/tests/lib/AppFramework/Http/ResponseTest.php
+++ b/tests/lib/AppFramework/Http/ResponseTest.php
@@ -24,14 +24,14 @@ class ResponseTest extends \Test\TestCase {
}
- public function testAddHeader() {
+ public function testAddHeader(): void {
$this->childResponse->addHeader(' hello ', 'world');
$headers = $this->childResponse->getHeaders();
$this->assertEquals('world', $headers['hello']);
}
- public function testSetHeaders() {
+ public function testSetHeaders(): void {
$expected = [
'Last-Modified' => 1,
'ETag' => 3,
@@ -50,7 +50,7 @@ class ResponseTest extends \Test\TestCase {
$this->assertEquals($expected, $headers);
}
- public function testOverwriteCsp() {
+ public function testOverwriteCsp(): void {
$expected = [
'Content-Security-Policy' => "default-src 'none';base-uri 'none';manifest-src 'self';script-src 'self' 'unsafe-inline';style-src 'self' 'unsafe-inline';img-src 'self';font-src 'self' data:;connect-src 'self';media-src 'self'",
];
@@ -62,31 +62,31 @@ class ResponseTest extends \Test\TestCase {
$this->assertEquals(array_merge($expected, $headers), $headers);
}
- public function testGetCsp() {
+ public function testGetCsp(): void {
$policy = new Http\ContentSecurityPolicy();
$this->childResponse->setContentSecurityPolicy($policy);
$this->assertEquals($policy, $this->childResponse->getContentSecurityPolicy());
}
- public function testGetCspEmpty() {
+ public function testGetCspEmpty(): void {
$this->assertEquals(new Http\EmptyContentSecurityPolicy(), $this->childResponse->getContentSecurityPolicy());
}
- public function testAddHeaderValueNullDeletesIt() {
+ public function testAddHeaderValueNullDeletesIt(): void {
$this->childResponse->addHeader('hello', 'world');
$this->childResponse->addHeader('hello', null);
$this->assertEquals(5, count($this->childResponse->getHeaders()));
}
- public function testCacheHeadersAreDisabledByDefault() {
+ public function testCacheHeadersAreDisabledByDefault(): void {
$headers = $this->childResponse->getHeaders();
$this->assertEquals('no-cache, no-store, must-revalidate', $headers['Cache-Control']);
}
- public function testAddCookie() {
+ public function testAddCookie(): void {
$this->childResponse->addCookie('foo', 'bar');
$this->childResponse->addCookie('bar', 'foo', new \DateTime('1970-01-01'));
@@ -106,7 +106,7 @@ class ResponseTest extends \Test\TestCase {
}
- public function testSetCookies() {
+ public function testSetCookies(): void {
$expected = [
'foo' => [
'value' => 'bar',
@@ -125,7 +125,7 @@ class ResponseTest extends \Test\TestCase {
}
- public function testInvalidateCookie() {
+ public function testInvalidateCookie(): void {
$this->childResponse->addCookie('foo', 'bar');
$this->childResponse->invalidateCookie('foo');
$expected = [
@@ -142,7 +142,7 @@ class ResponseTest extends \Test\TestCase {
}
- public function testInvalidateCookies() {
+ public function testInvalidateCookies(): void {
$this->childResponse->addCookie('foo', 'bar');
$this->childResponse->addCookie('bar', 'foo');
$expected = [
@@ -179,12 +179,12 @@ class ResponseTest extends \Test\TestCase {
}
- public function testRenderReturnNullByDefault() {
+ public function testRenderReturnNullByDefault(): void {
$this->assertEquals(null, $this->childResponse->render());
}
- public function testGetStatus() {
+ public function testGetStatus(): void {
$default = $this->childResponse->getStatus();
$this->childResponse->setStatus(Http::STATUS_NOT_FOUND);
@@ -194,13 +194,13 @@ class ResponseTest extends \Test\TestCase {
}
- public function testGetEtag() {
+ public function testGetEtag(): void {
$this->childResponse->setEtag('hi');
$this->assertSame('hi', $this->childResponse->getEtag());
}
- public function testGetLastModified() {
+ public function testGetLastModified(): void {
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
$lastModified->setTimestamp(1);
$this->childResponse->setLastModified($lastModified);
@@ -209,7 +209,7 @@ class ResponseTest extends \Test\TestCase {
- public function testCacheSecondsZero() {
+ public function testCacheSecondsZero(): void {
$this->childResponse->cacheFor(0);
$headers = $this->childResponse->getHeaders();
@@ -218,7 +218,7 @@ class ResponseTest extends \Test\TestCase {
}
- public function testCacheSeconds() {
+ public function testCacheSeconds(): void {
$time = $this->createMock(ITimeFactory::class);
$time->method('getTime')
->willReturn(1234567);
@@ -234,7 +234,7 @@ class ResponseTest extends \Test\TestCase {
- public function testEtagLastModifiedHeaders() {
+ public function testEtagLastModifiedHeaders(): void {
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
$lastModified->setTimestamp(1);
$this->childResponse->setLastModified($lastModified);
@@ -242,7 +242,7 @@ class ResponseTest extends \Test\TestCase {
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
}
- public function testChainability() {
+ public function testChainability(): void {
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
$lastModified->setTimestamp(1);
@@ -262,13 +262,13 @@ class ResponseTest extends \Test\TestCase {
$headers['Cache-Control']);
}
- public function testThrottle() {
+ public function testThrottle(): void {
$this->assertFalse($this->childResponse->isThrottled());
$this->childResponse->throttle();
$this->assertTrue($this->childResponse->isThrottled());
}
- public function testGetThrottleMetadata() {
+ public function testGetThrottleMetadata(): void {
$this->childResponse->throttle(['foo' => 'bar']);
$this->assertSame(['foo' => 'bar'], $this->childResponse->getThrottleMetadata());
}
diff --git a/tests/lib/AppFramework/Http/StreamResponseTest.php b/tests/lib/AppFramework/Http/StreamResponseTest.php
index 637fb025142..87f6097a07a 100644
--- a/tests/lib/AppFramework/Http/StreamResponseTest.php
+++ b/tests/lib/AppFramework/Http/StreamResponseTest.php
@@ -23,7 +23,7 @@ class StreamResponseTest extends \Test\TestCase {
->getMock();
}
- public function testOutputNotModified() {
+ public function testOutputNotModified(): void {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
@@ -35,7 +35,7 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
- public function testOutputOk() {
+ public function testOutputOk(): void {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
@@ -49,7 +49,7 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
- public function testOutputNotFound() {
+ public function testOutputNotFound(): void {
$path = __FILE__ . 'test';
$this->output->expects($this->once())
->method('getHttpResponseCode')
@@ -64,7 +64,7 @@ class StreamResponseTest extends \Test\TestCase {
$response->callback($this->output);
}
- public function testOutputReadFileError() {
+ public function testOutputReadFileError(): void {
$path = __FILE__;
$this->output->expects($this->once())
->method('getHttpResponseCode')
diff --git a/tests/lib/AppFramework/Http/TemplateResponseTest.php b/tests/lib/AppFramework/Http/TemplateResponseTest.php
index df9824d3032..ad0fe808b76 100644
--- a/tests/lib/AppFramework/Http/TemplateResponseTest.php
+++ b/tests/lib/AppFramework/Http/TemplateResponseTest.php
@@ -24,7 +24,7 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testSetParamsConstructor() {
+ public function testSetParamsConstructor(): void {
$params = ['hi' => 'yo'];
$this->tpl = new TemplateResponse('app', 'home', $params);
@@ -32,7 +32,7 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testSetRenderAsConstructor() {
+ public function testSetRenderAsConstructor(): void {
$renderAs = 'myrender';
$this->tpl = new TemplateResponse('app', 'home', [], $renderAs);
@@ -40,7 +40,7 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testSetParams() {
+ public function testSetParams(): void {
$params = ['hi' => 'yo'];
$this->tpl->setParams($params);
@@ -48,17 +48,17 @@ class TemplateResponseTest extends \Test\TestCase {
}
- public function testGetTemplateName() {
+ public function testGetTemplateName(): void {
$this->assertEquals('home', $this->tpl->getTemplateName());
}
- public function testGetRenderAs() {
+ public function testGetRenderAs(): void {
$render = 'myrender';
$this->tpl->renderAs($render);
$this->assertEquals($render, $this->tpl->getRenderAs());
}
- public function testChainability() {
+ public function testChainability(): void {
$params = ['hi' => 'yo'];
$this->tpl->setParams($params)
->setStatus(Http::STATUS_NOT_FOUND);
diff --git a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
index 890735008fc..22b1b13aaee 100644
--- a/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/AdditionalScriptsMiddlewareTest.php
@@ -44,7 +44,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
$this->controller = $this->createMock(Controller::class);
}
- public function testNoTemplateResponse() {
+ public function testNoTemplateResponse(): void {
$this->userSession->expects($this->never())
->method($this->anything());
$this->dispatcher->expects($this->never())
@@ -53,7 +53,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(Response::class));
}
- public function testPublicShareController() {
+ public function testPublicShareController(): void {
$this->userSession->expects($this->never())
->method($this->anything());
$this->dispatcher->expects($this->never())
@@ -62,7 +62,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
$this->middleWare->afterController($this->createMock(PublicShareController::class), 'myMethod', $this->createMock(Response::class));
}
- public function testStandaloneTemplateResponse() {
+ public function testStandaloneTemplateResponse(): void {
$this->userSession->expects($this->never())
->method($this->anything());
$this->dispatcher->expects($this->once())
@@ -78,7 +78,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(StandaloneTemplateResponse::class));
}
- public function testTemplateResponseNotLoggedIn() {
+ public function testTemplateResponseNotLoggedIn(): void {
$this->userSession->method('isLoggedIn')
->willReturn(false);
$this->dispatcher->expects($this->once())
@@ -94,7 +94,7 @@ class AdditionalScriptsMiddlewareTest extends \Test\TestCase {
$this->middleWare->afterController($this->controller, 'myMethod', $this->createMock(TemplateResponse::class));
}
- public function testTemplateResponseLoggedIn() {
+ public function testTemplateResponseLoggedIn(): void {
$events = [];
$this->userSession->method('isLoggedIn')
diff --git a/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php b/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php
index a0848b70796..010ce3fff6d 100644
--- a/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/CompressionMiddlewareTest.php
@@ -36,7 +36,7 @@ class CompressionMiddlewareTest extends \Test\TestCase {
$this->controller = $this->createMock(Controller::class);
}
- public function testGzipOCSV1() {
+ public function testGzipOCSV1(): void {
$this->request->method('getHeader')
->with('Accept-Encoding')
->willReturn('gzip');
@@ -58,7 +58,7 @@ class CompressionMiddlewareTest extends \Test\TestCase {
$this->assertSame($output, gzdecode($result));
}
- public function testGzipOCSV2() {
+ public function testGzipOCSV2(): void {
$this->request->method('getHeader')
->with('Accept-Encoding')
->willReturn('gzip');
@@ -80,7 +80,7 @@ class CompressionMiddlewareTest extends \Test\TestCase {
$this->assertSame($output, gzdecode($result));
}
- public function testGzipJSONResponse() {
+ public function testGzipJSONResponse(): void {
$this->request->method('getHeader')
->with('Accept-Encoding')
->willReturn('gzip');
@@ -102,7 +102,7 @@ class CompressionMiddlewareTest extends \Test\TestCase {
$this->assertSame($output, gzdecode($result));
}
- public function testNoGzipDataResponse() {
+ public function testNoGzipDataResponse(): void {
$this->request->method('getHeader')
->with('Accept-Encoding')
->willReturn('gzip');
@@ -122,7 +122,7 @@ class CompressionMiddlewareTest extends \Test\TestCase {
$this->assertSame($output, $result);
}
- public function testNoGzipNo200() {
+ public function testNoGzipNo200(): void {
$this->request->method('getHeader')
->with('Accept-Encoding')
->willReturn('gzip');
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
index fd3ed861405..fae5f5d9f1c 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareDispatcherTest.php
@@ -129,20 +129,20 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionShouldReturnResponseOfMiddleware() {
+ public function testAfterExceptionShouldReturnResponseOfMiddleware(): void {
$response = new Response();
$m1 = $this->getMockBuilder('\OCP\AppFramework\Middleware')
->setMethods(['afterException', 'beforeController'])
->getMock();
$m1->expects($this->never())
- ->method('afterException');
+ ->method('afterException');
$m2 = $this->getMockBuilder('OCP\AppFramework\Middleware')
->setMethods(['afterException', 'beforeController'])
->getMock();
$m2->expects($this->once())
- ->method('afterException')
- ->willReturn($response);
+ ->method('afterException')
+ ->willReturn($response);
$this->dispatcher->registerMiddleware($m1);
$this->dispatcher->registerMiddleware($m2);
@@ -152,7 +152,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionShouldThrowAgainWhenNotHandled() {
+ public function testAfterExceptionShouldThrowAgainWhenNotHandled(): void {
$m1 = new TestMiddleware(false);
$m2 = new TestMiddleware(true);
@@ -165,7 +165,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeControllerCorrectArguments() {
+ public function testBeforeControllerCorrectArguments(): void {
$m1 = $this->getMiddleware();
$this->dispatcher->beforeController($this->controller, $this->method);
@@ -174,7 +174,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterControllerCorrectArguments() {
+ public function testAfterControllerCorrectArguments(): void {
$m1 = $this->getMiddleware();
$this->dispatcher->afterController($this->controller, $this->method, $this->response);
@@ -185,7 +185,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionCorrectArguments() {
+ public function testAfterExceptionCorrectArguments(): void {
$m1 = $this->getMiddleware();
$this->expectException(\Exception::class);
@@ -199,7 +199,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeOutputCorrectArguments() {
+ public function testBeforeOutputCorrectArguments(): void {
$m1 = $this->getMiddleware();
$this->dispatcher->beforeOutput($this->controller, $this->method, $this->out);
@@ -210,7 +210,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeControllerOrder() {
+ public function testBeforeControllerOrder(): void {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -220,7 +220,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
$this->assertEquals(2, $m2->beforeControllerOrder);
}
- public function testAfterControllerOrder() {
+ public function testAfterControllerOrder(): void {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -231,7 +231,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testAfterExceptionOrder() {
+ public function testAfterExceptionOrder(): void {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -244,7 +244,7 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testBeforeOutputOrder() {
+ public function testBeforeOutputOrder(): void {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware();
@@ -255,16 +255,16 @@ class MiddlewareDispatcherTest extends \Test\TestCase {
}
- public function testExceptionShouldRunAfterExceptionOfOnlyPreviouslyExecutedMiddlewares() {
+ public function testExceptionShouldRunAfterExceptionOfOnlyPreviouslyExecutedMiddlewares(): void {
$m1 = $this->getMiddleware();
$m2 = $this->getMiddleware(true);
$m3 = $this->createMock(Middleware::class);
$m3->expects($this->never())
- ->method('afterException');
+ ->method('afterException');
$m3->expects($this->never())
- ->method('beforeController');
+ ->method('beforeController');
$m3->expects($this->never())
- ->method('afterController');
+ ->method('afterController');
$m3->method('beforeOutput')
->willReturnArgument(2);
diff --git a/tests/lib/AppFramework/Middleware/MiddlewareTest.php b/tests/lib/AppFramework/Middleware/MiddlewareTest.php
index 0662f822103..c1e5c44c4db 100644
--- a/tests/lib/AppFramework/Middleware/MiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/MiddlewareTest.php
@@ -37,8 +37,8 @@ class MiddlewareTest extends \Test\TestCase {
$this->middleware = new ChildMiddleware();
$this->api = $this->getMockBuilder(DIContainer::class)
- ->disableOriginalConstructor()
- ->getMock();
+ ->disableOriginalConstructor()
+ ->getMock();
$this->controller = $this->getMockBuilder(Controller::class)
->setMethods([])
diff --git a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
index e41bb45e069..58ae6b13aed 100644
--- a/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php
@@ -56,7 +56,7 @@ class NotModifiedMiddlewareTest extends \Test\TestCase {
/**
* @dataProvider dataModified
*/
- public function testMiddleware(?string $etag, string $etagHeader, ?\DateTime $lastModified, string $lastModifiedHeader, bool $notModifiedSet) {
+ public function testMiddleware(?string $etag, string $etagHeader, ?\DateTime $lastModified, string $lastModifiedHeader, bool $notModifiedSet): void {
$this->request->method('getHeader')
->willReturnCallback(function (string $name) use ($etagHeader, $lastModifiedHeader) {
if ($name === 'IF_NONE_MATCH') {
diff --git a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
index 28b2ba34fca..6724f841c5e 100644
--- a/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/OCSMiddlewareTest.php
@@ -74,7 +74,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
* @param string $message
* @param int $code
*/
- public function testAfterExceptionOCSv1($controller, $exception, $forward, $message = '', $code = 0) {
+ public function testAfterExceptionOCSv1($controller, $exception, $forward, $message = '', $code = 0): void {
$this->request
->method('getScriptName')
->willReturn('/ocs/v1.php');
@@ -110,7 +110,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
* @param string $message
* @param int $code
*/
- public function testAfterExceptionOCSv2($controller, $exception, $forward, $message = '', $code = 0) {
+ public function testAfterExceptionOCSv2($controller, $exception, $forward, $message = '', $code = 0): void {
$this->request
->method('getScriptName')
->willReturn('/ocs/v2.php');
@@ -144,7 +144,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
* @param string $message
* @param int $code
*/
- public function testAfterExceptionOCSv2SubFolder($controller, $exception, $forward, $message = '', $code = 0) {
+ public function testAfterExceptionOCSv2SubFolder($controller, $exception, $forward, $message = '', $code = 0): void {
$this->request
->method('getScriptName')
->willReturn('/mysubfolder/ocs/v2.php');
@@ -201,7 +201,7 @@ class OCSMiddlewareTest extends \Test\TestCase {
* @param bool $converted
* @param int $convertedOCSStatus
*/
- public function testAfterController($controller, $response, $converted, $convertedOCSStatus = 0) {
+ public function testAfterController($controller, $response, $converted, $convertedOCSStatus = 0): void {
$OCSMiddleware = new OCSMiddleware($this->request);
$newResponse = $OCSMiddleware->afterController($controller, 'foo', $response);
diff --git a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
index 03cd253044d..8433aa93f4a 100644
--- a/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/PublicShare/PublicShareMiddlewareTest.php
@@ -10,8 +10,9 @@ use OC\AppFramework\Middleware\PublicShare\Exceptions\NeedAuthenticationExceptio
use OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware;
use OCP\AppFramework\AuthPublicShareController;
use OCP\AppFramework\Controller;
-use OCP\AppFramework\Http\NotFoundResponse;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Http\RedirectResponse;
+use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\PublicShareController;
use OCP\Files\NotFoundException;
use OCP\IConfig;
@@ -50,7 +51,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
);
}
- public function testBeforeControllerNoPublicShareController() {
+ public function testBeforeControllerNoPublicShareController(): void {
$controller = $this->createMock(Controller::class);
$this->middleware->beforeController($controller, 'method');
@@ -68,7 +69,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
/**
* @dataProvider dataShareApi
*/
- public function testBeforeControllerShareApiDisabled(string $shareApi, string $shareLinks) {
+ public function testBeforeControllerShareApiDisabled(string $shareApi, string $shareLinks): void {
$controller = $this->createMock(PublicShareController::class);
$this->config->method('getAppValue')
@@ -81,7 +82,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($controller, 'mehod');
}
- public function testBeforeControllerNoTokenParam() {
+ public function testBeforeControllerNoTokenParam(): void {
$controller = $this->createMock(PublicShareController::class);
$this->config->method('getAppValue')
@@ -94,7 +95,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($controller, 'mehod');
}
- public function testBeforeControllerInvalidToken() {
+ public function testBeforeControllerInvalidToken(): void {
$controller = $this->createMock(PublicShareController::class);
$this->config->method('getAppValue')
@@ -116,7 +117,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($controller, 'mehod');
}
- public function testBeforeControllerValidTokenNotAuthenticated() {
+ public function testBeforeControllerValidTokenNotAuthenticated(): void {
$controller = $this->getMockBuilder(PublicShareController::class)
->setConstructorArgs(['app', $this->request, $this->session])
->getMock();
@@ -141,7 +142,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($controller, 'mehod');
}
- public function testBeforeControllerValidTokenAuthenticateMethod() {
+ public function testBeforeControllerValidTokenAuthenticateMethod(): void {
$controller = $this->getMockBuilder(PublicShareController::class)
->setConstructorArgs(['app', $this->request, $this->session])
->getMock();
@@ -166,7 +167,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->assertTrue(true);
}
- public function testBeforeControllerValidTokenShowAuthenticateMethod() {
+ public function testBeforeControllerValidTokenShowAuthenticateMethod(): void {
$controller = $this->getMockBuilder(PublicShareController::class)
->setConstructorArgs(['app', $this->request, $this->session])
->getMock();
@@ -191,7 +192,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->assertTrue(true);
}
- public function testBeforeControllerAuthPublicShareController() {
+ public function testBeforeControllerAuthPublicShareController(): void {
$controller = $this->getMockBuilder(AuthPublicShareController::class)
->setConstructorArgs(['app', $this->request, $this->session, $this->createMock(IURLGenerator::class)])
->getMock();
@@ -220,7 +221,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
$this->middleware->beforeController($controller, 'method');
}
- public function testAfterExceptionNoPublicShareController() {
+ public function testAfterExceptionNoPublicShareController(): void {
$controller = $this->createMock(Controller::class);
$exception = new \Exception();
@@ -231,15 +232,16 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
}
}
- public function testAfterExceptionPublicShareControllerNotFoundException() {
+ public function testAfterExceptionPublicShareControllerNotFoundException(): void {
$controller = $this->createMock(PublicShareController::class);
$exception = new NotFoundException();
$result = $this->middleware->afterException($controller, 'method', $exception);
- $this->assertInstanceOf(NotFoundResponse::class, $result);
+ $this->assertInstanceOf(TemplateResponse::class, $result);
+ $this->assertEquals($result->getStatus(), Http::STATUS_NOT_FOUND);
}
- public function testAfterExceptionPublicShareController() {
+ public function testAfterExceptionPublicShareController(): void {
$controller = $this->createMock(PublicShareController::class);
$exception = new \Exception();
@@ -250,7 +252,7 @@ class PublicShareMiddlewareTest extends \Test\TestCase {
}
}
- public function testAfterExceptionAuthPublicShareController() {
+ public function testAfterExceptionAuthPublicShareController(): void {
$controller = $this->getMockBuilder(AuthPublicShareController::class)
->setConstructorArgs([
'app',
diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
index ab06b020c9b..b703b10c554 100644
--- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php
@@ -18,6 +18,7 @@ use OCP\IRequest;
use OCP\IRequestId;
use OCP\Security\Bruteforce\IThrottler;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
use Test\AppFramework\Middleware\Security\Mock\CORSMiddlewareController;
class CORSMiddlewareTest extends \Test\TestCase {
@@ -29,12 +30,14 @@ class CORSMiddlewareTest extends \Test\TestCase {
private $throttler;
/** @var CORSMiddlewareController */
private $controller;
+ private LoggerInterface $logger;
protected function setUp(): void {
parent::setUp();
$this->reflector = new ControllerMethodReflector();
$this->session = $this->createMock(Session::class);
$this->throttler = $this->createMock(IThrottler::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->controller = new CORSMiddlewareController(
'test',
$this->createMock(IRequest::class)
@@ -62,7 +65,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IConfig::class)
);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$response = $middleware->afterController($this->controller, $method, new Response());
$headers = $response->getHeaders();
@@ -79,7 +82,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IRequestId::class),
$this->createMock(IConfig::class)
);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$response = $middleware->afterController($this->controller, __FUNCTION__, new Response());
$headers = $response->getHeaders();
@@ -103,7 +106,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IConfig::class)
);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$response = $middleware->afterController($this->controller, $method, new Response());
$headers = $response->getHeaders();
@@ -133,7 +136,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IConfig::class)
);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$response = new Response();
$response->addHeader('AcCess-control-Allow-Credentials ', 'TRUE');
@@ -159,7 +162,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IConfig::class)
);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$this->session->expects($this->once())
->method('isLoggedIn')
->willReturn(false);
@@ -193,7 +196,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IConfig::class)
);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$this->session->expects($this->once())
->method('isLoggedIn')
->willReturn(true);
@@ -234,7 +237,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
->with($this->equalTo('user'), $this->equalTo('pass'))
->willReturn(true);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$middleware->beforeController($this->controller, $method);
}
@@ -267,7 +270,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
->with($this->equalTo('user'), $this->equalTo('pass'))
->will($this->throwException(new \OC\Authentication\Exceptions\PasswordLoginForbiddenException));
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$middleware->beforeController($this->controller, $method);
}
@@ -300,12 +303,12 @@ class CORSMiddlewareTest extends \Test\TestCase {
->with($this->equalTo('user'), $this->equalTo('pass'))
->willReturn(false);
$this->reflector->reflect($this->controller, $method);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$middleware->beforeController($this->controller, $method);
}
- public function testAfterExceptionWithSecurityExceptionNoStatus() {
+ public function testAfterExceptionWithSecurityExceptionNoStatus(): void {
$request = new Request(
['server' => [
'PHP_AUTH_USER' => 'user',
@@ -314,14 +317,14 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IRequestId::class),
$this->createMock(IConfig::class)
);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$response = $middleware->afterException($this->controller, __FUNCTION__, new SecurityException('A security exception'));
$expected = new JSONResponse(['message' => 'A security exception'], 500);
$this->assertEquals($expected, $response);
}
- public function testAfterExceptionWithSecurityExceptionWithStatus() {
+ public function testAfterExceptionWithSecurityExceptionWithStatus(): void {
$request = new Request(
['server' => [
'PHP_AUTH_USER' => 'user',
@@ -330,14 +333,14 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IRequestId::class),
$this->createMock(IConfig::class)
);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$response = $middleware->afterException($this->controller, __FUNCTION__, new SecurityException('A security exception', 501));
$expected = new JSONResponse(['message' => 'A security exception'], 501);
$this->assertEquals($expected, $response);
}
- public function testAfterExceptionWithRegularException() {
+ public function testAfterExceptionWithRegularException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('A regular exception');
@@ -349,7 +352,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
$this->createMock(IRequestId::class),
$this->createMock(IConfig::class)
);
- $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler);
+ $middleware = new CORSMiddleware($request, $this->reflector, $this->session, $this->throttler, $this->logger);
$middleware->afterException($this->controller, __FUNCTION__, new \Exception('A regular exception'));
}
}
diff --git a/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php
index 63a3e7ff123..b0b41b27cb9 100644
--- a/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/CSPMiddlewareTest.php
@@ -12,23 +12,19 @@ use OC\AppFramework\Middleware\Security\CSPMiddleware;
use OC\Security\CSP\ContentSecurityPolicy;
use OC\Security\CSP\ContentSecurityPolicyManager;
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
-use OC\Security\CSRF\CsrfToken;
-use OC\Security\CSRF\CsrfTokenManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\EmptyContentSecurityPolicy;
use OCP\AppFramework\Http\Response;
use PHPUnit\Framework\MockObject\MockObject;
class CSPMiddlewareTest extends \Test\TestCase {
- /** @var CSPMiddleware|MockObject */
+ /** @var CSPMiddleware&MockObject */
private $middleware;
- /** @var Controller|MockObject */
+ /** @var Controller&MockObject */
private $controller;
- /** @var ContentSecurityPolicyManager|MockObject */
+ /** @var ContentSecurityPolicyManager&MockObject */
private $contentSecurityPolicyManager;
- /** @var CsrfTokenManager|MockObject */
- private $csrfTokenManager;
- /** @var ContentSecurityPolicyNonceManager|MockObject */
+ /** @var ContentSecurityPolicyNonceManager&MockObject */
private $cspNonceManager;
protected function setUp(): void {
@@ -36,16 +32,14 @@ class CSPMiddlewareTest extends \Test\TestCase {
$this->controller = $this->createMock(Controller::class);
$this->contentSecurityPolicyManager = $this->createMock(ContentSecurityPolicyManager::class);
- $this->csrfTokenManager = $this->createMock(CsrfTokenManager::class);
$this->cspNonceManager = $this->createMock(ContentSecurityPolicyNonceManager::class);
$this->middleware = new CSPMiddleware(
$this->contentSecurityPolicyManager,
$this->cspNonceManager,
- $this->csrfTokenManager
);
}
- public function testAfterController() {
+ public function testAfterController(): void {
$this->cspNonceManager
->expects($this->once())
->method('browserSupportsCspV3')
@@ -77,7 +71,7 @@ class CSPMiddlewareTest extends \Test\TestCase {
$this->middleware->afterController($this->controller, 'test', $response);
}
- public function testAfterControllerEmptyCSP() {
+ public function testAfterControllerEmptyCSP(): void {
$response = $this->createMock(Response::class);
$emptyPolicy = new EmptyContentSecurityPolicy();
$response->expects($this->any())
@@ -89,19 +83,15 @@ class CSPMiddlewareTest extends \Test\TestCase {
$this->middleware->afterController($this->controller, 'test', $response);
}
- public function testAfterControllerWithContentSecurityPolicy3Support() {
+ public function testAfterControllerWithContentSecurityPolicy3Support(): void {
$this->cspNonceManager
->expects($this->once())
->method('browserSupportsCspV3')
->willReturn(true);
- $token = $this->createMock(CsrfToken::class);
- $token
- ->expects($this->once())
- ->method('getEncryptedValue')
- ->willReturn('MyEncryptedToken');
- $this->csrfTokenManager
+ $token = base64_encode('the-nonce');
+ $this->cspNonceManager
->expects($this->once())
- ->method('getToken')
+ ->method('getNonce')
->willReturn($token);
$response = $this->createMock(Response::class);
$defaultPolicy = new ContentSecurityPolicy();
diff --git a/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php
index 1cdd99b1aae..55a70d4c040 100644
--- a/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/FeaturePolicyMiddlewareTest.php
@@ -34,7 +34,7 @@ class FeaturePolicyMiddlewareTest extends \Test\TestCase {
);
}
- public function testAfterController() {
+ public function testAfterController(): void {
$response = $this->createMock(Response::class);
$defaultPolicy = new FeaturePolicy();
$defaultPolicy->addAllowedCameraDomain('defaultpolicy');
@@ -56,7 +56,7 @@ class FeaturePolicyMiddlewareTest extends \Test\TestCase {
$this->middleware->afterController($this->controller, 'test', $response);
}
- public function testAfterControllerEmptyCSP() {
+ public function testAfterControllerEmptyCSP(): void {
$response = $this->createMock(Response::class);
$emptyPolicy = new EmptyFeaturePolicy();
$response->method('getFeaturePolicy')
diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
index beee7151264..148335d270f 100644
--- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php
@@ -16,6 +16,7 @@ use OCP\IRequest;
use OCP\ISession;
use OCP\IUser;
use OCP\IUserSession;
+use Psr\Log\LoggerInterface;
use Test\AppFramework\Middleware\Security\Mock\PasswordConfirmationMiddlewareController;
use Test\TestCase;
@@ -35,6 +36,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
private IProvider|\PHPUnit\Framework\MockObject\MockObject $tokenProvider;
+ private LoggerInterface $logger;
protected function setUp(): void {
$this->reflector = new ControllerMethodReflector();
@@ -43,6 +45,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
$this->user = $this->createMock(IUser::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
$this->tokenProvider = $this->createMock(IProvider::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->controller = new PasswordConfirmationMiddlewareController(
'test',
$this->createMock(IRequest::class)
@@ -54,10 +57,11 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
$this->userSession,
$this->timeFactory,
$this->tokenProvider,
+ $this->logger,
);
}
- public function testNoAnnotationNorAttribute() {
+ public function testNoAnnotationNorAttribute(): void {
$this->reflector->reflect($this->controller, __FUNCTION__);
$this->session->expects($this->never())
->method($this->anything());
@@ -67,7 +71,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
$this->middleware->beforeController($this->controller, __FUNCTION__);
}
- public function testDifferentAnnotation() {
+ public function testDifferentAnnotation(): void {
$this->reflector->reflect($this->controller, __FUNCTION__);
$this->session->expects($this->never())
->method($this->anything());
@@ -80,7 +84,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
/**
* @dataProvider dataProvider
*/
- public function testAnnotation($backend, $lastConfirm, $currentTime, $exception) {
+ public function testAnnotation($backend, $lastConfirm, $currentTime, $exception): void {
$this->reflector->reflect($this->controller, __FUNCTION__);
$this->user->method('getBackendClassName')
@@ -115,7 +119,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
/**
* @dataProvider dataProvider
*/
- public function testAttribute($backend, $lastConfirm, $currentTime, $exception) {
+ public function testAttribute($backend, $lastConfirm, $currentTime, $exception): void {
$this->reflector->reflect($this->controller, __FUNCTION__);
$this->user->method('getBackendClassName')
@@ -160,7 +164,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
];
}
- public function testSSO() {
+ public function testSSO(): void {
static $sessionId = 'mySession1d';
$this->reflector->reflect($this->controller, __FUNCTION__);
diff --git a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php
index b4d7ee10f7c..0ca4a455cba 100644
--- a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php
@@ -33,7 +33,7 @@ class SameSiteCookieMiddlewareTest extends TestCase {
$this->middleware = new SameSiteCookieMiddleware($this->request, $this->reflector);
}
- public function testBeforeControllerNoIndex() {
+ public function testBeforeControllerNoIndex(): void {
$this->request->method('getScriptName')
->willReturn('/ocs/v2.php');
@@ -41,7 +41,7 @@ class SameSiteCookieMiddlewareTest extends TestCase {
$this->addToAssertionCount(1);
}
- public function testBeforeControllerIndexHasAnnotation() {
+ public function testBeforeControllerIndexHasAnnotation(): void {
$this->request->method('getScriptName')
->willReturn('/index.php');
@@ -53,7 +53,7 @@ class SameSiteCookieMiddlewareTest extends TestCase {
$this->addToAssertionCount(1);
}
- public function testBeforeControllerIndexNoAnnotationPassingCheck() {
+ public function testBeforeControllerIndexNoAnnotationPassingCheck(): void {
$this->request->method('getScriptName')
->willReturn('/index.php');
@@ -68,7 +68,7 @@ class SameSiteCookieMiddlewareTest extends TestCase {
$this->addToAssertionCount(1);
}
- public function testBeforeControllerIndexNoAnnotationFailingCheck() {
+ public function testBeforeControllerIndexNoAnnotationFailingCheck(): void {
$this->expectException(LaxSameSiteCookieFailedException::class);
$this->request->method('getScriptName')
@@ -84,7 +84,7 @@ class SameSiteCookieMiddlewareTest extends TestCase {
$this->middleware->beforeController($this->createMock(Controller::class), 'foo');
}
- public function testAfterExceptionNoLaxCookie() {
+ public function testAfterExceptionNoLaxCookie(): void {
$ex = new SecurityException();
try {
@@ -95,7 +95,7 @@ class SameSiteCookieMiddlewareTest extends TestCase {
}
}
- public function testAfterExceptionLaxCookie() {
+ public function testAfterExceptionLaxCookie(): void {
$ex = new LaxSameSiteCookieFailedException();
$this->request->method('getRequestUri')
diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
index bda71c4e8ed..07e368fd1e6 100644
--- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
+++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php
@@ -24,14 +24,18 @@ use OCP\App\IAppManager;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\Group\ISubAdmin;
use OCP\IConfig;
+use OCP\IGroupManager;
use OCP\IL10N;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IRequestId;
use OCP\ISession;
use OCP\IURLGenerator;
+use OCP\IUser;
use OCP\IUserSession;
+use OCP\Security\Ip\IRemoteAddress;
use Psr\Log\LoggerInterface;
use Test\AppFramework\Middleware\Security\Mock\NormalController;
use Test\AppFramework\Middleware\Security\Mock\OCSController;
@@ -70,6 +74,9 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->authorizedGroupMapper = $this->createMock(AuthorizedGroupMapper::class);
$this->userSession = $this->createMock(Session::class);
+ $user = $this->createMock(IUser::class);
+ $user->method('getUID')->willReturn('test');
+ $this->userSession->method('getUser')->willReturn($user);
$this->request = $this->createMock(IRequest::class);
$this->controller = new SecurityMiddlewareController(
'test',
@@ -90,6 +97,15 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->appManager->expects($this->any())
->method('isEnabledForUser')
->willReturn($isAppEnabledForUser);
+ $remoteIpAddress = $this->createMock(IRemoteAddress::class);
+ $remoteIpAddress->method('allowsAdminActions')->willReturn(true);
+
+ $groupManager = $this->createMock(IGroupManager::class);
+ $groupManager->method('isAdmin')
+ ->willReturn($isAdminUser);
+ $subAdminManager = $this->createMock(ISubAdmin::class);
+ $subAdminManager->method('isSubAdmin')
+ ->willReturn($isSubAdmin);
return new SecurityMiddleware(
$this->request,
@@ -99,12 +115,13 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->logger,
'files',
$isLoggedIn,
- $isAdminUser,
- $isSubAdmin,
+ $groupManager,
+ $subAdminManager,
$this->appManager,
$this->l10n,
$this->authorizedGroupMapper,
- $this->userSession
+ $this->userSession,
+ $remoteIpAddress
);
}
@@ -330,7 +347,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
/**
* @dataProvider dataNoCSRFRequiredPublicPage
*/
- public function testNoCsrfCheck(string $method) {
+ public function testNoCsrfCheck(string $method): void {
$this->request->expects($this->never())
->method('passesCSRFCheck')
->willReturn(false);
@@ -574,13 +591,13 @@ class SecurityMiddlewareTest extends \Test\TestCase {
}
- public function testAfterExceptionNotCaughtThrowsItAgain() {
+ public function testAfterExceptionNotCaughtThrowsItAgain(): void {
$ex = new \Exception();
$this->expectException(\Exception::class);
$this->middleware->afterException($this->controller, 'test', $ex);
}
- public function testAfterExceptionReturnsRedirectForNotLoggedInUser() {
+ public function testAfterExceptionReturnsRedirectForNotLoggedInUser(): void {
$this->request = new Request(
[
'server' =>
@@ -615,7 +632,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->assertEquals($expected, $response);
}
- public function testAfterExceptionRedirectsToWebRootAfterStrictCookieFail() {
+ public function testAfterExceptionRedirectsToWebRootAfterStrictCookieFail(): void {
$this->request = new Request(
[
'server' => [
@@ -660,7 +677,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
* @dataProvider exceptionProvider
* @param SecurityException $exception
*/
- public function testAfterExceptionReturnsTemplateResponse(SecurityException $exception) {
+ public function testAfterExceptionReturnsTemplateResponse(SecurityException $exception): void {
$this->request = new Request(
[
'server' =>
@@ -686,7 +703,7 @@ class SecurityMiddlewareTest extends \Test\TestCase {
$this->assertEquals($expected, $response);
}
- public function testAfterAjaxExceptionReturnsJSONError() {
+ public function testAfterAjaxExceptionReturnsJSONError(): void {
$response = $this->middleware->afterException($this->controller, 'test',
$this->secAjaxException);
diff --git a/tests/lib/AppFramework/OCS/BaseResponseTest.php b/tests/lib/AppFramework/OCS/BaseResponseTest.php
index aaa107ef013..159459a4aec 100644
--- a/tests/lib/AppFramework/OCS/BaseResponseTest.php
+++ b/tests/lib/AppFramework/OCS/BaseResponseTest.php
@@ -7,7 +7,7 @@ declare(strict_types=1);
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-namespace Test\AppFramework\Middleware;
+namespace Test\AppFramework\OCS;
use OC\AppFramework\OCS\BaseResponse;
diff --git a/tests/lib/AppFramework/OCS/V2ResponseTest.php b/tests/lib/AppFramework/OCS/V2ResponseTest.php
new file mode 100644
index 00000000000..97a227418f3
--- /dev/null
+++ b/tests/lib/AppFramework/OCS/V2ResponseTest.php
@@ -0,0 +1,38 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\AppFramework\OCS;
+
+use OC\AppFramework\OCS\V2Response;
+use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\DataResponse;
+use OCP\AppFramework\OCSController;
+
+class V2ResponseTest extends \Test\TestCase {
+ /**
+ * @dataProvider providesStatusCodes
+ */
+ public function testStatusCodeMapper(int $expected, int $sc): void {
+ $response = new V2Response(new DataResponse([], $sc));
+ $this->assertEquals($expected, $response->getStatus());
+ }
+
+ public function providesStatusCodes(): array {
+ return [
+ [Http::STATUS_OK, 200],
+ [Http::STATUS_BAD_REQUEST, 104],
+ [Http::STATUS_BAD_REQUEST, 1000],
+ [201, 201],
+ [Http::STATUS_UNAUTHORIZED, OCSController::RESPOND_UNAUTHORISED],
+ [Http::STATUS_INTERNAL_SERVER_ERROR, OCSController::RESPOND_SERVER_ERROR],
+ [Http::STATUS_NOT_FOUND, OCSController::RESPOND_NOT_FOUND],
+ [Http::STATUS_INTERNAL_SERVER_ERROR, OCSController::RESPOND_UNKNOWN_ERROR],
+ ];
+ }
+}
diff --git a/tests/lib/AppFramework/Routing/RoutingTest.php b/tests/lib/AppFramework/Routing/RoutingTest.php
index 00b586e6cc4..32b57e7bf21 100644
--- a/tests/lib/AppFramework/Routing/RoutingTest.php
+++ b/tests/lib/AppFramework/Routing/RoutingTest.php
@@ -20,7 +20,7 @@ use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
class RoutingTest extends \Test\TestCase {
- public function testSimpleRoute() {
+ public function testSimpleRoute(): void {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET']
]];
@@ -28,7 +28,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithUnderScoreNames() {
+ public function testSimpleRouteWithUnderScoreNames(): void {
$routes = ['routes' => [
['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'root' => '']
]];
@@ -36,7 +36,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleRoute($routes, 'admin_folders.open_current', 'DELETE', '/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent', [], [], '', true);
}
- public function testSimpleOCSRoute() {
+ public function testSimpleOCSRoute(): void {
$routes = ['ocs' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'GET']
]
@@ -45,7 +45,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleOCSRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithMissingVerb() {
+ public function testSimpleRouteWithMissingVerb(): void {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open']
]];
@@ -53,7 +53,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleOCSRouteWithMissingVerb() {
+ public function testSimpleOCSRouteWithMissingVerb(): void {
$routes = ['ocs' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open']
]
@@ -62,7 +62,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleOCSRoute($routes, 'folders.open', 'GET', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithLowercaseVerb() {
+ public function testSimpleRouteWithLowercaseVerb(): void {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete']
]];
@@ -70,7 +70,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleOCSRouteWithLowercaseVerb() {
+ public function testSimpleOCSRouteWithLowercaseVerb(): void {
$routes = ['ocs' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete']
]
@@ -79,7 +79,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open');
}
- public function testSimpleRouteWithRequirements() {
+ public function testSimpleRouteWithRequirements(): void {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']]
]];
@@ -87,7 +87,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', ['something']);
}
- public function testSimpleOCSRouteWithRequirements() {
+ public function testSimpleOCSRouteWithRequirements(): void {
$routes = ['ocs' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'requirements' => ['something']]
]
@@ -96,7 +96,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', ['something']);
}
- public function testSimpleRouteWithDefaults() {
+ public function testSimpleRouteWithDefaults(): void {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', [], 'defaults' => ['param' => 'foobar']]
]];
@@ -105,7 +105,7 @@ class RoutingTest extends \Test\TestCase {
}
- public function testSimpleOCSRouteWithDefaults() {
+ public function testSimpleOCSRouteWithDefaults(): void {
$routes = ['ocs' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'defaults' => ['param' => 'foobar']]
]
@@ -114,7 +114,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleOCSRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', [], ['param' => 'foobar']);
}
- public function testSimpleRouteWithPostfix() {
+ public function testSimpleRouteWithPostfix(): void {
$routes = ['routes' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something']
]];
@@ -122,7 +122,7 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleRoute($routes, 'folders.open', 'DELETE', '/apps/app1/folders/{folderId}/open', 'FoldersController', 'open', [], [], '_something');
}
- public function testSimpleOCSRouteWithPostfix() {
+ public function testSimpleOCSRouteWithPostfix(): void {
$routes = ['ocs' => [
['name' => 'folders#open', 'url' => '/folders/{folderId}/open', 'verb' => 'delete', 'postfix' => '_something']
]
@@ -132,7 +132,7 @@ class RoutingTest extends \Test\TestCase {
}
- public function testSimpleRouteWithBrokenName() {
+ public function testSimpleRouteWithBrokenName(): void {
$this->expectException(\UnexpectedValueException::class);
$routes = ['routes' => [
@@ -160,7 +160,7 @@ class RoutingTest extends \Test\TestCase {
}
- public function testSimpleOCSRouteWithBrokenName() {
+ public function testSimpleOCSRouteWithBrokenName(): void {
$this->expectException(\UnexpectedValueException::class);
$routes = ['ocs' => [
@@ -187,7 +187,7 @@ class RoutingTest extends \Test\TestCase {
$config->register();
}
- public function testSimpleOCSRouteWithUnderScoreNames() {
+ public function testSimpleOCSRouteWithUnderScoreNames(): void {
$routes = ['ocs' => [
['name' => 'admin_folders#open_current', 'url' => '/folders/{folderId}/open', 'verb' => 'delete']
]];
@@ -195,31 +195,31 @@ class RoutingTest extends \Test\TestCase {
$this->assertSimpleOCSRoute($routes, 'admin_folders.open_current', 'DELETE', '/apps/app1/folders/{folderId}/open', 'AdminFoldersController', 'openCurrent');
}
- public function testOCSResource() {
+ public function testOCSResource(): void {
$routes = ['ocs-resources' => ['account' => ['url' => '/accounts']]];
$this->assertOCSResource($routes, 'account', '/apps/app1/accounts', 'AccountController', 'id');
}
- public function testOCSResourceWithUnderScoreName() {
+ public function testOCSResourceWithUnderScoreName(): void {
$routes = ['ocs-resources' => ['admin_accounts' => ['url' => '/admin/accounts']]];
$this->assertOCSResource($routes, 'admin_accounts', '/apps/app1/admin/accounts', 'AdminAccountsController', 'id');
}
- public function testOCSResourceWithRoot() {
+ public function testOCSResourceWithRoot(): void {
$routes = ['ocs-resources' => ['admin_accounts' => ['url' => '/admin/accounts', 'root' => '/core/endpoint']]];
$this->assertOCSResource($routes, 'admin_accounts', '/core/endpoint/admin/accounts', 'AdminAccountsController', 'id');
}
- public function testResource() {
+ public function testResource(): void {
$routes = ['resources' => ['account' => ['url' => '/accounts']]];
$this->assertResource($routes, 'account', '/apps/app1/accounts', 'AccountController', 'id');
}
- public function testResourceWithUnderScoreName() {
+ public function testResourceWithUnderScoreName(): void {
$routes = ['resources' => ['admin_accounts' => ['url' => '/admin/accounts']]];
$this->assertResource($routes, 'admin_accounts', '/apps/app1/admin/accounts', 'AdminAccountsController', 'id');
diff --git a/tests/lib/AppFramework/Services/AppConfigTest.php b/tests/lib/AppFramework/Services/AppConfigTest.php
index 0ee4afe9bf6..46f73a8c088 100644
--- a/tests/lib/AppFramework/Services/AppConfigTest.php
+++ b/tests/lib/AppFramework/Services/AppConfigTest.php
@@ -35,9 +35,9 @@ class AppConfigTest extends TestCase {
public function testGetAppKeys(): void {
$expected = ['key1', 'key2', 'key3', 'key4', 'key5', 'key6', 'key7', 'test8'];
$this->appConfigCore->expects($this->once())
- ->method('getKeys')
- ->with(self::TEST_APPID)
- ->willReturn($expected);
+ ->method('getKeys')
+ ->with(self::TEST_APPID)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppKeys());
}
@@ -65,9 +65,9 @@ class AppConfigTest extends TestCase {
public function testHasAppKey(bool $lazy, bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('hasKey')
- ->with(self::TEST_APPID, $key, $lazy)
- ->willReturn($expected);
+ ->method('hasKey')
+ ->with(self::TEST_APPID, $key, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->hasAppKey($key, $lazy));
}
@@ -95,9 +95,9 @@ class AppConfigTest extends TestCase {
public function testIsSensitive(bool $lazy, bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('isSensitive')
- ->with(self::TEST_APPID, $key, $lazy)
- ->willReturn($expected);
+ ->method('isSensitive')
+ ->with(self::TEST_APPID, $key, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->isSensitive($key, $lazy));
}
@@ -111,9 +111,9 @@ class AppConfigTest extends TestCase {
public function testIsSensitiveException(bool $lazy, bool $expected): void {
$key = 'unknown-key';
$this->appConfigCore->expects($this->once())
- ->method('isSensitive')
- ->with(self::TEST_APPID, $key, $lazy)
- ->willThrowException(new AppConfigUnknownKeyException());
+ ->method('isSensitive')
+ ->with(self::TEST_APPID, $key, $lazy)
+ ->willThrowException(new AppConfigUnknownKeyException());
$this->expectException(AppConfigUnknownKeyException::class);
$this->appConfig->isSensitive($key, $lazy);
@@ -139,9 +139,9 @@ class AppConfigTest extends TestCase {
public function testIsLazy(bool $expected): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('isLazy')
- ->with(self::TEST_APPID, $key)
- ->willReturn($expected);
+ ->method('isLazy')
+ ->with(self::TEST_APPID, $key)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->isLazy($key));
}
@@ -149,9 +149,9 @@ class AppConfigTest extends TestCase {
public function testIsLazyException(): void {
$key = 'unknown-key';
$this->appConfigCore->expects($this->once())
- ->method('isLazy')
- ->with(self::TEST_APPID, $key)
- ->willThrowException(new AppConfigUnknownKeyException());
+ ->method('isLazy')
+ ->with(self::TEST_APPID, $key)
+ ->willThrowException(new AppConfigUnknownKeyException());
$this->expectException(AppConfigUnknownKeyException::class);
$this->appConfig->isLazy($key);
@@ -186,9 +186,9 @@ class AppConfigTest extends TestCase {
];
$this->appConfigCore->expects($this->once())
- ->method('getAllValues')
- ->with(self::TEST_APPID, $key, $filtered)
- ->willReturn($expected);
+ ->method('getAllValues')
+ ->with(self::TEST_APPID, $key, $filtered)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAllAppValues($key, $filtered));
}
@@ -197,8 +197,8 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 'value';
$this->appConfigCore->expects($this->once())
- ->method('setValueMixed')
- ->with(self::TEST_APPID, $key, $value);
+ ->method('setValueMixed')
+ ->with(self::TEST_APPID, $key, $value);
$this->appConfig->setAppValue($key, $value);
}
@@ -239,9 +239,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 'valueString';
$this->appConfigCore->expects($this->once())
- ->method('setValueString')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueString')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueString($key, $value, $lazy, $sensitive));
}
@@ -256,9 +256,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 'valueString';
$this->appConfigCore->expects($this->once())
- ->method('setValueString')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueString')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueString($key, $value, $lazy, $sensitive);
@@ -275,9 +275,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 42;
$this->appConfigCore->expects($this->once())
- ->method('setValueInt')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueInt')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueInt($key, $value, $lazy, $sensitive));
}
@@ -292,9 +292,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 42;
$this->appConfigCore->expects($this->once())
- ->method('setValueInt')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueInt')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueInt($key, $value, $lazy, $sensitive);
@@ -311,9 +311,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 3.14;
$this->appConfigCore->expects($this->once())
- ->method('setValueFloat')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueFloat')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueFloat($key, $value, $lazy, $sensitive));
}
@@ -328,9 +328,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = 3.14;
$this->appConfigCore->expects($this->once())
- ->method('setValueFloat')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueFloat')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueFloat($key, $value, $lazy, $sensitive);
@@ -360,9 +360,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = true;
$this->appConfigCore->expects($this->once())
- ->method('setValueBool')
- ->with(self::TEST_APPID, $key, $value, $lazy)
- ->willReturn($expected);
+ ->method('setValueBool')
+ ->with(self::TEST_APPID, $key, $value, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueBool($key, $value, $lazy));
}
@@ -376,9 +376,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = true;
$this->appConfigCore->expects($this->once())
- ->method('setValueBool')
- ->with(self::TEST_APPID, $key, $value, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueBool')
+ ->with(self::TEST_APPID, $key, $value, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueBool($key, $value, $lazy);
@@ -395,9 +395,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = ['item' => true];
$this->appConfigCore->expects($this->once())
- ->method('setValueArray')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willReturn($expected);
+ ->method('setValueArray')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->setAppValueArray($key, $value, $lazy, $sensitive));
}
@@ -412,9 +412,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$value = ['item' => true];
$this->appConfigCore->expects($this->once())
- ->method('setValueArray')
- ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('setValueArray')
+ ->with(self::TEST_APPID, $key, $value, $lazy, $sensitive)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->setAppValueArray($key, $value, $lazy, $sensitive);
@@ -425,9 +425,9 @@ class AppConfigTest extends TestCase {
$value = 'value';
$default = 'default';
$this->appConfigCore->expects($this->once())
- ->method('getValueMixed')
- ->with(self::TEST_APPID, $key, $default)
- ->willReturn($value);
+ ->method('getValueMixed')
+ ->with(self::TEST_APPID, $key, $default)
+ ->willReturn($value);
$this->assertSame($value, $this->appConfig->getAppValue($key, $default));
}
@@ -436,9 +436,9 @@ class AppConfigTest extends TestCase {
$key = 'key';
$default = 'default';
$this->appConfigCore->expects($this->once())
- ->method('getValueMixed')
- ->with(self::TEST_APPID, $key, $default)
- ->willReturn($default);
+ ->method('getValueMixed')
+ ->with(self::TEST_APPID, $key, $default)
+ ->willReturn($default);
$this->assertSame($default, $this->appConfig->getAppValue($key, $default));
}
@@ -479,9 +479,9 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueString')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueString')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueString($key, $default, $lazy));
}
@@ -496,9 +496,9 @@ class AppConfigTest extends TestCase {
$default = 'default';
$this->appConfigCore->expects($this->once())
- ->method('getValueString')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueString')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueString($key, $default, $lazy);
@@ -517,9 +517,9 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueInt')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueInt')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueInt($key, $default, $lazy));
}
@@ -534,9 +534,9 @@ class AppConfigTest extends TestCase {
$default = 17;
$this->appConfigCore->expects($this->once())
- ->method('getValueInt')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueInt')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueInt($key, $default, $lazy);
@@ -555,9 +555,9 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueFloat')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueFloat')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueFloat($key, $default, $lazy));
}
@@ -572,9 +572,9 @@ class AppConfigTest extends TestCase {
$default = 17.04;
$this->appConfigCore->expects($this->once())
- ->method('getValueFloat')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueFloat')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueFloat($key, $default, $lazy);
@@ -593,9 +593,9 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default; // yes, it can be simplified
$this->appConfigCore->expects($this->once())
- ->method('getValueBool')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueBool')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueBool($key, $default, $lazy));
}
@@ -610,9 +610,9 @@ class AppConfigTest extends TestCase {
$default = false;
$this->appConfigCore->expects($this->once())
- ->method('getValueBool')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueBool')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueBool($key, $default, $lazy);
@@ -631,9 +631,9 @@ class AppConfigTest extends TestCase {
$expected = ($exist) ? $value : $default;
$this->appConfigCore->expects($this->once())
- ->method('getValueArray')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willReturn($expected);
+ ->method('getValueArray')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willReturn($expected);
$this->assertSame($expected, $this->appConfig->getAppValueArray($key, $default, $lazy));
}
@@ -648,9 +648,9 @@ class AppConfigTest extends TestCase {
$default = [];
$this->appConfigCore->expects($this->once())
- ->method('getValueArray')
- ->with(self::TEST_APPID, $key, $default, $lazy)
- ->willThrowException(new AppConfigTypeConflictException());
+ ->method('getValueArray')
+ ->with(self::TEST_APPID, $key, $default, $lazy)
+ ->willThrowException(new AppConfigTypeConflictException());
$this->expectException(AppConfigTypeConflictException::class);
$this->appConfig->getAppValueArray($key, $default, $lazy);
@@ -659,16 +659,16 @@ class AppConfigTest extends TestCase {
public function testDeleteAppValue(): void {
$key = 'key';
$this->appConfigCore->expects($this->once())
- ->method('deleteKey')
- ->with(self::TEST_APPID, $key);
+ ->method('deleteKey')
+ ->with(self::TEST_APPID, $key);
$this->appConfig->deleteAppValue($key);
}
public function testDeleteAppValues(): void {
$this->appConfigCore->expects($this->once())
- ->method('deleteApp')
- ->with(self::TEST_APPID);
+ ->method('deleteApp')
+ ->with(self::TEST_APPID);
$this->appConfig->deleteAppValues();
}
diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
index 05ad6456904..e0748d89f7f 100644
--- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
+++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
@@ -56,7 +56,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
/**
* @Annotation
*/
- public function testReadAnnotation() {
+ public function testReadAnnotation(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -69,10 +69,10 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
/**
* @Annotation(parameter=value)
*/
- public function testGetAnnotationParameterSingle() {
+ public function testGetAnnotationParameterSingle(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
- __CLASS__,
+ self::class,
__FUNCTION__
);
@@ -82,10 +82,10 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
/**
* @Annotation(parameter1=value1, parameter2=value2,parameter3=value3)
*/
- public function testGetAnnotationParameterMultiple() {
+ public function testGetAnnotationParameterMultiple(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
- __CLASS__,
+ self::class,
__FUNCTION__
);
@@ -98,7 +98,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param test
*/
- public function testReadAnnotationNoLowercase() {
+ public function testReadAnnotationNoLowercase(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -114,7 +114,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param int $test
*/
- public function testReadTypeIntAnnotations() {
+ public function testReadTypeIntAnnotations(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -135,7 +135,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
/**
* @requires PHP 7
*/
- public function testReadTypeIntAnnotationsScalarTypes() {
+ public function testReadTypeIntAnnotationsScalarTypes(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -153,7 +153,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
* @Annotation
* @param double $test something special
*/
- public function testReadTypeDoubleAnnotations() {
+ public function testReadTypeDoubleAnnotations(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -165,9 +165,9 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
/**
* @Annotation
- * @param string $foo
+ * @param string $foo
*/
- public function testReadTypeWhitespaceAnnotations() {
+ public function testReadTypeWhitespaceAnnotations(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -180,7 +180,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
public function arguments($arg, $arg2 = 'hi') {
}
- public function testReflectParameters() {
+ public function testReflectParameters(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -193,7 +193,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
public function arguments2($arg) {
}
- public function testReflectParameters2() {
+ public function testReflectParameters2(): void {
$reader = new ControllerMethodReflector();
$reader->reflect(
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
@@ -204,7 +204,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
}
- public function testInheritance() {
+ public function testInheritance(): void {
$reader = new ControllerMethodReflector();
$reader->reflect('Test\AppFramework\Utility\EndController', 'test');
@@ -212,7 +212,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
}
- public function testInheritanceOverride() {
+ public function testInheritanceOverride(): void {
$reader = new ControllerMethodReflector();
$reader->reflect('Test\AppFramework\Utility\EndController', 'test2');
@@ -221,14 +221,14 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
}
- public function testInheritanceOverrideNoDocblock() {
+ public function testInheritanceOverrideNoDocblock(): void {
$reader = new ControllerMethodReflector();
$reader->reflect('Test\AppFramework\Utility\EndController', 'test3');
$this->assertFalse($reader->hasAnnotation('Annotation'));
}
- public function testRangeDetection() {
+ public function testRangeDetection(): void {
$reader = new ControllerMethodReflector();
$reader->reflect('Test\AppFramework\Utility\EndController', 'test4');
diff --git a/tests/lib/AppFramework/Utility/SimpleContainerTest.php b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
index d27d29db951..d3e9dec18e0 100644
--- a/tests/lib/AppFramework/Utility/SimpleContainerTest.php
+++ b/tests/lib/AppFramework/Utility/SimpleContainerTest.php
@@ -67,7 +67,7 @@ class SimpleContainerTest extends \Test\TestCase {
- public function testRegister() {
+ public function testRegister(): void {
$this->container->registerParameter('test', 'abc');
$this->assertEquals('abc', $this->container->query('test'));
}
@@ -76,7 +76,7 @@ class SimpleContainerTest extends \Test\TestCase {
/**
* Test querying a class that is not registered without autoload enabled
*/
- public function testNothingRegistered() {
+ public function testNothingRegistered(): void {
try {
$this->container->query('something really hard', false);
$this->fail('Expected `QueryException` exception was not thrown');
@@ -90,7 +90,7 @@ class SimpleContainerTest extends \Test\TestCase {
/**
* Test querying a class that is not registered with autoload enabled
*/
- public function testNothingRegistered_autoload() {
+ public function testNothingRegistered_autoload(): void {
try {
$this->container->query('something really hard');
$this->fail('Expected `QueryException` exception was not thrown');
@@ -102,26 +102,26 @@ class SimpleContainerTest extends \Test\TestCase {
- public function testNotAClass() {
+ public function testNotAClass(): void {
$this->expectException(\OCP\AppFramework\QueryException::class);
$this->container->query('Test\AppFramework\Utility\TestInterface');
}
- public function testNoConstructorClass() {
+ public function testNoConstructorClass(): void {
$object = $this->container->query('Test\AppFramework\Utility\ClassEmptyConstructor');
$this->assertTrue($object instanceof ClassEmptyConstructor);
}
- public function testInstancesOnlyOnce() {
+ public function testInstancesOnlyOnce(): void {
$object = $this->container->query('Test\AppFramework\Utility\ClassEmptyConstructor');
$object2 = $this->container->query('Test\AppFramework\Utility\ClassEmptyConstructor');
$this->assertSame($object, $object2);
}
- public function testConstructorSimple() {
+ public function testConstructorSimple(): void {
$this->container->registerParameter('test', 'abc');
$object = $this->container->query(
'Test\AppFramework\Utility\ClassSimpleConstructor'
@@ -131,7 +131,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
- public function testConstructorComplex() {
+ public function testConstructorComplex(): void {
$this->container->registerParameter('test', 'abc');
$object = $this->container->query(
'Test\AppFramework\Utility\ClassComplexConstructor'
@@ -142,7 +142,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
- public function testConstructorComplexInterface() {
+ public function testConstructorComplexInterface(): void {
$this->container->registerParameter('test', 'abc');
$this->container->registerService(
'Test\AppFramework\Utility\IInterfaceConstructor', function ($c) {
@@ -157,7 +157,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
- public function testOverrideService() {
+ public function testOverrideService(): void {
$this->container->registerService(
'Test\AppFramework\Utility\IInterfaceConstructor', function ($c) {
return $c->query('Test\AppFramework\Utility\ClassSimpleConstructor');
@@ -172,13 +172,13 @@ class SimpleContainerTest extends \Test\TestCase {
$this->assertTrue($object instanceof ClassEmptyConstructor);
}
- public function testRegisterAliasParamter() {
+ public function testRegisterAliasParamter(): void {
$this->container->registerParameter('test', 'abc');
$this->container->registerAlias('test1', 'test');
$this->assertEquals('abc', $this->container->query('test1'));
}
- public function testRegisterAliasService() {
+ public function testRegisterAliasService(): void {
$this->container->registerService('test', function () {
return new \StdClass;
}, true);
@@ -203,7 +203,7 @@ class SimpleContainerTest extends \Test\TestCase {
/**
* @dataProvider sanitizeNameProvider
*/
- public function testSanitizeName($register, $query) {
+ public function testSanitizeName($register, $query): void {
$this->container->registerService($register, function () {
return 'abc';
});
@@ -211,7 +211,7 @@ class SimpleContainerTest extends \Test\TestCase {
}
- public function testConstructorComplexNoTestParameterFound() {
+ public function testConstructorComplexNoTestParameterFound(): void {
$this->expectException(\OCP\AppFramework\QueryException::class);
$object = $this->container->query(
@@ -219,7 +219,7 @@ class SimpleContainerTest extends \Test\TestCase {
);
}
- public function testRegisterFactory() {
+ public function testRegisterFactory(): void {
$this->container->registerService('test', function () {
return new \StdClass();
}, false);
@@ -227,7 +227,7 @@ class SimpleContainerTest extends \Test\TestCase {
$this->container->query('test'), $this->container->query('test'));
}
- public function testRegisterAliasFactory() {
+ public function testRegisterAliasFactory(): void {
$this->container->registerService('test', function () {
return new \StdClass();
}, false);
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index 4fe88e09e6a..e6759170fb1 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -308,14 +308,14 @@ class AppTest extends \Test\TestCase {
/**
* @dataProvider appVersionsProvider
*/
- public function testIsAppCompatible($ocVersion, $appInfo, $expectedResult) {
+ public function testIsAppCompatible($ocVersion, $appInfo, $expectedResult): void {
$this->assertEquals($expectedResult, \OC_App::isAppCompatible($ocVersion, $appInfo));
}
/**
* Tests that the app order is correct
*/
- public function testGetEnabledAppsIsSorted() {
+ public function testGetEnabledAppsIsSorted(): void {
$apps = \OC_App::getEnabledApps();
// copy array
$sortedApps = $apps;
@@ -457,12 +457,12 @@ class AppTest extends \Test\TestCase {
*
* @dataProvider appConfigValuesProvider
*/
- public function testEnabledApps($user, $expectedApps, $forceAll) {
+ public function testEnabledApps($user, $expectedApps, $forceAll): void {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
- $user1 = $userManager->createUser(self::TEST_USER1, self::TEST_USER1);
- $user2 = $userManager->createUser(self::TEST_USER2, self::TEST_USER2);
- $user3 = $userManager->createUser(self::TEST_USER3, self::TEST_USER3);
+ $user1 = $userManager->createUser(self::TEST_USER1, 'NotAnEasyPassword123456+');
+ $user2 = $userManager->createUser(self::TEST_USER2, 'NotAnEasyPassword123456_');
+ $user3 = $userManager->createUser(self::TEST_USER3, 'NotAnEasyPassword123456?');
$group1 = $groupManager->createGroup(self::TEST_GROUP1);
$group1->addUser($user1);
@@ -506,9 +506,9 @@ class AppTest extends \Test\TestCase {
* Test isEnabledApps() with cache, not re-reading the list of
* enabled apps more than once when a user is set.
*/
- public function testEnabledAppsCache() {
+ public function testEnabledAppsCache(): void {
$userManager = \OC::$server->getUserManager();
- $user1 = $userManager->createUser(self::TEST_USER1, self::TEST_USER1);
+ $user1 = $userManager->createUser(self::TEST_USER1, 'NotAnEasyPassword123456+');
\OC_User::setUserId(self::TEST_USER1);
@@ -615,20 +615,20 @@ class AppTest extends \Test\TestCase {
* @param array $data
* @param array $expected
*/
- public function testParseAppInfo(array $data, array $expected) {
+ public function testParseAppInfo(array $data, array $expected): void {
$this->assertSame($expected, \OC_App::parseAppInfo($data));
}
- public function testParseAppInfoL10N() {
+ public function testParseAppInfoL10N(): void {
$parser = new InfoParser();
- $data = $parser->parse(\OC::$SERVERROOT. "/tests/data/app/description-multi-lang.xml");
+ $data = $parser->parse(\OC::$SERVERROOT. '/tests/data/app/description-multi-lang.xml');
$this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']);
$this->assertEquals('German', \OC_App::parseAppInfo($data, 'de')['description']);
}
- public function testParseAppInfoL10NSingleLanguage() {
+ public function testParseAppInfoL10NSingleLanguage(): void {
$parser = new InfoParser();
- $data = $parser->parse(\OC::$SERVERROOT. "/tests/data/app/description-single-lang.xml");
+ $data = $parser->parse(\OC::$SERVERROOT. '/tests/data/app/description-single-lang.xml');
$this->assertEquals('English', \OC_App::parseAppInfo($data, 'en')['description']);
}
}
diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php
index 6475b49e549..3f2d8c9561e 100644
--- a/tests/lib/Archive/TestBase.php
+++ b/tests/lib/Archive/TestBase.php
@@ -24,7 +24,7 @@ abstract class TestBase extends \Test\TestCase {
*/
abstract protected function getNew();
- public function testGetFiles() {
+ public function testGetFiles(): void {
$this->instance = $this->getExisting();
$allFiles = $this->instance->getFiles();
$expected = ['lorem.txt','logo-wide.png','dir/', 'dir/lorem.txt'];
@@ -50,7 +50,7 @@ abstract class TestBase extends \Test\TestCase {
}
}
- public function testContent() {
+ public function testContent(): void {
$this->instance = $this->getExisting();
$dir = \OC::$SERVERROOT.'/tests/data';
$textFile = $dir.'/lorem.txt';
@@ -61,7 +61,7 @@ abstract class TestBase extends \Test\TestCase {
$this->assertEquals(file_get_contents($textFile), file_get_contents($tmpFile));
}
- public function testWrite() {
+ public function testWrite(): void {
$dir = \OC::$SERVERROOT.'/tests/data';
$textFile = $dir.'/lorem.txt';
$this->instance = $this->getNew();
@@ -76,7 +76,7 @@ abstract class TestBase extends \Test\TestCase {
$this->assertEquals('foobar', $this->instance->getFile('lorem.txt'));
}
- public function testReadStream() {
+ public function testReadStream(): void {
$dir = \OC::$SERVERROOT.'/tests/data';
$this->instance = $this->getExisting();
$fh = $this->instance->getStream('lorem.txt', 'r');
@@ -85,7 +85,7 @@ abstract class TestBase extends \Test\TestCase {
fclose($fh);
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), $content);
}
- public function testWriteStream() {
+ public function testWriteStream(): void {
$dir = \OC::$SERVERROOT.'/tests/data';
$this->instance = $this->getNew();
$fh = $this->instance->getStream('lorem.txt', 'w');
@@ -96,7 +96,7 @@ abstract class TestBase extends \Test\TestCase {
$this->assertTrue($this->instance->fileExists('lorem.txt'));
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), $this->instance->getFile('lorem.txt'));
}
- public function testFolder() {
+ public function testFolder(): void {
$this->instance = $this->getNew();
$this->assertFalse($this->instance->fileExists('/test'));
$this->assertFalse($this->instance->fileExists('/test/'));
@@ -107,7 +107,7 @@ abstract class TestBase extends \Test\TestCase {
$this->assertFalse($this->instance->fileExists('/test'));
$this->assertFalse($this->instance->fileExists('/test/'));
}
- public function testExtract() {
+ public function testExtract(): void {
$dir = \OC::$SERVERROOT.'/tests/data';
$this->instance = $this->getExisting();
$tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
@@ -118,7 +118,7 @@ abstract class TestBase extends \Test\TestCase {
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt'));
\OCP\Files::rmdirr($tmpDir);
}
- public function testMoveRemove() {
+ public function testMoveRemove(): void {
$dir = \OC::$SERVERROOT.'/tests/data';
$textFile = $dir.'/lorem.txt';
$this->instance = $this->getNew();
@@ -131,7 +131,7 @@ abstract class TestBase extends \Test\TestCase {
$this->instance->remove('target.txt');
$this->assertFalse($this->instance->fileExists('target.txt'));
}
- public function testRecursive() {
+ public function testRecursive(): void {
$dir = \OC::$SERVERROOT.'/tests/data';
$this->instance = $this->getNew();
$this->instance->addRecursive('/dir', $dir);
diff --git a/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php b/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php
index c8fd688d154..c89b1e4108f 100644
--- a/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php
+++ b/tests/lib/Authentication/Events/RemoteWipeFinishedTest.php
@@ -14,7 +14,7 @@ use OC\Authentication\Token\IToken;
use Test\TestCase;
class RemoteWipeFinishedTest extends TestCase {
- public function testGetToken() {
+ public function testGetToken(): void {
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
diff --git a/tests/lib/Authentication/Events/RemoteWipeStartedTest.php b/tests/lib/Authentication/Events/RemoteWipeStartedTest.php
index 27bd10dea05..fc297f7c087 100644
--- a/tests/lib/Authentication/Events/RemoteWipeStartedTest.php
+++ b/tests/lib/Authentication/Events/RemoteWipeStartedTest.php
@@ -14,7 +14,7 @@ use OC\Authentication\Token\IToken;
use Test\TestCase;
class RemoteWipeStartedTest extends TestCase {
- public function testGetToken() {
+ public function testGetToken(): void {
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
diff --git a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php
index d1cbaae22fb..e2f957ab69a 100644
--- a/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php
+++ b/tests/lib/Authentication/Listeners/RemoteWipeActivityListenerTest.php
@@ -43,7 +43,7 @@ class RemoteWipeActivityListenerTest extends TestCase {
);
}
- public function testHandleUnrelated() {
+ public function testHandleUnrelated(): void {
$event = new Event();
$this->listener->handle($event);
@@ -51,7 +51,7 @@ class RemoteWipeActivityListenerTest extends TestCase {
$this->addToAssertionCount(1);
}
- public function testHandleRemoteWipeStarted() {
+ public function testHandleRemoteWipeStarted(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
@@ -87,7 +87,7 @@ class RemoteWipeActivityListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeStartedCanNotPublish() {
+ public function testHandleRemoteWipeStartedCanNotPublish(): void {
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
$this->activityManager->expects($this->once())
@@ -99,7 +99,7 @@ class RemoteWipeActivityListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeFinished() {
+ public function testHandleRemoteWipeFinished(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
diff --git a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php
index 27dd85d9961..1c45add4e31 100644
--- a/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php
+++ b/tests/lib/Authentication/Listeners/RemoteWipeEmailListenerTest.php
@@ -66,14 +66,14 @@ class RemoteWipeEmailListenerTest extends TestCase {
}
- public function testHandleUnrelated() {
+ public function testHandleUnrelated(): void {
$event = new Event();
$this->mailer->expects($this->never())->method('send');
$this->listener->handle($event);
}
- public function testHandleRemoteWipeStartedInvalidUser() {
+ public function testHandleRemoteWipeStartedInvalidUser(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
@@ -87,7 +87,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeStartedNoEmailSet() {
+ public function testHandleRemoteWipeStartedNoEmailSet(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
@@ -103,7 +103,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeStartedTransmissionError() {
+ public function testHandleRemoteWipeStartedTransmissionError(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
@@ -123,7 +123,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeStarted() {
+ public function testHandleRemoteWipeStarted(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
@@ -148,7 +148,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeFinishedInvalidUser() {
+ public function testHandleRemoteWipeFinishedInvalidUser(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
@@ -162,7 +162,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeFinishedNoEmailSet() {
+ public function testHandleRemoteWipeFinishedNoEmailSet(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
@@ -178,7 +178,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeFinishedTransmissionError() {
+ public function testHandleRemoteWipeFinishedTransmissionError(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
@@ -198,7 +198,7 @@ class RemoteWipeEmailListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeFinished() {
+ public function testHandleRemoteWipeFinished(): void {
/** @var IToken|MockObject $token */
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
diff --git a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php
index d223f0d05a1..53fa502b199 100644
--- a/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php
+++ b/tests/lib/Authentication/Listeners/RemoteWipeNotificationsListenerTest.php
@@ -44,7 +44,7 @@ class RemoteWipeNotificationsListenerTest extends TestCase {
);
}
- public function testHandleUnrelated() {
+ public function testHandleUnrelated(): void {
$event = new Event();
$this->listener->handle($event);
@@ -52,7 +52,7 @@ class RemoteWipeNotificationsListenerTest extends TestCase {
$this->addToAssertionCount(1);
}
- public function testHandleRemoteWipeStarted() {
+ public function testHandleRemoteWipeStarted(): void {
$token = $this->createMock(IToken::class);
$event = new RemoteWipeStarted($token);
$notification = $this->createMock(INotification::class);
@@ -92,7 +92,7 @@ class RemoteWipeNotificationsListenerTest extends TestCase {
$this->listener->handle($event);
}
- public function testHandleRemoteWipeFinished() {
+ public function testHandleRemoteWipeFinished(): void {
$token = $this->createMock(IToken::class);
$event = new RemoteWipeFinished($token);
$notification = $this->createMock(INotification::class);
diff --git a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php
index 1a97f0e345b..025612e963e 100644
--- a/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php
+++ b/tests/lib/Authentication/Login/ClearLostPasswordTokensCommandTest.php
@@ -27,7 +27,7 @@ class ClearLostPasswordTokensCommandTest extends ALoginCommandTest {
);
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getLoggedInLoginData();
$this->user->expects($this->once())
->method('getUID')
diff --git a/tests/lib/Authentication/Login/CompleteLoginCommandTest.php b/tests/lib/Authentication/Login/CompleteLoginCommandTest.php
index eeb39d5173d..4ddb26e7648 100644
--- a/tests/lib/Authentication/Login/CompleteLoginCommandTest.php
+++ b/tests/lib/Authentication/Login/CompleteLoginCommandTest.php
@@ -27,7 +27,7 @@ class CompleteLoginCommandTest extends ALoginCommandTest {
);
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getLoggedInLoginData();
$this->session->expects($this->once())
->method('completeLogin')
diff --git a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php
index 049b6b1c94b..fd6a154ef5d 100644
--- a/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php
+++ b/tests/lib/Authentication/Login/CreateSessionTokenCommandTest.php
@@ -34,7 +34,7 @@ class CreateSessionTokenCommandTest extends ALoginCommandTest {
);
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->once())
->method('getSystemValueInt')
@@ -67,7 +67,7 @@ class CreateSessionTokenCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessDoNotRemember() {
+ public function testProcessDoNotRemember(): void {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->once())
->method('getSystemValueInt')
diff --git a/tests/lib/Authentication/Login/EmailLoginCommandTest.php b/tests/lib/Authentication/Login/EmailLoginCommandTest.php
index 236825e77bb..b34d0d95f4f 100644
--- a/tests/lib/Authentication/Login/EmailLoginCommandTest.php
+++ b/tests/lib/Authentication/Login/EmailLoginCommandTest.php
@@ -28,7 +28,7 @@ class EmailLoginCommandTest extends ALoginCommandTest {
);
}
- public function testProcessAlreadyLoggedIn() {
+ public function testProcessAlreadyLoggedIn(): void {
$data = $this->getLoggedInLoginData();
$result = $this->cmd->process($data);
@@ -36,7 +36,7 @@ class EmailLoginCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessNotAnEmailLogin() {
+ public function testProcessNotAnEmailLogin(): void {
$data = $this->getFailedLoginData();
$this->userManager->expects($this->never())
->method('getByEmail')
@@ -48,7 +48,7 @@ class EmailLoginCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessDuplicateEmailLogin() {
+ public function testProcessDuplicateEmailLogin(): void {
$data = $this->getFailedLoginData();
$data->setUsername('user@example.com');
$this->userManager->expects($this->once())
@@ -64,7 +64,7 @@ class EmailLoginCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessUidIsEmail() {
+ public function testProcessUidIsEmail(): void {
$email = 'user@domain.com';
$data = $this->getFailedLoginData();
$data->setUsername($email);
@@ -88,7 +88,7 @@ class EmailLoginCommandTest extends ALoginCommandTest {
$this->assertEquals($email, $data->getUsername());
}
- public function testProcessWrongPassword() {
+ public function testProcessWrongPassword(): void {
$email = 'user@domain.com';
$data = $this->getFailedLoginData();
$data->setUsername($email);
@@ -117,7 +117,7 @@ class EmailLoginCommandTest extends ALoginCommandTest {
$this->assertEquals($email, $data->getUsername());
}
- public function testProcess() {
+ public function testProcess(): void {
$email = 'user@domain.com';
$data = $this->getFailedLoginData();
$data->setUsername($email);
diff --git a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
index 9f9a36faf9f..4eb4f94055f 100644
--- a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
+++ b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
@@ -32,7 +32,7 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
);
}
- public function testProcessNotRememberedLogin() {
+ public function testProcessNotRememberedLogin(): void {
$data = $this->getLoggedInLoginData();
$data->setRememberLogin(false);
$this->userSession->expects($this->never())
@@ -43,7 +43,7 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->once())
->method('getSystemValueBool')
@@ -58,7 +58,7 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessNotRemeberedLoginWithAutologout() {
+ public function testProcessNotRemeberedLoginWithAutologout(): void {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->once())
->method('getSystemValueBool')
diff --git a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php
index bb5d6235f86..ce783050921 100644
--- a/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php
+++ b/tests/lib/Authentication/Login/LoggedInCheckCommandTest.php
@@ -34,7 +34,7 @@ class LoggedInCheckCommandTest extends ALoginCommandTest {
);
}
- public function testProcessSuccessfulLogin() {
+ public function testProcessSuccessfulLogin(): void {
$data = $this->getLoggedInLoginData();
$result = $this->cmd->process($data);
@@ -42,7 +42,7 @@ class LoggedInCheckCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessFailedLogin() {
+ public function testProcessFailedLogin(): void {
$data = $this->getFailedLoginData();
$this->logger->expects($this->once())
->method('warning');
diff --git a/tests/lib/Authentication/Login/PreLoginHookCommandTest.php b/tests/lib/Authentication/Login/PreLoginHookCommandTest.php
index 824042e1dee..b6d826f1c21 100644
--- a/tests/lib/Authentication/Login/PreLoginHookCommandTest.php
+++ b/tests/lib/Authentication/Login/PreLoginHookCommandTest.php
@@ -28,7 +28,7 @@ class PreLoginHookCommandTest extends ALoginCommandTest {
);
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getBasicLoginData();
$this->userManager->expects($this->once())
->method('emit')
diff --git a/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php b/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php
index 068516b933b..d4e15f68257 100644
--- a/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php
+++ b/tests/lib/Authentication/Login/SetUserTimezoneCommandTest.php
@@ -33,7 +33,7 @@ class SetUserTimezoneCommandTest extends ALoginCommandTest {
);
}
- public function testProcessNoTimezoneSet() {
+ public function testProcessNoTimezoneSet(): void {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->never())
->method('setUserValue');
@@ -45,7 +45,7 @@ class SetUserTimezoneCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getLoggedInLoginDataWithTimezone();
$this->user->expects($this->once())
->method('getUID')
diff --git a/tests/lib/Authentication/Login/TwoFactorCommandTest.php b/tests/lib/Authentication/Login/TwoFactorCommandTest.php
index 54f634618fd..af7d7446bfb 100644
--- a/tests/lib/Authentication/Login/TwoFactorCommandTest.php
+++ b/tests/lib/Authentication/Login/TwoFactorCommandTest.php
@@ -42,7 +42,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
);
}
- public function testNotTwoFactorAuthenticated() {
+ public function testNotTwoFactorAuthenticated(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -55,7 +55,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessOneActiveProvider() {
+ public function testProcessOneActiveProvider(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -99,7 +99,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertEquals('two/factor/url', $result->getRedirectUrl());
}
- public function testProcessMissingProviders() {
+ public function testProcessMissingProviders(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -140,7 +140,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertEquals('two/factor/url', $result->getRedirectUrl());
}
- public function testProcessTwoActiveProviders() {
+ public function testProcessTwoActiveProviders(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -186,7 +186,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertEquals('two/factor/url', $result->getRedirectUrl());
}
- public function testProcessFailingProviderAndEnforcedButNoSetupProviders() {
+ public function testProcessFailingProviderAndEnforcedButNoSetupProviders(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -221,7 +221,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertEquals('two/factor/url', $result->getRedirectUrl());
}
- public function testProcessFailingProviderAndEnforced() {
+ public function testProcessFailingProviderAndEnforced(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -259,7 +259,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertEquals('two/factor/url', $result->getRedirectUrl());
}
- public function testProcessNoProvidersButEnforced() {
+ public function testProcessNoProvidersButEnforced(): void {
$data = $this->getLoggedInLoginData();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
@@ -294,7 +294,7 @@ class TwoFactorCommandTest extends ALoginCommandTest {
$this->assertEquals('two/factor/url', $result->getRedirectUrl());
}
- public function testProcessWithRedirectUrl() {
+ public function testProcessWithRedirectUrl(): void {
$data = $this->getLoggedInLoginDataWithRedirectUrl();
$this->twoFactorManager->expects($this->once())
->method('isTwoFactorAuthenticated')
diff --git a/tests/lib/Authentication/Login/UidLoginCommandTest.php b/tests/lib/Authentication/Login/UidLoginCommandTest.php
index e56c4323fd4..3073aac1859 100644
--- a/tests/lib/Authentication/Login/UidLoginCommandTest.php
+++ b/tests/lib/Authentication/Login/UidLoginCommandTest.php
@@ -27,7 +27,7 @@ class UidLoginCommandTest extends ALoginCommandTest {
);
}
- public function testProcessFailingLogin() {
+ public function testProcessFailingLogin(): void {
$data = $this->getBasicLoginData();
$this->userManager->expects($this->once())
->method('checkPasswordNoLogging')
@@ -43,7 +43,7 @@ class UidLoginCommandTest extends ALoginCommandTest {
$this->assertFalse($data->getUser());
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getBasicLoginData();
$this->userManager->expects($this->once())
->method('checkPasswordNoLogging')
diff --git a/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php b/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php
index d471b73659f..f5760f3f232 100644
--- a/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php
+++ b/tests/lib/Authentication/Login/UpdateLastPasswordConfirmCommandTest.php
@@ -27,7 +27,7 @@ class UpdateLastPasswordConfirmCommandTest extends ALoginCommandTest {
);
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getLoggedInLoginData();
$this->user->expects($this->once())
->method('getLastLogin')
diff --git a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php
index a36fb5c70bd..84b1018e5fa 100644
--- a/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php
+++ b/tests/lib/Authentication/Login/UserDisabledCheckCommandTest.php
@@ -34,7 +34,7 @@ class UserDisabledCheckCommandTest extends ALoginCommandTest {
);
}
- public function testProcessNonExistingUser() {
+ public function testProcessNonExistingUser(): void {
$data = $this->getBasicLoginData();
$this->userManager->expects($this->once())
->method('get')
@@ -46,7 +46,7 @@ class UserDisabledCheckCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
- public function testProcessDisabledUser() {
+ public function testProcessDisabledUser(): void {
$data = $this->getBasicLoginData();
$this->userManager->expects($this->once())
->method('get')
@@ -62,7 +62,7 @@ class UserDisabledCheckCommandTest extends ALoginCommandTest {
$this->assertSame(LoginController::LOGIN_MSG_USERDISABLED, $result->getErrorMessage());
}
- public function testProcess() {
+ public function testProcess(): void {
$data = $this->getBasicLoginData();
$this->userManager->expects($this->once())
->method('get')
diff --git a/tests/lib/Authentication/LoginCredentials/CredentialsTest.php b/tests/lib/Authentication/LoginCredentials/CredentialsTest.php
index ed3ea469653..a64ad6c9b76 100644
--- a/tests/lib/Authentication/LoginCredentials/CredentialsTest.php
+++ b/tests/lib/Authentication/LoginCredentials/CredentialsTest.php
@@ -33,15 +33,15 @@ class CredentialsTest extends TestCase {
$this->credentials = new Credentials($this->uid, $this->user, $this->password);
}
- public function testGetUID() {
+ public function testGetUID(): void {
$this->assertEquals($this->uid, $this->credentials->getUID());
}
- public function testGetUserName() {
+ public function testGetUserName(): void {
$this->assertEquals($this->user, $this->credentials->getLoginName());
}
- public function testGetPassword() {
+ public function testGetPassword(): void {
$this->assertEquals($this->password, $this->credentials->getPassword());
}
}
diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php
index 06dd2527930..6f1e3a6d750 100644
--- a/tests/lib/Authentication/LoginCredentials/StoreTest.php
+++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php
@@ -43,7 +43,7 @@ class StoreTest extends TestCase {
$this->store = new Store($this->session, $this->logger, $this->tokenProvider);
}
- public function testAuthenticate() {
+ public function testAuthenticate(): void {
$params = [
'run' => true,
'uid' => 'user123',
@@ -57,14 +57,14 @@ class StoreTest extends TestCase {
$this->store->authenticate($params);
}
- public function testSetSession() {
+ public function testSetSession(): void {
$session = $this->createMock(ISession::class);
$this->store->setSession($session);
$this->addToAssertionCount(1);
}
- public function testGetLoginCredentialsNoTokenProvider() {
+ public function testGetLoginCredentialsNoTokenProvider(): void {
$this->store = new Store($this->session, $this->logger, null);
$this->expectException(CredentialsUnavailableException::class);
@@ -72,7 +72,7 @@ class StoreTest extends TestCase {
$this->store->getLoginCredentials();
}
- public function testGetLoginCredentials() {
+ public function testGetLoginCredentials(): void {
$uid = 'uid';
$user = 'user123';
$password = 'passme';
@@ -101,7 +101,7 @@ class StoreTest extends TestCase {
$this->assertEquals($expected, $creds);
}
- public function testGetLoginCredentialsSessionNotAvailable() {
+ public function testGetLoginCredentialsSessionNotAvailable(): void {
$this->session->expects($this->once())
->method('getId')
->will($this->throwException(new SessionNotAvailableException()));
@@ -110,7 +110,7 @@ class StoreTest extends TestCase {
$this->store->getLoginCredentials();
}
- public function testGetLoginCredentialsInvalidToken() {
+ public function testGetLoginCredentialsInvalidToken(): void {
$this->session->expects($this->once())
->method('getId')
->willReturn('sess2233');
@@ -123,7 +123,7 @@ class StoreTest extends TestCase {
$this->store->getLoginCredentials();
}
- public function testGetLoginCredentialsPartialCredentialsAndSessionName() {
+ public function testGetLoginCredentialsPartialCredentialsAndSessionName(): void {
$uid = 'id987';
$user = 'user987';
$password = '7389374';
@@ -161,7 +161,7 @@ class StoreTest extends TestCase {
$this->assertEquals($expected, $actual);
}
- public function testGetLoginCredentialsPartialCredentials() {
+ public function testGetLoginCredentialsPartialCredentials(): void {
$uid = 'id987';
$password = '7389374';
@@ -198,7 +198,7 @@ class StoreTest extends TestCase {
$this->assertEquals($expected, $actual);
}
- public function testGetLoginCredentialsInvalidTokenLoginCredentials() {
+ public function testGetLoginCredentialsInvalidTokenLoginCredentials(): void {
$uid = 'id987';
$user = 'user987';
$password = '7389374';
@@ -225,7 +225,7 @@ class StoreTest extends TestCase {
$this->assertEquals($expected, $actual);
}
- public function testGetLoginCredentialsPasswordlessToken() {
+ public function testGetLoginCredentialsPasswordlessToken(): void {
$this->session->expects($this->once())
->method('getId')
->willReturn('sess2233');
diff --git a/tests/lib/Authentication/Token/ManagerTest.php b/tests/lib/Authentication/Token/ManagerTest.php
index 98baffed14b..4fde9817d09 100644
--- a/tests/lib/Authentication/Token/ManagerTest.php
+++ b/tests/lib/Authentication/Token/ManagerTest.php
@@ -33,7 +33,7 @@ class ManagerTest extends TestCase {
);
}
- public function testGenerateToken() {
+ public function testGenerateToken(): void {
$token = new PublicKeyToken();
$this->publicKeyTokenProvider->expects($this->once())
@@ -61,7 +61,7 @@ class ManagerTest extends TestCase {
$this->assertSame($token, $actual);
}
- public function testGenerateConflictingToken() {
+ public function testGenerateConflictingToken(): void {
/** @var MockObject|UniqueConstraintViolationException $exception */
$exception = $this->createMock(UniqueConstraintViolationException::class);
@@ -97,7 +97,7 @@ class ManagerTest extends TestCase {
$this->assertSame($token, $actual);
}
- public function testGenerateTokenTooLongName() {
+ public function testGenerateTokenTooLongName(): void {
$token = $this->createMock(IToken::class);
$token->method('getName')
->willReturn(str_repeat('a', 120) . '…');
@@ -160,7 +160,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider tokenData
*/
- public function testUpdateToken(IToken $token) {
+ public function testUpdateToken(IToken $token): void {
$this->setNoCall($token);
$this->setCall($token, 'updateToken');
$this->setException($token);
@@ -171,7 +171,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider tokenData
*/
- public function testUpdateTokenActivity(IToken $token) {
+ public function testUpdateTokenActivity(IToken $token): void {
$this->setNoCall($token);
$this->setCall($token, 'updateTokenActivity');
$this->setException($token);
@@ -182,7 +182,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider tokenData
*/
- public function testGetPassword(IToken $token) {
+ public function testGetPassword(IToken $token): void {
$this->setNoCall($token);
$this->setCall($token, 'getPassword', 'password');
$this->setException($token);
@@ -195,7 +195,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider tokenData
*/
- public function testSetPassword(IToken $token) {
+ public function testSetPassword(IToken $token): void {
$this->setNoCall($token);
$this->setCall($token, 'setPassword');
$this->setException($token);
@@ -203,7 +203,7 @@ class ManagerTest extends TestCase {
$this->manager->setPassword($token, 'tokenId', 'password');
}
- public function testInvalidateTokens() {
+ public function testInvalidateTokens(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('invalidateToken')
->with('token');
@@ -211,7 +211,7 @@ class ManagerTest extends TestCase {
$this->manager->invalidateToken('token');
}
- public function testInvalidateTokenById() {
+ public function testInvalidateTokenById(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('invalidateTokenById')
->with('uid', 42);
@@ -219,14 +219,14 @@ class ManagerTest extends TestCase {
$this->manager->invalidateTokenById('uid', 42);
}
- public function testInvalidateOldTokens() {
+ public function testInvalidateOldTokens(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('invalidateOldTokens');
$this->manager->invalidateOldTokens();
}
- public function testInvalidateLastUsedBefore() {
+ public function testInvalidateLastUsedBefore(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('invalidateLastUsedBefore')
->with('user', 946684800);
@@ -234,7 +234,7 @@ class ManagerTest extends TestCase {
$this->manager->invalidateLastUsedBefore('user', 946684800);
}
- public function testGetTokenByUser() {
+ public function testGetTokenByUser(): void {
$t1 = new PublicKeyToken();
$t2 = new PublicKeyToken();
@@ -247,7 +247,7 @@ class ManagerTest extends TestCase {
$this->assertEquals([$t1, $t2], $result);
}
- public function testRenewSessionTokenPublicKey() {
+ public function testRenewSessionTokenPublicKey(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('renewSessionToken')
->with('oldId', 'newId');
@@ -255,7 +255,7 @@ class ManagerTest extends TestCase {
$this->manager->renewSessionToken('oldId', 'newId');
}
- public function testRenewSessionInvalid() {
+ public function testRenewSessionInvalid(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('renewSessionToken')
->with('oldId', 'newId')
@@ -265,7 +265,7 @@ class ManagerTest extends TestCase {
$this->manager->renewSessionToken('oldId', 'newId');
}
- public function testGetTokenByIdPublicKey() {
+ public function testGetTokenByIdPublicKey(): void {
$token = $this->createMock(IToken::class);
$this->publicKeyTokenProvider->expects($this->once())
@@ -276,7 +276,7 @@ class ManagerTest extends TestCase {
$this->assertSame($token, $this->manager->getTokenById(42));
}
- public function testGetTokenByIdInvalid() {
+ public function testGetTokenByIdInvalid(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('getTokenById')
->with(42)
@@ -286,7 +286,7 @@ class ManagerTest extends TestCase {
$this->manager->getTokenById(42);
}
- public function testGetTokenPublicKey() {
+ public function testGetTokenPublicKey(): void {
$token = new PublicKeyToken();
$this->publicKeyTokenProvider
@@ -297,7 +297,7 @@ class ManagerTest extends TestCase {
$this->assertSame($token, $this->manager->getToken('tokenId'));
}
- public function testGetTokenInvalid() {
+ public function testGetTokenInvalid(): void {
$this->publicKeyTokenProvider
->method('getToken')
->with('tokenId')
@@ -307,12 +307,12 @@ class ManagerTest extends TestCase {
$this->manager->getToken('tokenId');
}
- public function testRotateInvalid() {
+ public function testRotateInvalid(): void {
$this->expectException(InvalidTokenException::class);
$this->manager->rotate($this->createMock(IToken::class), 'oldId', 'newId');
}
- public function testRotatePublicKey() {
+ public function testRotatePublicKey(): void {
$token = new PublicKeyToken();
$this->publicKeyTokenProvider
@@ -323,7 +323,7 @@ class ManagerTest extends TestCase {
$this->assertSame($token, $this->manager->rotate($token, 'oldId', 'newId'));
}
- public function testMarkPasswordInvalidPublicKey() {
+ public function testMarkPasswordInvalidPublicKey(): void {
$token = $this->createMock(PublicKeyToken::class);
$this->publicKeyTokenProvider->expects($this->once())
@@ -333,13 +333,13 @@ class ManagerTest extends TestCase {
$this->manager->markPasswordInvalid($token, 'tokenId');
}
- public function testMarkPasswordInvalidInvalidToken() {
+ public function testMarkPasswordInvalidInvalidToken(): void {
$this->expectException(InvalidTokenException::class);
$this->manager->markPasswordInvalid($this->createMock(IToken::class), 'tokenId');
}
- public function testUpdatePasswords() {
+ public function testUpdatePasswords(): void {
$this->publicKeyTokenProvider->expects($this->once())
->method('updatePasswords')
->with('uid', 'pass');
@@ -347,7 +347,7 @@ class ManagerTest extends TestCase {
$this->manager->updatePasswords('uid', 'pass');
}
- public function testInvalidateTokensOfUserNoClientName() {
+ public function testInvalidateTokensOfUserNoClientName(): void {
$t1 = new PublicKeyToken();
$t2 = new PublicKeyToken();
$t1->setId(123);
@@ -368,7 +368,7 @@ class ManagerTest extends TestCase {
$this->manager->invalidateTokensOfUser('theUser', null);
}
- public function testInvalidateTokensOfUserClientNameGiven() {
+ public function testInvalidateTokensOfUserClientNameGiven(): void {
$t1 = new PublicKeyToken();
$t2 = new PublicKeyToken();
$t3 = new PublicKeyToken();
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
index 4b87f7101b5..7cc4e77ecb2 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenMapperTest.php
@@ -118,10 +118,10 @@ class PublicKeyTokenMapperTest extends TestCase {
->from('authtoken')
->execute()
->fetch();
- return (int) $result['count'];
+ return (int)$result['count'];
}
- public function testInvalidate() {
+ public function testInvalidate(): void {
$token = '9c5a2e661482b65597408a6bb6c4a3d1af36337381872ac56e445a06cdb7fea2b1039db707545c11027a4966919918b19d875a8b774840b18c6cbb7ae56fe206';
$this->mapper->invalidate($token);
@@ -129,7 +129,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(4, $this->getNumberOfTokens());
}
- public function testInvalidateInvalid() {
+ public function testInvalidateInvalid(): void {
$token = 'youwontfindthisoneinthedatabase';
$this->mapper->invalidate($token);
@@ -137,7 +137,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(5, $this->getNumberOfTokens());
}
- public function testInvalidateOld() {
+ public function testInvalidateOld(): void {
$olderThan = $this->time - 60 * 60; // One hour
$this->mapper->invalidateOld($olderThan);
@@ -145,7 +145,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(4, $this->getNumberOfTokens());
}
- public function testInvalidateLastUsedBefore() {
+ public function testInvalidateLastUsedBefore(): void {
$before = $this->time - 60 * 2; // Two minutes
$this->mapper->invalidateLastUsedBefore('user3', $before);
@@ -153,7 +153,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertSame(4, $this->getNumberOfTokens());
}
- public function testGetToken() {
+ public function testGetToken(): void {
$token = new PublicKeyToken();
$token->setUid('user2');
$token->setLoginName('User2');
@@ -177,7 +177,7 @@ class PublicKeyTokenMapperTest extends TestCase {
}
- public function testGetInvalidToken() {
+ public function testGetInvalidToken(): void {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$token = 'thisisaninvalidtokenthatisnotinthedatabase';
@@ -185,7 +185,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->mapper->getToken($token);
}
- public function testGetTokenById() {
+ public function testGetTokenById(): void {
$token = new PublicKeyToken();
$token->setUid('user2');
$token->setLoginName('User2');
@@ -209,14 +209,14 @@ class PublicKeyTokenMapperTest extends TestCase {
}
- public function testGetTokenByIdNotFound() {
+ public function testGetTokenByIdNotFound(): void {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$this->mapper->getTokenById(-1);
}
- public function testGetInvalidTokenById() {
+ public function testGetInvalidTokenById(): void {
$this->expectException(\OCP\AppFramework\Db\DoesNotExistException::class);
$id = '42';
@@ -224,15 +224,15 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->mapper->getToken($id);
}
- public function testGetTokenByUser() {
+ public function testGetTokenByUser(): void {
$this->assertCount(2, $this->mapper->getTokenByUser('user1'));
}
- public function testGetTokenByUserNotFound() {
+ public function testGetTokenByUserNotFound(): void {
$this->assertCount(0, $this->mapper->getTokenByUser('user1000'));
}
- public function testGetById() {
+ public function testGetById(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$qb = $this->dbConnection->getQueryBuilder();
@@ -246,7 +246,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals('user1', $token->getUID());
}
- public function testDeleteByName() {
+ public function testDeleteByName(): void {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('name')
->from('authtoken')
@@ -257,7 +257,7 @@ class PublicKeyTokenMapperTest extends TestCase {
$this->assertEquals(4, $this->getNumberOfTokens());
}
- public function testHasExpiredTokens() {
+ public function testHasExpiredTokens(): void {
$this->assertFalse($this->mapper->hasExpiredTokens('user1'));
$this->assertTrue($this->mapper->hasExpiredTokens('user3'));
}
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 3c81eade700..be90d60c64f 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -56,12 +56,6 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->hasher = \OC::$server->get(IHasher::class);
$this->crypto = \OC::$server->getCrypto();
$this->config = $this->createMock(IConfig::class);
- $this->config->method('getSystemValueInt')
- ->willReturnMap([
- ['session_lifetime', 60 * 60 * 24, 150],
- ['remember_login_cookie_lifetime', 60 * 60 * 24 * 15, 300],
- ['token_auth_activity_update', 60, 60],
- ]);
$this->config->method('getSystemValue')
->willReturnMap([
['openssl', [], []],
@@ -90,7 +84,7 @@ class PublicKeyTokenProviderTest extends TestCase {
);
}
- public function testGenerateToken() {
+ public function testGenerateToken(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -135,7 +129,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($actual, $token);
}
- public function testGenerateTokenLongPassword() {
+ public function testGenerateTokenLongPassword(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -154,7 +148,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$actual = $this->tokenProvider->generateToken($token, $uid, $user, $password, $name, $type, IToken::DO_NOT_REMEMBER);
}
- public function testGenerateTokenInvalidName() {
+ public function testGenerateTokenInvalidName(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -179,7 +173,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
}
- public function testUpdateToken() {
+ public function testUpdateToken(): void {
$tk = new PublicKeyToken();
$this->mapper->expects($this->once())
->method('updateActivity')
@@ -195,7 +189,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertEquals($this->time, $tk->getLastActivity());
}
- public function testUpdateTokenDebounce() {
+ public function testUpdateTokenDebounce(): void {
$tk = new PublicKeyToken();
$this->config->method('getSystemValueInt')
->willReturnCallback(function ($value, $default) {
@@ -210,7 +204,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->updateTokenActivity($tk);
}
- public function testGetTokenByUser() {
+ public function testGetTokenByUser(): void {
$this->mapper->expects($this->once())
->method('getTokenByUser')
->with('uid')
@@ -219,7 +213,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertEquals(['token'], $this->tokenProvider->getTokenByUser('uid'));
}
- public function testGetPassword() {
+ public function testGetPassword(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -237,7 +231,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
- public function testGetPasswordPasswordLessToken() {
+ public function testGetPasswordPasswordLessToken(): void {
$this->expectException(\OC\Authentication\Exceptions\PasswordlessTokenException::class);
$token = 'token1234';
@@ -248,7 +242,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
- public function testGetPasswordInvalidToken() {
+ public function testGetPasswordInvalidToken(): void {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
$token = 'tokentokentokentokentoken';
@@ -267,7 +261,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getPassword($actual, 'wrongtoken');
}
- public function testSetPassword() {
+ public function testSetPassword(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -299,7 +293,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
- public function testSetPasswordInvalidToken() {
+ public function testSetPasswordInvalidToken(): void {
$this->expectException(\OC\Authentication\Exceptions\InvalidTokenException::class);
$token = $this->createMock(IToken::class);
@@ -309,7 +303,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->setPassword($token, $tokenId, $password);
}
- public function testInvalidateToken() {
+ public function testInvalidateToken(): void {
$this->mapper->expects($this->exactly(2))
->method('invalidate')
->withConsecutive(
@@ -320,7 +314,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->invalidateToken('token7');
}
- public function testInvalidateTokenById() {
+ public function testInvalidateTokenById(): void {
$id = 123;
$this->mapper->expects($this->once())
@@ -330,26 +324,31 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->invalidateTokenById('uid', $id);
}
- public function testInvalidateOldTokens() {
+ public function testInvalidateOldTokens(): void {
$defaultSessionLifetime = 60 * 60 * 24;
$defaultRememberMeLifetime = 60 * 60 * 24 * 15;
- $this->config->expects($this->exactly(2))
+ $wipeTokenLifetime = 60 * 60 * 24 * 60;
+ $this->config->expects($this->exactly(4))
->method('getSystemValueInt')
->willReturnMap([
['session_lifetime', $defaultSessionLifetime, 150],
['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300],
+ ['token_auth_wipe_token_retention', $wipeTokenLifetime, 500],
+ ['token_auth_token_retention', 60 * 60 * 24 * 365, 800],
]);
- $this->mapper->expects($this->exactly(2))
+ $this->mapper->expects($this->exactly(4))
->method('invalidateOld')
->withConsecutive(
- [$this->time - 150],
- [$this->time - 300]
+ [$this->time - 150, IToken::TEMPORARY_TOKEN, IToken::DO_NOT_REMEMBER],
+ [$this->time - 300, IToken::TEMPORARY_TOKEN, IToken::REMEMBER],
+ [$this->time - 500, IToken::WIPE_TOKEN, null],
+ [$this->time - 800, IToken::PERMANENT_TOKEN, null],
);
$this->tokenProvider->invalidateOldTokens();
}
- public function testInvalidateLastUsedBefore() {
+ public function testInvalidateLastUsedBefore(): void {
$this->mapper->expects($this->once())
->method('invalidateLastUsedBefore')
->with('user', 946684800);
@@ -357,7 +356,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->invalidateLastUsedBefore('user', 946684800);
}
- public function testRenewSessionTokenWithoutPassword() {
+ public function testRenewSessionTokenWithoutPassword(): void {
$token = 'oldIdtokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -451,7 +450,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($token, $this->tokenProvider->getToken('unhashedTokentokentokentokentoken'));
}
- public function testGetInvalidToken() {
+ public function testGetInvalidToken(): void {
$this->expectException(InvalidTokenException::class);
$this->mapper->expects($this->exactly(2))
@@ -468,7 +467,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getToken('unhashedTokentokentokentokentoken');
}
- public function testGetExpiredToken() {
+ public function testGetExpiredToken(): void {
$token = 'tokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -494,7 +493,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
}
- public function testGetTokenById() {
+ public function testGetTokenById(): void {
$token = $this->createMock(PublicKeyToken::class);
$this->mapper->expects($this->once())
@@ -505,7 +504,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame($token, $this->tokenProvider->getTokenById(42));
}
- public function testGetInvalidTokenById() {
+ public function testGetInvalidTokenById(): void {
$this->expectException(InvalidTokenException::class);
$this->mapper->expects($this->once())
@@ -516,7 +515,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->getTokenById(42);
}
- public function testGetExpiredTokenById() {
+ public function testGetExpiredTokenById(): void {
$token = new PublicKeyToken();
$token->setExpires(42);
@@ -533,7 +532,7 @@ class PublicKeyTokenProviderTest extends TestCase {
}
}
- public function testRotate() {
+ public function testRotate(): void {
$token = 'oldtokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -552,7 +551,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertSame('password', $this->tokenProvider->getPassword($new, 'newtokentokentokentokentoken'));
}
- public function testRotateNoPassword() {
+ public function testRotateNoPassword(): void {
$token = 'oldtokentokentokentokentoken';
$uid = 'user';
$user = 'User';
@@ -572,7 +571,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->assertNull($new->getPassword());
}
- public function testMarkPasswordInvalidInvalidToken() {
+ public function testMarkPasswordInvalidInvalidToken(): void {
$token = $this->createMock(IToken::class);
$this->expectException(InvalidTokenException::class);
@@ -580,7 +579,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->markPasswordInvalid($token, 'tokenId');
}
- public function testMarkPasswordInvalid() {
+ public function testMarkPasswordInvalid(): void {
$token = $this->createMock(PublicKeyToken::class);
$token->expects($this->once())
@@ -593,7 +592,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->markPasswordInvalid($token, 'tokenId');
}
- public function testUpdatePasswords() {
+ public function testUpdatePasswords(): void {
$uid = 'myUID';
$token1 = $this->tokenProvider->generateToken(
'foobetokentokentokentoken',
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenTest.php b/tests/lib/Authentication/Token/PublicKeyTokenTest.php
index cc8890002e9..5f5f29c865f 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenTest.php
@@ -13,7 +13,7 @@ use OCP\Authentication\Token\IToken;
use Test\TestCase;
class PublicKeyTokenTest extends TestCase {
- public function testSetScopeAsArray() {
+ public function testSetScopeAsArray(): void {
$scope = [IToken::SCOPE_FILESYSTEM => false];
$token = new PublicKeyToken();
$token->setScope($scope);
@@ -21,7 +21,7 @@ class PublicKeyTokenTest extends TestCase {
$this->assertEquals($scope, $token->getScopeAsArray());
}
- public function testDefaultScope() {
+ public function testDefaultScope(): void {
$scope = [IToken::SCOPE_FILESYSTEM => true];
$token = new PublicKeyToken();
$this->assertEquals($scope, $token->getScopeAsArray());
diff --git a/tests/lib/Authentication/Token/RemoteWipeTest.php b/tests/lib/Authentication/Token/RemoteWipeTest.php
index 1c4a0f73d84..ca09767c759 100644
--- a/tests/lib/Authentication/Token/RemoteWipeTest.php
+++ b/tests/lib/Authentication/Token/RemoteWipeTest.php
@@ -106,7 +106,7 @@ class RemoteWipeTest extends TestCase {
$this->assertTrue($result);
}
- public function testStartWipingNotAWipeToken() {
+ public function testStartWipingNotAWipeToken(): void {
$token = $this->createMock(IToken::class);
$this->tokenProvider->expects($this->once())
->method('getToken')
@@ -120,7 +120,7 @@ class RemoteWipeTest extends TestCase {
$this->assertFalse($result);
}
- public function testStartWiping() {
+ public function testStartWiping(): void {
$token = $this->createMock(IToken::class);
$this->tokenProvider->expects($this->once())
->method('getToken')
@@ -137,7 +137,7 @@ class RemoteWipeTest extends TestCase {
$this->assertTrue($result);
}
- public function testFinishWipingNotAWipeToken() {
+ public function testFinishWipingNotAWipeToken(): void {
$token = $this->createMock(IToken::class);
$this->tokenProvider->expects($this->once())
->method('getToken')
diff --git a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
index 56acba46ef0..7a1ea64ca9a 100644
--- a/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDaoTest.php
@@ -35,7 +35,7 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->dao = new ProviderUserAssignmentDao($this->dbConn);
}
- public function testGetState() {
+ public function testGetState(): void {
$qb = $this->dbConn->getQueryBuilder();
$q1 = $qb->insert(ProviderUserAssignmentDao::TABLE_NAME)->values([
'provider_id' => $qb->createNamedParameter('twofactor_u2f'),
@@ -59,7 +59,7 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->assertEquals($expected, $state);
}
- public function testPersist() {
+ public function testPersist(): void {
$qb = $this->dbConn->getQueryBuilder();
$this->dao->persist('twofactor_totp', 'user123', 0);
@@ -76,7 +76,7 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->assertCount(1, $data);
}
- public function testPersistTwice() {
+ public function testPersistTwice(): void {
$qb = $this->dbConn->getQueryBuilder();
$this->dao->persist('twofactor_totp', 'user123', 0);
@@ -95,7 +95,7 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->assertCount(1, $data);
}
- public function testPersistSameStateTwice() {
+ public function testPersistSameStateTwice(): void {
$qb = $this->dbConn->getQueryBuilder();
$this->dao->persist('twofactor_totp', 'user123', 1);
@@ -114,7 +114,7 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->assertCount(1, $data);
}
- public function testDeleteByUser() {
+ public function testDeleteByUser(): void {
$this->dao->persist('twofactor_fail', 'user1', 1);
$this->dao->persist('twofactor_u2f', 'user1', 1);
$this->dao->persist('twofactor_fail', 'user2', 0);
@@ -143,7 +143,7 @@ class ProviderUserAssignmentDaoTest extends TestCase {
$this->assertCount(2, $statesUser2);
}
- public function testDeleteAll() {
+ public function testDeleteAll(): void {
$this->dao->persist('twofactor_fail', 'user1', 1);
$this->dao->persist('twofactor_u2f', 'user1', 1);
$this->dao->persist('twofactor_fail', 'user2', 0);
diff --git a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php
index bf09b3d8ca3..5323a36867a 100644
--- a/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/EnforcementStateTest.php
@@ -17,25 +17,25 @@ use OC\Authentication\TwoFactorAuth\EnforcementState;
use Test\TestCase;
class EnforcementStateTest extends TestCase {
- public function testIsEnforced() {
+ public function testIsEnforced(): void {
$state = new EnforcementState(true);
$this->assertTrue($state->isEnforced());
}
- public function testGetEnforcedGroups() {
+ public function testGetEnforcedGroups(): void {
$state = new EnforcementState(true, ['twofactorers']);
$this->assertEquals(['twofactorers'], $state->getEnforcedGroups());
}
- public function testGetExcludedGroups() {
+ public function testGetExcludedGroups(): void {
$state = new EnforcementState(true, [], ['yoloers']);
$this->assertEquals(['yoloers'], $state->getExcludedGroups());
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$state = new EnforcementState(true, ['twofactorers'], ['yoloers']);
$expected = [
'enforced' => true,
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index a89b07f7716..7701cb68302 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -135,7 +135,7 @@ class ManagerTest extends TestCase {
]);
}
- public function testIsTwoFactorAuthenticatedEnforced() {
+ public function testIsTwoFactorAuthenticatedEnforced(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('isEnforcedFor')
->with($this->user)
@@ -146,7 +146,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($enabled);
}
- public function testIsTwoFactorAuthenticatedNoProviders() {
+ public function testIsTwoFactorAuthenticatedNoProviders(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('isEnforcedFor')
->with($this->user)
@@ -161,7 +161,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->isTwoFactorAuthenticated($this->user));
}
- public function testIsTwoFactorAuthenticatedOnlyBackupCodes() {
+ public function testIsTwoFactorAuthenticatedOnlyBackupCodes(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('isEnforcedFor')
->with($this->user)
@@ -184,7 +184,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->isTwoFactorAuthenticated($this->user));
}
- public function testIsTwoFactorAuthenticatedFailingProviders() {
+ public function testIsTwoFactorAuthenticatedFailingProviders(): void {
$this->mandatoryTwoFactor->expects($this->once())
->method('isEnforcedFor')
->with($this->user)
@@ -219,7 +219,7 @@ class ManagerTest extends TestCase {
*
* @dataProvider providerStatesFixData
*/
- public function testIsTwoFactorAuthenticatedFixesProviderStates(bool $providerEnabled, bool $expected) {
+ public function testIsTwoFactorAuthenticatedFixesProviderStates(bool $providerEnabled, bool $expected): void {
$this->providerRegistry->expects($this->once())
->method('getProviderStates')
->willReturn([]); // Nothing registered yet
@@ -251,7 +251,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $this->manager->isTwoFactorAuthenticated($this->user));
}
- public function testGetProvider() {
+ public function testGetProvider(): void {
$this->providerRegistry->expects($this->once())
->method('getProviderStates')
->with($this->user)
@@ -268,7 +268,7 @@ class ManagerTest extends TestCase {
$this->assertSame($this->fakeProvider, $provider);
}
- public function testGetInvalidProvider() {
+ public function testGetInvalidProvider(): void {
$this->providerRegistry->expects($this->once())
->method('getProviderStates')
->with($this->user)
@@ -283,7 +283,7 @@ class ManagerTest extends TestCase {
$this->assertNull($provider);
}
- public function testGetLoginSetupProviders() {
+ public function testGetLoginSetupProviders(): void {
$provider1 = $this->createMock(IProvider::class);
$provider2 = $this->createMock(IActivatableAtLogin::class);
$this->providerLoader->expects($this->once())
@@ -300,7 +300,7 @@ class ManagerTest extends TestCase {
$this->assertSame($provider2, reset($providers));
}
- public function testGetProviders() {
+ public function testGetProviders(): void {
$this->providerRegistry->expects($this->once())
->method('getProviderStates')
->with($this->user)
@@ -322,7 +322,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($providerSet->isProviderMissing());
}
- public function testGetProvidersOneMissing() {
+ public function testGetProvidersOneMissing(): void {
$this->providerRegistry->expects($this->once())
->method('getProviderStates')
->with($this->user)
@@ -342,7 +342,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($providerSet->isProviderMissing());
}
- public function testVerifyChallenge() {
+ public function testVerifyChallenge(): void {
$this->prepareProviders();
$challenge = 'passme';
@@ -412,7 +412,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($result);
}
- public function testVerifyChallengeInvalidProviderId() {
+ public function testVerifyChallengeInvalidProviderId(): void {
$this->prepareProviders();
$challenge = 'passme';
@@ -425,7 +425,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->verifyChallenge('dontexist', $this->user, $challenge));
}
- public function testVerifyInvalidChallenge() {
+ public function testVerifyInvalidChallenge(): void {
$this->prepareProviders();
$challenge = 'dontpassme';
@@ -471,7 +471,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->verifyChallenge('email', $this->user, $challenge));
}
- public function testNeedsSecondFactor() {
+ public function testNeedsSecondFactor(): void {
$user = $this->createMock(IUser::class);
$this->session->expects($this->exactly(3))
->method('exists')
@@ -522,7 +522,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($manager->needsSecondFactor($user));
}
- public function testNeedsSecondFactorUserIsNull() {
+ public function testNeedsSecondFactorUserIsNull(): void {
$user = null;
$this->session->expects($this->never())
->method('exists');
@@ -530,7 +530,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->needsSecondFactor($user));
}
- public function testNeedsSecondFactorWithNoProviderAvailableAnymore() {
+ public function testNeedsSecondFactorWithNoProviderAvailableAnymore(): void {
$this->prepareNoProviders();
$user = null;
@@ -545,7 +545,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->needsSecondFactor($user));
}
- public function testPrepareTwoFactorLogin() {
+ public function testPrepareTwoFactorLogin(): void {
$this->user->method('getUID')
->willReturn('ferdinand');
@@ -575,7 +575,7 @@ class ManagerTest extends TestCase {
$this->manager->prepareTwoFactorLogin($this->user, true);
}
- public function testPrepareTwoFactorLoginDontRemember() {
+ public function testPrepareTwoFactorLoginDontRemember(): void {
$this->user->method('getUID')
->willReturn('ferdinand');
@@ -604,7 +604,7 @@ class ManagerTest extends TestCase {
$this->manager->prepareTwoFactorLogin($this->user, false);
}
- public function testNeedsSecondFactorSessionAuth() {
+ public function testNeedsSecondFactorSessionAuth(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('user');
@@ -639,7 +639,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->needsSecondFactor($user));
}
- public function testNeedsSecondFactorSessionAuthFailDBPass() {
+ public function testNeedsSecondFactorSessionAuthFailDBPass(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('user');
@@ -670,7 +670,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->needsSecondFactor($user));
}
- public function testNeedsSecondFactorInvalidToken() {
+ public function testNeedsSecondFactorInvalidToken(): void {
$this->prepareNoProviders();
$user = $this->createMock(IUser::class);
@@ -691,7 +691,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->needsSecondFactor($user));
}
- public function testNeedsSecondFactorAppPassword() {
+ public function testNeedsSecondFactorAppPassword(): void {
$user = $this->createMock(IUser::class);
$this->session->method('exists')
->willReturnMap([
diff --git a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php
index 1d6127fa928..d2ecd3c509c 100644
--- a/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/MandatoryTwoFactorTest.php
@@ -36,7 +36,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->mandatoryTwoFactor = new MandatoryTwoFactor($this->config, $this->groupManager);
}
- public function testIsNotEnforced() {
+ public function testIsNotEnforced(): void {
$this->config
->method('getSystemValue')
->willReturnMap([
@@ -50,7 +50,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->assertFalse($state->isEnforced());
}
- public function testIsEnforced() {
+ public function testIsEnforced(): void {
$this->config
->method('getSystemValue')
->willReturnMap([
@@ -64,7 +64,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->assertTrue($state->isEnforced());
}
- public function testIsNotEnforcedForAnybody() {
+ public function testIsNotEnforcedForAnybody(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('user123');
$this->config
@@ -80,7 +80,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->assertFalse($isEnforced);
}
- public function testIsEnforcedForAGroupMember() {
+ public function testIsEnforcedForAGroupMember(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('user123');
$this->config
@@ -100,7 +100,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->assertTrue($isEnforced);
}
- public function testIsEnforcedForOtherGroups() {
+ public function testIsEnforcedForOtherGroups(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('user123');
$this->config
@@ -118,7 +118,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->assertFalse($isEnforced);
}
- public function testIsEnforcedButMemberOfExcludedGroup() {
+ public function testIsEnforcedButMemberOfExcludedGroup(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')->willReturn('user123');
$this->config
@@ -138,7 +138,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->assertFalse($isEnforced);
}
- public function testSetEnforced() {
+ public function testSetEnforced(): void {
$this->config
->expects($this->exactly(3))
->method('setSystemValue')
@@ -151,7 +151,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->mandatoryTwoFactor->setState(new EnforcementState(true));
}
- public function testSetEnforcedForGroups() {
+ public function testSetEnforcedForGroups(): void {
$this->config
->expects($this->exactly(3))
->method('setSystemValue')
@@ -164,7 +164,7 @@ class MandatoryTwoFactorTest extends TestCase {
$this->mandatoryTwoFactor->setState(new EnforcementState(true, ['twofactorers'], ['yoloers']));
}
- public function testSetNotEnforced() {
+ public function testSetNotEnforced(): void {
$this->config
->expects($this->exactly(3))
->method('setSystemValue')
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
index bbbb8e8e55a..6eb3b7dfb26 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderLoaderTest.php
@@ -47,7 +47,7 @@ class ProviderLoaderTest extends TestCase {
}
- public function testFailHardIfProviderCanNotBeLoaded() {
+ public function testFailHardIfProviderCanNotBeLoaded(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Could not load two-factor auth provider \\OCA\\MyFaulty2faApp\\DoesNotExist');
@@ -69,7 +69,7 @@ class ProviderLoaderTest extends TestCase {
$this->loader->getProviders($this->user);
}
- public function testGetProviders() {
+ public function testGetProviders(): void {
$provider = $this->createMock(IProvider::class);
$provider->method('getId')->willReturn('test');
\OC::$server->registerService('\\OCA\\TwoFactorTest\\Provider', function () use ($provider) {
@@ -93,7 +93,7 @@ class ProviderLoaderTest extends TestCase {
$this->assertSame($provider, $providers['test']);
}
- public function testGetProvidersBootstrap() {
+ public function testGetProvidersBootstrap(): void {
$provider = $this->createMock(IProvider::class);
$provider->method('getId')->willReturn('test');
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php
index 0e8cf122080..34248f11f21 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderManagerTest.php
@@ -42,14 +42,14 @@ class ProviderManagerTest extends TestCase {
}
- public function testTryEnableInvalidProvider() {
+ public function testTryEnableInvalidProvider(): void {
$this->expectException(\OC\Authentication\Exceptions\InvalidProviderException::class);
$user = $this->createMock(IUser::class);
$this->providerManager->tryEnableProviderFor('none', $user);
}
- public function testTryEnableUnsupportedProvider() {
+ public function testTryEnableUnsupportedProvider(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
$this->providerLoader->expects($this->once())
@@ -66,7 +66,7 @@ class ProviderManagerTest extends TestCase {
$this->assertFalse($res);
}
- public function testTryEnableProvider() {
+ public function testTryEnableProvider(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IActivatableByAdmin::class);
$this->providerLoader->expects($this->once())
@@ -88,14 +88,14 @@ class ProviderManagerTest extends TestCase {
}
- public function testTryDisableInvalidProvider() {
+ public function testTryDisableInvalidProvider(): void {
$this->expectException(\OC\Authentication\Exceptions\InvalidProviderException::class);
$user = $this->createMock(IUser::class);
$this->providerManager->tryDisableProviderFor('none', $user);
}
- public function testTryDisableUnsupportedProvider() {
+ public function testTryDisableUnsupportedProvider(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
$this->providerLoader->expects($this->once())
@@ -112,7 +112,7 @@ class ProviderManagerTest extends TestCase {
$this->assertFalse($res);
}
- public function testTryDisableProvider() {
+ public function testTryDisableProvider(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IDeactivatableByAdmin::class);
$this->providerLoader->expects($this->once())
diff --git a/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php b/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php
index b6b9640cd9b..568b83567f8 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ProviderSetTest.php
@@ -18,7 +18,7 @@ class ProviderSetTest extends TestCase {
/** @var ProviderSet */
private $providerSet;
- public function testIndexesProviders() {
+ public function testIndexesProviders(): void {
$p1 = $this->createMock(IProvider::class);
$p1->method('getId')->willReturn('p1');
$p2 = $this->createMock(IProvider::class);
@@ -33,7 +33,7 @@ class ProviderSetTest extends TestCase {
$this->assertEquals($expected, $set->getProviders());
}
- public function testGet3rdPartyProviders() {
+ public function testGet3rdPartyProviders(): void {
$p1 = $this->createMock(IProvider::class);
$p1->method('getId')->willReturn('p1');
$p2 = $this->createMock(IProvider::class);
@@ -50,7 +50,7 @@ class ProviderSetTest extends TestCase {
$this->assertEquals($expected, $set->getPrimaryProviders());
}
- public function testGetProvider() {
+ public function testGetProvider(): void {
$p1 = $this->createMock(IProvider::class);
$p1->method('getId')->willReturn('p1');
@@ -60,14 +60,14 @@ class ProviderSetTest extends TestCase {
$this->assertEquals($p1, $provider);
}
- public function testGetProviderNotFound() {
+ public function testGetProviderNotFound(): void {
$set = new ProviderSet([], false);
$provider = $set->getProvider('p1');
$this->assertNull($provider);
}
- public function testIsProviderMissing() {
+ public function testIsProviderMissing(): void {
$set = new ProviderSet([], true);
$this->assertTrue($set->isProviderMissing());
diff --git a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
index 7485fe377ee..77e619d03a2 100644
--- a/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/RegistryTest.php
@@ -42,7 +42,7 @@ class RegistryTest extends TestCase {
$this->registry = new Registry($this->dao, $this->dispatcher);
}
- public function testGetProviderStates() {
+ public function testGetProviderStates(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->once())->method('getUID')->willReturn('user123');
$state = [
@@ -55,7 +55,7 @@ class RegistryTest extends TestCase {
$this->assertEquals($state, $actual);
}
- public function testEnableProvider() {
+ public function testEnableProvider(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
$user->expects($this->once())->method('getUID')->willReturn('user123');
@@ -81,7 +81,7 @@ class RegistryTest extends TestCase {
$this->registry->enableProviderFor($provider, $user);
}
- public function testDisableProvider() {
+ public function testDisableProvider(): void {
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
$user->expects($this->once())->method('getUID')->willReturn('user123');
@@ -108,7 +108,7 @@ class RegistryTest extends TestCase {
$this->registry->disableProviderFor($provider, $user);
}
- public function testDeleteUserData() {
+ public function testDeleteUserData(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->once())->method('getUID')->willReturn('user123');
$this->dao->expects($this->once())
@@ -129,7 +129,7 @@ class RegistryTest extends TestCase {
$this->registry->deleteUserData($user);
}
- public function testCleanUp() {
+ public function testCleanUp(): void {
$this->dao->expects($this->once())
->method('deleteAll')
->with('twofactor_u2f');
diff --git a/tests/lib/AutoLoaderTest.php b/tests/lib/AutoLoaderTest.php
index 22d66c6c4aa..2aa8bc2a26a 100644
--- a/tests/lib/AutoLoaderTest.php
+++ b/tests/lib/AutoLoaderTest.php
@@ -18,40 +18,40 @@ class AutoLoaderTest extends TestCase {
$this->loader = new \OC\AutoLoader([]);
}
- public function testLegacyPath() {
+ public function testLegacyPath(): void {
$this->assertEquals([
\OC::$SERVERROOT . '/lib/private/legacy/files.php',
], $this->loader->findClass('OC_Files'));
}
- public function testLoadTestTestCase() {
+ public function testLoadTestTestCase(): void {
$this->assertEquals([
\OC::$SERVERROOT . '/tests/lib/TestCase.php'
], $this->loader->findClass('Test\TestCase'));
}
- public function testLoadCore() {
+ public function testLoadCore(): void {
$this->assertEquals([
\OC::$SERVERROOT . '/lib/private/legacy/foo/bar.php',
], $this->loader->findClass('OC_Foo_Bar'));
}
- public function testLoadPublicNamespace() {
+ public function testLoadPublicNamespace(): void {
$this->assertEquals([], $this->loader->findClass('OCP\Foo\Bar'));
}
- public function testLoadAppNamespace() {
+ public function testLoadAppNamespace(): void {
$result = $this->loader->findClass('OCA\Files\Foobar');
$this->assertEquals(2, count($result));
$this->assertStringEndsWith('apps/files/foobar.php', $result[0]);
$this->assertStringEndsWith('apps/files/lib/foobar.php', $result[1]);
}
- public function testLoadCoreNamespaceCore() {
+ public function testLoadCoreNamespaceCore(): void {
$this->assertEquals([], $this->loader->findClass('OC\Core\Foo\Bar'));
}
- public function testLoadCoreNamespaceSettings() {
+ public function testLoadCoreNamespaceSettings(): void {
$this->assertEquals([], $this->loader->findClass('OC\Settings\Foo\Bar'));
}
}
diff --git a/tests/lib/Avatar/AvatarManagerTest.php b/tests/lib/Avatar/AvatarManagerTest.php
index 16754f7125c..25e8e1563f5 100644
--- a/tests/lib/Avatar/AvatarManagerTest.php
+++ b/tests/lib/Avatar/AvatarManagerTest.php
@@ -71,7 +71,7 @@ class AvatarManagerTest extends \Test\TestCase {
);
}
- public function testGetAvatarInvalidUser() {
+ public function testGetAvatarInvalidUser(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('user does not exist');
@@ -84,7 +84,7 @@ class AvatarManagerTest extends \Test\TestCase {
$this->avatarManager->getAvatar('invalidUser');
}
- public function testGetAvatarForSelf() {
+ public function testGetAvatarForSelf(): void {
$user = $this->createMock(User::class);
$user
->expects($this->any())
@@ -124,9 +124,9 @@ class AvatarManagerTest extends \Test\TestCase {
->willReturn(IAccountManager::SCOPE_PRIVATE);
$this->knownUserService->expects($this->any())
- ->method('isKnownToUser')
- ->with('valid-user', 'valid-user')
- ->willReturn(true);
+ ->method('isKnownToUser')
+ ->with('valid-user', 'valid-user')
+ ->willReturn(true);
$folder = $this->createMock(ISimpleFolder::class);
$this->appData
@@ -139,7 +139,7 @@ class AvatarManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $this->avatarManager->getAvatar('valid-user'));
}
- public function testGetAvatarValidUserDifferentCasing() {
+ public function testGetAvatarValidUserDifferentCasing(): void {
$user = $this->createMock(User::class);
$this->userManager->expects($this->once())
->method('get')
@@ -206,7 +206,7 @@ class AvatarManagerTest extends \Test\TestCase {
/**
* @dataProvider dataGetAvatarScopes
*/
- public function testGetAvatarScopes($avatarScope, $isPublicCall, $isKnownUser, $expectedPlaceholder) {
+ public function testGetAvatarScopes($avatarScope, $isPublicCall, $isKnownUser, $expectedPlaceholder): void {
if ($isPublicCall) {
$requestingUser = null;
} else {
@@ -261,12 +261,12 @@ class AvatarManagerTest extends \Test\TestCase {
if (!$isPublicCall) {
$this->knownUserService->expects($this->any())
- ->method('isKnownToUser')
- ->with('requesting-user', 'valid-user')
- ->willReturn($isKnownUser);
+ ->method('isKnownToUser')
+ ->with('requesting-user', 'valid-user')
+ ->willReturn($isKnownUser);
} else {
$this->knownUserService->expects($this->never())
- ->method('isKnownToUser');
+ ->method('isKnownToUser');
}
if ($expectedPlaceholder) {
diff --git a/tests/lib/Avatar/GuestAvatarTest.php b/tests/lib/Avatar/GuestAvatarTest.php
index e71cabaa624..8188684b51f 100644
--- a/tests/lib/Avatar/GuestAvatarTest.php
+++ b/tests/lib/Avatar/GuestAvatarTest.php
@@ -44,7 +44,7 @@ class GuestAvatarTest extends TestCase {
* For the test a static name "einstein" is used and
* the generated image is compared with an expected one.
*/
- public function testGet() {
+ public function testGet(): void {
$this->markTestSkipped('TODO: Disable because fails on drone');
$avatar = $this->guestAvatar->getFile(32);
self::assertInstanceOf(InMemoryFile::class, $avatar);
@@ -59,7 +59,7 @@ class GuestAvatarTest extends TestCase {
*
* @return void
*/
- public function testIsCustomAvatar() {
+ public function testIsCustomAvatar(): void {
self::assertFalse($this->guestAvatar->isCustomAvatar());
}
}
diff --git a/tests/lib/Avatar/UserAvatarTest.php b/tests/lib/Avatar/UserAvatarTest.php
index 2687972b8f6..0e2bfe6872f 100644
--- a/tests/lib/Avatar/UserAvatarTest.php
+++ b/tests/lib/Avatar/UserAvatarTest.php
@@ -14,6 +14,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\IConfig;
use OCP\IL10N;
+use OCP\Image;
use Psr\Log\LoggerInterface;
class UserAvatarTest extends \Test\TestCase {
@@ -49,7 +50,7 @@ class UserAvatarTest extends \Test\TestCase {
];
}
- public function testGetNoAvatar() {
+ public function testGetNoAvatar(): void {
$file = $this->createMock(ISimpleFile::class);
$this->folder->method('newFile')
->willReturn($file);
@@ -84,7 +85,7 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertTrue($result->valid());
}
- public function testGetAvatarSizeMatch() {
+ public function testGetAvatarSizeMatch(): void {
$this->folder->method('fileExists')
->willReturnMap([
['avatar.jpg', true],
@@ -92,7 +93,7 @@ class UserAvatarTest extends \Test\TestCase {
['generated', false],
]);
- $expected = new \OC_Image();
+ $expected = new Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$file = $this->createMock(ISimpleFile::class);
@@ -102,14 +103,14 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertEquals($expected->data(), $this->avatar->get(128)->data());
}
- public function testGetAvatarSizeMinusOne() {
+ public function testGetAvatarSizeMinusOne(): void {
$this->folder->method('fileExists')
->willReturnMap([
['avatar.jpg', true],
['generated', false],
]);
- $expected = new \OC_Image();
+ $expected = new Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$file = $this->createMock(ISimpleFile::class);
@@ -119,7 +120,7 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertEquals($expected->data(), $this->avatar->get(-1)->data());
}
- public function testGetAvatarNoSizeMatch() {
+ public function testGetAvatarNoSizeMatch(): void {
$this->folder->method('fileExists')
->willReturnMap([
['avatar.jpg', false],
@@ -128,9 +129,9 @@ class UserAvatarTest extends \Test\TestCase {
['generated', false],
]);
- $expected = new \OC_Image();
+ $expected = new Image();
$expected->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
- $expected2 = new \OC_Image();
+ $expected2 = new Image();
$expected2->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$expected2->resize(32);
@@ -163,11 +164,11 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertEquals($expected2->data(), $this->avatar->get(32)->data());
}
- public function testExistsNo() {
+ public function testExistsNo(): void {
$this->assertFalse($this->avatar->exists());
}
- public function testExiststJPG() {
+ public function testExiststJPG(): void {
$this->folder->method('fileExists')
->willReturnMap([
['avatar.jpg', true],
@@ -176,7 +177,7 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertTrue($this->avatar->exists());
}
- public function testExistsPNG() {
+ public function testExistsPNG(): void {
$this->folder->method('fileExists')
->willReturnMap([
['avatar.jpg', false],
@@ -185,7 +186,7 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertTrue($this->avatar->exists());
}
- public function testSetAvatar() {
+ public function testSetAvatar(): void {
$avatarFileJPG = $this->createMock(File::class);
$avatarFileJPG->method('getName')
->willReturn('avatar.jpg');
@@ -215,7 +216,7 @@ class UserAvatarTest extends \Test\TestCase {
->with('avatar.png')
->willReturn($newFile);
- $image = new \OC_Image();
+ $image = new Image();
$image->loadFromFile(\OC::$SERVERROOT . '/tests/data/testavatar.png');
$newFile->expects($this->once())
->method('putContent')
@@ -231,7 +232,7 @@ class UserAvatarTest extends \Test\TestCase {
$this->avatar->set($image->data());
}
- public function testGenerateSvgAvatar() {
+ public function testGenerateSvgAvatar(): void {
$avatar = $this->invokePrivate($this->avatar, 'getAvatarVector', [64, false]);
$svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
@@ -246,7 +247,7 @@ class UserAvatarTest extends \Test\TestCase {
/**
* @dataProvider avatarTextData
*/
- public function testGetAvatarText($displayName, $expectedAvatarText) {
+ public function testGetAvatarText($displayName, $expectedAvatarText): void {
$user = $this->getUserWithDisplayName($displayName);
$avatar = $this->getUserAvatar($user);
@@ -254,12 +255,12 @@ class UserAvatarTest extends \Test\TestCase {
$this->assertEquals($expectedAvatarText, $avatarText);
}
- public function testHashToInt() {
+ public function testHashToInt(): void {
$hashToInt = $this->invokePrivate($this->avatar, 'hashToInt', ['abcdef', 18]);
$this->assertTrue(gettype($hashToInt) === 'integer');
}
- public function testMixPalette() {
+ public function testMixPalette(): void {
$colorFrom = new \OCP\Color(0, 0, 0);
$colorTo = new \OCP\Color(6, 12, 18);
$steps = 6;
diff --git a/tests/lib/BackgroundJob/JobListTest.php b/tests/lib/BackgroundJob/JobListTest.php
index 510d307eda8..a9d7df0e6f4 100644
--- a/tests/lib/BackgroundJob/JobListTest.php
+++ b/tests/lib/BackgroundJob/JobListTest.php
@@ -87,7 +87,7 @@ class JobListTest extends TestCase {
* @dataProvider argumentProvider
* @param $argument
*/
- public function testAddRemove($argument) {
+ public function testAddRemove($argument): void {
$existingJobs = $this->getAllSorted();
$job = new TestJob();
$this->instance->add($job, $argument);
@@ -109,7 +109,7 @@ class JobListTest extends TestCase {
* @dataProvider argumentProvider
* @param $argument
*/
- public function testRemoveDifferentArgument($argument) {
+ public function testRemoveDifferentArgument($argument): void {
$existingJobs = $this->getAllSorted();
$job = new TestJob();
$this->instance->add($job, $argument);
@@ -130,7 +130,7 @@ class JobListTest extends TestCase {
* @dataProvider argumentProvider
* @param $argument
*/
- public function testHas($argument) {
+ public function testHas($argument): void {
$job = new TestJob();
$this->assertFalse($this->instance->has($job, $argument));
$this->instance->add($job, $argument);
@@ -146,7 +146,7 @@ class JobListTest extends TestCase {
* @dataProvider argumentProvider
* @param $argument
*/
- public function testHasDifferentArgument($argument) {
+ public function testHasDifferentArgument($argument): void {
$job = new TestJob();
$this->instance->add($job, $argument);
@@ -170,7 +170,7 @@ class JobListTest extends TestCase {
$query->execute();
}
- public function testGetNext() {
+ public function testGetNext(): void {
$job = new TestJob();
$this->createTempJob(get_class($job), 1, 0, 12345);
$this->createTempJob(get_class($job), 2, 0, 12346);
@@ -186,7 +186,7 @@ class JobListTest extends TestCase {
$this->assertEquals($savedJob1, $nextJob);
}
- public function testGetNextSkipReserved() {
+ public function testGetNextSkipReserved(): void {
$job = new TestJob();
$this->createTempJob(get_class($job), 1, 123456789, 12345);
$this->createTempJob(get_class($job), 2, 0, 12346);
@@ -200,7 +200,7 @@ class JobListTest extends TestCase {
$this->assertEquals(2, $nextJob->getArgument());
}
- public function testGetNextSkipNonExisting() {
+ public function testGetNextSkipNonExisting(): void {
$job = new TestJob();
$this->createTempJob('\OC\Non\Existing\Class', 1, 0, 12345);
$this->createTempJob(get_class($job), 2, 0, 12346);
@@ -218,7 +218,7 @@ class JobListTest extends TestCase {
* @dataProvider argumentProvider
* @param $argument
*/
- public function testGetById($argument) {
+ public function testGetById($argument): void {
$job = new TestJob();
$this->instance->add($job, $argument);
@@ -229,7 +229,7 @@ class JobListTest extends TestCase {
$this->assertEquals($addedJob, $this->instance->getById($addedJob->getId()));
}
- public function testSetLastRun() {
+ public function testSetLastRun(): void {
$job = new TestJob();
$this->instance->add($job);
@@ -247,7 +247,7 @@ class JobListTest extends TestCase {
$this->assertLessThanOrEqual($timeEnd, $addedJob->getLastRun());
}
- public function testHasReservedJobs() {
+ public function testHasReservedJobs(): void {
$this->clearJobsList();
$this->timeFactory->expects($this->atLeastOnce())
@@ -278,7 +278,7 @@ class JobListTest extends TestCase {
$this->assertTrue($this->instance->hasReservedJob(TestJob::class));
}
- public function testHasReservedJobsAndParallelAwareJob() {
+ public function testHasReservedJobsAndParallelAwareJob(): void {
$this->clearJobsList();
$this->timeFactory->expects($this->atLeastOnce())
diff --git a/tests/lib/BackgroundJob/JobTest.php b/tests/lib/BackgroundJob/JobTest.php
index fa89a06c8f5..9024742f432 100644
--- a/tests/lib/BackgroundJob/JobTest.php
+++ b/tests/lib/BackgroundJob/JobTest.php
@@ -24,7 +24,7 @@ class JobTest extends \Test\TestCase {
\OC::$server->registerService(LoggerInterface::class, fn ($c) => $this->logger);
}
- public function testRemoveAfterException() {
+ public function testRemoveAfterException(): void {
$jobList = new DummyJobList();
$e = new \Exception();
$job = new TestJob($this->timeFactory, $this, function () use ($e) {
@@ -41,7 +41,7 @@ class JobTest extends \Test\TestCase {
$this->assertCount(1, $jobList->getAll());
}
- public function testRemoveAfterError() {
+ public function testRemoveAfterError(): void {
$jobList = new DummyJobList();
$job = new TestJob($this->timeFactory, $this, function () {
$test = null;
diff --git a/tests/lib/BackgroundJob/QueuedJobTest.php b/tests/lib/BackgroundJob/QueuedJobTest.php
index ab4bacb201e..893f476bb5f 100644
--- a/tests/lib/BackgroundJob/QueuedJobTest.php
+++ b/tests/lib/BackgroundJob/QueuedJobTest.php
@@ -27,7 +27,7 @@ class QueuedJobTest extends \Test\TestCase {
$this->jobList = new DummyJobList();
}
- public function testJobShouldBeRemovedNew() {
+ public function testJobShouldBeRemovedNew(): void {
$job = new TestQueuedJobNew(\OCP\Server::get(ITimeFactory::class));
$job->setId(42);
$this->jobList->add($job);
diff --git a/tests/lib/BackgroundJob/TimedJobTest.php b/tests/lib/BackgroundJob/TimedJobTest.php
index 0ae245d1ff8..ad0f54ebe4a 100644
--- a/tests/lib/BackgroundJob/TimedJobTest.php
+++ b/tests/lib/BackgroundJob/TimedJobTest.php
@@ -34,7 +34,7 @@ class TimedJobTest extends \Test\TestCase {
$this->time = \OCP\Server::get(ITimeFactory::class);
}
- public function testShouldRunAfterIntervalNew() {
+ public function testShouldRunAfterIntervalNew(): void {
$job = new TestTimedJobNew($this->time);
$job->setId(42);
$this->jobList->add($job);
@@ -44,7 +44,7 @@ class TimedJobTest extends \Test\TestCase {
$this->assertTrue($job->ran);
}
- public function testShouldNotRunWithinIntervalNew() {
+ public function testShouldNotRunWithinIntervalNew(): void {
$job = new TestTimedJobNew($this->time);
$job->setId(42);
$this->jobList->add($job);
@@ -54,7 +54,7 @@ class TimedJobTest extends \Test\TestCase {
$this->assertFalse($job->ran);
}
- public function testShouldNotTwiceNew() {
+ public function testShouldNotTwiceNew(): void {
$job = new TestTimedJobNew($this->time);
$job->setId(42);
$this->jobList->add($job);
diff --git a/tests/lib/Cache/CappedMemoryCacheTest.php b/tests/lib/Cache/CappedMemoryCacheTest.php
index 6d1c7e6e372..f2ed1a5ee0d 100644
--- a/tests/lib/Cache/CappedMemoryCacheTest.php
+++ b/tests/lib/Cache/CappedMemoryCacheTest.php
@@ -18,7 +18,7 @@ class CappedMemoryCacheTest extends TestCache {
$this->instance = new \OCP\Cache\CappedMemoryCache();
}
- public function testSetOverCap() {
+ public function testSetOverCap(): void {
$instance = new \OCP\Cache\CappedMemoryCache(3);
$instance->set('1', 'a');
@@ -34,7 +34,7 @@ class CappedMemoryCacheTest extends TestCache {
$this->assertTrue($instance->hasKey('5'));
}
- public function testClear() {
+ public function testClear(): void {
$value = 'ipsum lorum';
$this->instance->set('1_value1', $value);
$this->instance->set('1_value2', $value);
@@ -48,7 +48,7 @@ class CappedMemoryCacheTest extends TestCache {
$this->assertFalse($this->instance->hasKey('3_value1'));
}
- public function testIndirectSet() {
+ public function testIndirectSet(): void {
$this->instance->set('array', []);
$this->instance['array'][] = 'foo';
diff --git a/tests/lib/Cache/FileCacheTest.php b/tests/lib/Cache/FileCacheTest.php
index ef738eaaacf..1d12147af0d 100644
--- a/tests/lib/Cache/FileCacheTest.php
+++ b/tests/lib/Cache/FileCacheTest.php
@@ -97,7 +97,7 @@ class FileCacheTest extends TestCache {
return $mockStorage;
}
- public function testGarbageCollectOldKeys() {
+ public function testGarbageCollectOldKeys(): void {
$mockStorage = $this->setupMockStorage();
$mockStorage->expects($this->atLeastOnce())
@@ -112,7 +112,7 @@ class FileCacheTest extends TestCache {
$this->instance->gc();
}
- public function testGarbageCollectLeaveRecentKeys() {
+ public function testGarbageCollectLeaveRecentKeys(): void {
$mockStorage = $this->setupMockStorage();
$mockStorage->expects($this->atLeastOnce())
@@ -135,7 +135,7 @@ class FileCacheTest extends TestCache {
/**
* @dataProvider lockExceptionProvider
*/
- public function testGarbageCollectIgnoreLockedKeys($testException) {
+ public function testGarbageCollectIgnoreLockedKeys($testException): void {
$mockStorage = $this->setupMockStorage();
$mockStorage->expects($this->atLeastOnce())
diff --git a/tests/lib/Cache/TestCache.php b/tests/lib/Cache/TestCache.php
index 1ed52ad5170..3245cd90a38 100644
--- a/tests/lib/Cache/TestCache.php
+++ b/tests/lib/Cache/TestCache.php
@@ -21,7 +21,7 @@ abstract class TestCache extends \Test\TestCase {
parent::tearDown();
}
- public function testSimple() {
+ public function testSimple(): void {
$this->assertNull($this->instance->get('value1'));
$this->assertFalse($this->instance->hasKey('value1'));
@@ -50,7 +50,7 @@ abstract class TestCache extends \Test\TestCase {
$this->assertFalse($this->instance->hasKey('value1'));
}
- public function testClear() {
+ public function testClear(): void {
$value = 'ipsum lorum';
$this->instance->set('1_value1', $value . '1');
$this->instance->set('1_value2', $value . '2');
diff --git a/tests/lib/Calendar/ManagerTest.php b/tests/lib/Calendar/ManagerTest.php
index db98dfa1aed..3d1a46d3f2a 100644
--- a/tests/lib/Calendar/ManagerTest.php
+++ b/tests/lib/Calendar/ManagerTest.php
@@ -38,7 +38,7 @@ class ManagerTest extends TestCase {
/** @var Manager */
private $manager;
- /** @var ITimeFactory|ITimeFactory&MockObject|MockObject */
+ /** @var ITimeFactory|ITimeFactory&MockObject|MockObject */
private $time;
protected function setUp(): void {
@@ -60,7 +60,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider searchProvider
*/
- public function testSearch($search1, $search2, $expected) {
+ public function testSearch($search1, $search2, $expected): void {
/** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('simple:1');
@@ -87,7 +87,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider searchProvider
*/
- public function testSearchOptions($search1, $search2, $expected) {
+ public function testSearchOptions($search1, $search2, $expected): void {
/** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('simple:1');
@@ -168,7 +168,7 @@ class ManagerTest extends TestCase {
];
}
- public function testRegisterUnregister() {
+ public function testRegisterUnregister(): void {
/** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('key1');
@@ -192,7 +192,7 @@ class ManagerTest extends TestCase {
$this->assertContains($calendar2, $result);
}
- public function testGetCalendars() {
+ public function testGetCalendars(): void {
/** @var ICalendar | MockObject $calendar1 */
$calendar1 = $this->createMock(ICalendar::class);
$calendar1->method('getKey')->willReturn('key1');
@@ -216,12 +216,12 @@ class ManagerTest extends TestCase {
$this->assertCount(0, $result);
}
- public function testEnabledIfNot() {
+ public function testEnabledIfNot(): void {
$isEnabled = $this->manager->isEnabled();
$this->assertFalse($isEnabled);
}
- public function testIfEnabledIfSo() {
+ public function testIfEnabledIfSo(): void {
/** @var ICalendar | MockObject $calendar */
$calendar = $this->createMock(ICalendar::class);
$this->manager->registerCalendar($calendar);
diff --git a/tests/lib/CapabilitiesManagerTest.php b/tests/lib/CapabilitiesManagerTest.php
index 14b83e3dda3..23909a91c5a 100644
--- a/tests/lib/CapabilitiesManagerTest.php
+++ b/tests/lib/CapabilitiesManagerTest.php
@@ -29,7 +29,7 @@ class CapabilitiesManagerTest extends TestCase {
/**
* Test no capabilities
*/
- public function testNoCapabilities() {
+ public function testNoCapabilities(): void {
$res = $this->manager->getCapabilities();
$this->assertEmpty($res);
}
@@ -37,7 +37,7 @@ class CapabilitiesManagerTest extends TestCase {
/**
* Test a valid capabilitie
*/
- public function testValidCapability() {
+ public function testValidCapability(): void {
$this->manager->registerCapability(function () {
return new SimpleCapability();
});
@@ -49,7 +49,7 @@ class CapabilitiesManagerTest extends TestCase {
/**
* Test a public capabilitie
*/
- public function testPublicCapability() {
+ public function testPublicCapability(): void {
$this->manager->registerCapability(function () {
return new PublicSimpleCapability1();
});
@@ -67,7 +67,7 @@ class CapabilitiesManagerTest extends TestCase {
/**
* Test that we need something that implents ICapability
*/
- public function testNoICapability() {
+ public function testNoICapability(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('The given Capability (Test\\NoCapability) does not implement the ICapability interface');
@@ -82,7 +82,7 @@ class CapabilitiesManagerTest extends TestCase {
/**
* Test a bunch of merged Capabilities
*/
- public function testMergedCapabilities() {
+ public function testMergedCapabilities(): void {
$this->manager->registerCapability(function () {
return new SimpleCapability();
});
@@ -108,7 +108,7 @@ class CapabilitiesManagerTest extends TestCase {
/**
* Test deep identical capabilities
*/
- public function testDeepIdenticalCapabilities() {
+ public function testDeepIdenticalCapabilities(): void {
$this->manager->registerCapability(function () {
return new DeepCapability();
});
@@ -128,7 +128,7 @@ class CapabilitiesManagerTest extends TestCase {
$this->assertEquals($expected, $res);
}
- public function testInvalidCapability() {
+ public function testInvalidCapability(): void {
$this->manager->registerCapability(function () {
throw new QueryException();
});
diff --git a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
index fa491661f5f..e52ae95bf34 100644
--- a/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/GroupPluginTest.php
@@ -18,19 +18,19 @@ use OCP\Share\IShare;
use Test\TestCase;
class GroupPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $session;
- /** @var ISearchResult */
+ /** @var ISearchResult */
protected $searchResult;
- /** @var GroupPlugin */
+ /** @var GroupPlugin */
protected $plugin;
/** @var int */
@@ -39,7 +39,7 @@ class GroupPluginTest extends TestCase {
/** @var int */
protected $offset = 0;
- /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */
protected $user;
protected function setUp(): void {
@@ -441,7 +441,7 @@ class GroupPluginTest extends TestCase {
array $expected,
bool $reachedEnd,
$singleGroup
- ) {
+ ): void {
$this->config->expects($this->any())
->method('getAppValue')
->willReturnCallback(
diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
index 5b15bca5c18..b54ca3ee4c3 100644
--- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
@@ -24,15 +24,15 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class LookupPluginTest extends TestCase {
- /** @var IConfig|MockObject */
+ /** @var IConfig|MockObject */
protected $config;
- /** @var IClientService|MockObject */
+ /** @var IClientService|MockObject */
protected $clientService;
/** @var IUserSession|MockObject */
protected $userSession;
/** @var ICloudIdManager|MockObject */
protected $cloudIdManager;
- /** @var LookupPlugin */
+ /** @var LookupPlugin */
protected $plugin;
/** @var LoggerInterface|MockObject */
protected $logger;
@@ -69,7 +69,7 @@ class LookupPluginTest extends TestCase {
);
}
- public function testSearchNoLookupServerURI() {
+ public function testSearchNoLookupServerURI(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('files_sharing', 'lookupServerEnabled', 'yes')
@@ -98,7 +98,7 @@ class LookupPluginTest extends TestCase {
$this->plugin->search('foobar', 10, 0, $searchResult);
}
- public function testSearchNoInternet() {
+ public function testSearchNoInternet(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('files_sharing', 'lookupServerEnabled', 'yes')
@@ -126,7 +126,7 @@ class LookupPluginTest extends TestCase {
* @dataProvider searchDataProvider
* @param array $searchParams
*/
- public function testSearch(array $searchParams) {
+ public function testSearch(array $searchParams): void {
$type = new SearchResultType('lookup');
/** @var ISearchResult|MockObject $searchResult */
@@ -189,7 +189,7 @@ class LookupPluginTest extends TestCase {
* @param bool $GSEnabled
* @param bool $LookupEnabled
*/
- public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled) {
+ public function testSearchEnableDisableLookupServer(array $searchParams, $GSEnabled, $LookupEnabled): void {
$type = new SearchResultType('lookup');
/** @var ISearchResult|MockObject $searchResult */
@@ -258,7 +258,7 @@ class LookupPluginTest extends TestCase {
}
- public function testSearchLookupServerDisabled() {
+ public function testSearchLookupServerDisabled(): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('files_sharing', 'lookupServerEnabled', 'yes')
diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
index 9a31800ccbe..568325fd30c 100644
--- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php
@@ -26,28 +26,28 @@ use OCP\Share\IShare;
use Test\TestCase;
class MailPluginTest extends TestCase {
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
protected $contactsManager;
- /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
protected $cloudIdManager;
- /** @var MailPlugin */
+ /** @var MailPlugin */
protected $plugin;
- /** @var SearchResult */
+ /** @var SearchResult */
protected $searchResult;
- /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IGroupManager|\PHPUnit\Framework\MockObject\MockObject */
protected $groupManager;
- /** @var KnownUserService|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var KnownUserService|\PHPUnit\Framework\MockObject\MockObject */
protected $knownUserService;
- /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IUserSession|\PHPUnit\Framework\MockObject\MockObject */
protected $userSession;
/** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */
@@ -94,7 +94,7 @@ class MailPluginTest extends TestCase {
* @param array $expected
* @param bool $reachedEnd
*/
- public function testSearch($searchTerm, $contacts, $shareeEnumeration, $expected, $exactIdMatch, $reachedEnd, $validEmail) {
+ public function testSearch($searchTerm, $contacts, $shareeEnumeration, $expected, $exactIdMatch, $reachedEnd, $validEmail): void {
$this->config->expects($this->any())
->method('getAppValue')
->willReturnCallback(
@@ -577,7 +577,7 @@ class MailPluginTest extends TestCase {
* @param bool $reachedEnd
* @param array groups
*/
- public function testSearchGroupsOnly($searchTerm, $contacts, $expected, $exactIdMatch, $reachedEnd, $userToGroupMapping, $validEmail) {
+ public function testSearchGroupsOnly($searchTerm, $contacts, $expected, $exactIdMatch, $reachedEnd, $userToGroupMapping, $validEmail): void {
$this->config->expects($this->any())
->method('getAppValue')
->willReturnCallback(
@@ -654,8 +654,8 @@ class MailPluginTest extends TestCase {
false,
false,
[
- "currentUser" => ["group1"],
- "User" => ["group1"]
+ 'currentUser' => ['group1'],
+ 'User' => ['group1']
],
false,
],
@@ -675,8 +675,8 @@ class MailPluginTest extends TestCase {
false,
false,
[
- "currentUser" => ["group1"],
- "User" => ["group2"]
+ 'currentUser' => ['group1'],
+ 'User' => ['group2']
],
false,
],
@@ -696,8 +696,8 @@ class MailPluginTest extends TestCase {
false,
false,
[
- "currentUser" => ["group1"],
- "User" => ["group2"]
+ 'currentUser' => ['group1'],
+ 'User' => ['group2']
],
true,
]
diff --git a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
index 73116ecad68..14894aa2df6 100644
--- a/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/RemotePluginTest.php
@@ -26,19 +26,19 @@ class RemotePluginTest extends TestCase {
/** @var IUserManager|\PHPUnit\Framework\MockObject\MockObject */
protected $userManager;
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
protected $config;
- /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IManager|\PHPUnit\Framework\MockObject\MockObject */
protected $contactsManager;
- /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var ICloudIdManager|\PHPUnit\Framework\MockObject\MockObject */
protected $cloudIdManager;
- /** @var RemotePlugin */
+ /** @var RemotePlugin */
protected $plugin;
- /** @var SearchResult */
+ /** @var SearchResult */
protected $searchResult;
protected function setUp(): void {
@@ -79,7 +79,7 @@ class RemotePluginTest extends TestCase {
* @param bool $exactIdMatch
* @param bool $reachedEnd
*/
- public function testSearch($searchTerm, array $contacts, $shareeEnumeration, array $expected, $exactIdMatch, $reachedEnd) {
+ public function testSearch($searchTerm, array $contacts, $shareeEnumeration, array $expected, $exactIdMatch, $reachedEnd): void {
$this->config->expects($this->any())
->method('getAppValue')
->willReturnCallback(
@@ -117,7 +117,7 @@ class RemotePluginTest extends TestCase {
* @param string $expectedUser
* @param string $expectedUrl
*/
- public function testSplitUserRemote($remote, $expectedUser, $expectedUrl) {
+ public function testSplitUserRemote($remote, $expectedUser, $expectedUrl): void {
$this->instantiatePlugin();
$this->contactsManager->expects($this->any())
@@ -134,7 +134,7 @@ class RemotePluginTest extends TestCase {
*
* @param string $id
*/
- public function testSplitUserRemoteError($id) {
+ public function testSplitUserRemoteError($id): void {
$this->expectException(\Exception::class);
$this->instantiatePlugin();
diff --git a/tests/lib/Collaboration/Collaborators/SearchResultTest.php b/tests/lib/Collaboration/Collaborators/SearchResultTest.php
index da879a7b7a4..6641a2caed1 100644
--- a/tests/lib/Collaboration/Collaborators/SearchResultTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchResultTest.php
@@ -14,9 +14,9 @@ use OCP\IContainer;
use Test\TestCase;
class SearchResultTest extends TestCase {
- /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */
protected $container;
- /** @var ISearch */
+ /** @var ISearch */
protected $search;
protected function setUp(): void {
@@ -41,7 +41,7 @@ class SearchResultTest extends TestCase {
* @param array $toAdd
* @param array $expected
*/
- public function testAddResultSet(array $toAdd, array $expected) {
+ public function testAddResultSet(array $toAdd, array $expected): void {
$result = new SearchResult();
foreach ($toAdd as $type => $results) {
@@ -72,7 +72,7 @@ class SearchResultTest extends TestCase {
* @param string $id
* @param bool $expected
*/
- public function testHasResult(array $toAdd, $type, $id, $expected) {
+ public function testHasResult(array $toAdd, $type, $id, $expected): void {
$result = new SearchResult();
foreach ($toAdd as $addType => $results) {
diff --git a/tests/lib/Collaboration/Collaborators/SearchTest.php b/tests/lib/Collaboration/Collaborators/SearchTest.php
index 91b01aac7ce..88bdfa6047e 100644
--- a/tests/lib/Collaboration/Collaborators/SearchTest.php
+++ b/tests/lib/Collaboration/Collaborators/SearchTest.php
@@ -16,9 +16,9 @@ use OCP\Share\IShare;
use Test\TestCase;
class SearchTest extends TestCase {
- /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IContainer|\PHPUnit\Framework\MockObject\MockObject */
protected $container;
- /** @var ISearch */
+ /** @var ISearch */
protected $search;
protected function setUp(): void {
@@ -43,7 +43,7 @@ class SearchTest extends TestCase {
array $mockedMailResult,
array $expected,
bool $expectedMoreResults
- ) {
+ ): void {
$searchResult = new SearchResult();
$userPlugin = $this->createMock(ISearchPlugin::class);
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index eac7eb1124b..c6a266b55d6 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -22,35 +22,35 @@ use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class UserPluginTest extends TestCase {
- /** @var IConfig|MockObject */
+ /** @var IConfig|MockObject */
protected $config;
- /** @var IUserManager|MockObject */
+ /** @var IUserManager|MockObject */
protected $userManager;
- /** @var IGroupManager|MockObject */
+ /** @var IGroupManager|MockObject */
protected $groupManager;
- /** @var IUserSession|MockObject */
+ /** @var IUserSession|MockObject */
protected $session;
- /** @var KnownUserService|MockObject */
+ /** @var KnownUserService|MockObject */
protected $knownUserService;
/** @var IUserStatusManager|MockObject */
protected $userStatusManager;
- /** @var UserPlugin */
+ /** @var UserPlugin */
protected $plugin;
- /** @var ISearchResult */
+ /** @var ISearchResult */
protected $searchResult;
protected int $limit = 2;
protected int $offset = 0;
- /** @var IUser|MockObject */
+ /** @var IUser|MockObject */
protected $user;
protected function setUp(): void {
@@ -442,8 +442,8 @@ class UserPluginTest extends TestCase {
$singleUser,
array $users = [],
$shareeEnumerationPhone = false
- ) {
- $this->mockConfig(["core" => [
+ ): void {
+ $this->mockConfig(['core' => [
'shareapi_only_share_with_group_members' => $shareWithGroupOnly ? 'yes' : 'no',
'shareapi_allow_share_dialog_user_enumeration' => $shareeEnumeration? 'yes' : 'no',
'shareapi_restrict_user_enumeration_to_group' => false ? 'yes' : 'no',
@@ -539,7 +539,7 @@ class UserPluginTest extends TestCase {
* @param array $expectedUIDs
* @param $currentUserId
*/
- public function testTakeOutCurrentUser(array $users, array $expectedUIDs, $currentUserId) {
+ public function testTakeOutCurrentUser(array $users, array $expectedUIDs, $currentUserId): void {
$this->instantiatePlugin();
$this->session->expects($this->once())
@@ -719,7 +719,7 @@ class UserPluginTest extends TestCase {
/**
* @dataProvider dataSearchEnumeration
*/
- public function testSearchEnumerationLimit($search, $userGroups, $matchingUsers, $result, $mockedSettings) {
+ public function testSearchEnumerationLimit($search, $userGroups, $matchingUsers, $result, $mockedSettings): void {
$this->mockConfig($mockedSettings);
$userResults = [];
@@ -762,16 +762,16 @@ class UserPluginTest extends TestCase {
return null;
});
$this->userManager
- ->method('searchDisplayName')
- ->willReturnCallback(function ($search) use ($matchingUsers) {
- $users = array_filter(
- $matchingUsers,
- fn ($user) => str_contains(strtolower($user['displayName']), strtolower($search))
- );
- return array_map(
- fn ($user) => $this->getUserMock($user['uid'], $user['displayName']),
- $users);
- });
+ ->method('searchDisplayName')
+ ->willReturnCallback(function ($search) use ($matchingUsers) {
+ $users = array_filter(
+ $matchingUsers,
+ fn ($user) => str_contains(strtolower($user['displayName']), strtolower($search))
+ );
+ return array_map(
+ fn ($user) => $this->getUserMock($user['uid'], $user['displayName']),
+ $users);
+ });
$this->groupManager->method('displayNamesInGroup')
->willReturn($userResults);
diff --git a/tests/lib/Command/AsyncBusTest.php b/tests/lib/Command/AsyncBusTest.php
index 7492a4912d7..e8d7a857129 100644
--- a/tests/lib/Command/AsyncBusTest.php
+++ b/tests/lib/Command/AsyncBusTest.php
@@ -92,40 +92,40 @@ abstract class AsyncBusTest extends TestCase {
self::$lastCommand = '';
}
- public function testSimpleCommand() {
+ public function testSimpleCommand(): void {
$command = new SimpleCommand();
$this->getBus()->push($command);
$this->runJobs();
$this->assertEquals('SimpleCommand', self::$lastCommand);
}
- public function testStateFullCommand() {
+ public function testStateFullCommand(): void {
$command = new StateFullCommand('foo');
$this->getBus()->push($command);
$this->runJobs();
$this->assertEquals('foo', self::$lastCommand);
}
- public function testStaticCallable() {
+ public function testStaticCallable(): void {
$this->getBus()->push(['\Test\Command\AsyncBusTest', 'DummyCommand']);
$this->runJobs();
$this->assertEquals('static', self::$lastCommand);
}
- public function testMemberCallable() {
+ public function testMemberCallable(): void {
$command = new StateFullCommand('bar');
$this->getBus()->push([$command, 'handle']);
$this->runJobs();
$this->assertEquals('bar', self::$lastCommand);
}
- public function testFunctionCallable() {
+ public function testFunctionCallable(): void {
$this->getBus()->push('\Test\Command\BasicFunction');
$this->runJobs();
$this->assertEquals('function', self::$lastCommand);
}
- public function testClosure() {
+ public function testClosure(): void {
$this->getBus()->push(function () {
AsyncBusTest::$lastCommand = 'closure';
});
@@ -133,7 +133,7 @@ abstract class AsyncBusTest extends TestCase {
$this->assertEquals('closure', self::$lastCommand);
}
- public function testClosureSelf() {
+ public function testClosureSelf(): void {
$this->getBus()->push(function () {
AsyncBusTest::$lastCommand = 'closure-self';
});
@@ -142,7 +142,7 @@ abstract class AsyncBusTest extends TestCase {
}
- public function testClosureThis() {
+ public function testClosureThis(): void {
// clean class to prevent phpunit putting closure in $this
$test = new ThisClosureTest();
$test->test($this->getBus());
@@ -150,7 +150,7 @@ abstract class AsyncBusTest extends TestCase {
$this->assertEquals('closure-this', self::$lastCommand);
}
- public function testClosureBind() {
+ public function testClosureBind(): void {
$state = 'bar';
$this->getBus()->push(function () use ($state) {
AsyncBusTest::$lastCommand = 'closure-' . $state;
@@ -159,14 +159,14 @@ abstract class AsyncBusTest extends TestCase {
$this->assertEquals('closure-bar', self::$lastCommand);
}
- public function testFileFileAccessCommand() {
+ public function testFileFileAccessCommand(): void {
$this->getBus()->push(new FilesystemCommand());
$this->assertEquals('', self::$lastCommand);
$this->runJobs();
$this->assertEquals('FileAccess', self::$lastCommand);
}
- public function testFileFileAccessCommandSync() {
+ public function testFileFileAccessCommandSync(): void {
$this->getBus()->requireSync('\OC\Command\FileAccess');
$this->getBus()->push(new FilesystemCommand());
$this->assertEquals('FileAccess', self::$lastCommand);
diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php
index 41333863ad4..d4921c79431 100644
--- a/tests/lib/Command/Integrity/SignAppTest.php
+++ b/tests/lib/Command/Integrity/SignAppTest.php
@@ -37,7 +37,7 @@ class SignAppTest extends TestCase {
);
}
- public function testExecuteWithMissingPath() {
+ public function testExecuteWithMissingPath(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -64,7 +64,7 @@ class SignAppTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithMissingPrivateKey() {
+ public function testExecuteWithMissingPrivateKey(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -91,7 +91,7 @@ class SignAppTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithMissingCertificate() {
+ public function testExecuteWithMissingCertificate(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -118,7 +118,7 @@ class SignAppTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithNotExistingPrivateKey() {
+ public function testExecuteWithNotExistingPrivateKey(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -152,7 +152,7 @@ class SignAppTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithNotExistingCertificate() {
+ public function testExecuteWithNotExistingCertificate(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -191,7 +191,7 @@ class SignAppTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithException() {
+ public function testExecuteWithException(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -235,7 +235,7 @@ class SignAppTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signApp, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecute() {
+ public function testExecute(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php
index 51bec55b774..bbb68e00a84 100644
--- a/tests/lib/Command/Integrity/SignCoreTest.php
+++ b/tests/lib/Command/Integrity/SignCoreTest.php
@@ -32,7 +32,7 @@ class SignCoreTest extends TestCase {
);
}
- public function testExecuteWithMissingPrivateKey() {
+ public function testExecuteWithMissingPrivateKey(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -59,7 +59,7 @@ class SignCoreTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithMissingCertificate() {
+ public function testExecuteWithMissingCertificate(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -86,7 +86,7 @@ class SignCoreTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithNotExistingPrivateKey() {
+ public function testExecuteWithNotExistingPrivateKey(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -123,7 +123,7 @@ class SignCoreTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithNotExistingCertificate() {
+ public function testExecuteWithNotExistingCertificate(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -162,7 +162,7 @@ class SignCoreTest extends TestCase {
$this->assertSame(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecuteWithException() {
+ public function testExecuteWithException(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
@@ -206,7 +206,7 @@ class SignCoreTest extends TestCase {
$this->assertEquals(1, self::invokePrivate($this->signCore, 'execute', [$inputInterface, $outputInterface]));
}
- public function testExecute() {
+ public function testExecute(): void {
$inputInterface = $this->createMock(InputInterface::class);
$outputInterface = $this->createMock(OutputInterface::class);
diff --git a/tests/lib/Comments/CommentTest.php b/tests/lib/Comments/CommentTest.php
index feaa268a09e..742ce33071f 100644
--- a/tests/lib/Comments/CommentTest.php
+++ b/tests/lib/Comments/CommentTest.php
@@ -14,7 +14,7 @@ class CommentTest extends TestCase {
/**
* @throws \OCP\Comments\IllegalIDChangeException
*/
- public function testSettersValidInput() {
+ public function testSettersValidInput(): void {
$comment = new Comment();
$id = 'comment23';
@@ -61,7 +61,7 @@ class CommentTest extends TestCase {
}
- public function testSetIdIllegalInput() {
+ public function testSetIdIllegalInput(): void {
$this->expectException(\OCP\Comments\IllegalIDChangeException::class);
$comment = new Comment();
@@ -73,7 +73,7 @@ class CommentTest extends TestCase {
/**
* @throws \OCP\Comments\IllegalIDChangeException
*/
- public function testResetId() {
+ public function testResetId(): void {
$comment = new Comment();
$comment->setId('c23');
$comment->setId('');
@@ -96,7 +96,7 @@ class CommentTest extends TestCase {
/**
* @dataProvider simpleSetterProvider
*/
- public function testSimpleSetterInvalidInput($field, $input) {
+ public function testSimpleSetterInvalidInput($field, $input): void {
$this->expectException(\InvalidArgumentException::class);
$comment = new Comment();
@@ -121,7 +121,7 @@ class CommentTest extends TestCase {
/**
* @dataProvider roleSetterProvider
*/
- public function testSetRoleInvalidInput($role, $type, $id) {
+ public function testSetRoleInvalidInput($role, $type, $id): void {
$this->expectException(\InvalidArgumentException::class);
$comment = new Comment();
@@ -130,7 +130,7 @@ class CommentTest extends TestCase {
}
- public function testSetUberlongMessage() {
+ public function testSetUberlongMessage(): void {
$this->expectException(\OCP\Comments\MessageTooLongException::class);
$comment = new Comment();
diff --git a/tests/lib/Comments/ManagerTest.php b/tests/lib/Comments/ManagerTest.php
index 359be2696c6..9a36182d393 100644
--- a/tests/lib/Comments/ManagerTest.php
+++ b/tests/lib/Comments/ManagerTest.php
@@ -97,7 +97,7 @@ class ManagerTest extends TestCase {
}
- public function testGetCommentNotFound() {
+ public function testGetCommentNotFound(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -105,14 +105,14 @@ class ManagerTest extends TestCase {
}
- public function testGetCommentNotFoundInvalidInput() {
+ public function testGetCommentNotFoundInvalidInput(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->get('unexisting22');
}
- public function testGetComment() {
+ public function testGetComment(): void {
$manager = $this->getManager();
$creationDT = new \DateTime();
@@ -159,7 +159,7 @@ class ManagerTest extends TestCase {
}
- public function testGetTreeNotFound() {
+ public function testGetTreeNotFound(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -167,14 +167,14 @@ class ManagerTest extends TestCase {
}
- public function testGetTreeNotFoundInvalidIpnut() {
+ public function testGetTreeNotFoundInvalidIpnut(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->getTree('unexisting22');
}
- public function testGetTree() {
+ public function testGetTree(): void {
$headId = $this->addDatabaseEntry(0, 0);
$this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
@@ -200,7 +200,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetTreeNoReplies() {
+ public function testGetTreeNoReplies(): void {
$id = $this->addDatabaseEntry(0, 0);
$manager = $this->getManager();
@@ -219,7 +219,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetTreeWithLimitAndOffset() {
+ public function testGetTreeWithLimitAndOffset(): void {
$headId = $this->addDatabaseEntry(0, 0);
$this->addDatabaseEntry($headId, $headId, new \DateTime('-3 hours'));
@@ -249,7 +249,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetForObject() {
+ public function testGetForObject(): void {
$this->addDatabaseEntry(0, 0);
$manager = $this->getManager();
@@ -261,7 +261,7 @@ class ManagerTest extends TestCase {
$this->assertSame($comments[0]->getMessage(), 'nice one');
}
- public function testGetForObjectWithLimitAndOffset() {
+ public function testGetForObjectWithLimitAndOffset(): void {
$this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
$this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
$this->addDatabaseEntry(1, 1, new \DateTime('-4 hours'));
@@ -286,7 +286,7 @@ class ManagerTest extends TestCase {
} while (count($comments) > 0);
}
- public function testGetForObjectWithDateTimeConstraint() {
+ public function testGetForObjectWithDateTimeConstraint(): void {
$this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
$this->addDatabaseEntry(0, 0, new \DateTime('-5 hours'));
$id1 = $this->addDatabaseEntry(0, 0, new \DateTime('-3 hours'));
@@ -300,7 +300,7 @@ class ManagerTest extends TestCase {
$this->assertSame($comments[1]->getId(), strval($id1));
}
- public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint() {
+ public function testGetForObjectWithLimitAndOffsetAndDateTimeConstraint(): void {
$this->addDatabaseEntry(0, 0, new \DateTime('-7 hours'));
$this->addDatabaseEntry(0, 0, new \DateTime('-6 hours'));
$this->addDatabaseEntry(1, 1, new \DateTime('-5 hours'));
@@ -326,7 +326,7 @@ class ManagerTest extends TestCase {
} while (count($comments) > 0);
}
- public function testGetNumberOfCommentsForObject() {
+ public function testGetNumberOfCommentsForObject(): void {
for ($i = 1; $i < 5; $i++) {
$this->addDatabaseEntry(0, 0);
}
@@ -340,7 +340,7 @@ class ManagerTest extends TestCase {
$this->assertSame($amount, 4);
}
- public function testGetNumberOfUnreadCommentsForFolder() {
+ public function testGetNumberOfUnreadCommentsForFolder(): void {
$folder = $this->createMock(Folder::class);
$fileIds = range(1111, 1114);
$children = array_map(function (int $id) {
@@ -372,8 +372,8 @@ class ManagerTest extends TestCase {
$manager = $this->getManager();
- $manager->setReadMark('files', (string) $fileIds[0], (new \DateTime())->modify('-1 days'), $user);
- $manager->setReadMark('files', (string) $fileIds[2], (new \DateTime()), $user);
+ $manager->setReadMark('files', (string)$fileIds[0], (new \DateTime())->modify('-1 days'), $user);
+ $manager->setReadMark('files', (string)$fileIds[2], (new \DateTime()), $user);
$amount = $manager->getNumberOfUnreadCommentsForFolder($folder->getId(), $user);
$this->assertEquals([
@@ -391,7 +391,7 @@ class ManagerTest extends TestCase {
* @param $resultFrom
* @param $resultTo
*/
- public function testGetForObjectSince($lastKnown, $order, $limit, $resultFrom, $resultTo) {
+ public function testGetForObjectSince($lastKnown, $order, $limit, $resultFrom, $resultTo): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -408,7 +408,7 @@ class ManagerTest extends TestCase {
}
$this->assertSame($expected, array_map(function (IComment $c) {
- return (int) $c->getId();
+ return (int)$c->getId();
}, $comments));
}
@@ -445,14 +445,14 @@ class ManagerTest extends TestCase {
* @param string $oType
* @param string $oId
*/
- public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId) {
+ public function testCreateCommentInvalidArguments($aType, $aId, $oType, $oId): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->create($aType, $aId, $oType, $oId);
}
- public function testCreateComment() {
+ public function testCreateComment(): void {
$actorType = 'bot';
$actorId = 'bob';
$objectType = 'weather';
@@ -467,7 +467,7 @@ class ManagerTest extends TestCase {
}
- public function testDelete() {
+ public function testDelete(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -523,7 +523,7 @@ class ManagerTest extends TestCase {
];
}
- public function testSaveUpdate() {
+ public function testSaveUpdate(): void {
$manager = $this->getManager();
$comment = new Comment();
$comment
@@ -568,7 +568,7 @@ class ManagerTest extends TestCase {
}
- public function testSaveUpdateException() {
+ public function testSaveUpdateException(): void {
$this->expectException(\OCP\Comments\NotFoundException::class);
$manager = $this->getManager();
@@ -587,7 +587,7 @@ class ManagerTest extends TestCase {
}
- public function testSaveIncomplete() {
+ public function testSaveIncomplete(): void {
$this->expectException(\UnexpectedValueException::class);
$manager = $this->getManager();
@@ -596,7 +596,7 @@ class ManagerTest extends TestCase {
$manager->save($comment);
}
- public function testSaveAsChild() {
+ public function testSaveAsChild(): void {
$id = $this->addDatabaseEntry(0, 0);
$manager = $this->getManager();
@@ -635,14 +635,14 @@ class ManagerTest extends TestCase {
* @param string $type
* @param string $id
*/
- public function testDeleteReferencesOfActorInvalidInput($type, $id) {
+ public function testDeleteReferencesOfActorInvalidInput($type, $id): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->deleteReferencesOfActor($type, $id);
}
- public function testDeleteReferencesOfActor() {
+ public function testDeleteReferencesOfActor(): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -670,8 +670,8 @@ class ManagerTest extends TestCase {
$this->assertTrue($wasSuccessful);
}
- public function testDeleteReferencesOfActorWithUserManagement() {
- $user = \OC::$server->getUserManager()->createUser('xenia', '123456');
+ public function testDeleteReferencesOfActorWithUserManagement(): void {
+ $user = \OC::$server->getUserManager()->createUser('xenia', 'NotAnEasyPassword123456+');
$this->assertTrue($user instanceof IUser);
$manager = \OC::$server->get(ICommentsManager::class);
@@ -704,14 +704,14 @@ class ManagerTest extends TestCase {
* @param string $type
* @param string $id
*/
- public function testDeleteCommentsAtObjectInvalidInput($type, $id) {
+ public function testDeleteCommentsAtObjectInvalidInput($type, $id): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
$manager->deleteCommentsAtObject($type, $id);
}
- public function testDeleteCommentsAtObject() {
+ public function testDeleteCommentsAtObject(): void {
$ids = [];
$ids[] = $this->addDatabaseEntry(0, 0);
$ids[] = $this->addDatabaseEntry(0, 0);
@@ -764,7 +764,7 @@ class ManagerTest extends TestCase {
);
// just to make sure they are really set, with correct actor data
- $comment = $manager->get((string) $ids[1]);
+ $comment = $manager->get((string)$ids[1]);
$this->assertSame($comment->getObjectType(), 'files');
$this->assertSame($comment->getObjectId(), 'file64');
@@ -775,7 +775,7 @@ class ManagerTest extends TestCase {
$exists = 0;
foreach ($ids as $id) {
try {
- $manager->get((string) $id);
+ $manager->get((string)$id);
$exists++;
} catch (NotFoundException $e) {
$deleted++;
@@ -817,7 +817,7 @@ class ManagerTest extends TestCase {
$exists = 0;
foreach ($ids as $id) {
try {
- $manager->get((string) $id);
+ $manager->get((string)$id);
$exists++;
} catch (NotFoundException $e) {
$deleted++;
@@ -832,7 +832,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($deleted);
}
- public function testSetMarkRead() {
+ public function testSetMarkRead(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -849,7 +849,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($dateTimeGet->getTimestamp(), $dateTimeSet->getTimestamp());
}
- public function testSetMarkReadUpdate() {
+ public function testSetMarkReadUpdate(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -869,7 +869,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($dateTimeGet, $dateTimeSet);
}
- public function testReadMarkDeleteUser() {
+ public function testReadMarkDeleteUser(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -887,7 +887,7 @@ class ManagerTest extends TestCase {
$this->assertNull($dateTimeGet);
}
- public function testReadMarkDeleteObject() {
+ public function testReadMarkDeleteObject(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -905,7 +905,7 @@ class ManagerTest extends TestCase {
$this->assertNull($dateTimeGet);
}
- public function testSendEvent() {
+ public function testSendEvent(): void {
$handler1 = $this->getMockBuilder(ICommentsEventHandler::class)->getMock();
$handler1->expects($this->exactly(4))
->method('handle');
@@ -940,7 +940,7 @@ class ManagerTest extends TestCase {
$manager->delete($comment->getId());
}
- public function testResolveDisplayName() {
+ public function testResolveDisplayName(): void {
$manager = $this->getManager();
$planetClosure = function ($name) {
@@ -959,7 +959,7 @@ class ManagerTest extends TestCase {
}
- public function testRegisterResolverDuplicate() {
+ public function testRegisterResolverDuplicate(): void {
$this->expectException(\OutOfBoundsException::class);
$manager = $this->getManager();
@@ -972,7 +972,7 @@ class ManagerTest extends TestCase {
}
- public function testRegisterResolverInvalidType() {
+ public function testRegisterResolverInvalidType(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
@@ -984,7 +984,7 @@ class ManagerTest extends TestCase {
}
- public function testResolveDisplayNameUnregisteredType() {
+ public function testResolveDisplayNameUnregisteredType(): void {
$this->expectException(\OutOfBoundsException::class);
$manager = $this->getManager();
@@ -997,7 +997,7 @@ class ManagerTest extends TestCase {
$manager->resolveDisplayName('galaxy', 'sombrero');
}
- public function testResolveDisplayNameDirtyResolver() {
+ public function testResolveDisplayNameDirtyResolver(): void {
$manager = $this->getManager();
$planetClosure = function () {
@@ -1021,7 +1021,7 @@ class ManagerTest extends TestCase {
* @param array $reactionsExpected
* @return void
*/
- public function testReactionAddAndDelete(array $comments, array $reactionsExpected) {
+ public function testReactionAddAndDelete(array $comments, array $reactionsExpected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -1080,7 +1080,7 @@ class ManagerTest extends TestCase {
];
}
- public function testResolveDisplayNameInvalidType() {
+ public function testResolveDisplayNameInvalidType(): void {
$this->expectException(\InvalidArgumentException::class);
$manager = $this->getManager();
@@ -1104,7 +1104,7 @@ class ManagerTest extends TestCase {
[$message, $actorId, $verb, $parentText] = $comment;
$parentId = null;
if ($parentText) {
- $parentId = (string) $comments[$parentText]->getId();
+ $parentId = (string)$comments[$parentText]->getId();
}
$id = '';
if ($verb === 'reaction_deleted') {
@@ -1119,7 +1119,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestRetrieveAllReactions
*/
- public function testRetrieveAllReactions(array $comments, array $expected) {
+ public function testRetrieveAllReactions(array $comments, array $expected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2379,7 +2379,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestRetrieveAllReactionsWithSpecificReaction
*/
- public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected) {
+ public function testRetrieveAllReactionsWithSpecificReaction(array $comments, string $reaction, array $expected): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2434,7 +2434,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestGetReactionComment
*/
- public function testGetReactionComment(array $comments, array $expected, bool $notFound) {
+ public function testGetReactionComment(array $comments, array $expected, bool $notFound): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
@@ -2503,7 +2503,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestReactionMessageSize
*/
- public function testReactionMessageSize($reactionString, $valid) {
+ public function testReactionMessageSize($reactionString, $valid): void {
$this->skipIfNotSupport4ByteUTF();
if (!$valid) {
$this->expectException(\UnexpectedValueException::class);
@@ -2534,7 +2534,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider providerTestReactionsSummarizeOrdered
*/
- public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch) {
+ public function testReactionsSummarizeOrdered(array $comments, array $expected, bool $isFullMatch): void {
$this->skipIfNotSupport4ByteUTF();
$manager = $this->getManager();
diff --git a/tests/lib/ConfigTest.php b/tests/lib/ConfigTest.php
index e5d0c94003b..94ee8da5dec 100644
--- a/tests/lib/ConfigTest.php
+++ b/tests/lib/ConfigTest.php
@@ -36,7 +36,7 @@ class ConfigTest extends TestCase {
return new \OC\Config($this->randomTmpDir, 'testconfig.php');
}
- public function testGetKeys() {
+ public function testGetKeys(): void {
$expectedConfig = ['foo', 'beers', 'alcohol_free'];
$this->assertSame($expectedConfig, $this->getConfig()->getKeys());
}
@@ -48,7 +48,7 @@ class ConfigTest extends TestCase {
putenv('NC_taste');
}
- public function testGetValue() {
+ public function testGetValue(): void {
$config = $this->getConfig();
$this->assertSame('bar', $config->getValue('foo'));
$this->assertSame(null, $config->getValue('bar'));
@@ -58,7 +58,7 @@ class ConfigTest extends TestCase {
$this->assertSame(['Appenzeller', 'Guinness', 'Kölsch'], $config->getValue('beers'));
}
- public function testGetValueReturnsEnvironmentValueIfSet() {
+ public function testGetValueReturnsEnvironmentValueIfSet(): void {
$config = $this->getConfig();
$this->assertEquals('bar', $config->getValue('foo'));
@@ -68,7 +68,7 @@ class ConfigTest extends TestCase {
putenv('NC_foo'); // unset the env variable
}
- public function testGetValueReturnsEnvironmentValueIfSetToZero() {
+ public function testGetValueReturnsEnvironmentValueIfSetToZero(): void {
$config = $this->getConfig();
$this->assertEquals('bar', $config->getValue('foo'));
@@ -78,7 +78,7 @@ class ConfigTest extends TestCase {
putenv('NC_foo'); // unset the env variable
}
- public function testGetValueReturnsEnvironmentValueIfSetToFalse() {
+ public function testGetValueReturnsEnvironmentValueIfSetToFalse(): void {
$config = $this->getConfig();
$this->assertEquals('bar', $config->getValue('foo'));
@@ -88,7 +88,7 @@ class ConfigTest extends TestCase {
putenv('NC_foo'); // unset the env variable
}
- public function testSetValue() {
+ public function testSetValue(): void {
$config = $this->getConfig();
$config->setValue('foo', 'moo');
$this->assertSame('moo', $config->getValue('foo'));
@@ -111,7 +111,7 @@ class ConfigTest extends TestCase {
$this->assertEquals($expected, $content);
}
- public function testSetValues() {
+ public function testSetValues(): void {
$config = $this->getConfig();
$content = file_get_contents($this->configFile);
$this->assertEquals(self::TESTCONTENT, $content);
@@ -141,7 +141,7 @@ class ConfigTest extends TestCase {
$this->assertEquals($expected, $content);
}
- public function testDeleteKey() {
+ public function testDeleteKey(): void {
$config = $this->getConfig();
$config->deleteKey('foo');
$this->assertSame('this_was_clearly_not_set_before', $config->getValue('foo', 'this_was_clearly_not_set_before'));
@@ -152,7 +152,7 @@ class ConfigTest extends TestCase {
$this->assertEquals($expected, $content);
}
- public function testConfigMerge() {
+ public function testConfigMerge(): void {
// Create additional config
$additionalConfig = '<?php $CONFIG=array("php53"=>"totallyOutdated");';
$additionalConfigPath = $this->randomTmpDir.'additionalConfig.testconfig.php';
diff --git a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php
index 55129f7753f..09e0e11bd5e 100644
--- a/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ActionFactoryTest.php
@@ -20,7 +20,7 @@ class ActionFactoryTest extends TestCase {
$this->actionFactory = new ActionFactory();
}
- public function testNewLinkAction() {
+ public function testNewLinkAction(): void {
$icon = 'icon-test';
$name = 'Test';
$href = 'some/url';
@@ -32,7 +32,7 @@ class ActionFactoryTest extends TestCase {
$this->assertEquals(10, $action->getPriority());
}
- public function testNewEMailAction() {
+ public function testNewEMailAction(): void {
$icon = 'icon-test';
$name = 'Test';
$href = 'user@example.com';
diff --git a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
index e9dcb2fba81..84de6ec88e2 100644
--- a/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ActionProviderStoreTest.php
@@ -40,7 +40,7 @@ class ActionProviderStoreTest extends TestCase {
$this->actionProviderStore = new ActionProviderStore($this->serverContainer, $this->appManager, $logger);
}
- public function testGetProviders() {
+ public function testGetProviders(): void {
$user = $this->createMock(IUser::class);
$provider1 = $this->createMock(ProfileProvider::class);
$provider2 = $this->createMock(LocalTimeProvider::class);
@@ -76,7 +76,7 @@ class ActionProviderStoreTest extends TestCase {
$this->assertInstanceOf(EMailProvider::class, $providers[2]);
}
- public function testGetProvidersOfAppWithIncompleInfo() {
+ public function testGetProvidersOfAppWithIncompleInfo(): void {
$user = $this->createMock(IUser::class);
$provider1 = $this->createMock(ProfileProvider::class);
$provider2 = $this->createMock(LocalTimeProvider::class);
@@ -107,7 +107,7 @@ class ActionProviderStoreTest extends TestCase {
}
- public function testGetProvidersWithQueryException() {
+ public function testGetProvidersWithQueryException(): void {
$this->expectException(\Exception::class);
$user = $this->createMock(IUser::class);
diff --git a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
index a5ac4543463..5e2b416a66b 100644
--- a/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Actions/LinkActionTest.php
@@ -19,7 +19,7 @@ class LinkActionTest extends TestCase {
$this->action = new LinkAction();
}
- public function testSetIcon() {
+ public function testSetIcon(): void {
$icon = 'icon-test';
$this->action->setIcon($icon);
@@ -29,7 +29,7 @@ class LinkActionTest extends TestCase {
$this->assertEquals($json['icon'], $icon);
}
- public function testGetSetName() {
+ public function testGetSetName(): void {
$name = 'Jane Doe';
$this->assertEmpty($this->action->getName());
@@ -37,7 +37,7 @@ class LinkActionTest extends TestCase {
$this->assertEquals($name, $this->action->getName());
}
- public function testGetSetPriority() {
+ public function testGetSetPriority(): void {
$prio = 50;
$this->assertEquals(10, $this->action->getPriority());
@@ -45,7 +45,7 @@ class LinkActionTest extends TestCase {
$this->assertEquals($prio, $this->action->getPriority());
}
- public function testSetHref() {
+ public function testSetHref(): void {
$this->action->setHref('/some/url');
$json = $this->action->jsonSerialize();
@@ -53,7 +53,7 @@ class LinkActionTest extends TestCase {
$this->assertEquals('/some/url', $json['hyperlink']);
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$this->action->setIcon('icon-contacts');
$this->action->setName('Nickie Works');
$this->action->setPriority(33);
@@ -71,7 +71,7 @@ class LinkActionTest extends TestCase {
$this->assertEquals($expected, $json);
}
- public function testJsonSerializeNoAppName() {
+ public function testJsonSerializeNoAppName(): void {
$this->action->setIcon('icon-contacts');
$this->action->setName('Nickie Works');
$this->action->setPriority(33);
diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
index d66af2925f4..a3151d0b040 100644
--- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
@@ -69,7 +69,7 @@ class ContactsStoreTest extends TestCase {
);
}
- public function testGetContactsWithoutFilter() {
+ public function testGetContactsWithoutFilter(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
@@ -99,7 +99,7 @@ class ContactsStoreTest extends TestCase {
], $entries[1]->getEMailAddresses());
}
- public function testGetContactsHidesOwnEntry() {
+ public function testGetContactsHidesOwnEntry(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
@@ -126,7 +126,7 @@ class ContactsStoreTest extends TestCase {
$this->assertCount(1, $entries);
}
- public function testGetContactsWithoutBinaryImage() {
+ public function testGetContactsWithoutBinaryImage(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$this->urlGenerator->expects($this->any())
@@ -159,7 +159,7 @@ class ContactsStoreTest extends TestCase {
$this->assertSame('https://urlToNcAvatar.test', $entries[1]->getAvatar());
}
- public function testGetContactsWithoutAvatarURI() {
+ public function testGetContactsWithoutAvatarURI(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
@@ -188,7 +188,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('https://photo', $entries[1]->getAvatar());
}
- public function testGetContactsWhenUserIsInExcludeGroups() {
+ public function testGetContactsWhenUserIsInExcludeGroups(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -233,7 +233,7 @@ class ContactsStoreTest extends TestCase {
$this->assertCount(0, $entries);
}
- public function testGetContactsOnlyShareIfInTheSameGroup() {
+ public function testGetContactsOnlyShareIfInTheSameGroup(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -308,7 +308,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('contact', $entries[2]->getProperty('UID'));
}
- public function testGetContactsOnlyEnumerateIfInTheSameGroup() {
+ public function testGetContactsOnlyEnumerateIfInTheSameGroup(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -383,7 +383,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('contact', $entries[2]->getProperty('UID'));
}
- public function testGetContactsOnlyEnumerateIfPhoneBookMatch() {
+ public function testGetContactsOnlyEnumerateIfPhoneBookMatch(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -441,7 +441,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('contact', $entries[2]->getProperty('UID'));
}
- public function testGetContactsOnlyEnumerateIfPhoneBookMatchWithOwnGroupsOnly() {
+ public function testGetContactsOnlyEnumerateIfPhoneBookMatchWithOwnGroupsOnly(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -523,7 +523,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('contact', $entries[2]->getProperty('UID'));
}
- public function testGetContactsOnlyEnumerateIfPhoneBookOrSameGroup() {
+ public function testGetContactsOnlyEnumerateIfPhoneBookOrSameGroup(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -595,7 +595,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('contact', $entries[3]->getProperty('UID'));
}
- public function testGetContactsOnlyEnumerateIfPhoneBookOrSameGroupInOwnGroupsOnly() {
+ public function testGetContactsOnlyEnumerateIfPhoneBookOrSameGroupInOwnGroupsOnly(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -677,7 +677,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals('contact', $entries[2]->getProperty('UID'));
}
- public function testGetContactsWithFilter() {
+ public function testGetContactsWithFilter(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -764,7 +764,7 @@ class ContactsStoreTest extends TestCase {
], $entry[0]->getEMailAddresses());
}
- public function testGetContactsWithFilterWithoutFullMatch() {
+ public function testGetContactsWithFilterWithoutFullMatch(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -848,7 +848,7 @@ class ContactsStoreTest extends TestCase {
], $entry[0]->getEMailAddresses());
}
- public function testFindOneUser() {
+ public function testFindOneUser(): void {
$this->config
->method('getAppValue')
->willReturnMap([
@@ -891,7 +891,7 @@ class ContactsStoreTest extends TestCase {
], $entry->getEMailAddresses());
}
- public function testFindOneEMail() {
+ public function testFindOneEMail(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
@@ -922,7 +922,7 @@ class ContactsStoreTest extends TestCase {
], $entry->getEMailAddresses());
}
- public function testFindOneNotSupportedType() {
+ public function testFindOneNotSupportedType(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
@@ -931,7 +931,7 @@ class ContactsStoreTest extends TestCase {
$this->assertEquals(null, $entry);
}
- public function testFindOneNoMatches() {
+ public function testFindOneNoMatches(): void {
/** @var IUser|MockObject $user */
$user = $this->createMock(IUser::class);
$this->contactsManager->expects($this->once())
diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php
index b06054ee77b..15f5b60b948 100644
--- a/tests/lib/Contacts/ContactsMenu/EntryTest.php
+++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php
@@ -20,25 +20,25 @@ class EntryTest extends TestCase {
$this->entry = new Entry();
}
- public function testSetId() {
+ public function testSetId(): void {
$this->entry->setId(123);
$this->addToAssertionCount(1);
}
- public function testSetGetFullName() {
+ public function testSetGetFullName(): void {
$fn = 'Danette Chaille';
$this->assertEquals('', $this->entry->getFullName());
$this->entry->setFullName($fn);
$this->assertEquals($fn, $this->entry->getFullName());
}
- public function testAddGetEMailAddresses() {
+ public function testAddGetEMailAddresses(): void {
$this->assertEmpty($this->entry->getEMailAddresses());
$this->entry->addEMailAddress('user@example.com');
$this->assertEquals(['user@example.com'], $this->entry->getEMailAddresses());
}
- public function testAddAndSortAction() {
+ public function testAddAndSortAction(): void {
// Three actions, two with equal priority
$action1 = new LinkAction();
$action2 = new LinkAction();
@@ -62,7 +62,7 @@ class EntryTest extends TestCase {
$this->assertSame($action2, $sorted[2]);
}
- public function testSetGetProperties() {
+ public function testSetGetProperties(): void {
$props = [
'prop1' => 123,
'prop2' => 'string',
@@ -75,7 +75,7 @@ class EntryTest extends TestCase {
$this->assertEquals('string', $this->entry->getProperty('prop2'));
}
- public function testJsonSerialize() {
+ public function testJsonSerialize(): void {
$expectedJson = [
'id' => '123',
'fullName' => 'Guadalupe Frisbey',
diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
index 27ae9f5415c..c87bb3d5147 100644
--- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
@@ -57,7 +57,7 @@ class ManagerTest extends TestCase {
return $entries;
}
- public function testGetFilteredEntries() {
+ public function testGetFilteredEntries(): void {
$filter = 'con';
$user = $this->createMock(IUser::class);
$entries = $this->generateTestEntries();
@@ -94,7 +94,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
- public function testGetFilteredEntriesLimit() {
+ public function testGetFilteredEntriesLimit(): void {
$filter = 'con';
$user = $this->createMock(IUser::class);
$entries = $this->generateTestEntries();
@@ -131,7 +131,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
- public function testGetFilteredEntriesMinSearchStringLength() {
+ public function testGetFilteredEntriesMinSearchStringLength(): void {
$filter = 'con';
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
@@ -157,7 +157,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
- public function testFindOne() {
+ public function testFindOne(): void {
$shareTypeFilter = 42;
$shareWithFilter = 'foobar';
@@ -180,7 +180,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($entry, $data);
}
- public function testFindOne404() {
+ public function testFindOne404(): void {
$shareTypeFilter = 42;
$shareWithFilter = 'foobar';
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
index 0c7c4922939..648351c2ca9 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/EMailproviderTest.php
@@ -33,7 +33,7 @@ class EMailproviderTest extends TestCase {
$this->provider = new EMailProvider($this->actionFactory, $this->urlGenerator);
}
- public function testProcess() {
+ public function testProcess(): void {
$entry = $this->createMock(IEntry::class);
$action = $this->createMock(ILinkAction::class);
$iconUrl = 'https://example.com/img/actions/icon.svg';
@@ -60,7 +60,7 @@ class EMailproviderTest extends TestCase {
$this->provider->process($entry);
}
- public function testProcessEmptyAddress() {
+ public function testProcessEmptyAddress(): void {
$entry = $this->createMock(IEntry::class);
$iconUrl = 'https://example.com/img/actions/icon.svg';
$this->urlGenerator->expects($this->once())
diff --git a/tests/lib/ContactsManagerTest.php b/tests/lib/ContactsManagerTest.php
index 91053cd0b52..6a6cd5f421a 100644
--- a/tests/lib/ContactsManagerTest.php
+++ b/tests/lib/ContactsManagerTest.php
@@ -65,7 +65,7 @@ class ContactsManagerTest extends \Test\TestCase {
/**
* @dataProvider searchProvider
*/
- public function testSearch($search1, $search2, $expectedResult) {
+ public function testSearch($search1, $search2, $expectedResult): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook1 = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -99,7 +99,7 @@ class ContactsManagerTest extends \Test\TestCase {
}
- public function testDeleteHavePermission() {
+ public function testDeleteHavePermission(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -122,7 +122,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($result, 'returnMe');
}
- public function testDeleteNoPermission() {
+ public function testDeleteNoPermission(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -144,7 +144,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($result, null);
}
- public function testDeleteNoAddressbook() {
+ public function testDeleteNoAddressbook(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -162,7 +162,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($result, null);
}
- public function testCreateOrUpdateHavePermission() {
+ public function testCreateOrUpdateHavePermission(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -185,7 +185,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($result, 'returnMe');
}
- public function testCreateOrUpdateNoPermission() {
+ public function testCreateOrUpdateNoPermission(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -207,7 +207,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($result, null);
}
- public function testCreateOrUpdateNOAdressbook() {
+ public function testCreateOrUpdateNOAdressbook(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -225,12 +225,12 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertEquals($result, null);
}
- public function testIsEnabledIfNot() {
+ public function testIsEnabledIfNot(): void {
$result = $this->cm->isEnabled();
$this->assertFalse($result);
}
- public function testIsEnabledIfSo() {
+ public function testIsEnabledIfSo(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
->disableOriginalConstructor()
@@ -245,7 +245,7 @@ class ContactsManagerTest extends \Test\TestCase {
$this->assertTrue($result);
}
- public function testAddressBookEnumeration() {
+ public function testAddressBookEnumeration(): void {
// create mock for the addressbook
/** @var \PHPUnit\Framework\MockObject\MockObject|IAddressBook $addressbook */
$addressbook = $this->getMockBuilder('\OCP\IAddressBook')
diff --git a/tests/lib/DB/ConnectionFactoryTest.php b/tests/lib/DB/ConnectionFactoryTest.php
index 208f78f4512..23bde34a8fb 100644
--- a/tests/lib/DB/ConnectionFactoryTest.php
+++ b/tests/lib/DB/ConnectionFactoryTest.php
@@ -8,6 +8,7 @@ namespace Test\DB;
use OC\DB\ConnectionFactory;
use OC\SystemConfig;
+use OCP\ICacheFactory;
use Test\TestCase;
class ConnectionFactoryTest extends TestCase {
@@ -30,10 +31,11 @@ class ConnectionFactoryTest extends TestCase {
* @param string $host
* @param array $expected
*/
- public function testSplitHostFromPortAndSocket($host, array $expected) {
+ public function testSplitHostFromPortAndSocket($host, array $expected): void {
/** @var SystemConfig $config */
$config = $this->createMock(SystemConfig::class);
- $factory = new ConnectionFactory($config);
+ $cacheFactory = $this->createMock(ICacheFactory::class);
+ $factory = new ConnectionFactory($config, $cacheFactory);
$this->assertEquals($expected, self::invokePrivate($factory, 'splitHostFromPortAndSocket', [$host]));
}
diff --git a/tests/lib/DB/MigrationsTest.php b/tests/lib/DB/MigrationsTest.php
index 6cd489258bf..531e0a3805a 100644
--- a/tests/lib/DB/MigrationsTest.php
+++ b/tests/lib/DB/MigrationsTest.php
@@ -8,8 +8,6 @@
namespace Test\DB;
-use Doctrine\DBAL\Platforms\OraclePlatform;
-use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
@@ -21,8 +19,21 @@ use Doctrine\DBAL\Types\Type;
use OC\DB\Connection;
use OC\DB\MigrationService;
use OC\DB\SchemaWrapper;
+use OC\Migration\MetadataManager;
+use OCP\App\IAppManager;
use OCP\IDBConnection;
+use OCP\Migration\Attributes\AddColumn;
+use OCP\Migration\Attributes\AddIndex;
+use OCP\Migration\Attributes\ColumnType;
+use OCP\Migration\Attributes\CreateTable;
+use OCP\Migration\Attributes\DropColumn;
+use OCP\Migration\Attributes\DropIndex;
+use OCP\Migration\Attributes\DropTable;
+use OCP\Migration\Attributes\IndexType;
+use OCP\Migration\Attributes\ModifyColumn;
use OCP\Migration\IMigrationStep;
+use OCP\Server;
+use PHPUnit\Framework\MockObject\MockObject;
/**
* Class MigrationsTest
@@ -30,10 +41,9 @@ use OCP\Migration\IMigrationStep;
* @package Test\DB
*/
class MigrationsTest extends \Test\TestCase {
- /** @var MigrationService | \PHPUnit\Framework\MockObject\MockObject */
- private $migrationService;
- /** @var \PHPUnit\Framework\MockObject\MockObject | IDBConnection $db */
- private $db;
+ private MigrationService|MockObject $migrationService;
+ private MockObject|IDBConnection $db;
+ private IAppManager $appManager;
protected function setUp(): void {
parent::setUp();
@@ -41,16 +51,18 @@ class MigrationsTest extends \Test\TestCase {
$this->db = $this->createMock(Connection::class);
$this->db->expects($this->any())->method('getPrefix')->willReturn('test_oc_');
$this->migrationService = new MigrationService('testing', $this->db);
+
+ $this->appManager = Server::get(IAppManager::class);
}
- public function testGetters() {
+ public function testGetters(): void {
$this->assertEquals('testing', $this->migrationService->getApp());
$this->assertEquals(\OC::$SERVERROOT . '/apps/testing/lib/Migration', $this->migrationService->getMigrationsDirectory());
$this->assertEquals('OCA\Testing\Migration', $this->migrationService->getMigrationsNamespace());
$this->assertEquals('test_oc_migrations', $this->migrationService->getMigrationsTableName());
}
- public function testCore() {
+ public function testCore(): void {
$this->migrationService = new MigrationService('core', $this->db);
$this->assertEquals('core', $this->migrationService->getApp());
@@ -60,7 +72,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testExecuteUnknownStep() {
+ public function testExecuteUnknownStep(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Version 20170130180000 is unknown.');
@@ -68,7 +80,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testUnknownApp() {
+ public function testUnknownApp(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App not found');
@@ -76,7 +88,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testExecuteStepWithUnknownClass() {
+ public function testExecuteStepWithUnknownClass(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Migration step \'X\' is unknown');
@@ -90,7 +102,7 @@ class MigrationsTest extends \Test\TestCase {
$this->migrationService->executeStep('20170130180000');
}
- public function testExecuteStepWithSchemaChange() {
+ public function testExecuteStepWithSchemaChange(): void {
$schema = $this->createMock(Schema::class);
$this->db->expects($this->any())
->method('createSchema')
@@ -133,7 +145,7 @@ class MigrationsTest extends \Test\TestCase {
$this->migrationService->executeStep('20170130180000');
}
- public function testExecuteStepWithoutSchemaChange() {
+ public function testExecuteStepWithoutSchemaChange(): void {
$schema = $this->createMock(Schema::class);
$this->db->expects($this->any())
->method('createSchema')
@@ -177,7 +189,7 @@ class MigrationsTest extends \Test\TestCase {
* @param string $alias
* @param string $expected
*/
- public function testGetMigration($alias, $expected) {
+ public function testGetMigration($alias, $expected): void {
$this->migrationService = $this->getMockBuilder(MigrationService::class)
->setMethods(['getMigratedVersions', 'findMigrations'])
->setConstructorArgs(['testing', $this->db])
@@ -197,7 +209,7 @@ class MigrationsTest extends \Test\TestCase {
$this->assertEquals($expected, $migration);
}
- public function testMigrate() {
+ public function testMigrate(): void {
$this->migrationService = $this->getMockBuilder(MigrationService::class)
->setMethods(['getMigratedVersions', 'findMigrations', 'executeStep'])
->setConstructorArgs(['testing', $this->db])
@@ -218,7 +230,7 @@ class MigrationsTest extends \Test\TestCase {
$this->migrationService->migrate();
}
- public function testEnsureOracleConstraintsValid() {
+ public function testEnsureOracleConstraintsValid(): void {
$column = $this->createMock(Column::class);
$column->expects($this->once())
->method('getName')
@@ -281,7 +293,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
- public function testEnsureOracleConstraintsValidWithPrimaryKey() {
+ public function testEnsureOracleConstraintsValidWithPrimaryKey(): void {
$index = $this->createMock(Index::class);
$index->expects($this->any())
->method('getName')
@@ -324,11 +336,11 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
- public function testEnsureOracleConstraintsValidWithPrimaryKeyDefault() {
+ public function testEnsureOracleConstraintsValidWithPrimaryKeyDefault(): void {
$defaultName = 'PRIMARY';
- if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) {
+ if ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_POSTGRES) {
$defaultName = \str_repeat('a', 26) . '_' . \str_repeat('b', 30) . '_seq';
- } elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) {
+ } elseif ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
$defaultName = \str_repeat('a', 26) . '_seq';
}
@@ -378,7 +390,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongTableName() {
+ public function testEnsureOracleConstraintsTooLongTableName(): void {
$this->expectException(\InvalidArgumentException::class);
$table = $this->createMock(Table::class);
@@ -403,13 +415,13 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongPrimaryWithDefault() {
+ public function testEnsureOracleConstraintsTooLongPrimaryWithDefault(): void {
$this->expectException(\InvalidArgumentException::class);
$defaultName = 'PRIMARY';
- if ($this->db->getDatabasePlatform() instanceof PostgreSqlPlatform) {
+ if ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_POSTGRES) {
$defaultName = \str_repeat('a', 27) . '_' . \str_repeat('b', 30) . '_seq';
- } elseif ($this->db->getDatabasePlatform() instanceof OraclePlatform) {
+ } elseif ($this->db->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
$defaultName = \str_repeat('a', 27) . '_seq';
}
@@ -456,7 +468,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongPrimaryWithName() {
+ public function testEnsureOracleConstraintsTooLongPrimaryWithName(): void {
$this->expectException(\InvalidArgumentException::class);
$index = $this->createMock(Index::class);
@@ -499,7 +511,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongColumnName() {
+ public function testEnsureOracleConstraintsTooLongColumnName(): void {
$this->expectException(\InvalidArgumentException::class);
$column = $this->createMock(Column::class);
@@ -533,7 +545,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongIndexName() {
+ public function testEnsureOracleConstraintsTooLongIndexName(): void {
$this->expectException(\InvalidArgumentException::class);
$index = $this->createMock(Index::class);
@@ -570,7 +582,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongForeignKeyName() {
+ public function testEnsureOracleConstraintsTooLongForeignKeyName(): void {
$this->expectException(\InvalidArgumentException::class);
$foreignKey = $this->createMock(ForeignKeyConstraint::class);
@@ -610,7 +622,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsNoPrimaryKey() {
+ public function testEnsureOracleConstraintsNoPrimaryKey(): void {
$this->markTestSkipped('Test disabled for now due to multiple reasons, see https://github.com/nextcloud/server/pull/31580#issuecomment-1069182234 for details.');
$this->expectException(\InvalidArgumentException::class);
@@ -651,7 +663,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsTooLongSequenceName() {
+ public function testEnsureOracleConstraintsTooLongSequenceName(): void {
$this->expectException(\InvalidArgumentException::class);
$sequence = $this->createMock(Sequence::class);
@@ -679,7 +691,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsBooleanNotNull() {
+ public function testEnsureOracleConstraintsBooleanNotNull(): void {
$this->expectException(\InvalidArgumentException::class);
$column = $this->createMock(Column::class);
@@ -719,7 +731,7 @@ class MigrationsTest extends \Test\TestCase {
}
- public function testEnsureOracleConstraintsStringLength4000() {
+ public function testEnsureOracleConstraintsStringLength4000(): void {
$this->expectException(\InvalidArgumentException::class);
$column = $this->createMock(Column::class);
@@ -757,4 +769,163 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleConstraints', [$sourceSchema, $schema, 3]);
}
+
+
+ public function testExtractMigrationAttributes(): void {
+ $metadataManager = Server::get(MetadataManager::class);
+ $this->appManager->loadApp('testing');
+
+ $this->assertEquals($this->getMigrationMetadata(), json_decode(json_encode($metadataManager->extractMigrationAttributes('testing')), true));
+
+ $this->appManager->disableApp('testing');
+ }
+
+ public function testDeserializeMigrationMetadata(): void {
+ $metadataManager = Server::get(MetadataManager::class);
+ $this->assertEquals(
+ [
+ 'core' => [],
+ 'apps' => [
+ 'testing' => [
+ '30000Date20240102030405' => [
+ new DropTable('old_table'),
+ new CreateTable('new_table',
+ description: 'Table is used to store things, but also to get more things',
+ notes: ['this is a notice', 'and another one, if really needed']
+ ),
+ new AddColumn('my_table'),
+ new AddColumn('my_table', 'another_field'),
+ new AddColumn('other_table', 'last_one', ColumnType::DATE),
+ new AddIndex('my_table'),
+ new AddIndex('my_table', IndexType::PRIMARY),
+ new DropColumn('other_table'),
+ new DropColumn('other_table', 'old_column',
+ description: 'field is not used anymore and replaced by \'last_one\''
+ ),
+ new DropIndex('other_table'),
+ new ModifyColumn('other_table'),
+ new ModifyColumn('other_table', 'this_field'),
+ new ModifyColumn('other_table', 'this_field', ColumnType::BIGINT)
+ ]
+ ]
+ ]
+ ],
+ $metadataManager->getMigrationsAttributesFromReleaseMetadata(
+ [
+ 'core' => [],
+ 'apps' => ['testing' => $this->getMigrationMetadata()]
+ ]
+ )
+ );
+ }
+
+ private function getMigrationMetadata(): array {
+ return [
+ '30000Date20240102030405' => [
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropTable',
+ 'table' => 'old_table',
+ 'description' => '',
+ 'notes' => [],
+ 'columns' => []
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\CreateTable',
+ 'table' => 'new_table',
+ 'description' => 'Table is used to store things, but also to get more things',
+ 'notes' =>
+ [
+ 'this is a notice',
+ 'and another one, if really needed'
+ ],
+ 'columns' => []
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddColumn',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => '',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddColumn',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'another_field',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'last_one',
+ 'type' => 'date'
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddIndex',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddIndex',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'type' => 'primary'
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => '',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropColumn',
+ 'table' => 'other_table',
+ 'description' => 'field is not used anymore and replaced by \'last_one\'',
+ 'notes' => [],
+ 'name' => 'old_column',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropIndex',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\ModifyColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => '',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\ModifyColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'this_field',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\ModifyColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'this_field',
+ 'type' => 'bigint'
+ ],
+ ]
+ ];
+ }
}
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index eaa6540b93b..c6afe5a053a 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -10,8 +10,6 @@ namespace Test\DB;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\ParameterType;
-use Doctrine\DBAL\Platforms\OraclePlatform;
-use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaConfig;
use OC\DB\Migrator;
@@ -19,7 +17,7 @@ use OC\DB\OracleMigrator;
use OC\DB\SQLiteMigrator;
use OCP\DB\Types;
use OCP\IConfig;
-use OCP\Security\ISecureRandom;
+use OCP\IDBConnection;
/**
* Class MigratorTest
@@ -56,12 +54,10 @@ class MigratorTest extends \Test\TestCase {
}
private function getMigrator(): Migrator {
- $platform = $this->connection->getDatabasePlatform();
- $random = \OC::$server->get(ISecureRandom::class);
$dispatcher = \OC::$server->get(\OCP\EventDispatcher\IEventDispatcher::class);
- if ($platform instanceof SqlitePlatform) {
+ if ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_SQLITE) {
return new SQLiteMigrator($this->connection, $this->config, $dispatcher);
- } elseif ($platform instanceof OraclePlatform) {
+ } elseif ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
return new OracleMigrator($this->connection, $this->config, $dispatcher);
}
return new Migrator($this->connection, $this->config, $dispatcher);
@@ -130,7 +126,7 @@ class MigratorTest extends \Test\TestCase {
return $config;
}
- public function testUpgrade() {
+ public function testUpgrade(): void {
[$startSchema, $endSchema] = $this->getDuplicateKeySchemas();
$migrator = $this->getMigrator();
$migrator->migrate($startSchema);
@@ -143,7 +139,7 @@ class MigratorTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testUpgradeDifferentPrefix() {
+ public function testUpgradeDifferentPrefix(): void {
$oldTablePrefix = $this->config->getSystemValueString('dbtableprefix', 'oc_');
$this->config->setSystemValue('dbtableprefix', 'ownc_');
@@ -163,7 +159,7 @@ class MigratorTest extends \Test\TestCase {
$this->config->setSystemValue('dbtableprefix', $oldTablePrefix);
}
- public function testInsertAfterUpgrade() {
+ public function testInsertAfterUpgrade(): void {
[$startSchema, $endSchema] = $this->getDuplicateKeySchemas();
$migrator = $this->getMigrator();
$migrator->migrate($startSchema);
@@ -180,7 +176,7 @@ class MigratorTest extends \Test\TestCase {
}
}
- public function testAddingPrimaryKeyWithAutoIncrement() {
+ public function testAddingPrimaryKeyWithAutoIncrement(): void {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
$table->addColumn('id', 'integer');
@@ -200,7 +196,7 @@ class MigratorTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testReservedKeywords() {
+ public function testReservedKeywords(): void {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
$table->addColumn('id', 'integer', ['autoincrement' => true]);
@@ -224,7 +220,7 @@ class MigratorTest extends \Test\TestCase {
/**
* Test for nextcloud/server#36803
*/
- public function testColumnCommentsInUpdate() {
+ public function testColumnCommentsInUpdate(): void {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
$table->addColumn('id', 'integer', ['autoincrement' => true, 'comment' => 'foo']);
@@ -245,14 +241,14 @@ class MigratorTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testAddingForeignKey() {
+ public function testAddingForeignKey(): void {
$startSchema = new Schema([], [], $this->getSchemaConfig());
$table = $startSchema->createTable($this->tableName);
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('name', 'string');
$table->setPrimaryKey(['id']);
- $fkName = "fkc";
+ $fkName = 'fkc';
$tableFk = $startSchema->createTable($this->tableNameTmp);
$tableFk->addColumn('fk_id', 'integer');
$tableFk->addColumn('name', 'string');
@@ -300,7 +296,7 @@ class MigratorTest extends \Test\TestCase {
$migrator = $this->getMigrator();
$migrator->migrate($startSchema);
- if ($oracleThrows && $this->connection->getDatabasePlatform() instanceof OraclePlatform) {
+ if ($oracleThrows && $this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) {
// Oracle can not store false|empty string in notnull columns
$this->expectException(\Doctrine\DBAL\Exception\NotNullConstraintViolationException::class);
}
diff --git a/tests/lib/DB/OCPostgreSqlPlatformTest.php b/tests/lib/DB/OCPostgreSqlPlatformTest.php
index 4f83e866a7c..bea3adf29a4 100644
--- a/tests/lib/DB/OCPostgreSqlPlatformTest.php
+++ b/tests/lib/DB/OCPostgreSqlPlatformTest.php
@@ -7,7 +7,7 @@
namespace Test\DB;
-use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
+use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
@@ -23,8 +23,8 @@ use Doctrine\DBAL\Types\Types;
* @package Test\DB
*/
class OCPostgreSqlPlatformTest extends \Test\TestCase {
- public function testAlterBigint() {
- $platform = new PostgreSQL100Platform();
+ public function testAlterBigint(): void {
+ $platform = new PostgreSQLPlatform();
$sourceSchema = new Schema();
$targetSchema = new Schema();
@@ -48,7 +48,7 @@ class OCPostgreSqlPlatformTest extends \Test\TestCase {
}
protected function createTableAndColumn($schema, $type) {
- $table = $schema->createTable("poor_yorick");
+ $table = $schema->createTable('poor_yorick');
$table->addColumn('id', $type, [
'autoincrement' => true,
'unsigned' => true,
diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
index 671bcfc209e..ed6e328881b 100644
--- a/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
+++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderDBTest.php
@@ -52,7 +52,7 @@ class ExpressionBuilderDBTest extends TestCase {
* @param string $param2
* @param boolean $match
*/
- public function testLike($param1, $param2, $match) {
+ public function testLike($param1, $param2, $match): void {
$query = $this->connection->getQueryBuilder();
$query->select(new Literal('1'))
@@ -89,7 +89,7 @@ class ExpressionBuilderDBTest extends TestCase {
* @param string $param2
* @param boolean $match
*/
- public function testILike($param1, $param2, $match) {
+ public function testILike($param1, $param2, $match): void {
$query = $this->connection->getQueryBuilder();
$query->select(new Literal('1'))
@@ -141,7 +141,7 @@ class ExpressionBuilderDBTest extends TestCase {
self::assertEquals('myvalue', $entries[0]['configvalue']);
}
- public function testDateTimeEquals() {
+ public function testDateTimeEquals(): void {
$dateTime = new \DateTime('2023-01-01');
$insert = $this->connection->getQueryBuilder();
$insert->insert('testing')
@@ -158,7 +158,7 @@ class ExpressionBuilderDBTest extends TestCase {
self::assertCount(1, $entries);
}
- public function testDateTimeLess() {
+ public function testDateTimeLess(): void {
$dateTime = new \DateTime('2022-01-01');
$dateTimeCompare = new \DateTime('2022-01-02');
$insert = $this->connection->getQueryBuilder();
@@ -176,7 +176,7 @@ class ExpressionBuilderDBTest extends TestCase {
self::assertCount(1, $entries);
}
- public function testDateTimeGreater() {
+ public function testDateTimeGreater(): void {
$dateTime = new \DateTime('2023-01-02');
$dateTimeCompare = new \DateTime('2023-01-01');
$insert = $this->connection->getQueryBuilder();
@@ -199,8 +199,8 @@ class ExpressionBuilderDBTest extends TestCase {
$query->insert('appconfig')
->values([
'appid' => $query->createNamedParameter($appId),
- 'configkey' => $query->createNamedParameter((string) $key),
- 'configvalue' => $query->createNamedParameter((string) $value),
+ 'configkey' => $query->createNamedParameter((string)$key),
+ 'configvalue' => $query->createNamedParameter((string)$value),
])
->execute();
}
diff --git a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php
index d8147035b16..c14c55e6d02 100644
--- a/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/ExpressionBuilderTest.php
@@ -10,6 +10,7 @@ namespace Test\DB\QueryBuilder;
use Doctrine\DBAL\Query\Expression\ExpressionBuilder as DoctrineExpressionBuilder;
use OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder;
use OCP\DB\QueryBuilder\IQueryBuilder;
+use Psr\Log\LoggerInterface;
use Test\TestCase;
/**
@@ -32,15 +33,19 @@ class ExpressionBuilderTest extends TestCase {
/** @var \Doctrine\DBAL\Connection */
protected $internalConnection;
+ /** @var LoggerInterface */
+ protected $logger;
+
protected function setUp(): void {
parent::setUp();
$this->connection = \OC::$server->getDatabaseConnection();
$this->internalConnection = \OC::$server->get(\OC\DB\Connection::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$queryBuilder = $this->createMock(IQueryBuilder::class);
- $this->expressionBuilder = new ExpressionBuilder($this->connection, $queryBuilder);
+ $this->expressionBuilder = new ExpressionBuilder($this->connection, $queryBuilder, $this->logger);
$this->doctrineExpressionBuilder = new DoctrineExpressionBuilder($this->internalConnection);
}
@@ -67,7 +72,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testComparison($comparison, $input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testComparison($comparison, $input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -94,7 +99,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testEquals($input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -112,7 +117,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testNotEquals($input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testNotEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -130,7 +135,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testLowerThan($input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testLowerThan($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -148,7 +153,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testLowerThanEquals($input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testLowerThanEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -166,7 +171,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testGreaterThan($input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testGreaterThan($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -184,7 +189,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input2
* @param bool $isInput2Literal
*/
- public function testGreaterThanEquals($input1, $isInput1Literal, $input2, $isInput2Literal) {
+ public function testGreaterThanEquals($input1, $isInput1Literal, $input2, $isInput2Literal): void {
[$doctrineInput1, $ocInput1] = $this->helpWithLiteral($input1, $isInput1Literal);
[$doctrineInput2, $ocInput2] = $this->helpWithLiteral($input2, $isInput2Literal);
@@ -194,14 +199,14 @@ class ExpressionBuilderTest extends TestCase {
);
}
- public function testIsNull() {
+ public function testIsNull(): void {
$this->assertEquals(
$this->doctrineExpressionBuilder->isNull('`test`'),
$this->expressionBuilder->isNull('test')
);
}
- public function testIsNotNull() {
+ public function testIsNotNull(): void {
$this->assertEquals(
$this->doctrineExpressionBuilder->isNotNull('`test`'),
$this->expressionBuilder->isNotNull('test')
@@ -221,7 +226,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input
* @param bool $isLiteral
*/
- public function testLike($input, $isLiteral) {
+ public function testLike($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
$this->assertEquals(
@@ -236,7 +241,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input
* @param bool $isLiteral
*/
- public function testNotLike($input, $isLiteral) {
+ public function testNotLike($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
$this->assertEquals(
@@ -260,7 +265,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input
* @param bool $isLiteral
*/
- public function testIn($input, $isLiteral) {
+ public function testIn($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
$this->assertEquals(
@@ -275,7 +280,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input
* @param bool $isLiteral
*/
- public function testNotIn($input, $isLiteral) {
+ public function testNotIn($input, $isLiteral): void {
[$doctrineInput, $ocInput] = $this->helpWithLiteral($input, $isLiteral);
$this->assertEquals(
@@ -329,7 +334,7 @@ class ExpressionBuilderTest extends TestCase {
* @param mixed $input
* @param string|null $type
*/
- public function testLiteral($input, $type) {
+ public function testLiteral($input, $type): void {
/** @var \OC\DB\QueryBuilder\Literal $actual */
$actual = $this->expressionBuilder->literal($input, $type);
@@ -375,7 +380,7 @@ class ExpressionBuilderTest extends TestCase {
* @param bool $compareKeyToValue
* @param int $expected
*/
- public function testClobComparisons($function, $value, $type, $compareKeyToValue, $expected) {
+ public function testClobComparisons($function, $value, $type, $compareKeyToValue, $expected): void {
$appId = $this->getUniqueID('testing');
$this->createConfig($appId, 1, 4);
$this->createConfig($appId, 2, 5);
@@ -415,8 +420,8 @@ class ExpressionBuilderTest extends TestCase {
$query->insert('appconfig')
->values([
'appid' => $query->createNamedParameter($appId),
- 'configkey' => $query->createNamedParameter((string) $key),
- 'configvalue' => $query->createNamedParameter((string) $value),
+ 'configkey' => $query->createNamedParameter((string)$key),
+ 'configvalue' => $query->createNamedParameter((string)$value),
])
->execute();
}
diff --git a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
index d991c78f113..f3007ace85c 100644
--- a/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/FunctionBuilderTest.php
@@ -30,7 +30,7 @@ class FunctionBuilderTest extends TestCase {
/**
* @dataProvider providerTestConcatString
*/
- public function testConcatString($closure) {
+ public function testConcatString($closure): void {
$query = $this->connection->getQueryBuilder();
[$real, $arguments, $return] = $closure($query);
if ($real) {
@@ -81,7 +81,7 @@ class FunctionBuilderTest extends TestCase {
}],
'5 columns: string param with special chars used in the function' =>
[function ($q) {
- return [false, [$q->createNamedParameter("b"), $q->createNamedParameter("'"), $q->createNamedParameter('||'), $q->createNamedParameter(','), $q->createNamedParameter('a')], "b'||,a"];
+ return [false, [$q->createNamedParameter('b'), $q->createNamedParameter("'"), $q->createNamedParameter('||'), $q->createNamedParameter(','), $q->createNamedParameter('a')], "b'||,a"];
}],
];
}
@@ -232,7 +232,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEqualsCanonicalizing([1,2,3], $actual);
}
- public function testMd5() {
+ public function testMd5(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->md5($query->createNamedParameter('foobar')));
@@ -245,7 +245,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(md5('foobar'), $column);
}
- public function testSubstring() {
+ public function testSubstring(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->substring($query->createNamedParameter('foobar'), new Literal(2), $query->createNamedParameter(2)));
@@ -258,7 +258,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals('oo', $column);
}
- public function testSubstringNoLength() {
+ public function testSubstringNoLength(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->substring($query->createNamedParameter('foobar'), new Literal(2)));
@@ -271,7 +271,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals('oobar', $column);
}
- public function testLower() {
+ public function testLower(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->lower($query->createNamedParameter('FooBar')));
@@ -284,7 +284,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals('foobar', $column);
}
- public function testAdd() {
+ public function testAdd(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->add($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1)));
@@ -297,7 +297,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(3, $column);
}
- public function testSubtract() {
+ public function testSubtract(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->subtract($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1)));
@@ -310,7 +310,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(1, $column);
}
- public function testCount() {
+ public function testCount(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->count('appid'));
@@ -335,7 +335,7 @@ class FunctionBuilderTest extends TestCase {
/**
* @dataProvider octetLengthProvider
*/
- public function testOctetLength(string $str, int $bytes) {
+ public function testOctetLength(string $str, int $bytes): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->octetLength($query->createNamedParameter($str, IQueryBuilder::PARAM_STR)));
@@ -360,7 +360,7 @@ class FunctionBuilderTest extends TestCase {
/**
* @dataProvider charLengthProvider
*/
- public function testCharLength(string $str, int $bytes) {
+ public function testCharLength(string $str, int $bytes): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->charLength($query->createNamedParameter($str, IQueryBuilder::PARAM_STR)));
@@ -393,7 +393,7 @@ class FunctionBuilderTest extends TestCase {
$query->execute();
}
- public function testMaxEmpty() {
+ public function testMaxEmpty(): void {
$this->clearMinMax();
$query = $this->connection->getQueryBuilder();
@@ -409,7 +409,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(null, $row);
}
- public function testMinEmpty() {
+ public function testMinEmpty(): void {
$this->clearMinMax();
$query = $this->connection->getQueryBuilder();
@@ -425,7 +425,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(null, $row);
}
- public function testMax() {
+ public function testMax(): void {
$this->clearMinMax();
$this->setUpMinMax(10);
$this->setUpMinMax(11);
@@ -444,7 +444,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(20, $row);
}
- public function testMin() {
+ public function testMin(): void {
$this->clearMinMax();
$this->setUpMinMax(10);
$this->setUpMinMax(11);
@@ -463,7 +463,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(10, $row);
}
- public function testGreatest() {
+ public function testGreatest(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->greatest($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1)));
@@ -476,7 +476,7 @@ class FunctionBuilderTest extends TestCase {
$this->assertEquals(2, $row);
}
- public function testLeast() {
+ public function testLeast(): void {
$query = $this->connection->getQueryBuilder();
$query->select($query->func()->least($query->createNamedParameter(2, IQueryBuilder::PARAM_INT), new Literal(1)));
diff --git a/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php b/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php
new file mode 100644
index 00000000000..a8ebf11c2c2
--- /dev/null
+++ b/tests/lib/DB/QueryBuilder/Partitioned/JoinConditionTest.php
@@ -0,0 +1,78 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2024 Robin Appelman <robin@icewind.nl>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace lib\DB\QueryBuilder\Partitioned;
+
+use OC\DB\ConnectionAdapter;
+use OC\DB\QueryBuilder\Partitioned\JoinCondition;
+use OC\DB\QueryBuilder\QueryBuilder;
+use OC\SystemConfig;
+use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IDBConnection;
+use Psr\Log\LoggerInterface;
+use Test\TestCase;
+
+class JoinConditionTest extends TestCase {
+ protected function setUp(): void {
+ parent::setUp();
+ }
+
+ public function platformProvider(): array {
+ return [
+ [IDBConnection::PLATFORM_SQLITE],
+ [IDBConnection::PLATFORM_POSTGRES],
+ [IDBConnection::PLATFORM_MYSQL],
+ [IDBConnection::PLATFORM_ORACLE],
+ ];
+ }
+
+ private function getBuilder(string $platform): IQueryBuilder {
+ $connection = $this->createMock(ConnectionAdapter::class);
+ $connection->method('getDatabaseProvider')->willReturn($platform);
+ return new QueryBuilder(
+ $connection,
+ $this->createMock(SystemConfig::class),
+ $this->createMock(LoggerInterface::class)
+ );
+ }
+
+ /**
+ * @dataProvider platformProvider
+ */
+ public function testParseCondition(string $platform): void {
+ $query = $this->getBuilder($platform);
+ $param1 = $query->createNamedParameter('files');
+ $param2 = $query->createNamedParameter('test');
+ $condition = $query->expr()->andX(
+ $query->expr()->eq('tagmap.categoryid', 'tag.id'),
+ $query->expr()->eq('tag.type', $param1),
+ $query->expr()->eq('tag.uid', $param2)
+ );
+ $parsed = JoinCondition::parse($condition, 'vcategory', 'tag', 'tagmap');
+ $this->assertEquals('tagmap.categoryid', $parsed->fromColumn);
+ $this->assertEquals('tag.id', $parsed->toColumn);
+ $this->assertEquals([], $parsed->fromConditions);
+ $this->assertEquals([
+ $query->expr()->eq('tag.type', $param1),
+ $query->expr()->eq('tag.uid', $param2),
+ ], $parsed->toConditions);
+ }
+
+ /**
+ * @dataProvider platformProvider
+ */
+ public function testParseCastCondition(string $platform): void {
+ $query = $this->getBuilder($platform);
+
+ $condition = $query->expr()->eq($query->expr()->castColumn('m.objectid', IQueryBuilder::PARAM_INT), 'f.fileid');
+ $parsed = JoinCondition::parse($condition, 'filecache', 'f', 'm');
+ $this->assertEquals('m.objectid', $parsed->fromColumn);
+ $this->assertEquals('f.fileid', $parsed->toColumn);
+ $this->assertEquals([], $parsed->fromConditions);
+ }
+}
diff --git a/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php
new file mode 100644
index 00000000000..697b3ab92c9
--- /dev/null
+++ b/tests/lib/DB/QueryBuilder/Partitioned/PartitionedQueryBuilderTest.php
@@ -0,0 +1,222 @@
+<?php
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+declare(strict_types=1);
+
+namespace Test\DB\QueryBuilder\Partitioned;
+
+use OC\DB\QueryBuilder\Partitioned\PartitionedQueryBuilder;
+use OC\DB\QueryBuilder\Partitioned\PartitionSplit;
+use OC\DB\QueryBuilder\Sharded\AutoIncrementHandler;
+use OC\DB\QueryBuilder\Sharded\ShardConnectionManager;
+use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IDBConnection;
+use OCP\Server;
+use Test\TestCase;
+
+/**
+ * @group DB
+ */
+class PartitionedQueryBuilderTest extends TestCase {
+ private IDBConnection $connection;
+ private ShardConnectionManager $shardConnectionManager;
+ private AutoIncrementHandler $autoIncrementHandler;
+
+ protected function setUp(): void {
+ if (PHP_INT_SIZE < 8) {
+ $this->markTestSkipped('Test requires 64bit');
+ }
+ $this->connection = Server::get(IDBConnection::class);
+ $this->shardConnectionManager = Server::get(ShardConnectionManager::class);
+ $this->autoIncrementHandler = Server::get(AutoIncrementHandler::class);
+
+ $this->setupFileCache();
+ }
+
+ protected function tearDown(): void {
+ $this->cleanupDb();
+ parent::tearDown();
+ }
+
+
+ private function getQueryBuilder(): PartitionedQueryBuilder {
+ $builder = $this->connection->getQueryBuilder();
+ if ($builder instanceof PartitionedQueryBuilder) {
+ return $builder;
+ } else {
+ return new PartitionedQueryBuilder($builder, [], $this->shardConnectionManager, $this->autoIncrementHandler);
+ }
+ }
+
+ private function setupFileCache(): void {
+ $this->cleanupDb();
+ $query = $this->getQueryBuilder();
+ $query->insert('storages')
+ ->values([
+ 'numeric_id' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
+ 'id' => $query->createNamedParameter('test1'),
+ ]);
+ $query->executeStatement();
+
+ $query = $this->getQueryBuilder();
+ $query->insert('filecache')
+ ->values([
+ 'storage' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
+ 'path' => $query->createNamedParameter('file1'),
+ 'path_hash' => $query->createNamedParameter(md5('file1')),
+ ]);
+ $query->executeStatement();
+ $fileId = $query->getLastInsertId();
+
+ $query = $this->getQueryBuilder();
+ $query->insert('filecache_extended')
+ ->hintShardKey('storage', 1001001)
+ ->values([
+ 'fileid' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
+ 'upload_time' => $query->createNamedParameter(1234, IQueryBuilder::PARAM_INT),
+ ]);
+ $query->executeStatement();
+
+ $query = $this->getQueryBuilder();
+ $query->insert('mounts')
+ ->values([
+ 'storage_id' => $query->createNamedParameter(1001001, IQueryBuilder::PARAM_INT),
+ 'user_id' => $query->createNamedParameter('partitioned_test'),
+ 'mount_point' => $query->createNamedParameter('/mount/point'),
+ 'mount_provider_class' => $query->createNamedParameter('test'),
+ 'root_id' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
+ ]);
+ $query->executeStatement();
+ }
+
+ private function cleanupDb(): void {
+ $query = $this->getQueryBuilder();
+ $query->delete('storages')
+ ->where($query->expr()->gt('numeric_id', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)));
+ $query->executeStatement();
+
+ $query = $this->getQueryBuilder();
+ $query->delete('filecache')
+ ->where($query->expr()->gt('storage', $query->createNamedParameter(1000000, IQueryBuilder::PARAM_INT)))
+ ->runAcrossAllShards();
+ $query->executeStatement();
+
+ $query = $this->getQueryBuilder();
+ $query->delete('filecache_extended')
+ ->runAcrossAllShards();
+ $query->executeStatement();
+
+ $query = $this->getQueryBuilder();
+ $query->delete('mounts')
+ ->where($query->expr()->like('user_id', $query->createNamedParameter('partitioned_%')));
+ $query->executeStatement();
+ }
+
+ public function testSimpleOnlyPartitionQuery(): void {
+ $builder = $this->getQueryBuilder();
+ $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
+
+ // query borrowed from UserMountCache
+ $query = $builder->select('path')
+ ->from('filecache')
+ ->where($builder->expr()->eq('storage', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
+
+ $results = $query->executeQuery()->fetchAll();
+ $this->assertCount(1, $results);
+ $this->assertEquals($results[0]['path'], 'file1');
+ }
+
+ public function testSimplePartitionedQuery(): void {
+ $builder = $this->getQueryBuilder();
+ $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
+
+ // query borrowed from UserMountCache
+ $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
+ ->from('mounts', 'm')
+ ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
+ ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
+
+ $query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
+
+ $this->assertEquals(2, $query->getPartitionCount());
+
+ $results = $query->executeQuery()->fetchAll();
+ $this->assertCount(1, $results);
+ $this->assertEquals($results[0]['user_id'], 'partitioned_test');
+ $this->assertEquals($results[0]['mount_point'], '/mount/point');
+ $this->assertEquals($results[0]['mount_provider_class'], 'test');
+ $this->assertEquals($results[0]['path'], 'file1');
+ }
+
+ public function testMultiTablePartitionedQuery(): void {
+ $builder = $this->getQueryBuilder();
+ $builder->addPartition(new PartitionSplit('filecache', ['filecache', 'filecache_extended']));
+
+ $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class', 'fe.upload_time')
+ ->from('mounts', 'm')
+ ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
+ ->innerJoin('f', 'filecache_extended', 'fe', $builder->expr()->eq('f.fileid', 'fe.fileid'))
+ ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
+
+ $query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
+
+ $this->assertEquals(2, $query->getPartitionCount());
+
+ $results = $query->executeQuery()->fetchAll();
+ $this->assertCount(1, $results);
+ $this->assertEquals($results[0]['user_id'], 'partitioned_test');
+ $this->assertEquals($results[0]['mount_point'], '/mount/point');
+ $this->assertEquals($results[0]['mount_provider_class'], 'test');
+ $this->assertEquals($results[0]['path'], 'file1');
+ $this->assertEquals($results[0]['upload_time'], 1234);
+ }
+
+ public function testPartitionedQueryFromSplit(): void {
+ $builder = $this->getQueryBuilder();
+ $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
+
+ $query = $builder->select('storage', 'm.root_id', 'm.user_id', 'm.mount_point', 'm.mount_id', 'path', 'm.mount_provider_class')
+ ->from('filecache', 'f')
+ ->innerJoin('f', 'mounts', 'm', $builder->expr()->eq('m.root_id', 'f.fileid'));
+ $query->where($builder->expr()->eq('storage', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
+
+ $query->andWhere($builder->expr()->eq('m.user_id', $builder->createNamedParameter('partitioned_test')));
+
+ $this->assertEquals(2, $query->getPartitionCount());
+
+ $results = $query->executeQuery()->fetchAll();
+ $this->assertCount(1, $results);
+ $this->assertEquals($results[0]['user_id'], 'partitioned_test');
+ $this->assertEquals($results[0]['mount_point'], '/mount/point');
+ $this->assertEquals($results[0]['mount_provider_class'], 'test');
+ $this->assertEquals($results[0]['path'], 'file1');
+ }
+
+ public function testMultiJoinPartitionedQuery(): void {
+ $builder = $this->getQueryBuilder();
+ $builder->addPartition(new PartitionSplit('filecache', ['filecache']));
+
+ // query borrowed from UserMountCache
+ $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path', 'mount_provider_class')
+ ->selectAlias('s.id', 'storage_string_id')
+ ->from('mounts', 'm')
+ ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid'))
+ ->innerJoin('f', 'storages', 's', $builder->expr()->eq('f.storage', 's.numeric_id'))
+ ->where($builder->expr()->eq('storage_id', $builder->createNamedParameter(1001001, IQueryBuilder::PARAM_INT)));
+
+ $query->andWhere($builder->expr()->eq('user_id', $builder->createNamedParameter('partitioned_test')));
+
+ $this->assertEquals(3, $query->getPartitionCount());
+
+ $results = $query->executeQuery()->fetchAll();
+ $this->assertCount(1, $results);
+ $this->assertEquals($results[0]['user_id'], 'partitioned_test');
+ $this->assertEquals($results[0]['mount_point'], '/mount/point');
+ $this->assertEquals($results[0]['mount_provider_class'], 'test');
+ $this->assertEquals($results[0]['path'], 'file1');
+ $this->assertEquals($results[0]['storage_string_id'], 'test1');
+ }
+}
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
index 96cde8ba1f9..508748f13b2 100644
--- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
@@ -9,11 +9,12 @@ namespace Test\DB\QueryBuilder;
use Doctrine\DBAL\Query\Expression\CompositeExpression;
use Doctrine\DBAL\Query\QueryException;
-use Doctrine\DBAL\Result;
use OC\DB\QueryBuilder\Literal;
use OC\DB\QueryBuilder\Parameter;
use OC\DB\QueryBuilder\QueryBuilder;
use OC\SystemConfig;
+use OCP\DB\IResult;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use Psr\Log\LoggerInterface;
@@ -102,7 +103,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param int|null $firstResult
* @param array $expectedSet
*/
- public function testFirstResult($firstResult, $expectedSet) {
+ public function testFirstResult($firstResult, $expectedSet): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -139,7 +140,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param int $maxResult
* @param array $expectedSet
*/
- public function testMaxResults($maxResult, $expectedSet) {
+ public function testMaxResults($maxResult, $expectedSet): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -192,7 +193,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expected
* @param string $expectedLiteral
*/
- public function testSelect($selectArguments, $expected, $expectedLiteral = '') {
+ public function testSelect($selectArguments, $expected, $expectedLiteral = ''): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -245,7 +246,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $alias
* @param array $expected
*/
- public function testSelectAlias($select, $alias, $expected) {
+ public function testSelectAlias($select, $alias, $expected): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -271,7 +272,7 @@ class QueryBuilderTest extends \Test\TestCase {
$this->deleteTestingRows();
}
- public function testSelectDistinct() {
+ public function testSelectDistinct(): void {
$this->deleteTestingRows('testFirstResult1');
$this->deleteTestingRows('testFirstResult2');
$this->createTestingRows('testFirstResult1');
@@ -299,7 +300,7 @@ class QueryBuilderTest extends \Test\TestCase {
$this->deleteTestingRows('testFirstResult2');
}
- public function testSelectDistinctMultiple() {
+ public function testSelectDistinctMultiple(): void {
$this->deleteTestingRows('testFirstResult1');
$this->deleteTestingRows('testFirstResult2');
$this->createTestingRows('testFirstResult1');
@@ -369,7 +370,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expected
* @param string $expectedLiteral
*/
- public function testAddSelect($selectArguments, $expected, $expectedLiteral = '') {
+ public function testAddSelect($selectArguments, $expected, $expectedLiteral = ''): void {
$this->deleteTestingRows();
$this->createTestingRows();
@@ -422,7 +423,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testDelete($tableName, $tableAlias, $expectedQueryPart, $expectedQuery) {
+ public function testDelete($tableName, $tableAlias, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->delete($tableName, $tableAlias);
$this->assertSame(
@@ -451,7 +452,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testUpdate($tableName, $tableAlias, $expectedQueryPart, $expectedQuery) {
+ public function testUpdate($tableName, $tableAlias, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->update($tableName, $tableAlias);
$this->assertSame(
@@ -478,7 +479,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testInsert($tableName, $expectedQueryPart, $expectedQuery) {
+ public function testInsert($tableName, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->insert($tableName);
$this->assertSame(
@@ -523,7 +524,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testFrom($table1Name, $table1Alias, $table2Name, $table2Alias, $expectedQueryPart, $expectedQuery) {
+ public function testFrom($table1Name, $table1Alias, $table2Name, $table2Alias, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from($table1Name, $table1Alias);
if ($table2Name !== null) {
$this->queryBuilder->from($table2Name, $table2Alias);
@@ -571,7 +572,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery) {
+ public function testJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->join(
$fromAlias,
@@ -601,7 +602,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testInnerJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery) {
+ public function testInnerJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->innerJoin(
$fromAlias,
@@ -651,7 +652,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testLeftJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery) {
+ public function testLeftJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->leftJoin(
$fromAlias,
@@ -701,7 +702,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testRightJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery) {
+ public function testRightJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->rightJoin(
$fromAlias,
@@ -740,7 +741,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testSet($partOne1, $partOne2, $partTwo1, $partTwo2, $expectedQueryPart, $expectedQuery) {
+ public function testSet($partOne1, $partOne2, $partTwo1, $partTwo2, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->update('data');
$this->queryBuilder->set($partOne1, $partOne2);
if ($partTwo1 !== null) {
@@ -772,7 +773,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testWhere($whereArguments, $expectedQueryPart, $expectedQuery) {
+ public function testWhere($whereArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
[$this->queryBuilder, 'where'],
@@ -797,7 +798,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testAndWhere($whereArguments, $expectedQueryPart, $expectedQuery) {
+ public function testAndWhere($whereArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
[$this->queryBuilder, 'andWhere'],
@@ -829,7 +830,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testOrWhere($whereArguments, $expectedQueryPart, $expectedQuery) {
+ public function testOrWhere($whereArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
[$this->queryBuilder, 'orWhere'],
@@ -861,7 +862,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testGroupBy($groupByArguments, $expectedQueryPart, $expectedQuery) {
+ public function testGroupBy($groupByArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
call_user_func_array(
[$this->queryBuilder, 'groupBy'],
@@ -893,7 +894,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testAddGroupBy($groupByArguments, $expectedQueryPart, $expectedQuery) {
+ public function testAddGroupBy($groupByArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->select('column');
$this->queryBuilder->groupBy('column1');
call_user_func_array(
@@ -926,7 +927,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testSetValue($column, $value, $expectedQueryPart, $expectedQuery) {
+ public function testSetValue($column, $value, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->insert('data');
$this->queryBuilder->setValue($column, $value);
@@ -949,7 +950,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testValues($column, $value, $expectedQueryPart, $expectedQuery) {
+ public function testValues($column, $value, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->insert('data');
$this->queryBuilder->values([
$column => $value,
@@ -990,7 +991,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testHaving($havingArguments, $expectedQueryPart, $expectedQuery) {
+ public function testHaving($havingArguments, $expectedQueryPart, $expectedQuery): void {
call_user_func_array(
[$this->queryBuilder, 'having'],
$havingArguments
@@ -1031,7 +1032,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testAndHaving($havingArguments, $expectedQueryPart, $expectedQuery) {
+ public function testAndHaving($havingArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->having('condition1');
call_user_func_array(
[$this->queryBuilder, 'andHaving'],
@@ -1073,7 +1074,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testOrHaving($havingArguments, $expectedQueryPart, $expectedQuery) {
+ public function testOrHaving($havingArguments, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->having('condition1');
call_user_func_array(
[$this->queryBuilder, 'orHaving'],
@@ -1107,7 +1108,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testOrderBy($sort, $order, $expectedQueryPart, $expectedQuery) {
+ public function testOrderBy($sort, $order, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->orderBy($sort, $order);
$this->assertEquals(
@@ -1144,7 +1145,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param array $expectedQueryPart
* @param string $expectedQuery
*/
- public function testAddOrderBy($sort2, $order2, $order1, $expectedQueryPart, $expectedQuery) {
+ public function testAddOrderBy($sort2, $order2, $order1, $expectedQueryPart, $expectedQuery): void {
$this->queryBuilder->orderBy('column1', $order1);
$this->queryBuilder->addOrderBy($sort2, $order2);
@@ -1159,7 +1160,7 @@ class QueryBuilderTest extends \Test\TestCase {
);
}
- public function testGetLastInsertId() {
+ public function testGetLastInsertId(): void {
$qB = $this->connection->getQueryBuilder();
try {
@@ -1222,7 +1223,7 @@ class QueryBuilderTest extends \Test\TestCase {
* @param bool $automatic
* @param string $expected
*/
- public function testGetTableName($tableName, $automatic, $expected) {
+ public function testGetTableName($tableName, $automatic, $expected): void {
if ($automatic !== null) {
$this->queryBuilder->automaticTablePrefix($automatic);
}
@@ -1246,23 +1247,36 @@ class QueryBuilderTest extends \Test\TestCase {
* @param string $prefix
* @param string $expected
*/
- public function testGetColumnName($column, $prefix, $expected) {
+ public function testGetColumnName($column, $prefix, $expected): void {
$this->assertSame(
$expected,
$this->queryBuilder->getColumnName($column, $prefix)
);
}
- public function testExecuteWithoutLogger() {
+ private function getConnection(): IDBConnection {
+ $connection = $this->createMock(IDBConnection::class);
+ $connection->method('executeStatement')
+ ->willReturn(3);
+ $connection->method('executeQuery')
+ ->willReturn($this->createMock(IResult::class));
+ return $connection;
+ }
+
+ public function testExecuteWithoutLogger(): void {
$queryBuilder = $this->createMock(\Doctrine\DBAL\Query\QueryBuilder::class);
$queryBuilder
- ->expects($this->once())
- ->method('execute')
- ->willReturn(3);
+ ->method('getSQL')
+ ->willReturn('');
$queryBuilder
- ->expects($this->any())
->method('getParameters')
->willReturn([]);
+ $queryBuilder
+ ->method('getParameterTypes')
+ ->willReturn([]);
+ $queryBuilder
+ ->method('getType')
+ ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::UPDATE);
$this->logger
->expects($this->never())
->method('debug');
@@ -1273,10 +1287,11 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn(false);
$this->invokePrivate($this->queryBuilder, 'queryBuilder', [$queryBuilder]);
+ $this->invokePrivate($this->queryBuilder, 'connection', [$this->getConnection()]);
$this->assertEquals(3, $this->queryBuilder->execute());
}
- public function testExecuteWithLoggerAndNamedArray() {
+ public function testExecuteWithLoggerAndNamedArray(): void {
$queryBuilder = $this->createMock(\Doctrine\DBAL\Query\QueryBuilder::class);
$queryBuilder
->expects($this->any())
@@ -1286,20 +1301,25 @@ class QueryBuilderTest extends \Test\TestCase {
'key' => 'value',
]);
$queryBuilder
+ ->method('getParameterTypes')
+ ->willReturn([
+ 'foo' => IQueryBuilder::PARAM_STR,
+ 'key' => IQueryBuilder::PARAM_STR,
+ ]);
+ $queryBuilder
+ ->method('getType')
+ ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::UPDATE);
+ $queryBuilder
->expects($this->any())
->method('getSQL')
- ->willReturn('SELECT * FROM FOO WHERE BAR = ?');
- $queryBuilder
- ->expects($this->once())
- ->method('execute')
- ->willReturn(3);
+ ->willReturn('UPDATE FOO SET bar = 1 WHERE BAR = ?');
$this->logger
->expects($this->once())
->method('debug')
->with(
'DB QueryBuilder: \'{query}\' with parameters: {params}',
[
- 'query' => 'SELECT * FROM FOO WHERE BAR = ?',
+ 'query' => 'UPDATE FOO SET bar = 1 WHERE BAR = ?',
'params' => 'foo => \'bar\', key => \'value\'',
'app' => 'core',
]
@@ -1311,30 +1331,33 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn(true);
$this->invokePrivate($this->queryBuilder, 'queryBuilder', [$queryBuilder]);
+ $this->invokePrivate($this->queryBuilder, 'connection', [$this->getConnection()]);
$this->assertEquals(3, $this->queryBuilder->execute());
}
- public function testExecuteWithLoggerAndUnnamedArray() {
+ public function testExecuteWithLoggerAndUnnamedArray(): void {
$queryBuilder = $this->createMock(\Doctrine\DBAL\Query\QueryBuilder::class);
$queryBuilder
->expects($this->any())
->method('getParameters')
->willReturn(['Bar']);
$queryBuilder
+ ->method('getParameterTypes')
+ ->willReturn([IQueryBuilder::PARAM_STR]);
+ $queryBuilder
+ ->method('getType')
+ ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::UPDATE);
+ $queryBuilder
->expects($this->any())
->method('getSQL')
- ->willReturn('SELECT * FROM FOO WHERE BAR = ?');
- $queryBuilder
- ->expects($this->once())
- ->method('execute')
- ->willReturn(3);
+ ->willReturn('UPDATE FOO SET bar = false WHERE BAR = ?');
$this->logger
->expects($this->once())
->method('debug')
->with(
'DB QueryBuilder: \'{query}\' with parameters: {params}',
[
- 'query' => 'SELECT * FROM FOO WHERE BAR = ?',
+ 'query' => 'UPDATE FOO SET bar = false WHERE BAR = ?',
'params' => '0 => \'Bar\'',
'app' => 'core',
]
@@ -1346,30 +1369,33 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn(true);
$this->invokePrivate($this->queryBuilder, 'queryBuilder', [$queryBuilder]);
+ $this->invokePrivate($this->queryBuilder, 'connection', [$this->getConnection()]);
$this->assertEquals(3, $this->queryBuilder->execute());
}
- public function testExecuteWithLoggerAndNoParams() {
+ public function testExecuteWithLoggerAndNoParams(): void {
$queryBuilder = $this->createMock(\Doctrine\DBAL\Query\QueryBuilder::class);
$queryBuilder
->expects($this->any())
->method('getParameters')
->willReturn([]);
$queryBuilder
+ ->method('getParameterTypes')
+ ->willReturn([]);
+ $queryBuilder
+ ->method('getType')
+ ->willReturn(\Doctrine\DBAL\Query\QueryBuilder::UPDATE);
+ $queryBuilder
->expects($this->any())
->method('getSQL')
- ->willReturn('SELECT * FROM FOO WHERE BAR = ?');
- $queryBuilder
- ->expects($this->once())
- ->method('execute')
- ->willReturn(3);
+ ->willReturn('UPDATE FOO SET bar = false WHERE BAR = ?');
$this->logger
->expects($this->once())
->method('debug')
->with(
'DB QueryBuilder: \'{query}\'',
[
- 'query' => 'SELECT * FROM FOO WHERE BAR = ?',
+ 'query' => 'UPDATE FOO SET bar = false WHERE BAR = ?',
'app' => 'core',
]
);
@@ -1380,10 +1406,11 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn(true);
$this->invokePrivate($this->queryBuilder, 'queryBuilder', [$queryBuilder]);
+ $this->invokePrivate($this->queryBuilder, 'connection', [$this->getConnection()]);
$this->assertEquals(3, $this->queryBuilder->execute());
}
- public function testExecuteWithParameterTooLarge() {
+ public function testExecuteWithParameterTooLarge(): void {
$queryBuilder = $this->createMock(\Doctrine\DBAL\Query\QueryBuilder::class);
$p = array_fill(0, 1001, 'foo');
$queryBuilder
@@ -1391,13 +1418,12 @@ class QueryBuilderTest extends \Test\TestCase {
->method('getParameters')
->willReturn([$p]);
$queryBuilder
+ ->method('getParameterTypes')
+ ->willReturn([IQueryBuilder::PARAM_STR_ARRAY]);
+ $queryBuilder
->expects($this->any())
->method('getSQL')
->willReturn('SELECT * FROM FOO WHERE BAR IN (?)');
- $queryBuilder
- ->expects($this->once())
- ->method('execute')
- ->willReturn($this->createMock(Result::class));
$this->logger
->expects($this->once())
->method('error')
@@ -1415,10 +1441,11 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn(false);
$this->invokePrivate($this->queryBuilder, 'queryBuilder', [$queryBuilder]);
+ $this->invokePrivate($this->queryBuilder, 'connection', [$this->getConnection()]);
$this->queryBuilder->execute();
}
- public function testExecuteWithParametersTooMany() {
+ public function testExecuteWithParametersTooMany(): void {
$queryBuilder = $this->createMock(\Doctrine\DBAL\Query\QueryBuilder::class);
$p = array_fill(0, 999, 'foo');
$queryBuilder
@@ -1426,13 +1453,12 @@ class QueryBuilderTest extends \Test\TestCase {
->method('getParameters')
->willReturn(array_fill(0, 66, $p));
$queryBuilder
+ ->method('getParameterTypes')
+ ->willReturn([IQueryBuilder::PARAM_STR_ARRAY]);
+ $queryBuilder
->expects($this->any())
->method('getSQL')
->willReturn('SELECT * FROM FOO WHERE BAR IN (?) OR BAR IN (?)');
- $queryBuilder
- ->expects($this->once())
- ->method('execute')
- ->willReturn($this->createMock(Result::class));
$this->logger
->expects($this->once())
->method('error')
@@ -1450,6 +1476,7 @@ class QueryBuilderTest extends \Test\TestCase {
->willReturn(false);
$this->invokePrivate($this->queryBuilder, 'queryBuilder', [$queryBuilder]);
+ $this->invokePrivate($this->queryBuilder, 'connection', [$this->getConnection()]);
$this->queryBuilder->execute();
}
}
diff --git a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php
index 12984bac3e0..3c2e33c28ea 100644
--- a/tests/lib/DB/QueryBuilder/QuoteHelperTest.php
+++ b/tests/lib/DB/QueryBuilder/QuoteHelperTest.php
@@ -41,7 +41,7 @@ class QuoteHelperTest extends \Test\TestCase {
* @param mixed $input
* @param string $expected
*/
- public function testQuoteColumnName($input, $expected) {
+ public function testQuoteColumnName($input, $expected): void {
$this->assertSame(
$expected,
$this->helper->quoteColumnName($input)
@@ -76,7 +76,7 @@ class QuoteHelperTest extends \Test\TestCase {
* @param mixed $input
* @param string $expected
*/
- public function testQuoteColumnNames($input, $expected) {
+ public function testQuoteColumnNames($input, $expected): void {
$this->assertSame(
$expected,
$this->helper->quoteColumnNames($input)
diff --git a/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php b/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php
new file mode 100644
index 00000000000..a135b9159dd
--- /dev/null
+++ b/tests/lib/DB/QueryBuilder/Sharded/SharedQueryBuilderTest.php
@@ -0,0 +1,128 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2024 Robin Appelman <robin@icewind.nl>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\DB\QueryBuilder\Sharded;
+
+use OC\DB\QueryBuilder\Sharded\AutoIncrementHandler;
+use OC\DB\QueryBuilder\Sharded\InvalidShardedQueryException;
+use OC\DB\QueryBuilder\Sharded\RoundRobinShardMapper;
+use OC\DB\QueryBuilder\Sharded\ShardConnectionManager;
+use OC\DB\QueryBuilder\Sharded\ShardDefinition;
+use OC\DB\QueryBuilder\Sharded\ShardedQueryBuilder;
+use OCP\DB\QueryBuilder\IQueryBuilder;
+use OCP\IDBConnection;
+use OCP\Server;
+use Test\TestCase;
+
+/**
+ * @group DB
+ */
+class SharedQueryBuilderTest extends TestCase {
+ private IDBConnection $connection;
+ private AutoIncrementHandler $autoIncrementHandler;
+
+ protected function setUp(): void {
+ if (PHP_INT_SIZE < 8) {
+ $this->markTestSkipped('Test requires 64bit');
+ }
+ $this->connection = Server::get(IDBConnection::class);
+ $this->autoIncrementHandler = Server::get(AutoIncrementHandler::class);
+ }
+
+
+ private function getQueryBuilder(string $table, string $shardColumn, string $primaryColumn, array $companionTables = []): ShardedQueryBuilder {
+ return new ShardedQueryBuilder(
+ $this->connection->getQueryBuilder(),
+ [
+ new ShardDefinition($table, $primaryColumn, [], $shardColumn, new RoundRobinShardMapper(), $companionTables, []),
+ ],
+ $this->createMock(ShardConnectionManager::class),
+ $this->autoIncrementHandler,
+ );
+ }
+
+ public function testGetShardKeySingleParam(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('fileid', 'path')
+ ->from('filecache')
+ ->where($query->expr()->eq('storage', $query->createNamedParameter(10, IQueryBuilder::PARAM_INT)));
+
+ $this->assertEquals([], $query->getPrimaryKeys());
+ $this->assertEquals([10], $query->getShardKeys());
+ }
+
+ public function testGetPrimaryKeyParam(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('fileid', 'path')
+ ->from('filecache')
+ ->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
+
+ $this->assertEquals([10, 11], $query->getPrimaryKeys());
+ $this->assertEquals([], $query->getShardKeys());
+ }
+
+ public function testValidateWithShardKey(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('fileid', 'path')
+ ->from('filecache')
+ ->where($query->expr()->eq('storage', $query->createNamedParameter(10)));
+
+ $query->validate();
+ $this->assertTrue(true);
+ }
+
+ public function testValidateWithPrimaryKey(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('fileid', 'path')
+ ->from('filecache')
+ ->where($query->expr()->in('fileid', $query->createNamedParameter([10, 11], IQueryBuilder::PARAM_INT)));
+
+ $query->validate();
+ $this->assertTrue(true);
+ }
+
+ public function testValidateWithNoKey(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('fileid', 'path')
+ ->from('filecache')
+ ->where($query->expr()->lt('size', $query->createNamedParameter(0)));
+
+ $this->expectException(InvalidShardedQueryException::class);
+ $query->validate();
+ $this->fail('exception expected');
+ }
+
+ public function testValidateNonSharedTable(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('configvalue')
+ ->from('appconfig')
+ ->where($query->expr()->eq('configkey', $query->createNamedParameter('test')));
+
+ $query->validate();
+ $this->assertTrue(true);
+ }
+
+ public function testGetShardKeyMultipleSingleParam(): void {
+ $query = $this->getQueryBuilder('filecache', 'storage', 'fileid');
+ $query->select('fileid', 'path')
+ ->from('filecache')
+ ->where($query->expr()->andX(
+ $query->expr()->gt('mtime', $query->createNamedParameter(0), IQueryBuilder::PARAM_INT),
+ $query->expr()->orX(
+ $query->expr()->eq('storage', $query->createNamedParameter(10, IQueryBuilder::PARAM_INT)),
+ $query->expr()->andX(
+ $query->expr()->eq('storage', $query->createNamedParameter(11, IQueryBuilder::PARAM_INT)),
+ $query->expr()->like('path', $query->createNamedParameter('foo/%'))
+ )
+ )
+ ));
+
+ $this->assertEquals([], $query->getPrimaryKeys());
+ $this->assertEquals([10, 11], $query->getShardKeys());
+ }
+}
diff --git a/tests/lib/DateTimeFormatterTest.php b/tests/lib/DateTimeFormatterTest.php
index fa8124ed35a..924cac9d399 100644
--- a/tests/lib/DateTimeFormatterTest.php
+++ b/tests/lib/DateTimeFormatterTest.php
@@ -77,8 +77,8 @@ class DateTimeFormatterTest extends TestCase {
/**
* @dataProvider formatTimeSpanData
*/
- public function testFormatTimeSpan($expected, $timestamp, $compare, $locale = null) {
- $this->assertEquals((string) $expected, (string) $this->formatter->formatTimeSpan($timestamp, $compare, $locale));
+ public function testFormatTimeSpan($expected, $timestamp, $compare, $locale = null): void {
+ $this->assertEquals((string)$expected, (string)$this->formatter->formatTimeSpan($timestamp, $compare, $locale));
}
public function formatDateSpanData() {
@@ -143,8 +143,8 @@ class DateTimeFormatterTest extends TestCase {
/**
* @dataProvider formatDateSpanData
*/
- public function testFormatDateSpan($expected, $timestamp, $compare = null, $locale = null) {
- $this->assertEquals((string) $expected, (string) $this->formatter->formatDateSpan($timestamp, $compare, $locale));
+ public function testFormatDateSpan($expected, $timestamp, $compare = null, $locale = null): void {
+ $this->assertEquals((string)$expected, (string)$this->formatter->formatDateSpan($timestamp, $compare, $locale));
}
public function formatDateData() {
@@ -156,8 +156,8 @@ class DateTimeFormatterTest extends TestCase {
/**
* @dataProvider formatDateData
*/
- public function testFormatDate($timestamp, $expected) {
- $this->assertEquals($expected, (string) $this->formatter->formatDate($timestamp));
+ public function testFormatDate($timestamp, $expected): void {
+ $this->assertEquals($expected, (string)$this->formatter->formatDate($timestamp));
}
public function formatDateTimeData() {
@@ -170,12 +170,12 @@ class DateTimeFormatterTest extends TestCase {
/**
* @dataProvider formatDateTimeData
*/
- public function testFormatDateTime($timestamp, $timeZone, $expected) {
- $this->assertEquals($expected, (string) $this->formatter->formatDateTime($timestamp, 'long', 'long', $timeZone));
+ public function testFormatDateTime($timestamp, $timeZone, $expected): void {
+ $this->assertEquals($expected, (string)$this->formatter->formatDateTime($timestamp, 'long', 'long', $timeZone));
}
- public function testFormatDateWithInvalidTZ() {
+ public function testFormatDateWithInvalidTZ(): void {
$this->expectException(\Exception::class);
$this->formatter->formatDate(1350129205, 'long', new \DateTimeZone('Mordor/Barad-dûr'));
diff --git a/tests/lib/Diagnostics/EventLoggerTest.php b/tests/lib/Diagnostics/EventLoggerTest.php
index e69a27d70b3..3ad13702679 100644
--- a/tests/lib/Diagnostics/EventLoggerTest.php
+++ b/tests/lib/Diagnostics/EventLoggerTest.php
@@ -27,11 +27,11 @@ class EventLoggerTest extends TestCase {
);
}
- public function testQueryLogger() {
+ public function testQueryLogger(): void {
// Module is not activated and this should not be logged
- $this->logger->start("test1", "testevent1");
- $this->logger->end("test1");
- $this->logger->log("test2", "testevent2", microtime(true), microtime(true));
+ $this->logger->start('test1', 'testevent1');
+ $this->logger->end('test1');
+ $this->logger->log('test2', 'testevent2', microtime(true), microtime(true));
$events = $this->logger->getEvents();
$this->assertSame(0, sizeof($events));
@@ -39,19 +39,19 @@ class EventLoggerTest extends TestCase {
$this->logger->activate();
// start one event
- $this->logger->start("test3", "testevent3");
+ $this->logger->start('test3', 'testevent3');
// force log of another event
- $this->logger->log("test4", "testevent4", microtime(true), microtime(true));
+ $this->logger->log('test4', 'testevent4', microtime(true), microtime(true));
// log started event
- $this->logger->end("test3");
+ $this->logger->end('test3');
$events = $this->logger->getEvents();
- $this->assertSame("test4", $events['test4']->getId());
- $this->assertSame("testevent4", $events['test4']->getDescription());
- $this->assertSame("test3", $events['test3']->getId());
- $this->assertSame("testevent3", $events['test3']->getDescription());
+ $this->assertSame('test4', $events['test4']->getId());
+ $this->assertSame('testevent4', $events['test4']->getDescription());
+ $this->assertSame('test3', $events['test3']->getId());
+ $this->assertSame('testevent3', $events['test3']->getDescription());
$this->assertSame(2, sizeof($events));
}
}
diff --git a/tests/lib/Diagnostics/QueryLoggerTest.php b/tests/lib/Diagnostics/QueryLoggerTest.php
index 4cc45cf47d4..6450c153b39 100644
--- a/tests/lib/Diagnostics/QueryLoggerTest.php
+++ b/tests/lib/Diagnostics/QueryLoggerTest.php
@@ -20,16 +20,16 @@ class QueryLoggerTest extends TestCase {
$this->logger = new QueryLogger();
}
- public function testQueryLogger() {
+ public function testQueryLogger(): void {
// Module is not activated and this should not be logged
- $this->logger->startQuery("SELECT", ["testuser", "count"], ["string", "int"]);
+ $this->logger->startQuery('SELECT', ['testuser', 'count'], ['string', 'int']);
$this->logger->stopQuery();
$queries = $this->logger->getQueries();
$this->assertSame(0, sizeof($queries));
// Activate module and log some query
$this->logger->activate();
- $this->logger->startQuery("SELECT", ["testuser", "count"], ["string", "int"]);
+ $this->logger->startQuery('SELECT', ['testuser', 'count'], ['string', 'int']);
$this->logger->stopQuery();
$queries = $this->logger->getQueries();
diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php
index 3dc2e464c37..d26817438cf 100644
--- a/tests/lib/DirectEditing/ManagerTest.php
+++ b/tests/lib/DirectEditing/ManagerTest.php
@@ -156,12 +156,12 @@ class ManagerTest extends TestCase {
$this->manager->registerDirectEditor($this->editor);
}
- public function testEditorRegistration() {
+ public function testEditorRegistration(): void {
$this->assertEquals($this->manager->getEditors(), ['testeditor' => $this->editor]);
}
- public function testCreateToken() {
+ public function testCreateToken(): void {
$expectedToken = 'TOKEN' . time();
$file = $this->createMock(File::class);
$file->expects($this->any())
@@ -186,7 +186,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($token, $expectedToken);
}
- public function testCreateTokenAccess() {
+ public function testCreateTokenAccess(): void {
$expectedToken = 'TOKEN' . time();
$file = $this->createMock(File::class);
$file->expects($this->any())
@@ -214,7 +214,7 @@ class ManagerTest extends TestCase {
$this->assertInstanceOf(NotFoundResponse::class, $secondResult);
}
- public function testOpenByPath() {
+ public function testOpenByPath(): void {
$expectedToken = 'TOKEN' . time();
$file = $this->createMock(File::class);
$file->expects($this->any())
@@ -245,7 +245,7 @@ class ManagerTest extends TestCase {
$this->assertInstanceOf(NotFoundResponse::class, $secondResult);
}
- public function testOpenById() {
+ public function testOpenById(): void {
$expectedToken = 'TOKEN' . time();
$fileRead = $this->createMock(File::class);
$fileRead->method('getPermissions')
@@ -294,7 +294,7 @@ class ManagerTest extends TestCase {
$this->assertInstanceOf(NotFoundResponse::class, $secondResult);
}
- public function testCreateFileAlreadyExists() {
+ public function testCreateFileAlreadyExists(): void {
$this->expectException(\RuntimeException::class);
$this->userFolder
->method('nodeExists')
diff --git a/tests/lib/EmojiHelperTest.php b/tests/lib/EmojiHelperTest.php
index 677cb03aae4..9ad56b32472 100644
--- a/tests/lib/EmojiHelperTest.php
+++ b/tests/lib/EmojiHelperTest.php
@@ -69,3080 +69,3080 @@ class EmojiHelperTest extends TestCase {
['$$', false],
// Extracted from spreed/node_modules/emojis-list/index.js
// https://github.com/Kikobeats/emojis-list/blob/master/index.js
- ["🀄️", true],
- ["🃏", true],
- ["🅰️", true],
- ["🅱️", true],
- ["🅾️", true],
- ["🅿️", true],
- ["🆎", true],
- ["🆑", true],
- ["🆒", true],
- ["🆓", true],
- ["🆔", true],
- ["🆕", true],
- ["🆖", true],
- ["🆗", true],
- ["🆘", true],
- ["🆙", true],
- ["🆚", true],
- ["🇦🇨", true],
- ["🇦🇩", true],
- ["🇦🇪", true],
- ["🇦🇫", true],
- ["🇦🇬", true],
- ["🇦🇮", true],
- ["🇦🇱", true],
- ["🇦🇲", true],
- ["🇦🇴", true],
- ["🇦🇶", true],
- ["🇦🇷", true],
- ["🇦🇸", true],
- ["🇦🇹", true],
- ["🇦🇺", true],
- ["🇦🇼", true],
- ["🇦🇽", true],
- ["🇦🇿", true],
- ["🇦", true],
- ["🇧🇦", true],
- ["🇧🇧", true],
- ["🇧🇩", true],
- ["🇧🇪", true],
- ["🇧🇫", true],
- ["🇧🇬", true],
- ["🇧🇭", true],
- ["🇧🇮", true],
- ["🇧🇯", true],
- ["🇧🇱", true],
- ["🇧🇲", true],
- ["🇧🇳", true],
- ["🇧🇴", true],
- ["🇧🇶", true],
- ["🇧🇷", true],
- ["🇧🇸", true],
- ["🇧🇹", true],
- ["🇧🇻", true],
- ["🇧🇼", true],
- ["🇧🇾", true],
- ["🇧🇿", true],
- ["🇧", true],
- ["🇨🇦", true],
- ["🇨🇨", true],
- ["🇨🇩", true],
- ["🇨🇫", true],
- ["🇨🇬", true],
- ["🇨🇭", true],
- ["🇨🇮", true],
- ["🇨🇰", true],
- ["🇨🇱", true],
- ["🇨🇲", true],
- ["🇨🇳", true],
- ["🇨🇴", true],
- ["🇨🇵", true],
- ["🇨🇷", true],
- ["🇨🇺", true],
- ["🇨🇻", true],
- ["🇨🇼", true],
- ["🇨🇽", true],
- ["🇨🇾", true],
- ["🇨🇿", true],
- ["🇨", true],
- ["🇩🇪", true],
- ["🇩🇬", true],
- ["🇩🇯", true],
- ["🇩🇰", true],
- ["🇩🇲", true],
- ["🇩🇴", true],
- ["🇩🇿", true],
- ["🇩", true],
- ["🇪🇦", true],
- ["🇪🇨", true],
- ["🇪🇪", true],
- ["🇪🇬", true],
- ["🇪🇭", true],
- ["🇪🇷", true],
- ["🇪🇸", true],
- ["🇪🇹", true],
- ["🇪🇺", true],
- ["🇪", true],
- ["🇫🇮", true],
- ["🇫🇯", true],
- ["🇫🇰", true],
- ["🇫🇲", true],
- ["🇫🇴", true],
- ["🇫🇷", true],
- ["🇫", true],
- ["🇬🇦", true],
- ["🇬🇧", true],
- ["🇬🇩", true],
- ["🇬🇪", true],
- ["🇬🇫", true],
- ["🇬🇬", true],
- ["🇬🇭", true],
- ["🇬🇮", true],
- ["🇬🇱", true],
- ["🇬🇲", true],
- ["🇬🇳", true],
- ["🇬🇵", true],
- ["🇬🇶", true],
- ["🇬🇷", true],
- ["🇬🇸", true],
- ["🇬🇹", true],
- ["🇬🇺", true],
- ["🇬🇼", true],
- ["🇬🇾", true],
- ["🇬", true],
- ["🇭🇰", true],
- ["🇭🇲", true],
- ["🇭🇳", true],
- ["🇭🇷", true],
- ["🇭🇹", true],
- ["🇭🇺", true],
- ["🇭", true],
- ["🇮🇨", true],
- ["🇮🇩", true],
- ["🇮🇪", true],
- ["🇮🇱", true],
- ["🇮🇲", true],
- ["🇮🇳", true],
- ["🇮🇴", true],
- ["🇮🇶", true],
- ["🇮🇷", true],
- ["🇮🇸", true],
- ["🇮🇹", true],
- ["🇮", true],
- ["🇯🇪", true],
- ["🇯🇲", true],
- ["🇯🇴", true],
- ["🇯🇵", true],
- ["🇯", true],
- ["🇰🇪", true],
- ["🇰🇬", true],
- ["🇰🇭", true],
- ["🇰🇮", true],
- ["🇰🇲", true],
- ["🇰🇳", true],
- ["🇰🇵", true],
- ["🇰🇷", true],
- ["🇰🇼", true],
- ["🇰🇾", true],
- ["🇰🇿", true],
- ["🇰", true],
- ["🇱🇦", true],
- ["🇱🇧", true],
- ["🇱🇨", true],
- ["🇱🇮", true],
- ["🇱🇰", true],
- ["🇱🇷", true],
- ["🇱🇸", true],
- ["🇱🇹", true],
- ["🇱🇺", true],
- ["🇱🇻", true],
- ["🇱🇾", true],
- ["🇱", true],
- ["🇲🇦", true],
- ["🇲🇨", true],
- ["🇲🇩", true],
- ["🇲🇪", true],
- ["🇲🇫", true],
- ["🇲🇬", true],
- ["🇲🇭", true],
- ["🇲🇰", true],
- ["🇲🇱", true],
- ["🇲🇲", true],
- ["🇲🇳", true],
- ["🇲🇴", true],
- ["🇲🇵", true],
- ["🇲🇶", true],
- ["🇲🇷", true],
- ["🇲🇸", true],
- ["🇲🇹", true],
- ["🇲🇺", true],
- ["🇲🇻", true],
- ["🇲🇼", true],
- ["🇲🇽", true],
- ["🇲🇾", true],
- ["🇲🇿", true],
- ["🇲", true],
- ["🇳🇦", true],
- ["🇳🇨", true],
- ["🇳🇪", true],
- ["🇳🇫", true],
- ["🇳🇬", true],
- ["🇳🇮", true],
- ["🇳🇱", true],
- ["🇳🇴", true],
- ["🇳🇵", true],
- ["🇳🇷", true],
- ["🇳🇺", true],
- ["🇳🇿", true],
- ["🇳", true],
- ["🇴🇲", true],
- ["🇴", true],
- ["🇵🇦", true],
- ["🇵🇪", true],
- ["🇵🇫", true],
- ["🇵🇬", true],
- ["🇵🇭", true],
- ["🇵🇰", true],
- ["🇵🇱", true],
- ["🇵🇲", true],
- ["🇵🇳", true],
- ["🇵🇷", true],
- ["🇵🇸", true],
- ["🇵🇹", true],
- ["🇵🇼", true],
- ["🇵🇾", true],
- ["🇵", true],
- ["🇶🇦", true],
- ["🇶", true],
- ["🇷🇪", true],
- ["🇷🇴", true],
- ["🇷🇸", true],
- ["🇷🇺", true],
- ["🇷🇼", true],
- ["🇷", true],
- ["🇸🇦", true],
- ["🇸🇧", true],
- ["🇸🇨", true],
- ["🇸🇩", true],
- ["🇸🇪", true],
- ["🇸🇬", true],
- ["🇸🇭", true],
- ["🇸🇮", true],
- ["🇸🇯", true],
- ["🇸🇰", true],
- ["🇸🇱", true],
- ["🇸🇲", true],
- ["🇸🇳", true],
- ["🇸🇴", true],
- ["🇸🇷", true],
- ["🇸🇸", true],
- ["🇸🇹", true],
- ["🇸🇻", true],
- ["🇸🇽", true],
- ["🇸🇾", true],
- ["🇸🇿", true],
- ["🇸", true],
- ["🇹🇦", true],
- ["🇹🇨", true],
- ["🇹🇩", true],
- ["🇹🇫", true],
- ["🇹🇬", true],
- ["🇹🇭", true],
- ["🇹🇯", true],
- ["🇹🇰", true],
- ["🇹🇱", true],
- ["🇹🇲", true],
- ["🇹🇳", true],
- ["🇹🇴", true],
- ["🇹🇷", true],
- ["🇹🇹", true],
- ["🇹🇻", true],
- ["🇹🇼", true],
- ["🇹🇿", true],
- ["🇹", true],
- ["🇺🇦", true],
- ["🇺🇬", true],
- ["🇺🇲", true],
- ["🇺🇳", true],
- ["🇺🇸", true],
- ["🇺🇾", true],
- ["🇺🇿", true],
- ["🇺", true],
- ["🇻🇦", true],
- ["🇻🇨", true],
- ["🇻🇪", true],
- ["🇻🇬", true],
- ["🇻🇮", true],
- ["🇻🇳", true],
- ["🇻🇺", true],
- ["🇻", true],
- ["🇼🇫", true],
- ["🇼🇸", true],
- ["🇼", true],
- ["🇽🇰", true],
- ["🇽", true],
- ["🇾🇪", true],
- ["🇾🇹", true],
- ["🇾", true],
- ["🇿🇦", true],
- ["🇿🇲", true],
- ["🇿🇼", true],
- ["🇿", true],
- ["🈁", true],
- ["🈂️", true],
- ["🈚️", true],
- ["🈯️", true],
- ["🈲", true],
- ["🈳", true],
- ["🈴", true],
- ["🈵", true],
- ["🈶", true],
- ["🈷️", true],
- ["🈸", true],
- ["🈹", true],
- ["🈺", true],
- ["🉐", true],
- ["🉑", true],
- ["🌀", true],
- ["🌁", true],
- ["🌂", true],
- ["🌃", true],
- ["🌄", true],
- ["🌅", true],
- ["🌆", true],
- ["🌇", true],
- ["🌈", true],
- ["🌉", true],
- ["🌊", true],
- ["🌋", true],
- ["🌌", true],
- ["🌍", true],
- ["🌎", true],
- ["🌏", true],
- ["🌐", true],
- ["🌑", true],
- ["🌒", true],
- ["🌓", true],
- ["🌔", true],
- ["🌕", true],
- ["🌖", true],
- ["🌗", true],
- ["🌘", true],
- ["🌙", true],
- ["🌚", true],
- ["🌛", true],
- ["🌜", true],
- ["🌝", true],
- ["🌞", true],
- ["🌟", true],
- ["🌠", true],
- ["🌡️", true],
- ["🌤️", true],
- ["🌥️", true],
- ["🌦️", true],
- ["🌧️", true],
- ["🌨️", true],
- ["🌩️", true],
- ["🌪️", true],
- ["🌫️", true],
- ["🌬️", true],
- ["🌭", true],
- ["🌮", true],
- ["🌯", true],
- ["🌰", true],
- ["🌱", true],
- ["🌲", true],
- ["🌳", true],
- ["🌴", true],
- ["🌵", true],
- ["🌶️", true],
- ["🌷", true],
- ["🌸", true],
- ["🌹", true],
- ["🌺", true],
- ["🌻", true],
- ["🌼", true],
- ["🌽", true],
- ["🌾", true],
- ["🌿", true],
- ["🍀", true],
- ["🍁", true],
- ["🍂", true],
- ["🍃", true],
- ["🍄", true],
- ["🍅", true],
- ["🍆", true],
- ["🍇", true],
- ["🍈", true],
- ["🍉", true],
- ["🍊", true],
- ["🍋", true],
- ["🍌", true],
- ["🍍", true],
- ["🍎", true],
- ["🍏", true],
- ["🍐", true],
- ["🍑", true],
- ["🍒", true],
- ["🍓", true],
- ["🍔", true],
- ["🍕", true],
- ["🍖", true],
- ["🍗", true],
- ["🍘", true],
- ["🍙", true],
- ["🍚", true],
- ["🍛", true],
- ["🍜", true],
- ["🍝", true],
- ["🍞", true],
- ["🍟", true],
- ["🍠", true],
- ["🍡", true],
- ["🍢", true],
- ["🍣", true],
- ["🍤", true],
- ["🍥", true],
- ["🍦", true],
- ["🍧", true],
- ["🍨", true],
- ["🍩", true],
- ["🍪", true],
- ["🍫", true],
- ["🍬", true],
- ["🍭", true],
- ["🍮", true],
- ["🍯", true],
- ["🍰", true],
- ["🍱", true],
- ["🍲", true],
- ["🍳", true],
- ["🍴", true],
- ["🍵", true],
- ["🍶", true],
- ["🍷", true],
- ["🍸", true],
- ["🍹", true],
- ["🍺", true],
- ["🍻", true],
- ["🍼", true],
- ["🍽️", true],
- ["🍾", true],
- ["🍿", true],
- ["🎀", true],
- ["🎁", true],
- ["🎂", true],
- ["🎃", true],
- ["🎄", true],
- ["🎅🏻", true],
- ["🎅🏼", true],
- ["🎅🏽", true],
- ["🎅🏾", true],
- ["🎅🏿", true],
- ["🎅", true],
- ["🎆", true],
- ["🎇", true],
- ["🎈", true],
- ["🎉", true],
- ["🎊", true],
- ["🎋", true],
- ["🎌", true],
- ["🎍", true],
- ["🎎", true],
- ["🎏", true],
- ["🎐", true],
- ["🎑", true],
- ["🎒", true],
- ["🎓", true],
- ["🎖️", true],
- ["🎗️", true],
- ["🎙️", true],
- ["🎚️", true],
- ["🎛️", true],
- ["🎞️", true],
- ["🎟️", true],
- ["🎠", true],
- ["🎡", true],
- ["🎢", true],
- ["🎣", true],
- ["🎤", true],
- ["🎥", true],
- ["🎦", true],
- ["🎧", true],
- ["🎨", true],
- ["🎩", true],
- ["🎪", true],
- ["🎫", true],
- ["🎬", true],
- ["🎭", true],
- ["🎮", true],
- ["🎯", true],
- ["🎰", true],
- ["🎱", true],
- ["🎲", true],
- ["🎳", true],
- ["🎴", true],
- ["🎵", true],
- ["🎶", true],
- ["🎷", true],
- ["🎸", true],
- ["🎹", true],
- ["🎺", true],
- ["🎻", true],
- ["🎼", true],
- ["🎽", true],
- ["🎾", true],
- ["🎿", true],
- ["🏀", true],
- ["🏁", true],
- ["🏂🏻", true],
- ["🏂🏼", true],
- ["🏂🏽", true],
- ["🏂🏾", true],
- ["🏂🏿", true],
- ["🏂", true],
- ["🏃🏻‍♀️", true],
- ["🏃🏻‍♂️", true],
- ["🏃🏻", true],
- ["🏃🏼‍♀️", true],
- ["🏃🏼‍♂️", true],
- ["🏃🏼", true],
- ["🏃🏽‍♀️", true],
- ["🏃🏽‍♂️", true],
- ["🏃🏽", true],
- ["🏃🏾‍♀️", true],
- ["🏃🏾‍♂️", true],
- ["🏃🏾", true],
- ["🏃🏿‍♀️", true],
- ["🏃🏿‍♂️", true],
- ["🏃🏿", true],
- ["🏃‍♀️", true],
- ["🏃‍♂️", true],
- ["🏃", true],
- ["🏄🏻‍♀️", true],
- ["🏄🏻‍♂️", true],
- ["🏄🏻", true],
- ["🏄🏼‍♀️", true],
- ["🏄🏼‍♂️", true],
- ["🏄🏼", true],
- ["🏄🏽‍♀️", true],
- ["🏄🏽‍♂️", true],
- ["🏄🏽", true],
- ["🏄🏾‍♀️", true],
- ["🏄🏾‍♂️", true],
- ["🏄🏾", true],
- ["🏄🏿‍♀️", true],
- ["🏄🏿‍♂️", true],
- ["🏄🏿", true],
- ["🏄‍♀️", true],
- ["🏄‍♂️", true],
- ["🏄", true],
- ["🏅", true],
- ["🏆", true],
- ["🏇🏻", true],
- ["🏇🏼", true],
- ["🏇🏽", true],
- ["🏇🏾", true],
- ["🏇🏿", true],
- ["🏇", true],
- ["🏈", true],
- ["🏉", true],
- ["🏊🏻‍♀️", true],
- ["🏊🏻‍♂️", true],
- ["🏊🏻", true],
- ["🏊🏼‍♀️", true],
- ["🏊🏼‍♂️", true],
- ["🏊🏼", true],
- ["🏊🏽‍♀️", true],
- ["🏊🏽‍♂️", true],
- ["🏊🏽", true],
- ["🏊🏾‍♀️", true],
- ["🏊🏾‍♂️", true],
- ["🏊🏾", true],
- ["🏊🏿‍♀️", true],
- ["🏊🏿‍♂️", true],
- ["🏊🏿", true],
- ["🏊‍♀️", true],
- ["🏊‍♂️", true],
- ["🏊", true],
- ["🏋🏻‍♀️", true],
- ["🏋🏻‍♂️", true],
- ["🏋🏻", true],
- ["🏋🏼‍♀️", true],
- ["🏋🏼‍♂️", true],
- ["🏋🏼", true],
- ["🏋🏽‍♀️", true],
- ["🏋🏽‍♂️", true],
- ["🏋🏽", true],
- ["🏋🏾‍♀️", true],
- ["🏋🏾‍♂️", true],
- ["🏋🏾", true],
- ["🏋🏿‍♀️", true],
- ["🏋🏿‍♂️", true],
- ["🏋🏿", true],
- ["🏋️‍♀️", true],
- ["🏋️‍♂️", true],
- ["🏋️", true],
- ["🏌🏻‍♀️", true],
- ["🏌🏻‍♂️", true],
- ["🏌🏻", true],
- ["🏌🏼‍♀️", true],
- ["🏌🏼‍♂️", true],
- ["🏌🏼", true],
- ["🏌🏽‍♀️", true],
- ["🏌🏽‍♂️", true],
- ["🏌🏽", true],
- ["🏌🏾‍♀️", true],
- ["🏌🏾‍♂️", true],
- ["🏌🏾", true],
- ["🏌🏿‍♀️", true],
- ["🏌🏿‍♂️", true],
- ["🏌🏿", true],
- ["🏌️‍♀️", true],
- ["🏌️‍♂️", true],
- ["🏌️", true],
- ["🏍️", true],
- ["🏎️", true],
- ["🏏", true],
- ["🏐", true],
- ["🏑", true],
- ["🏒", true],
- ["🏓", true],
- ["🏔️", true],
- ["🏕️", true],
- ["🏖️", true],
- ["🏗️", true],
- ["🏘️", true],
- ["🏙️", true],
- ["🏚️", true],
- ["🏛️", true],
- ["🏜️", true],
- ["🏝️", true],
- ["🏞️", true],
- ["🏟️", true],
- ["🏠", true],
- ["🏡", true],
- ["🏢", true],
- ["🏣", true],
- ["🏤", true],
- ["🏥", true],
- ["🏦", true],
- ["🏧", true],
- ["🏨", true],
- ["🏩", true],
- ["🏪", true],
- ["🏫", true],
- ["🏬", true],
- ["🏭", true],
- ["🏮", true],
- ["🏯", true],
- ["🏰", true],
- ["🏳️‍🌈", true],
- ["🏳️", true],
- ["🏴‍☠️", true],
- ["🏴󠁧󠁢󠁥󠁮󠁧󠁿", true],
- ["🏴󠁧󠁢󠁳󠁣󠁴󠁿", true],
- ["🏴󠁧󠁢󠁷󠁬󠁳󠁿", true],
- ["🏴", true],
- ["🏵️", true],
- ["🏷️", true],
- ["🏸", true],
- ["🏹", true],
- ["🏺", true],
- ["🏻", true],
- ["🏼", true],
- ["🏽", true],
- ["🏾", true],
- ["🏿", true],
- ["🐀", true],
- ["🐁", true],
- ["🐂", true],
- ["🐃", true],
- ["🐄", true],
- ["🐅", true],
- ["🐆", true],
- ["🐇", true],
- ["🐈", true],
- ["🐉", true],
- ["🐊", true],
- ["🐋", true],
- ["🐌", true],
- ["🐍", true],
- ["🐎", true],
- ["🐏", true],
- ["🐐", true],
- ["🐑", true],
- ["🐒", true],
- ["🐓", true],
- ["🐔", true],
- ["🐕‍🦺", true],
- ["🐕", true],
- ["🐖", true],
- ["🐗", true],
- ["🐘", true],
- ["🐙", true],
- ["🐚", true],
- ["🐛", true],
- ["🐜", true],
- ["🐝", true],
- ["🐞", true],
- ["🐟", true],
- ["🐠", true],
- ["🐡", true],
- ["🐢", true],
- ["🐣", true],
- ["🐤", true],
- ["🐥", true],
- ["🐦", true],
- ["🐧", true],
- ["🐨", true],
- ["🐩", true],
- ["🐪", true],
- ["🐫", true],
- ["🐬", true],
- ["🐭", true],
- ["🐮", true],
- ["🐯", true],
- ["🐰", true],
- ["🐱", true],
- ["🐲", true],
- ["🐳", true],
- ["🐴", true],
- ["🐵", true],
- ["🐶", true],
- ["🐷", true],
- ["🐸", true],
- ["🐹", true],
- ["🐺", true],
- ["🐻", true],
- ["🐼", true],
- ["🐽", true],
- ["🐾", true],
- ["🐿️", true],
- ["👀", true],
- ["👁‍🗨", true],
- ["👁️", true],
- ["👂🏻", true],
- ["👂🏼", true],
- ["👂🏽", true],
- ["👂🏾", true],
- ["👂🏿", true],
- ["👂", true],
- ["👃🏻", true],
- ["👃🏼", true],
- ["👃🏽", true],
- ["👃🏾", true],
- ["👃🏿", true],
- ["👃", true],
- ["👄", true],
- ["👅", true],
- ["👆🏻", true],
- ["👆🏼", true],
- ["👆🏽", true],
- ["👆🏾", true],
- ["👆🏿", true],
- ["👆", true],
- ["👇🏻", true],
- ["👇🏼", true],
- ["👇🏽", true],
- ["👇🏾", true],
- ["👇🏿", true],
- ["👇", true],
- ["👈🏻", true],
- ["👈🏼", true],
- ["👈🏽", true],
- ["👈🏾", true],
- ["👈🏿", true],
- ["👈", true],
- ["👉🏻", true],
- ["👉🏼", true],
- ["👉🏽", true],
- ["👉🏾", true],
- ["👉🏿", true],
- ["👉", true],
- ["👊🏻", true],
- ["👊🏼", true],
- ["👊🏽", true],
- ["👊🏾", true],
- ["👊🏿", true],
- ["👊", true],
- ["👋🏻", true],
- ["👋🏼", true],
- ["👋🏽", true],
- ["👋🏾", true],
- ["👋🏿", true],
- ["👋", true],
- ["👌🏻", true],
- ["👌🏼", true],
- ["👌🏽", true],
- ["👌🏾", true],
- ["👌🏿", true],
- ["👌", true],
- ["👍🏻", true],
- ["👍🏼", true],
- ["👍🏽", true],
- ["👍🏾", true],
- ["👍🏿", true],
- ["👍", true],
- ["👎🏻", true],
- ["👎🏼", true],
- ["👎🏽", true],
- ["👎🏾", true],
- ["👎🏿", true],
- ["👎", true],
- ["👏🏻", true],
- ["👏🏼", true],
- ["👏🏽", true],
- ["👏🏾", true],
- ["👏🏿", true],
- ["👏", true],
- ["👐🏻", true],
- ["👐🏼", true],
- ["👐🏽", true],
- ["👐🏾", true],
- ["👐🏿", true],
- ["👐", true],
- ["👑", true],
- ["👒", true],
- ["👓", true],
- ["👔", true],
- ["👕", true],
- ["👖", true],
- ["👗", true],
- ["👘", true],
- ["👙", true],
- ["👚", true],
- ["👛", true],
- ["👜", true],
- ["👝", true],
- ["👞", true],
- ["👟", true],
- ["👠", true],
- ["👡", true],
- ["👢", true],
- ["👣", true],
- ["👤", true],
- ["👥", true],
- ["👦🏻", true],
- ["👦🏼", true],
- ["👦🏽", true],
- ["👦🏾", true],
- ["👦🏿", true],
- ["👦", true],
- ["👧🏻", true],
- ["👧🏼", true],
- ["👧🏽", true],
- ["👧🏾", true],
- ["👧🏿", true],
- ["👧", true],
- ["👨🏻‍🌾", true],
- ["👨🏻‍🍳", true],
- ["👨🏻‍🎓", true],
- ["👨🏻‍🎤", true],
- ["👨🏻‍🎨", true],
- ["👨🏻‍🏫", true],
- ["👨🏻‍🏭", true],
- ["👨🏻‍💻", true],
- ["👨🏻‍💼", true],
- ["👨🏻‍🔧", true],
- ["👨🏻‍🔬", true],
- ["👨🏻‍🚀", true],
- ["👨🏻‍🚒", true],
- ["👨🏻‍🦯", true],
- ["👨🏻‍🦰", true],
- ["👨🏻‍🦱", true],
- ["👨🏻‍🦲", true],
- ["👨🏻‍🦳", true],
- ["👨🏻‍🦼", true],
- ["👨🏻‍🦽", true],
- ["👨🏻‍⚕️", true],
- ["👨🏻‍⚖️", true],
- ["👨🏻‍✈️", true],
- ["👨🏻", true],
- ["👨🏼‍🌾", true],
- ["👨🏼‍🍳", true],
- ["👨🏼‍🎓", true],
- ["👨🏼‍🎤", true],
- ["👨🏼‍🎨", true],
- ["👨🏼‍🏫", true],
- ["👨🏼‍🏭", true],
- ["👨🏼‍💻", true],
- ["👨🏼‍💼", true],
- ["👨🏼‍🔧", true],
- ["👨🏼‍🔬", true],
- ["👨🏼‍🚀", true],
- ["👨🏼‍🚒", true],
- ["👨🏼‍🤝‍👨🏻", true],
- ["👨🏼‍🦯", true],
- ["👨🏼‍🦰", true],
- ["👨🏼‍🦱", true],
- ["👨🏼‍🦲", true],
- ["👨🏼‍🦳", true],
- ["👨🏼‍🦼", true],
- ["👨🏼‍🦽", true],
- ["👨🏼‍⚕️", true],
- ["👨🏼‍⚖️", true],
- ["👨🏼‍✈️", true],
- ["👨🏼", true],
- ["👨🏽‍🌾", true],
- ["👨🏽‍🍳", true],
- ["👨🏽‍🎓", true],
- ["👨🏽‍🎤", true],
- ["👨🏽‍🎨", true],
- ["👨🏽‍🏫", true],
- ["👨🏽‍🏭", true],
- ["👨🏽‍💻", true],
- ["👨🏽‍💼", true],
- ["👨🏽‍🔧", true],
- ["👨🏽‍🔬", true],
- ["👨🏽‍🚀", true],
- ["👨🏽‍🚒", true],
- ["👨🏽‍🤝‍👨🏻", true],
- ["👨🏽‍🤝‍👨🏼", true],
- ["👨🏽‍🦯", true],
- ["👨🏽‍🦰", true],
- ["👨🏽‍🦱", true],
- ["👨🏽‍🦲", true],
- ["👨🏽‍🦳", true],
- ["👨🏽‍🦼", true],
- ["👨🏽‍🦽", true],
- ["👨🏽‍⚕️", true],
- ["👨🏽‍⚖️", true],
- ["👨🏽‍✈️", true],
- ["👨🏽", true],
- ["👨🏾‍🌾", true],
- ["👨🏾‍🍳", true],
- ["👨🏾‍🎓", true],
- ["👨🏾‍🎤", true],
- ["👨🏾‍🎨", true],
- ["👨🏾‍🏫", true],
- ["👨🏾‍🏭", true],
- ["👨🏾‍💻", true],
- ["👨🏾‍💼", true],
- ["👨🏾‍🔧", true],
- ["👨🏾‍🔬", true],
- ["👨🏾‍🚀", true],
- ["👨🏾‍🚒", true],
- ["👨🏾‍🤝‍👨🏻", true],
- ["👨🏾‍🤝‍👨🏼", true],
- ["👨🏾‍🤝‍👨🏽", true],
- ["👨🏾‍🦯", true],
- ["👨🏾‍🦰", true],
- ["👨🏾‍🦱", true],
- ["👨🏾‍🦲", true],
- ["👨🏾‍🦳", true],
- ["👨🏾‍🦼", true],
- ["👨🏾‍🦽", true],
- ["👨🏾‍⚕️", true],
- ["👨🏾‍⚖️", true],
- ["👨🏾‍✈️", true],
- ["👨🏾", true],
- ["👨🏿‍🌾", true],
- ["👨🏿‍🍳", true],
- ["👨🏿‍🎓", true],
- ["👨🏿‍🎤", true],
- ["👨🏿‍🎨", true],
- ["👨🏿‍🏫", true],
- ["👨🏿‍🏭", true],
- ["👨🏿‍💻", true],
- ["👨🏿‍💼", true],
- ["👨🏿‍🔧", true],
- ["👨🏿‍🔬", true],
- ["👨🏿‍🚀", true],
- ["👨🏿‍🚒", true],
- ["👨🏿‍🤝‍👨🏻", true],
- ["👨🏿‍🤝‍👨🏼", true],
- ["👨🏿‍🤝‍👨🏽", true],
- ["👨🏿‍🤝‍👨🏾", true],
- ["👨🏿‍🦯", true],
- ["👨🏿‍🦰", true],
- ["👨🏿‍🦱", true],
- ["👨🏿‍🦲", true],
- ["👨🏿‍🦳", true],
- ["👨🏿‍🦼", true],
- ["👨🏿‍🦽", true],
- ["👨🏿‍⚕️", true],
- ["👨🏿‍⚖️", true],
- ["👨🏿‍✈️", true],
- ["👨🏿", true],
- ["👨‍🌾", true],
- ["👨‍🍳", true],
- ["👨‍🎓", true],
- ["👨‍🎤", true],
- ["👨‍🎨", true],
- ["👨‍🏫", true],
- ["👨‍🏭", true],
- ["👨‍👦‍👦", true],
- ["👨‍👦", true],
- ["👨‍👧‍👦", true],
- ["👨‍👧‍👧", true],
- ["👨‍👧", true],
- ["👨‍👨‍👦‍👦", true],
- ["👨‍👨‍👦", true],
- ["👨‍👨‍👧‍👦", true],
- ["👨‍👨‍👧‍👧", true],
- ["👨‍👨‍👧", true],
- ["👨‍👩‍👦‍👦", true],
- ["👨‍👩‍👦", true],
- ["👨‍👩‍👧‍👦", true],
- ["👨‍👩‍👧‍👧", true],
- ["👨‍👩‍👧", true],
- ["👨‍💻", true],
- ["👨‍💼", true],
- ["👨‍🔧", true],
- ["👨‍🔬", true],
- ["👨‍🚀", true],
- ["👨‍🚒", true],
- ["👨‍🦯", true],
- ["👨‍🦰", true],
- ["👨‍🦱", true],
- ["👨‍🦲", true],
- ["👨‍🦳", true],
- ["👨‍🦼", true],
- ["👨‍🦽", true],
- ["👨‍⚕️", true],
- ["👨‍⚖️", true],
- ["👨‍✈️", true],
- ["👨‍❤️‍👨", true],
- ["👨‍❤️‍💋‍👨", true],
- ["👨", true],
- ["👩🏻‍🌾", true],
- ["👩🏻‍🍳", true],
- ["👩🏻‍🎓", true],
- ["👩🏻‍🎤", true],
- ["👩🏻‍🎨", true],
- ["👩🏻‍🏫", true],
- ["👩🏻‍🏭", true],
- ["👩🏻‍💻", true],
- ["👩🏻‍💼", true],
- ["👩🏻‍🔧", true],
- ["👩🏻‍🔬", true],
- ["👩🏻‍🚀", true],
- ["👩🏻‍🚒", true],
- ["👩🏻‍🤝‍👨🏼", true],
- ["👩🏻‍🤝‍👨🏽", true],
- ["👩🏻‍🤝‍👨🏾", true],
- ["👩🏻‍🤝‍👨🏿", true],
- ["👩🏻‍🦯", true],
- ["👩🏻‍🦰", true],
- ["👩🏻‍🦱", true],
- ["👩🏻‍🦲", true],
- ["👩🏻‍🦳", true],
- ["👩🏻‍🦼", true],
- ["👩🏻‍🦽", true],
- ["👩🏻‍⚕️", true],
- ["👩🏻‍⚖️", true],
- ["👩🏻‍✈️", true],
- ["👩🏻", true],
- ["👩🏼‍🌾", true],
- ["👩🏼‍🍳", true],
- ["👩🏼‍🎓", true],
- ["👩🏼‍🎤", true],
- ["👩🏼‍🎨", true],
- ["👩🏼‍🏫", true],
- ["👩🏼‍🏭", true],
- ["👩🏼‍💻", true],
- ["👩🏼‍💼", true],
- ["👩🏼‍🔧", true],
- ["👩🏼‍🔬", true],
- ["👩🏼‍🚀", true],
- ["👩🏼‍🚒", true],
- ["👩🏼‍🤝‍👨🏻", true],
- ["👩🏼‍🤝‍👨🏽", true],
- ["👩🏼‍🤝‍👨🏾", true],
- ["👩🏼‍🤝‍👨🏿", true],
- ["👩🏼‍🤝‍👩🏻", true],
- ["👩🏼‍🦯", true],
- ["👩🏼‍🦰", true],
- ["👩🏼‍🦱", true],
- ["👩🏼‍🦲", true],
- ["👩🏼‍🦳", true],
- ["👩🏼‍🦼", true],
- ["👩🏼‍🦽", true],
- ["👩🏼‍⚕️", true],
- ["👩🏼‍⚖️", true],
- ["👩🏼‍✈️", true],
- ["👩🏼", true],
- ["👩🏽‍🌾", true],
- ["👩🏽‍🍳", true],
- ["👩🏽‍🎓", true],
- ["👩🏽‍🎤", true],
- ["👩🏽‍🎨", true],
- ["👩🏽‍🏫", true],
- ["👩🏽‍🏭", true],
- ["👩🏽‍💻", true],
- ["👩🏽‍💼", true],
- ["👩🏽‍🔧", true],
- ["👩🏽‍🔬", true],
- ["👩🏽‍🚀", true],
- ["👩🏽‍🚒", true],
- ["👩🏽‍🤝‍👨🏻", true],
- ["👩🏽‍🤝‍👨🏼", true],
- ["👩🏽‍🤝‍👨🏾", true],
- ["👩🏽‍🤝‍👨🏿", true],
- ["👩🏽‍🤝‍👩🏻", true],
- ["👩🏽‍🤝‍👩🏼", true],
- ["👩🏽‍🦯", true],
- ["👩🏽‍🦰", true],
- ["👩🏽‍🦱", true],
- ["👩🏽‍🦲", true],
- ["👩🏽‍🦳", true],
- ["👩🏽‍🦼", true],
- ["👩🏽‍🦽", true],
- ["👩🏽‍⚕️", true],
- ["👩🏽‍⚖️", true],
- ["👩🏽‍✈️", true],
- ["👩🏽", true],
- ["👩🏾‍🌾", true],
- ["👩🏾‍🍳", true],
- ["👩🏾‍🎓", true],
- ["👩🏾‍🎤", true],
- ["👩🏾‍🎨", true],
- ["👩🏾‍🏫", true],
- ["👩🏾‍🏭", true],
- ["👩🏾‍💻", true],
- ["👩🏾‍💼", true],
- ["👩🏾‍🔧", true],
- ["👩🏾‍🔬", true],
- ["👩🏾‍🚀", true],
- ["👩🏾‍🚒", true],
- ["👩🏾‍🤝‍👨🏻", true],
- ["👩🏾‍🤝‍👨🏼", true],
- ["👩🏾‍🤝‍👨🏽", true],
- ["👩🏾‍🤝‍👨🏿", true],
- ["👩🏾‍🤝‍👩🏻", true],
- ["👩🏾‍🤝‍👩🏼", true],
- ["👩🏾‍🤝‍👩🏽", true],
- ["👩🏾‍🦯", true],
- ["👩🏾‍🦰", true],
- ["👩🏾‍🦱", true],
- ["👩🏾‍🦲", true],
- ["👩🏾‍🦳", true],
- ["👩🏾‍🦼", true],
- ["👩🏾‍🦽", true],
- ["👩🏾‍⚕️", true],
- ["👩🏾‍⚖️", true],
- ["👩🏾‍✈️", true],
- ["👩🏾", true],
- ["👩🏿‍🌾", true],
- ["👩🏿‍🍳", true],
- ["👩🏿‍🎓", true],
- ["👩🏿‍🎤", true],
- ["👩🏿‍🎨", true],
- ["👩🏿‍🏫", true],
- ["👩🏿‍🏭", true],
- ["👩🏿‍💻", true],
- ["👩🏿‍💼", true],
- ["👩🏿‍🔧", true],
- ["👩🏿‍🔬", true],
- ["👩🏿‍🚀", true],
- ["👩🏿‍🚒", true],
- ["👩🏿‍🤝‍👨🏻", true],
- ["👩🏿‍🤝‍👨🏼", true],
- ["👩🏿‍🤝‍👨🏽", true],
- ["👩🏿‍🤝‍👨🏾", true],
- ["👩🏿‍🤝‍👩🏻", true],
- ["👩🏿‍🤝‍👩🏼", true],
- ["👩🏿‍🤝‍👩🏽", true],
- ["👩🏿‍🤝‍👩🏾", true],
- ["👩🏿‍🦯", true],
- ["👩🏿‍🦰", true],
- ["👩🏿‍🦱", true],
- ["👩🏿‍🦲", true],
- ["👩🏿‍🦳", true],
- ["👩🏿‍🦼", true],
- ["👩🏿‍🦽", true],
- ["👩🏿‍⚕️", true],
- ["👩🏿‍⚖️", true],
- ["👩🏿‍✈️", true],
- ["👩🏿", true],
- ["👩‍🌾", true],
- ["👩‍🍳", true],
- ["👩‍🎓", true],
- ["👩‍🎤", true],
- ["👩‍🎨", true],
- ["👩‍🏫", true],
- ["👩‍🏭", true],
- ["👩‍👦‍👦", true],
- ["👩‍👦", true],
- ["👩‍👧‍👦", true],
- ["👩‍👧‍👧", true],
- ["👩‍👧", true],
- ["👩‍👩‍👦‍👦", true],
- ["👩‍👩‍👦", true],
- ["👩‍👩‍👧‍👦", true],
- ["👩‍👩‍👧‍👧", true],
- ["👩‍👩‍👧", true],
- ["👩‍💻", true],
- ["👩‍💼", true],
- ["👩‍🔧", true],
- ["👩‍🔬", true],
- ["👩‍🚀", true],
- ["👩‍🚒", true],
- ["👩‍🦯", true],
- ["👩‍🦰", true],
- ["👩‍🦱", true],
- ["👩‍🦲", true],
- ["👩‍🦳", true],
- ["👩‍🦼", true],
- ["👩‍🦽", true],
- ["👩‍⚕️", true],
- ["👩‍⚖️", true],
- ["👩‍✈️", true],
- ["👩‍❤️‍👨", true],
- ["👩‍❤️‍👩", true],
- ["👩‍❤️‍💋‍👨", true],
- ["👩‍❤️‍💋‍👩", true],
- ["👩", true],
- ["👪", true],
- ["👫🏻", true],
- ["👫🏼", true],
- ["👫🏽", true],
- ["👫🏾", true],
- ["👫🏿", true],
- ["👫", true],
- ["👬🏻", true],
- ["👬🏼", true],
- ["👬🏽", true],
- ["👬🏾", true],
- ["👬🏿", true],
- ["👬", true],
- ["👭🏻", true],
- ["👭🏼", true],
- ["👭🏽", true],
- ["👭🏾", true],
- ["👭🏿", true],
- ["👭", true],
- ["👮🏻‍♀️", true],
- ["👮🏻‍♂️", true],
- ["👮🏻", true],
- ["👮🏼‍♀️", true],
- ["👮🏼‍♂️", true],
- ["👮🏼", true],
- ["👮🏽‍♀️", true],
- ["👮🏽‍♂️", true],
- ["👮🏽", true],
- ["👮🏾‍♀️", true],
- ["👮🏾‍♂️", true],
- ["👮🏾", true],
- ["👮🏿‍♀️", true],
- ["👮🏿‍♂️", true],
- ["👮🏿", true],
- ["👮‍♀️", true],
- ["👮‍♂️", true],
- ["👮", true],
- ["👯‍♀️", true],
- ["👯‍♂️", true],
- ["👯", true],
- ["👰🏻", true],
- ["👰🏼", true],
- ["👰🏽", true],
- ["👰🏾", true],
- ["👰🏿", true],
- ["👰", true],
- ["👱🏻‍♀️", true],
- ["👱🏻‍♂️", true],
- ["👱🏻", true],
- ["👱🏼‍♀️", true],
- ["👱🏼‍♂️", true],
- ["👱🏼", true],
- ["👱🏽‍♀️", true],
- ["👱🏽‍♂️", true],
- ["👱🏽", true],
- ["👱🏾‍♀️", true],
- ["👱🏾‍♂️", true],
- ["👱🏾", true],
- ["👱🏿‍♀️", true],
- ["👱🏿‍♂️", true],
- ["👱🏿", true],
- ["👱‍♀️", true],
- ["👱‍♂️", true],
- ["👱", true],
- ["👲🏻", true],
- ["👲🏼", true],
- ["👲🏽", true],
- ["👲🏾", true],
- ["👲🏿", true],
- ["👲", true],
- ["👳🏻‍♀️", true],
- ["👳🏻‍♂️", true],
- ["👳🏻", true],
- ["👳🏼‍♀️", true],
- ["👳🏼‍♂️", true],
- ["👳🏼", true],
- ["👳🏽‍♀️", true],
- ["👳🏽‍♂️", true],
- ["👳🏽", true],
- ["👳🏾‍♀️", true],
- ["👳🏾‍♂️", true],
- ["👳🏾", true],
- ["👳🏿‍♀️", true],
- ["👳🏿‍♂️", true],
- ["👳🏿", true],
- ["👳‍♀️", true],
- ["👳‍♂️", true],
- ["👳", true],
- ["👴🏻", true],
- ["👴🏼", true],
- ["👴🏽", true],
- ["👴🏾", true],
- ["👴🏿", true],
- ["👴", true],
- ["👵🏻", true],
- ["👵🏼", true],
- ["👵🏽", true],
- ["👵🏾", true],
- ["👵🏿", true],
- ["👵", true],
- ["👶🏻", true],
- ["👶🏼", true],
- ["👶🏽", true],
- ["👶🏾", true],
- ["👶🏿", true],
- ["👶", true],
- ["👷🏻‍♀️", true],
- ["👷🏻‍♂️", true],
- ["👷🏻", true],
- ["👷🏼‍♀️", true],
- ["👷🏼‍♂️", true],
- ["👷🏼", true],
- ["👷🏽‍♀️", true],
- ["👷🏽‍♂️", true],
- ["👷🏽", true],
- ["👷🏾‍♀️", true],
- ["👷🏾‍♂️", true],
- ["👷🏾", true],
- ["👷🏿‍♀️", true],
- ["👷🏿‍♂️", true],
- ["👷🏿", true],
- ["👷‍♀️", true],
- ["👷‍♂️", true],
- ["👷", true],
- ["👸🏻", true],
- ["👸🏼", true],
- ["👸🏽", true],
- ["👸🏾", true],
- ["👸🏿", true],
- ["👸", true],
- ["👹", true],
- ["👺", true],
- ["👻", true],
- ["👼🏻", true],
- ["👼🏼", true],
- ["👼🏽", true],
- ["👼🏾", true],
- ["👼🏿", true],
- ["👼", true],
- ["👽", true],
- ["👾", true],
- ["👿", true],
- ["💀", true],
- ["💁🏻‍♀️", true],
- ["💁🏻‍♂️", true],
- ["💁🏻", true],
- ["💁🏼‍♀️", true],
- ["💁🏼‍♂️", true],
- ["💁🏼", true],
- ["💁🏽‍♀️", true],
- ["💁🏽‍♂️", true],
- ["💁🏽", true],
- ["💁🏾‍♀️", true],
- ["💁🏾‍♂️", true],
- ["💁🏾", true],
- ["💁🏿‍♀️", true],
- ["💁🏿‍♂️", true],
- ["💁🏿", true],
- ["💁‍♀️", true],
- ["💁‍♂️", true],
- ["💁", true],
- ["💂🏻‍♀️", true],
- ["💂🏻‍♂️", true],
- ["💂🏻", true],
- ["💂🏼‍♀️", true],
- ["💂🏼‍♂️", true],
- ["💂🏼", true],
- ["💂🏽‍♀️", true],
- ["💂🏽‍♂️", true],
- ["💂🏽", true],
- ["💂🏾‍♀️", true],
- ["💂🏾‍♂️", true],
- ["💂🏾", true],
- ["💂🏿‍♀️", true],
- ["💂🏿‍♂️", true],
- ["💂🏿", true],
- ["💂‍♀️", true],
- ["💂‍♂️", true],
- ["💂", true],
- ["💃🏻", true],
- ["💃🏼", true],
- ["💃🏽", true],
- ["💃🏾", true],
- ["💃🏿", true],
- ["💃", true],
- ["💄", true],
- ["💅🏻", true],
- ["💅🏼", true],
- ["💅🏽", true],
- ["💅🏾", true],
- ["💅🏿", true],
- ["💅", true],
- ["💆🏻‍♀️", true],
- ["💆🏻‍♂️", true],
- ["💆🏻", true],
- ["💆🏼‍♀️", true],
- ["💆🏼‍♂️", true],
- ["💆🏼", true],
- ["💆🏽‍♀️", true],
- ["💆🏽‍♂️", true],
- ["💆🏽", true],
- ["💆🏾‍♀️", true],
- ["💆🏾‍♂️", true],
- ["💆🏾", true],
- ["💆🏿‍♀️", true],
- ["💆🏿‍♂️", true],
- ["💆🏿", true],
- ["💆‍♀️", true],
- ["💆‍♂️", true],
- ["💆", true],
- ["💇🏻‍♀️", true],
- ["💇🏻‍♂️", true],
- ["💇🏻", true],
- ["💇🏼‍♀️", true],
- ["💇🏼‍♂️", true],
- ["💇🏼", true],
- ["💇🏽‍♀️", true],
- ["💇🏽‍♂️", true],
- ["💇🏽", true],
- ["💇🏾‍♀️", true],
- ["💇🏾‍♂️", true],
- ["💇🏾", true],
- ["💇🏿‍♀️", true],
- ["💇🏿‍♂️", true],
- ["💇🏿", true],
- ["💇‍♀️", true],
- ["💇‍♂️", true],
- ["💇", true],
- ["💈", true],
- ["💉", true],
- ["💊", true],
- ["💋", true],
- ["💌", true],
- ["💍", true],
- ["💎", true],
- ["💏", true],
- ["💐", true],
- ["💑", true],
- ["💒", true],
- ["💓", true],
- ["💔", true],
- ["💕", true],
- ["💖", true],
- ["💗", true],
- ["💘", true],
- ["💙", true],
- ["💚", true],
- ["💛", true],
- ["💜", true],
- ["💝", true],
- ["💞", true],
- ["💟", true],
- ["💠", true],
- ["💡", true],
- ["💢", true],
- ["💣", true],
- ["💤", true],
- ["💥", true],
- ["💦", true],
- ["💧", true],
- ["💨", true],
- ["💩", true],
- ["💪🏻", true],
- ["💪🏼", true],
- ["💪🏽", true],
- ["💪🏾", true],
- ["💪🏿", true],
- ["💪", true],
- ["💫", true],
- ["💬", true],
- ["💭", true],
- ["💮", true],
- ["💯", true],
- ["💰", true],
- ["💱", true],
- ["💲", true],
- ["💳", true],
- ["💴", true],
- ["💵", true],
- ["💶", true],
- ["💷", true],
- ["💸", true],
- ["💹", true],
- ["💺", true],
- ["💻", true],
- ["💼", true],
- ["💽", true],
- ["💾", true],
- ["💿", true],
- ["📀", true],
- ["📁", true],
- ["📂", true],
- ["📃", true],
- ["📄", true],
- ["📅", true],
- ["📆", true],
- ["📇", true],
- ["📈", true],
- ["📉", true],
- ["📊", true],
- ["📋", true],
- ["📌", true],
- ["📍", true],
- ["📎", true],
- ["📏", true],
- ["📐", true],
- ["📑", true],
- ["📒", true],
- ["📓", true],
- ["📔", true],
- ["📕", true],
- ["📖", true],
- ["📗", true],
- ["📘", true],
- ["📙", true],
- ["📚", true],
- ["📛", true],
- ["📜", true],
- ["📝", true],
- ["📞", true],
- ["📟", true],
- ["📠", true],
- ["📡", true],
- ["📢", true],
- ["📣", true],
- ["📤", true],
- ["📥", true],
- ["📦", true],
- ["📧", true],
- ["📨", true],
- ["📩", true],
- ["📪", true],
- ["📫", true],
- ["📬", true],
- ["📭", true],
- ["📮", true],
- ["📯", true],
- ["📰", true],
- ["📱", true],
- ["📲", true],
- ["📳", true],
- ["📴", true],
- ["📵", true],
- ["📶", true],
- ["📷", true],
- ["📸", true],
- ["📹", true],
- ["📺", true],
- ["📻", true],
- ["📼", true],
- ["📽️", true],
- ["📿", true],
- ["🔀", true],
- ["🔁", true],
- ["🔂", true],
- ["🔃", true],
- ["🔄", true],
- ["🔅", true],
- ["🔆", true],
- ["🔇", true],
- ["🔈", true],
- ["🔉", true],
- ["🔊", true],
- ["🔋", true],
- ["🔌", true],
- ["🔍", true],
- ["🔎", true],
- ["🔏", true],
- ["🔐", true],
- ["🔑", true],
- ["🔒", true],
- ["🔓", true],
- ["🔔", true],
- ["🔕", true],
- ["🔖", true],
- ["🔗", true],
- ["🔘", true],
- ["🔙", true],
- ["🔚", true],
- ["🔛", true],
- ["🔜", true],
- ["🔝", true],
- ["🔞", true],
- ["🔟", true],
- ["🔠", true],
- ["🔡", true],
- ["🔢", true],
- ["🔣", true],
- ["🔤", true],
- ["🔥", true],
- ["🔦", true],
- ["🔧", true],
- ["🔨", true],
- ["🔩", true],
- ["🔪", true],
- ["🔫", true],
- ["🔬", true],
- ["🔭", true],
- ["🔮", true],
- ["🔯", true],
- ["🔰", true],
- ["🔱", true],
- ["🔲", true],
- ["🔳", true],
- ["🔴", true],
- ["🔵", true],
- ["🔶", true],
- ["🔷", true],
- ["🔸", true],
- ["🔹", true],
- ["🔺", true],
- ["🔻", true],
- ["🔼", true],
- ["🔽", true],
- ["🕉️", true],
- ["🕊️", true],
- ["🕋", true],
- ["🕌", true],
- ["🕍", true],
- ["🕎", true],
- ["🕐", true],
- ["🕑", true],
- ["🕒", true],
- ["🕓", true],
- ["🕔", true],
- ["🕕", true],
- ["🕖", true],
- ["🕗", true],
- ["🕘", true],
- ["🕙", true],
- ["🕚", true],
- ["🕛", true],
- ["🕜", true],
- ["🕝", true],
- ["🕞", true],
- ["🕟", true],
- ["🕠", true],
- ["🕡", true],
- ["🕢", true],
- ["🕣", true],
- ["🕤", true],
- ["🕥", true],
- ["🕦", true],
- ["🕧", true],
- ["🕯️", true],
- ["🕰️", true],
- ["🕳️", true],
- ["🕴🏻‍♀️", true],
- ["🕴🏻‍♂️", true],
- ["🕴🏻", true],
- ["🕴🏼‍♀️", true],
- ["🕴🏼‍♂️", true],
- ["🕴🏼", true],
- ["🕴🏽‍♀️", true],
- ["🕴🏽‍♂️", true],
- ["🕴🏽", true],
- ["🕴🏾‍♀️", true],
- ["🕴🏾‍♂️", true],
- ["🕴🏾", true],
- ["🕴🏿‍♀️", true],
- ["🕴🏿‍♂️", true],
- ["🕴🏿", true],
- ["🕴️‍♀️", true],
- ["🕴️‍♂️", true],
- ["🕴️", true],
- ["🕵🏻‍♀️", true],
- ["🕵🏻‍♂️", true],
- ["🕵🏻", true],
- ["🕵🏼‍♀️", true],
- ["🕵🏼‍♂️", true],
- ["🕵🏼", true],
- ["🕵🏽‍♀️", true],
- ["🕵🏽‍♂️", true],
- ["🕵🏽", true],
- ["🕵🏾‍♀️", true],
- ["🕵🏾‍♂️", true],
- ["🕵🏾", true],
- ["🕵🏿‍♀️", true],
- ["🕵🏿‍♂️", true],
- ["🕵🏿", true],
- ["🕵️‍♀️", true],
- ["🕵️‍♂️", true],
- ["🕵️", true],
- ["🕶️", true],
- ["🕷️", true],
- ["🕸️", true],
- ["🕹️", true],
- ["🕺🏻", true],
- ["🕺🏼", true],
- ["🕺🏽", true],
- ["🕺🏾", true],
- ["🕺🏿", true],
- ["🕺", true],
- ["🖇️", true],
- ["🖊️", true],
- ["🖋️", true],
- ["🖌️", true],
- ["🖍️", true],
- ["🖐🏻", true],
- ["🖐🏼", true],
- ["🖐🏽", true],
- ["🖐🏾", true],
- ["🖐🏿", true],
- ["🖐️", true],
- ["🖕🏻", true],
- ["🖕🏼", true],
- ["🖕🏽", true],
- ["🖕🏾", true],
- ["🖕🏿", true],
- ["🖕", true],
- ["🖖🏻", true],
- ["🖖🏼", true],
- ["🖖🏽", true],
- ["🖖🏾", true],
- ["🖖🏿", true],
- ["🖖", true],
- ["🖤", true],
- ["🖥️", true],
- ["🖨️", true],
- ["🖱️", true],
- ["🖲️", true],
- ["🖼️", true],
- ["🗂️", true],
- ["🗃️", true],
- ["🗄️", true],
- ["🗑️", true],
- ["🗒️", true],
- ["🗓️", true],
- ["🗜️", true],
- ["🗝️", true],
- ["🗞️", true],
- ["🗡️", true],
- ["🗣️", true],
- ["🗨️", true],
- ["🗯️", true],
- ["🗳️", true],
- ["🗺️", true],
- ["🗻", true],
- ["🗼", true],
- ["🗽", true],
- ["🗾", true],
- ["🗿", true],
- ["😀", true],
- ["😁", true],
- ["😂", true],
- ["😃", true],
- ["😄", true],
- ["😅", true],
- ["😆", true],
- ["😇", true],
- ["😈", true],
- ["😉", true],
- ["😊", true],
- ["😋", true],
- ["😌", true],
- ["😍", true],
- ["😎", true],
- ["😏", true],
- ["😐", true],
- ["😑", true],
- ["😒", true],
- ["😓", true],
- ["😔", true],
- ["😕", true],
- ["😖", true],
- ["😗", true],
- ["😘", true],
- ["😙", true],
- ["😚", true],
- ["😛", true],
- ["😜", true],
- ["😝", true],
- ["😞", true],
- ["😟", true],
- ["😠", true],
- ["😡", true],
- ["😢", true],
- ["😣", true],
- ["😤", true],
- ["😥", true],
- ["😦", true],
- ["😧", true],
- ["😨", true],
- ["😩", true],
- ["😪", true],
- ["😫", true],
- ["😬", true],
- ["😭", true],
- ["😮", true],
- ["😯", true],
- ["😰", true],
- ["😱", true],
- ["😲", true],
- ["😳", true],
- ["😴", true],
- ["😵", true],
- ["😶", true],
- ["😷", true],
- ["😸", true],
- ["😹", true],
- ["😺", true],
- ["😻", true],
- ["😼", true],
- ["😽", true],
- ["😾", true],
- ["😿", true],
- ["🙀", true],
- ["🙁", true],
- ["🙂", true],
- ["🙃", true],
- ["🙄", true],
- ["🙅🏻‍♀️", true],
- ["🙅🏻‍♂️", true],
- ["🙅🏻", true],
- ["🙅🏼‍♀️", true],
- ["🙅🏼‍♂️", true],
- ["🙅🏼", true],
- ["🙅🏽‍♀️", true],
- ["🙅🏽‍♂️", true],
- ["🙅🏽", true],
- ["🙅🏾‍♀️", true],
- ["🙅🏾‍♂️", true],
- ["🙅🏾", true],
- ["🙅🏿‍♀️", true],
- ["🙅🏿‍♂️", true],
- ["🙅🏿", true],
- ["🙅‍♀️", true],
- ["🙅‍♂️", true],
- ["🙅", true],
- ["🙆🏻‍♀️", true],
- ["🙆🏻‍♂️", true],
- ["🙆🏻", true],
- ["🙆🏼‍♀️", true],
- ["🙆🏼‍♂️", true],
- ["🙆🏼", true],
- ["🙆🏽‍♀️", true],
- ["🙆🏽‍♂️", true],
- ["🙆🏽", true],
- ["🙆🏾‍♀️", true],
- ["🙆🏾‍♂️", true],
- ["🙆🏾", true],
- ["🙆🏿‍♀️", true],
- ["🙆🏿‍♂️", true],
- ["🙆🏿", true],
- ["🙆‍♀️", true],
- ["🙆‍♂️", true],
- ["🙆", true],
- ["🙇🏻‍♀️", true],
- ["🙇🏻‍♂️", true],
- ["🙇🏻", true],
- ["🙇🏼‍♀️", true],
- ["🙇🏼‍♂️", true],
- ["🙇🏼", true],
- ["🙇🏽‍♀️", true],
- ["🙇🏽‍♂️", true],
- ["🙇🏽", true],
- ["🙇🏾‍♀️", true],
- ["🙇🏾‍♂️", true],
- ["🙇🏾", true],
- ["🙇🏿‍♀️", true],
- ["🙇🏿‍♂️", true],
- ["🙇🏿", true],
- ["🙇‍♀️", true],
- ["🙇‍♂️", true],
- ["🙇", true],
- ["🙈", true],
- ["🙉", true],
- ["🙊", true],
- ["🙋🏻‍♀️", true],
- ["🙋🏻‍♂️", true],
- ["🙋🏻", true],
- ["🙋🏼‍♀️", true],
- ["🙋🏼‍♂️", true],
- ["🙋🏼", true],
- ["🙋🏽‍♀️", true],
- ["🙋🏽‍♂️", true],
- ["🙋🏽", true],
- ["🙋🏾‍♀️", true],
- ["🙋🏾‍♂️", true],
- ["🙋🏾", true],
- ["🙋🏿‍♀️", true],
- ["🙋🏿‍♂️", true],
- ["🙋🏿", true],
- ["🙋‍♀️", true],
- ["🙋‍♂️", true],
- ["🙋", true],
- ["🙌🏻", true],
- ["🙌🏼", true],
- ["🙌🏽", true],
- ["🙌🏾", true],
- ["🙌🏿", true],
- ["🙌", true],
- ["🙍🏻‍♀️", true],
- ["🙍🏻‍♂️", true],
- ["🙍🏻", true],
- ["🙍🏼‍♀️", true],
- ["🙍🏼‍♂️", true],
- ["🙍🏼", true],
- ["🙍🏽‍♀️", true],
- ["🙍🏽‍♂️", true],
- ["🙍🏽", true],
- ["🙍🏾‍♀️", true],
- ["🙍🏾‍♂️", true],
- ["🙍🏾", true],
- ["🙍🏿‍♀️", true],
- ["🙍🏿‍♂️", true],
- ["🙍🏿", true],
- ["🙍‍♀️", true],
- ["🙍‍♂️", true],
- ["🙍", true],
- ["🙎🏻‍♀️", true],
- ["🙎🏻‍♂️", true],
- ["🙎🏻", true],
- ["🙎🏼‍♀️", true],
- ["🙎🏼‍♂️", true],
- ["🙎🏼", true],
- ["🙎🏽‍♀️", true],
- ["🙎🏽‍♂️", true],
- ["🙎🏽", true],
- ["🙎🏾‍♀️", true],
- ["🙎🏾‍♂️", true],
- ["🙎🏾", true],
- ["🙎🏿‍♀️", true],
- ["🙎🏿‍♂️", true],
- ["🙎🏿", true],
- ["🙎‍♀️", true],
- ["🙎‍♂️", true],
- ["🙎", true],
- ["🙏🏻", true],
- ["🙏🏼", true],
- ["🙏🏽", true],
- ["🙏🏾", true],
- ["🙏🏿", true],
- ["🙏", true],
- ["🚀", true],
- ["🚁", true],
- ["🚂", true],
- ["🚃", true],
- ["🚄", true],
- ["🚅", true],
- ["🚆", true],
- ["🚇", true],
- ["🚈", true],
- ["🚉", true],
- ["🚊", true],
- ["🚋", true],
- ["🚌", true],
- ["🚍", true],
- ["🚎", true],
- ["🚏", true],
- ["🚐", true],
- ["🚑", true],
- ["🚒", true],
- ["🚓", true],
- ["🚔", true],
- ["🚕", true],
- ["🚖", true],
- ["🚗", true],
- ["🚘", true],
- ["🚙", true],
- ["🚚", true],
- ["🚛", true],
- ["🚜", true],
- ["🚝", true],
- ["🚞", true],
- ["🚟", true],
- ["🚠", true],
- ["🚡", true],
- ["🚢", true],
- ["🚣🏻‍♀️", true],
- ["🚣🏻‍♂️", true],
- ["🚣🏻", true],
- ["🚣🏼‍♀️", true],
- ["🚣🏼‍♂️", true],
- ["🚣🏼", true],
- ["🚣🏽‍♀️", true],
- ["🚣🏽‍♂️", true],
- ["🚣🏽", true],
- ["🚣🏾‍♀️", true],
- ["🚣🏾‍♂️", true],
- ["🚣🏾", true],
- ["🚣🏿‍♀️", true],
- ["🚣🏿‍♂️", true],
- ["🚣🏿", true],
- ["🚣‍♀️", true],
- ["🚣‍♂️", true],
- ["🚣", true],
- ["🚤", true],
- ["🚥", true],
- ["🚦", true],
- ["🚧", true],
- ["🚨", true],
- ["🚩", true],
- ["🚪", true],
- ["🚫", true],
- ["🚬", true],
- ["🚭", true],
- ["🚮", true],
- ["🚯", true],
- ["🚰", true],
- ["🚱", true],
- ["🚲", true],
- ["🚳", true],
- ["🚴🏻‍♀️", true],
- ["🚴🏻‍♂️", true],
- ["🚴🏻", true],
- ["🚴🏼‍♀️", true],
- ["🚴🏼‍♂️", true],
- ["🚴🏼", true],
- ["🚴🏽‍♀️", true],
- ["🚴🏽‍♂️", true],
- ["🚴🏽", true],
- ["🚴🏾‍♀️", true],
- ["🚴🏾‍♂️", true],
- ["🚴🏾", true],
- ["🚴🏿‍♀️", true],
- ["🚴🏿‍♂️", true],
- ["🚴🏿", true],
- ["🚴‍♀️", true],
- ["🚴‍♂️", true],
- ["🚴", true],
- ["🚵🏻‍♀️", true],
- ["🚵🏻‍♂️", true],
- ["🚵🏻", true],
- ["🚵🏼‍♀️", true],
- ["🚵🏼‍♂️", true],
- ["🚵🏼", true],
- ["🚵🏽‍♀️", true],
- ["🚵🏽‍♂️", true],
- ["🚵🏽", true],
- ["🚵🏾‍♀️", true],
- ["🚵🏾‍♂️", true],
- ["🚵🏾", true],
- ["🚵🏿‍♀️", true],
- ["🚵🏿‍♂️", true],
- ["🚵🏿", true],
- ["🚵‍♀️", true],
- ["🚵‍♂️", true],
- ["🚵", true],
- ["🚶🏻‍♀️", true],
- ["🚶🏻‍♂️", true],
- ["🚶🏻", true],
- ["🚶🏼‍♀️", true],
- ["🚶🏼‍♂️", true],
- ["🚶🏼", true],
- ["🚶🏽‍♀️", true],
- ["🚶🏽‍♂️", true],
- ["🚶🏽", true],
- ["🚶🏾‍♀️", true],
- ["🚶🏾‍♂️", true],
- ["🚶🏾", true],
- ["🚶🏿‍♀️", true],
- ["🚶🏿‍♂️", true],
- ["🚶🏿", true],
- ["🚶‍♀️", true],
- ["🚶‍♂️", true],
- ["🚶", true],
- ["🚷", true],
- ["🚸", true],
- ["🚹", true],
- ["🚺", true],
- ["🚻", true],
- ["🚼", true],
- ["🚽", true],
- ["🚾", true],
- ["🚿", true],
- ["🛀🏻", true],
- ["🛀🏼", true],
- ["🛀🏽", true],
- ["🛀🏾", true],
- ["🛀🏿", true],
- ["🛀", true],
- ["🛁", true],
- ["🛂", true],
- ["🛃", true],
- ["🛄", true],
- ["🛅", true],
- ["🛋️", true],
- ["🛌🏻", true],
- ["🛌🏼", true],
- ["🛌🏽", true],
- ["🛌🏾", true],
- ["🛌🏿", true],
- ["🛌", true],
- ["🛍️", true],
- ["🛎️", true],
- ["🛏️", true],
- ["🛐", true],
- ["🛑", true],
- ["🛒", true],
- ["🛕", true],
- ["🛠️", true],
- ["🛡️", true],
- ["🛢️", true],
- ["🛣️", true],
- ["🛤️", true],
- ["🛥️", true],
- ["🛩️", true],
- ["🛫", true],
- ["🛬", true],
- ["🛰️", true],
- ["🛳️", true],
- ["🛴", true],
- ["🛵", true],
- ["🛶", true],
- ["🛷", true],
- ["🛸", true],
- ["🛹", true],
- ["🛺", true],
- ["🟠", true],
- ["🟡", true],
- ["🟢", true],
- ["🟣", true],
- ["🟤", true],
- ["🟥", true],
- ["🟦", true],
- ["🟧", true],
- ["🟨", true],
- ["🟩", true],
- ["🟪", true],
- ["🟫", true],
- ["🤍", true],
- ["🤎", true],
- ["🤏🏻", true],
- ["🤏🏼", true],
- ["🤏🏽", true],
- ["🤏🏾", true],
- ["🤏🏿", true],
- ["🤏", true],
- ["🤐", true],
- ["🤑", true],
- ["🤒", true],
- ["🤓", true],
- ["🤔", true],
- ["🤕", true],
- ["🤖", true],
- ["🤗", true],
- ["🤘🏻", true],
- ["🤘🏼", true],
- ["🤘🏽", true],
- ["🤘🏾", true],
- ["🤘🏿", true],
- ["🤘", true],
- ["🤙🏻", true],
- ["🤙🏼", true],
- ["🤙🏽", true],
- ["🤙🏾", true],
- ["🤙🏿", true],
- ["🤙", true],
- ["🤚🏻", true],
- ["🤚🏼", true],
- ["🤚🏽", true],
- ["🤚🏾", true],
- ["🤚🏿", true],
- ["🤚", true],
- ["🤛🏻", true],
- ["🤛🏼", true],
- ["🤛🏽", true],
- ["🤛🏾", true],
- ["🤛🏿", true],
- ["🤛", true],
- ["🤜🏻", true],
- ["🤜🏼", true],
- ["🤜🏽", true],
- ["🤜🏾", true],
- ["🤜🏿", true],
- ["🤜", true],
- ["🤝", true],
- ["🤞🏻", true],
- ["🤞🏼", true],
- ["🤞🏽", true],
- ["🤞🏾", true],
- ["🤞🏿", true],
- ["🤞", true],
- ["🤟🏻", true],
- ["🤟🏼", true],
- ["🤟🏽", true],
- ["🤟🏾", true],
- ["🤟🏿", true],
- ["🤟", true],
- ["🤠", true],
- ["🤡", true],
- ["🤢", true],
- ["🤣", true],
- ["🤤", true],
- ["🤥", true],
- ["🤦🏻‍♀️", true],
- ["🤦🏻‍♂️", true],
- ["🤦🏻", true],
- ["🤦🏼‍♀️", true],
- ["🤦🏼‍♂️", true],
- ["🤦🏼", true],
- ["🤦🏽‍♀️", true],
- ["🤦🏽‍♂️", true],
- ["🤦🏽", true],
- ["🤦🏾‍♀️", true],
- ["🤦🏾‍♂️", true],
- ["🤦🏾", true],
- ["🤦🏿‍♀️", true],
- ["🤦🏿‍♂️", true],
- ["🤦🏿", true],
- ["🤦‍♀️", true],
- ["🤦‍♂️", true],
- ["🤦", true],
- ["🤧", true],
- ["🤨", true],
- ["🤩", true],
- ["🤪", true],
- ["🤫", true],
- ["🤬", true],
- ["🤭", true],
- ["🤮", true],
- ["🤯", true],
- ["🤰🏻", true],
- ["🤰🏼", true],
- ["🤰🏽", true],
- ["🤰🏾", true],
- ["🤰🏿", true],
- ["🤰", true],
- ["🤱🏻", true],
- ["🤱🏼", true],
- ["🤱🏽", true],
- ["🤱🏾", true],
- ["🤱🏿", true],
- ["🤱", true],
- ["🤲🏻", true],
- ["🤲🏼", true],
- ["🤲🏽", true],
- ["🤲🏾", true],
- ["🤲🏿", true],
- ["🤲", true],
- ["🤳🏻", true],
- ["🤳🏼", true],
- ["🤳🏽", true],
- ["🤳🏾", true],
- ["🤳🏿", true],
- ["🤳", true],
- ["🤴🏻", true],
- ["🤴🏼", true],
- ["🤴🏽", true],
- ["🤴🏾", true],
- ["🤴🏿", true],
- ["🤴", true],
- ["🤵🏻‍♀️", true],
- ["🤵🏻‍♂️", true],
- ["🤵🏻", true],
- ["🤵🏼‍♀️", true],
- ["🤵🏼‍♂️", true],
- ["🤵🏼", true],
- ["🤵🏽‍♀️", true],
- ["🤵🏽‍♂️", true],
- ["🤵🏽", true],
- ["🤵🏾‍♀️", true],
- ["🤵🏾‍♂️", true],
- ["🤵🏾", true],
- ["🤵🏿‍♀️", true],
- ["🤵🏿‍♂️", true],
- ["🤵🏿", true],
- ["🤵‍♀️", true],
- ["🤵‍♂️", true],
- ["🤵", true],
- ["🤶🏻", true],
- ["🤶🏼", true],
- ["🤶🏽", true],
- ["🤶🏾", true],
- ["🤶🏿", true],
- ["🤶", true],
- ["🤷🏻‍♀️", true],
- ["🤷🏻‍♂️", true],
- ["🤷🏻", true],
- ["🤷🏼‍♀️", true],
- ["🤷🏼‍♂️", true],
- ["🤷🏼", true],
- ["🤷🏽‍♀️", true],
- ["🤷🏽‍♂️", true],
- ["🤷🏽", true],
- ["🤷🏾‍♀️", true],
- ["🤷🏾‍♂️", true],
- ["🤷🏾", true],
- ["🤷🏿‍♀️", true],
- ["🤷🏿‍♂️", true],
- ["🤷🏿", true],
- ["🤷‍♀️", true],
- ["🤷‍♂️", true],
- ["🤷", true],
- ["🤸🏻‍♀️", true],
- ["🤸🏻‍♂️", true],
- ["🤸🏻", true],
- ["🤸🏼‍♀️", true],
- ["🤸🏼‍♂️", true],
- ["🤸🏼", true],
- ["🤸🏽‍♀️", true],
- ["🤸🏽‍♂️", true],
- ["🤸🏽", true],
- ["🤸🏾‍♀️", true],
- ["🤸🏾‍♂️", true],
- ["🤸🏾", true],
- ["🤸🏿‍♀️", true],
- ["🤸🏿‍♂️", true],
- ["🤸🏿", true],
- ["🤸‍♀️", true],
- ["🤸‍♂️", true],
- ["🤸", true],
- ["🤹🏻‍♀️", true],
- ["🤹🏻‍♂️", true],
- ["🤹🏻", true],
- ["🤹🏼‍♀️", true],
- ["🤹🏼‍♂️", true],
- ["🤹🏼", true],
- ["🤹🏽‍♀️", true],
- ["🤹🏽‍♂️", true],
- ["🤹🏽", true],
- ["🤹🏾‍♀️", true],
- ["🤹🏾‍♂️", true],
- ["🤹🏾", true],
- ["🤹🏿‍♀️", true],
- ["🤹🏿‍♂️", true],
- ["🤹🏿", true],
- ["🤹‍♀️", true],
- ["🤹‍♂️", true],
- ["🤹", true],
- ["🤺", true],
- ["🤼‍♀️", true],
- ["🤼‍♂️", true],
- ["🤼", true],
- ["🤽🏻‍♀️", true],
- ["🤽🏻‍♂️", true],
- ["🤽🏻", true],
- ["🤽🏼‍♀️", true],
- ["🤽🏼‍♂️", true],
- ["🤽🏼", true],
- ["🤽🏽‍♀️", true],
- ["🤽🏽‍♂️", true],
- ["🤽🏽", true],
- ["🤽🏾‍♀️", true],
- ["🤽🏾‍♂️", true],
- ["🤽🏾", true],
- ["🤽🏿‍♀️", true],
- ["🤽🏿‍♂️", true],
- ["🤽🏿", true],
- ["🤽‍♀️", true],
- ["🤽‍♂️", true],
- ["🤽", true],
- ["🤾🏻‍♀️", true],
- ["🤾🏻‍♂️", true],
- ["🤾🏻", true],
- ["🤾🏼‍♀️", true],
- ["🤾🏼‍♂️", true],
- ["🤾🏼", true],
- ["🤾🏽‍♀️", true],
- ["🤾🏽‍♂️", true],
- ["🤾🏽", true],
- ["🤾🏾‍♀️", true],
- ["🤾🏾‍♂️", true],
- ["🤾🏾", true],
- ["🤾🏿‍♀️", true],
- ["🤾🏿‍♂️", true],
- ["🤾🏿", true],
- ["🤾‍♀️", true],
- ["🤾‍♂️", true],
- ["🤾", true],
- ["🤿", true],
- ["🥀", true],
- ["🥁", true],
- ["🥂", true],
- ["🥃", true],
- ["🥄", true],
- ["🥅", true],
- ["🥇", true],
- ["🥈", true],
- ["🥉", true],
- ["🥊", true],
- ["🥋", true],
- ["🥌", true],
- ["🥍", true],
- ["🥎", true],
- ["🥏", true],
- ["🥐", true],
- ["🥑", true],
- ["🥒", true],
- ["🥓", true],
- ["🥔", true],
- ["🥕", true],
- ["🥖", true],
- ["🥗", true],
- ["🥘", true],
- ["🥙", true],
- ["🥚", true],
- ["🥛", true],
- ["🥜", true],
- ["🥝", true],
- ["🥞", true],
- ["🥟", true],
- ["🥠", true],
- ["🥡", true],
- ["🥢", true],
- ["🥣", true],
- ["🥤", true],
- ["🥥", true],
- ["🥦", true],
- ["🥧", true],
- ["🥨", true],
- ["🥩", true],
- ["🥪", true],
- ["🥫", true],
- ["🥬", true],
- ["🥭", true],
- ["🥮", true],
- ["🥯", true],
- ["🥰", true],
- ["🥱", true],
- ["🥳", true],
- ["🥴", true],
- ["🥵", true],
- ["🥶", true],
- ["🥺", true],
- ["🥻", true],
- ["🥼", true],
- ["🥽", true],
- ["🥾", true],
- ["🥿", true],
- ["🦀", true],
- ["🦁", true],
- ["🦂", true],
- ["🦃", true],
- ["🦄", true],
- ["🦅", true],
- ["🦆", true],
- ["🦇", true],
- ["🦈", true],
- ["🦉", true],
- ["🦊", true],
- ["🦋", true],
- ["🦌", true],
- ["🦍", true],
- ["🦎", true],
- ["🦏", true],
- ["🦐", true],
- ["🦑", true],
- ["🦒", true],
- ["🦓", true],
- ["🦔", true],
- ["🦕", true],
- ["🦖", true],
- ["🦗", true],
- ["🦘", true],
- ["🦙", true],
- ["🦚", true],
- ["🦛", true],
- ["🦜", true],
- ["🦝", true],
- ["🦞", true],
- ["🦟", true],
- ["🦠", true],
- ["🦡", true],
- ["🦢", true],
- ["🦥", true],
- ["🦦", true],
- ["🦧", true],
- ["🦨", true],
- ["🦩", true],
- ["🦪", true],
- ["🦮", true],
- ["🦯", true],
- ["🦰", true],
- ["🦱", true],
- ["🦲", true],
- ["🦳", true],
- ["🦴", true],
- ["🦵🏻", true],
- ["🦵🏼", true],
- ["🦵🏽", true],
- ["🦵🏾", true],
- ["🦵🏿", true],
- ["🦵", true],
- ["🦶🏻", true],
- ["🦶🏼", true],
- ["🦶🏽", true],
- ["🦶🏾", true],
- ["🦶🏿", true],
- ["🦶", true],
- ["🦷", true],
- ["🦸🏻‍♀️", true],
- ["🦸🏻‍♂️", true],
- ["🦸🏻", true],
- ["🦸🏼‍♀️", true],
- ["🦸🏼‍♂️", true],
- ["🦸🏼", true],
- ["🦸🏽‍♀️", true],
- ["🦸🏽‍♂️", true],
- ["🦸🏽", true],
- ["🦸🏾‍♀️", true],
- ["🦸🏾‍♂️", true],
- ["🦸🏾", true],
- ["🦸🏿‍♀️", true],
- ["🦸🏿‍♂️", true],
- ["🦸🏿", true],
- ["🦸‍♀️", true],
- ["🦸‍♂️", true],
- ["🦸", true],
- ["🦹🏻‍♀️", true],
- ["🦹🏻‍♂️", true],
- ["🦹🏻", true],
- ["🦹🏼‍♀️", true],
- ["🦹🏼‍♂️", true],
- ["🦹🏼", true],
- ["🦹🏽‍♀️", true],
- ["🦹🏽‍♂️", true],
- ["🦹🏽", true],
- ["🦹🏾‍♀️", true],
- ["🦹🏾‍♂️", true],
- ["🦹🏾", true],
- ["🦹🏿‍♀️", true],
- ["🦹🏿‍♂️", true],
- ["🦹🏿", true],
- ["🦹‍♀️", true],
- ["🦹‍♂️", true],
- ["🦹", true],
- ["🦺", true],
- ["🦻🏻", true],
- ["🦻🏼", true],
- ["🦻🏽", true],
- ["🦻🏾", true],
- ["🦻🏿", true],
- ["🦻", true],
- ["🦼", true],
- ["🦽", true],
- ["🦾", true],
- ["🦿", true],
- ["🧀", true],
- ["🧁", true],
- ["🧂", true],
- ["🧃", true],
- ["🧄", true],
- ["🧅", true],
- ["🧆", true],
- ["🧇", true],
- ["🧈", true],
- ["🧉", true],
- ["🧊", true],
- ["🧍🏻‍♀️", true],
- ["🧍🏻‍♂️", true],
- ["🧍🏻", true],
- ["🧍🏼‍♀️", true],
- ["🧍🏼‍♂️", true],
- ["🧍🏼", true],
- ["🧍🏽‍♀️", true],
- ["🧍🏽‍♂️", true],
- ["🧍🏽", true],
- ["🧍🏾‍♀️", true],
- ["🧍🏾‍♂️", true],
- ["🧍🏾", true],
- ["🧍🏿‍♀️", true],
- ["🧍🏿‍♂️", true],
- ["🧍🏿", true],
- ["🧍‍♀️", true],
- ["🧍‍♂️", true],
- ["🧍", true],
- ["🧎🏻‍♀️", true],
- ["🧎🏻‍♂️", true],
- ["🧎🏻", true],
- ["🧎🏼‍♀️", true],
- ["🧎🏼‍♂️", true],
- ["🧎🏼", true],
- ["🧎🏽‍♀️", true],
- ["🧎🏽‍♂️", true],
- ["🧎🏽", true],
- ["🧎🏾‍♀️", true],
- ["🧎🏾‍♂️", true],
- ["🧎🏾", true],
- ["🧎🏿‍♀️", true],
- ["🧎🏿‍♂️", true],
- ["🧎🏿", true],
- ["🧎‍♀️", true],
- ["🧎‍♂️", true],
- ["🧎", true],
- ["🧏🏻‍♀️", true],
- ["🧏🏻‍♂️", true],
- ["🧏🏻", true],
- ["🧏🏼‍♀️", true],
- ["🧏🏼‍♂️", true],
- ["🧏🏼", true],
- ["🧏🏽‍♀️", true],
- ["🧏🏽‍♂️", true],
- ["🧏🏽", true],
- ["🧏🏾‍♀️", true],
- ["🧏🏾‍♂️", true],
- ["🧏🏾", true],
- ["🧏🏿‍♀️", true],
- ["🧏🏿‍♂️", true],
- ["🧏🏿", true],
- ["🧏‍♀️", true],
- ["🧏‍♂️", true],
- ["🧏", true],
- ["🧐", true],
- ["🧑🏻‍🤝‍🧑🏻", true],
- ["🧑🏻", true],
- ["🧑🏼‍🤝‍🧑🏻", true],
- ["🧑🏼‍🤝‍🧑🏼", true],
- ["🧑🏼", true],
- ["🧑🏽‍🤝‍🧑🏻", true],
- ["🧑🏽‍🤝‍🧑🏼", true],
- ["🧑🏽‍🤝‍🧑🏽", true],
- ["🧑🏽", true],
- ["🧑🏾‍🤝‍🧑🏻", true],
- ["🧑🏾‍🤝‍🧑🏼", true],
- ["🧑🏾‍🤝‍🧑🏽", true],
- ["🧑🏾‍🤝‍🧑🏾", true],
- ["🧑🏾", true],
- ["🧑🏿‍🤝‍🧑🏻", true],
- ["🧑🏿‍🤝‍🧑🏼", true],
- ["🧑🏿‍🤝‍🧑🏽", true],
- ["🧑🏿‍🤝‍🧑🏾", true],
- ["🧑🏿‍🤝‍🧑🏿", true],
- ["🧑🏿", true],
- ["🧑‍🤝‍🧑", true],
- ["🧑", true],
- ["🧒🏻", true],
- ["🧒🏼", true],
- ["🧒🏽", true],
- ["🧒🏾", true],
- ["🧒🏿", true],
- ["🧒", true],
- ["🧓🏻", true],
- ["🧓🏼", true],
- ["🧓🏽", true],
- ["🧓🏾", true],
- ["🧓🏿", true],
- ["🧓", true],
- ["🧔🏻", true],
- ["🧔🏼", true],
- ["🧔🏽", true],
- ["🧔🏾", true],
- ["🧔🏿", true],
- ["🧔", true],
- ["🧕🏻", true],
- ["🧕🏼", true],
- ["🧕🏽", true],
- ["🧕🏾", true],
- ["🧕🏿", true],
- ["🧕", true],
- ["🧖🏻‍♀️", true],
- ["🧖🏻‍♂️", true],
- ["🧖🏻", true],
- ["🧖🏼‍♀️", true],
- ["🧖🏼‍♂️", true],
- ["🧖🏼", true],
- ["🧖🏽‍♀️", true],
- ["🧖🏽‍♂️", true],
- ["🧖🏽", true],
- ["🧖🏾‍♀️", true],
- ["🧖🏾‍♂️", true],
- ["🧖🏾", true],
- ["🧖🏿‍♀️", true],
- ["🧖🏿‍♂️", true],
- ["🧖🏿", true],
- ["🧖‍♀️", true],
- ["🧖‍♂️", true],
- ["🧖", true],
- ["🧗🏻‍♀️", true],
- ["🧗🏻‍♂️", true],
- ["🧗🏻", true],
- ["🧗🏼‍♀️", true],
- ["🧗🏼‍♂️", true],
- ["🧗🏼", true],
- ["🧗🏽‍♀️", true],
- ["🧗🏽‍♂️", true],
- ["🧗🏽", true],
- ["🧗🏾‍♀️", true],
- ["🧗🏾‍♂️", true],
- ["🧗🏾", true],
- ["🧗🏿‍♀️", true],
- ["🧗🏿‍♂️", true],
- ["🧗🏿", true],
- ["🧗‍♀️", true],
- ["🧗‍♂️", true],
- ["🧗", true],
- ["🧘🏻‍♀️", true],
- ["🧘🏻‍♂️", true],
- ["🧘🏻", true],
- ["🧘🏼‍♀️", true],
- ["🧘🏼‍♂️", true],
- ["🧘🏼", true],
- ["🧘🏽‍♀️", true],
- ["🧘🏽‍♂️", true],
- ["🧘🏽", true],
- ["🧘🏾‍♀️", true],
- ["🧘🏾‍♂️", true],
- ["🧘🏾", true],
- ["🧘🏿‍♀️", true],
- ["🧘🏿‍♂️", true],
- ["🧘🏿", true],
- ["🧘‍♀️", true],
- ["🧘‍♂️", true],
- ["🧘", true],
- ["🧙🏻‍♀️", true],
- ["🧙🏻‍♂️", true],
- ["🧙🏻", true],
- ["🧙🏼‍♀️", true],
- ["🧙🏼‍♂️", true],
- ["🧙🏼", true],
- ["🧙🏽‍♀️", true],
- ["🧙🏽‍♂️", true],
- ["🧙🏽", true],
- ["🧙🏾‍♀️", true],
- ["🧙🏾‍♂️", true],
- ["🧙🏾", true],
- ["🧙🏿‍♀️", true],
- ["🧙🏿‍♂️", true],
- ["🧙🏿", true],
- ["🧙‍♀️", true],
- ["🧙‍♂️", true],
- ["🧙", true],
- ["🧚🏻‍♀️", true],
- ["🧚🏻‍♂️", true],
- ["🧚🏻", true],
- ["🧚🏼‍♀️", true],
- ["🧚🏼‍♂️", true],
- ["🧚🏼", true],
- ["🧚🏽‍♀️", true],
- ["🧚🏽‍♂️", true],
- ["🧚🏽", true],
- ["🧚🏾‍♀️", true],
- ["🧚🏾‍♂️", true],
- ["🧚🏾", true],
- ["🧚🏿‍♀️", true],
- ["🧚🏿‍♂️", true],
- ["🧚🏿", true],
- ["🧚‍♀️", true],
- ["🧚‍♂️", true],
- ["🧚", true],
- ["🧛🏻‍♀️", true],
- ["🧛🏻‍♂️", true],
- ["🧛🏻", true],
- ["🧛🏼‍♀️", true],
- ["🧛🏼‍♂️", true],
- ["🧛🏼", true],
- ["🧛🏽‍♀️", true],
- ["🧛🏽‍♂️", true],
- ["🧛🏽", true],
- ["🧛🏾‍♀️", true],
- ["🧛🏾‍♂️", true],
- ["🧛🏾", true],
- ["🧛🏿‍♀️", true],
- ["🧛🏿‍♂️", true],
- ["🧛🏿", true],
- ["🧛‍♀️", true],
- ["🧛‍♂️", true],
- ["🧛", true],
- ["🧜🏻‍♀️", true],
- ["🧜🏻‍♂️", true],
- ["🧜🏻", true],
- ["🧜🏼‍♀️", true],
- ["🧜🏼‍♂️", true],
- ["🧜🏼", true],
- ["🧜🏽‍♀️", true],
- ["🧜🏽‍♂️", true],
- ["🧜🏽", true],
- ["🧜🏾‍♀️", true],
- ["🧜🏾‍♂️", true],
- ["🧜🏾", true],
- ["🧜🏿‍♀️", true],
- ["🧜🏿‍♂️", true],
- ["🧜🏿", true],
- ["🧜‍♀️", true],
- ["🧜‍♂️", true],
- ["🧜", true],
- ["🧝🏻‍♀️", true],
- ["🧝🏻‍♂️", true],
- ["🧝🏻", true],
- ["🧝🏼‍♀️", true],
- ["🧝🏼‍♂️", true],
- ["🧝🏼", true],
- ["🧝🏽‍♀️", true],
- ["🧝🏽‍♂️", true],
- ["🧝🏽", true],
- ["🧝🏾‍♀️", true],
- ["🧝🏾‍♂️", true],
- ["🧝🏾", true],
- ["🧝🏿‍♀️", true],
- ["🧝🏿‍♂️", true],
- ["🧝🏿", true],
- ["🧝‍♀️", true],
- ["🧝‍♂️", true],
- ["🧝", true],
- ["🧞‍♀️", true],
- ["🧞‍♂️", true],
- ["🧞", true],
- ["🧟‍♀️", true],
- ["🧟‍♂️", true],
- ["🧟", true],
- ["🧠", true],
- ["🧡", true],
- ["🧢", true],
- ["🧣", true],
- ["🧤", true],
- ["🧥", true],
- ["🧦", true],
- ["🧧", true],
- ["🧨", true],
- ["🧩", true],
- ["🧪", true],
- ["🧫", true],
- ["🧬", true],
- ["🧭", true],
- ["🧮", true],
- ["🧯", true],
- ["🧰", true],
- ["🧱", true],
- ["🧲", true],
- ["🧳", true],
- ["🧴", true],
- ["🧵", true],
- ["🧶", true],
- ["🧷", true],
- ["🧸", true],
- ["🧹", true],
- ["🧺", true],
- ["🧻", true],
- ["🧼", true],
- ["🧽", true],
- ["🧾", true],
- ["🧿", true],
- ["🩰", true],
- ["🩱", true],
- ["🩲", true],
- ["🩳", true],
- ["🩸", true],
- ["🩹", true],
- ["🩺", true],
- ["🪀", true],
- ["🪁", true],
- ["🪂", true],
- ["🪐", true],
- ["🪑", true],
- ["🪒", true],
- ["🪓", true],
- ["🪔", true],
- ["🪕", true],
- ["‼️", true],
- ["⁉️", true],
- ["™️", true],
- ["ℹ️", true],
- ["↔️", true],
- ["↕️", true],
- ["↖️", true],
- ["↗️", true],
- ["↘️", true],
- ["↙️", true],
- ["↩️", true],
- ["↪️", true],
- ["#⃣", true],
- ["⌚️", true],
- ["⌛️", true],
- ["⌨️", true],
- ["⏏️", true],
- ["⏩", true],
- ["⏪", true],
- ["⏫", true],
- ["⏬", true],
- ["⏭️", true],
- ["⏮️", true],
- ["⏯️", true],
- ["⏰", true],
- ["⏱️", true],
- ["⏲️", true],
- ["⏳", true],
- ["⏸️", true],
- ["⏹️", true],
- ["⏺️", true],
- ["Ⓜ️", true],
- ["▪️", true],
- ["▫️", true],
- ["▶️", true],
- ["◀️", true],
- ["◻️", true],
- ["◼️", true],
- ["◽️", true],
- ["◾️", true],
- ["☀️", true],
- ["☁️", true],
- ["☂️", true],
- ["☃️", true],
- ["☄️", true],
- ["☎️", true],
- ["☑️", true],
- ["☔️", true],
- ["☕️", true],
- ["☘️", true],
- ["☝🏻", true],
- ["☝🏼", true],
- ["☝🏽", true],
- ["☝🏾", true],
- ["☝🏿", true],
- ["☝️", true],
- ["☠️", true],
- ["☢️", true],
- ["☣️", true],
- ["☦️", true],
- ["☪️", true],
- ["☮️", true],
- ["☯️", true],
- ["☸️", true],
- ["☹️", true],
- ["☺️", true],
- ["♀️", true],
- ["♂️", true],
- ["♈️", true],
- ["♉️", true],
- ["♊️", true],
- ["♋️", true],
- ["♌️", true],
- ["♍️", true],
- ["♎️", true],
- ["♏️", true],
- ["♐️", true],
- ["♑️", true],
- ["♒️", true],
- ["♓️", true],
- ["♟️", true],
- ["♠️", true],
- ["♣️", true],
- ["♥️", true],
- ["♦️", true],
- ["♨️", true],
- ["♻️", true],
- ["♾", true],
- ["♿️", true],
- ["⚒️", true],
- ["⚓️", true],
- ["⚔️", true],
- ["⚕️", true],
- ["⚖️", true],
- ["⚗️", true],
- ["⚙️", true],
- ["⚛️", true],
- ["⚜️", true],
- ["⚠️", true],
- ["⚡️", true],
- ["⚪️", true],
- ["⚫️", true],
- ["⚰️", true],
- ["⚱️", true],
- ["⚽️", true],
- ["⚾️", true],
- ["⛄️", true],
- ["⛅️", true],
- ["⛈️", true],
- ["⛎", true],
- ["⛏️", true],
- ["⛑️", true],
- ["⛓️", true],
- ["⛔️", true],
- ["⛩️", true],
- ["⛪️", true],
- ["⛰️", true],
- ["⛱️", true],
- ["⛲️", true],
- ["⛳️", true],
- ["⛴️", true],
- ["⛵️", true],
- ["⛷🏻", true],
- ["⛷🏼", true],
- ["⛷🏽", true],
- ["⛷🏾", true],
- ["⛷🏿", true],
- ["⛷️", true],
- ["⛸️", true],
- ["⛹🏻‍♀️", true],
- ["⛹🏻‍♂️", true],
- ["⛹🏻", true],
- ["⛹🏼‍♀️", true],
- ["⛹🏼‍♂️", true],
- ["⛹🏼", true],
- ["⛹🏽‍♀️", true],
- ["⛹🏽‍♂️", true],
- ["⛹🏽", true],
- ["⛹🏾‍♀️", true],
- ["⛹🏾‍♂️", true],
- ["⛹🏾", true],
- ["⛹🏿‍♀️", true],
- ["⛹🏿‍♂️", true],
- ["⛹🏿", true],
- ["⛹️‍♀️", true],
- ["⛹️‍♂️", true],
- ["⛹️", true],
- ["⛺️", true],
- ["⛽️", true],
- ["✂️", true],
- ["✅", true],
- ["✈️", true],
- ["✉️", true],
- ["✊🏻", true],
- ["✊🏼", true],
- ["✊🏽", true],
- ["✊🏾", true],
- ["✊🏿", true],
- ["✊", true],
- ["✋🏻", true],
- ["✋🏼", true],
- ["✋🏽", true],
- ["✋🏾", true],
- ["✋🏿", true],
- ["✋", true],
- ["✌🏻", true],
- ["✌🏼", true],
- ["✌🏽", true],
- ["✌🏾", true],
- ["✌🏿", true],
- ["✌️", true],
- ["✍🏻", true],
- ["✍🏼", true],
- ["✍🏽", true],
- ["✍🏾", true],
- ["✍🏿", true],
- ["✍️", true],
- ["✏️", true],
- ["✒️", true],
- ["✔️", true],
- ["✖️", true],
- ["✝️", true],
- ["✡️", true],
- ["✨", true],
- ["✳️", true],
- ["✴️", true],
- ["❄️", true],
- ["❇️", true],
- ["❌", true],
- ["❎", true],
- ["❓", true],
- ["❔", true],
- ["❕", true],
- ["❗️", true],
- ["❣️", true],
- ["❤️", true],
- ["➕", true],
- ["➖", true],
- ["➗", true],
- ["➡️", true],
- ["➰", true],
- ["➿", true],
- ["⤴️", true],
- ["⤵️", true],
- ["*⃣", true],
- ["⬅️", true],
- ["⬆️", true],
- ["⬇️", true],
- ["⬛️", true],
- ["⬜️", true],
- ["⭐️", true],
- ["⭕️", true],
- ["0⃣", true],
- ["〰️", true],
- ["〽️", true],
- ["1⃣", true],
- ["2⃣", true],
- ["㊗️", true],
- ["㊙️", true],
- ["3⃣", true],
- ["4⃣", true],
- ["5⃣", true],
- ["6⃣", true],
- ["7⃣", true],
- ["8⃣", true],
- ["9⃣", true],
- ["©️", true],
- ["®️", true],
+ ['🀄️', true],
+ ['🃏', true],
+ ['🅰️', true],
+ ['🅱️', true],
+ ['🅾️', true],
+ ['🅿️', true],
+ ['🆎', true],
+ ['🆑', true],
+ ['🆒', true],
+ ['🆓', true],
+ ['🆔', true],
+ ['🆕', true],
+ ['🆖', true],
+ ['🆗', true],
+ ['🆘', true],
+ ['🆙', true],
+ ['🆚', true],
+ ['🇦🇨', true],
+ ['🇦🇩', true],
+ ['🇦🇪', true],
+ ['🇦🇫', true],
+ ['🇦🇬', true],
+ ['🇦🇮', true],
+ ['🇦🇱', true],
+ ['🇦🇲', true],
+ ['🇦🇴', true],
+ ['🇦🇶', true],
+ ['🇦🇷', true],
+ ['🇦🇸', true],
+ ['🇦🇹', true],
+ ['🇦🇺', true],
+ ['🇦🇼', true],
+ ['🇦🇽', true],
+ ['🇦🇿', true],
+ ['🇦', true],
+ ['🇧🇦', true],
+ ['🇧🇧', true],
+ ['🇧🇩', true],
+ ['🇧🇪', true],
+ ['🇧🇫', true],
+ ['🇧🇬', true],
+ ['🇧🇭', true],
+ ['🇧🇮', true],
+ ['🇧🇯', true],
+ ['🇧🇱', true],
+ ['🇧🇲', true],
+ ['🇧🇳', true],
+ ['🇧🇴', true],
+ ['🇧🇶', true],
+ ['🇧🇷', true],
+ ['🇧🇸', true],
+ ['🇧🇹', true],
+ ['🇧🇻', true],
+ ['🇧🇼', true],
+ ['🇧🇾', true],
+ ['🇧🇿', true],
+ ['🇧', true],
+ ['🇨🇦', true],
+ ['🇨🇨', true],
+ ['🇨🇩', true],
+ ['🇨🇫', true],
+ ['🇨🇬', true],
+ ['🇨🇭', true],
+ ['🇨🇮', true],
+ ['🇨🇰', true],
+ ['🇨🇱', true],
+ ['🇨🇲', true],
+ ['🇨🇳', true],
+ ['🇨🇴', true],
+ ['🇨🇵', true],
+ ['🇨🇷', true],
+ ['🇨🇺', true],
+ ['🇨🇻', true],
+ ['🇨🇼', true],
+ ['🇨🇽', true],
+ ['🇨🇾', true],
+ ['🇨🇿', true],
+ ['🇨', true],
+ ['🇩🇪', true],
+ ['🇩🇬', true],
+ ['🇩🇯', true],
+ ['🇩🇰', true],
+ ['🇩🇲', true],
+ ['🇩🇴', true],
+ ['🇩🇿', true],
+ ['🇩', true],
+ ['🇪🇦', true],
+ ['🇪🇨', true],
+ ['🇪🇪', true],
+ ['🇪🇬', true],
+ ['🇪🇭', true],
+ ['🇪🇷', true],
+ ['🇪🇸', true],
+ ['🇪🇹', true],
+ ['🇪🇺', true],
+ ['🇪', true],
+ ['🇫🇮', true],
+ ['🇫🇯', true],
+ ['🇫🇰', true],
+ ['🇫🇲', true],
+ ['🇫🇴', true],
+ ['🇫🇷', true],
+ ['🇫', true],
+ ['🇬🇦', true],
+ ['🇬🇧', true],
+ ['🇬🇩', true],
+ ['🇬🇪', true],
+ ['🇬🇫', true],
+ ['🇬🇬', true],
+ ['🇬🇭', true],
+ ['🇬🇮', true],
+ ['🇬🇱', true],
+ ['🇬🇲', true],
+ ['🇬🇳', true],
+ ['🇬🇵', true],
+ ['🇬🇶', true],
+ ['🇬🇷', true],
+ ['🇬🇸', true],
+ ['🇬🇹', true],
+ ['🇬🇺', true],
+ ['🇬🇼', true],
+ ['🇬🇾', true],
+ ['🇬', true],
+ ['🇭🇰', true],
+ ['🇭🇲', true],
+ ['🇭🇳', true],
+ ['🇭🇷', true],
+ ['🇭🇹', true],
+ ['🇭🇺', true],
+ ['🇭', true],
+ ['🇮🇨', true],
+ ['🇮🇩', true],
+ ['🇮🇪', true],
+ ['🇮🇱', true],
+ ['🇮🇲', true],
+ ['🇮🇳', true],
+ ['🇮🇴', true],
+ ['🇮🇶', true],
+ ['🇮🇷', true],
+ ['🇮🇸', true],
+ ['🇮🇹', true],
+ ['🇮', true],
+ ['🇯🇪', true],
+ ['🇯🇲', true],
+ ['🇯🇴', true],
+ ['🇯🇵', true],
+ ['🇯', true],
+ ['🇰🇪', true],
+ ['🇰🇬', true],
+ ['🇰🇭', true],
+ ['🇰🇮', true],
+ ['🇰🇲', true],
+ ['🇰🇳', true],
+ ['🇰🇵', true],
+ ['🇰🇷', true],
+ ['🇰🇼', true],
+ ['🇰🇾', true],
+ ['🇰🇿', true],
+ ['🇰', true],
+ ['🇱🇦', true],
+ ['🇱🇧', true],
+ ['🇱🇨', true],
+ ['🇱🇮', true],
+ ['🇱🇰', true],
+ ['🇱🇷', true],
+ ['🇱🇸', true],
+ ['🇱🇹', true],
+ ['🇱🇺', true],
+ ['🇱🇻', true],
+ ['🇱🇾', true],
+ ['🇱', true],
+ ['🇲🇦', true],
+ ['🇲🇨', true],
+ ['🇲🇩', true],
+ ['🇲🇪', true],
+ ['🇲🇫', true],
+ ['🇲🇬', true],
+ ['🇲🇭', true],
+ ['🇲🇰', true],
+ ['🇲🇱', true],
+ ['🇲🇲', true],
+ ['🇲🇳', true],
+ ['🇲🇴', true],
+ ['🇲🇵', true],
+ ['🇲🇶', true],
+ ['🇲🇷', true],
+ ['🇲🇸', true],
+ ['🇲🇹', true],
+ ['🇲🇺', true],
+ ['🇲🇻', true],
+ ['🇲🇼', true],
+ ['🇲🇽', true],
+ ['🇲🇾', true],
+ ['🇲🇿', true],
+ ['🇲', true],
+ ['🇳🇦', true],
+ ['🇳🇨', true],
+ ['🇳🇪', true],
+ ['🇳🇫', true],
+ ['🇳🇬', true],
+ ['🇳🇮', true],
+ ['🇳🇱', true],
+ ['🇳🇴', true],
+ ['🇳🇵', true],
+ ['🇳🇷', true],
+ ['🇳🇺', true],
+ ['🇳🇿', true],
+ ['🇳', true],
+ ['🇴🇲', true],
+ ['🇴', true],
+ ['🇵🇦', true],
+ ['🇵🇪', true],
+ ['🇵🇫', true],
+ ['🇵🇬', true],
+ ['🇵🇭', true],
+ ['🇵🇰', true],
+ ['🇵🇱', true],
+ ['🇵🇲', true],
+ ['🇵🇳', true],
+ ['🇵🇷', true],
+ ['🇵🇸', true],
+ ['🇵🇹', true],
+ ['🇵🇼', true],
+ ['🇵🇾', true],
+ ['🇵', true],
+ ['🇶🇦', true],
+ ['🇶', true],
+ ['🇷🇪', true],
+ ['🇷🇴', true],
+ ['🇷🇸', true],
+ ['🇷🇺', true],
+ ['🇷🇼', true],
+ ['🇷', true],
+ ['🇸🇦', true],
+ ['🇸🇧', true],
+ ['🇸🇨', true],
+ ['🇸🇩', true],
+ ['🇸🇪', true],
+ ['🇸🇬', true],
+ ['🇸🇭', true],
+ ['🇸🇮', true],
+ ['🇸🇯', true],
+ ['🇸🇰', true],
+ ['🇸🇱', true],
+ ['🇸🇲', true],
+ ['🇸🇳', true],
+ ['🇸🇴', true],
+ ['🇸🇷', true],
+ ['🇸🇸', true],
+ ['🇸🇹', true],
+ ['🇸🇻', true],
+ ['🇸🇽', true],
+ ['🇸🇾', true],
+ ['🇸🇿', true],
+ ['🇸', true],
+ ['🇹🇦', true],
+ ['🇹🇨', true],
+ ['🇹🇩', true],
+ ['🇹🇫', true],
+ ['🇹🇬', true],
+ ['🇹🇭', true],
+ ['🇹🇯', true],
+ ['🇹🇰', true],
+ ['🇹🇱', true],
+ ['🇹🇲', true],
+ ['🇹🇳', true],
+ ['🇹🇴', true],
+ ['🇹🇷', true],
+ ['🇹🇹', true],
+ ['🇹🇻', true],
+ ['🇹🇼', true],
+ ['🇹🇿', true],
+ ['🇹', true],
+ ['🇺🇦', true],
+ ['🇺🇬', true],
+ ['🇺🇲', true],
+ ['🇺🇳', true],
+ ['🇺🇸', true],
+ ['🇺🇾', true],
+ ['🇺🇿', true],
+ ['🇺', true],
+ ['🇻🇦', true],
+ ['🇻🇨', true],
+ ['🇻🇪', true],
+ ['🇻🇬', true],
+ ['🇻🇮', true],
+ ['🇻🇳', true],
+ ['🇻🇺', true],
+ ['🇻', true],
+ ['🇼🇫', true],
+ ['🇼🇸', true],
+ ['🇼', true],
+ ['🇽🇰', true],
+ ['🇽', true],
+ ['🇾🇪', true],
+ ['🇾🇹', true],
+ ['🇾', true],
+ ['🇿🇦', true],
+ ['🇿🇲', true],
+ ['🇿🇼', true],
+ ['🇿', true],
+ ['🈁', true],
+ ['🈂️', true],
+ ['🈚️', true],
+ ['🈯️', true],
+ ['🈲', true],
+ ['🈳', true],
+ ['🈴', true],
+ ['🈵', true],
+ ['🈶', true],
+ ['🈷️', true],
+ ['🈸', true],
+ ['🈹', true],
+ ['🈺', true],
+ ['🉐', true],
+ ['🉑', true],
+ ['🌀', true],
+ ['🌁', true],
+ ['🌂', true],
+ ['🌃', true],
+ ['🌄', true],
+ ['🌅', true],
+ ['🌆', true],
+ ['🌇', true],
+ ['🌈', true],
+ ['🌉', true],
+ ['🌊', true],
+ ['🌋', true],
+ ['🌌', true],
+ ['🌍', true],
+ ['🌎', true],
+ ['🌏', true],
+ ['🌐', true],
+ ['🌑', true],
+ ['🌒', true],
+ ['🌓', true],
+ ['🌔', true],
+ ['🌕', true],
+ ['🌖', true],
+ ['🌗', true],
+ ['🌘', true],
+ ['🌙', true],
+ ['🌚', true],
+ ['🌛', true],
+ ['🌜', true],
+ ['🌝', true],
+ ['🌞', true],
+ ['🌟', true],
+ ['🌠', true],
+ ['🌡️', true],
+ ['🌤️', true],
+ ['🌥️', true],
+ ['🌦️', true],
+ ['🌧️', true],
+ ['🌨️', true],
+ ['🌩️', true],
+ ['🌪️', true],
+ ['🌫️', true],
+ ['🌬️', true],
+ ['🌭', true],
+ ['🌮', true],
+ ['🌯', true],
+ ['🌰', true],
+ ['🌱', true],
+ ['🌲', true],
+ ['🌳', true],
+ ['🌴', true],
+ ['🌵', true],
+ ['🌶️', true],
+ ['🌷', true],
+ ['🌸', true],
+ ['🌹', true],
+ ['🌺', true],
+ ['🌻', true],
+ ['🌼', true],
+ ['🌽', true],
+ ['🌾', true],
+ ['🌿', true],
+ ['🍀', true],
+ ['🍁', true],
+ ['🍂', true],
+ ['🍃', true],
+ ['🍄', true],
+ ['🍅', true],
+ ['🍆', true],
+ ['🍇', true],
+ ['🍈', true],
+ ['🍉', true],
+ ['🍊', true],
+ ['🍋', true],
+ ['🍌', true],
+ ['🍍', true],
+ ['🍎', true],
+ ['🍏', true],
+ ['🍐', true],
+ ['🍑', true],
+ ['🍒', true],
+ ['🍓', true],
+ ['🍔', true],
+ ['🍕', true],
+ ['🍖', true],
+ ['🍗', true],
+ ['🍘', true],
+ ['🍙', true],
+ ['🍚', true],
+ ['🍛', true],
+ ['🍜', true],
+ ['🍝', true],
+ ['🍞', true],
+ ['🍟', true],
+ ['🍠', true],
+ ['🍡', true],
+ ['🍢', true],
+ ['🍣', true],
+ ['🍤', true],
+ ['🍥', true],
+ ['🍦', true],
+ ['🍧', true],
+ ['🍨', true],
+ ['🍩', true],
+ ['🍪', true],
+ ['🍫', true],
+ ['🍬', true],
+ ['🍭', true],
+ ['🍮', true],
+ ['🍯', true],
+ ['🍰', true],
+ ['🍱', true],
+ ['🍲', true],
+ ['🍳', true],
+ ['🍴', true],
+ ['🍵', true],
+ ['🍶', true],
+ ['🍷', true],
+ ['🍸', true],
+ ['🍹', true],
+ ['🍺', true],
+ ['🍻', true],
+ ['🍼', true],
+ ['🍽️', true],
+ ['🍾', true],
+ ['🍿', true],
+ ['🎀', true],
+ ['🎁', true],
+ ['🎂', true],
+ ['🎃', true],
+ ['🎄', true],
+ ['🎅🏻', true],
+ ['🎅🏼', true],
+ ['🎅🏽', true],
+ ['🎅🏾', true],
+ ['🎅🏿', true],
+ ['🎅', true],
+ ['🎆', true],
+ ['🎇', true],
+ ['🎈', true],
+ ['🎉', true],
+ ['🎊', true],
+ ['🎋', true],
+ ['🎌', true],
+ ['🎍', true],
+ ['🎎', true],
+ ['🎏', true],
+ ['🎐', true],
+ ['🎑', true],
+ ['🎒', true],
+ ['🎓', true],
+ ['🎖️', true],
+ ['🎗️', true],
+ ['🎙️', true],
+ ['🎚️', true],
+ ['🎛️', true],
+ ['🎞️', true],
+ ['🎟️', true],
+ ['🎠', true],
+ ['🎡', true],
+ ['🎢', true],
+ ['🎣', true],
+ ['🎤', true],
+ ['🎥', true],
+ ['🎦', true],
+ ['🎧', true],
+ ['🎨', true],
+ ['🎩', true],
+ ['🎪', true],
+ ['🎫', true],
+ ['🎬', true],
+ ['🎭', true],
+ ['🎮', true],
+ ['🎯', true],
+ ['🎰', true],
+ ['🎱', true],
+ ['🎲', true],
+ ['🎳', true],
+ ['🎴', true],
+ ['🎵', true],
+ ['🎶', true],
+ ['🎷', true],
+ ['🎸', true],
+ ['🎹', true],
+ ['🎺', true],
+ ['🎻', true],
+ ['🎼', true],
+ ['🎽', true],
+ ['🎾', true],
+ ['🎿', true],
+ ['🏀', true],
+ ['🏁', true],
+ ['🏂🏻', true],
+ ['🏂🏼', true],
+ ['🏂🏽', true],
+ ['🏂🏾', true],
+ ['🏂🏿', true],
+ ['🏂', true],
+ ['🏃🏻‍♀️', true],
+ ['🏃🏻‍♂️', true],
+ ['🏃🏻', true],
+ ['🏃🏼‍♀️', true],
+ ['🏃🏼‍♂️', true],
+ ['🏃🏼', true],
+ ['🏃🏽‍♀️', true],
+ ['🏃🏽‍♂️', true],
+ ['🏃🏽', true],
+ ['🏃🏾‍♀️', true],
+ ['🏃🏾‍♂️', true],
+ ['🏃🏾', true],
+ ['🏃🏿‍♀️', true],
+ ['🏃🏿‍♂️', true],
+ ['🏃🏿', true],
+ ['🏃‍♀️', true],
+ ['🏃‍♂️', true],
+ ['🏃', true],
+ ['🏄🏻‍♀️', true],
+ ['🏄🏻‍♂️', true],
+ ['🏄🏻', true],
+ ['🏄🏼‍♀️', true],
+ ['🏄🏼‍♂️', true],
+ ['🏄🏼', true],
+ ['🏄🏽‍♀️', true],
+ ['🏄🏽‍♂️', true],
+ ['🏄🏽', true],
+ ['🏄🏾‍♀️', true],
+ ['🏄🏾‍♂️', true],
+ ['🏄🏾', true],
+ ['🏄🏿‍♀️', true],
+ ['🏄🏿‍♂️', true],
+ ['🏄🏿', true],
+ ['🏄‍♀️', true],
+ ['🏄‍♂️', true],
+ ['🏄', true],
+ ['🏅', true],
+ ['🏆', true],
+ ['🏇🏻', true],
+ ['🏇🏼', true],
+ ['🏇🏽', true],
+ ['🏇🏾', true],
+ ['🏇🏿', true],
+ ['🏇', true],
+ ['🏈', true],
+ ['🏉', true],
+ ['🏊🏻‍♀️', true],
+ ['🏊🏻‍♂️', true],
+ ['🏊🏻', true],
+ ['🏊🏼‍♀️', true],
+ ['🏊🏼‍♂️', true],
+ ['🏊🏼', true],
+ ['🏊🏽‍♀️', true],
+ ['🏊🏽‍♂️', true],
+ ['🏊🏽', true],
+ ['🏊🏾‍♀️', true],
+ ['🏊🏾‍♂️', true],
+ ['🏊🏾', true],
+ ['🏊🏿‍♀️', true],
+ ['🏊🏿‍♂️', true],
+ ['🏊🏿', true],
+ ['🏊‍♀️', true],
+ ['🏊‍♂️', true],
+ ['🏊', true],
+ ['🏋🏻‍♀️', true],
+ ['🏋🏻‍♂️', true],
+ ['🏋🏻', true],
+ ['🏋🏼‍♀️', true],
+ ['🏋🏼‍♂️', true],
+ ['🏋🏼', true],
+ ['🏋🏽‍♀️', true],
+ ['🏋🏽‍♂️', true],
+ ['🏋🏽', true],
+ ['🏋🏾‍♀️', true],
+ ['🏋🏾‍♂️', true],
+ ['🏋🏾', true],
+ ['🏋🏿‍♀️', true],
+ ['🏋🏿‍♂️', true],
+ ['🏋🏿', true],
+ ['🏋️‍♀️', true],
+ ['🏋️‍♂️', true],
+ ['🏋️', true],
+ ['🏌🏻‍♀️', true],
+ ['🏌🏻‍♂️', true],
+ ['🏌🏻', true],
+ ['🏌🏼‍♀️', true],
+ ['🏌🏼‍♂️', true],
+ ['🏌🏼', true],
+ ['🏌🏽‍♀️', true],
+ ['🏌🏽‍♂️', true],
+ ['🏌🏽', true],
+ ['🏌🏾‍♀️', true],
+ ['🏌🏾‍♂️', true],
+ ['🏌🏾', true],
+ ['🏌🏿‍♀️', true],
+ ['🏌🏿‍♂️', true],
+ ['🏌🏿', true],
+ ['🏌️‍♀️', true],
+ ['🏌️‍♂️', true],
+ ['🏌️', true],
+ ['🏍️', true],
+ ['🏎️', true],
+ ['🏏', true],
+ ['🏐', true],
+ ['🏑', true],
+ ['🏒', true],
+ ['🏓', true],
+ ['🏔️', true],
+ ['🏕️', true],
+ ['🏖️', true],
+ ['🏗️', true],
+ ['🏘️', true],
+ ['🏙️', true],
+ ['🏚️', true],
+ ['🏛️', true],
+ ['🏜️', true],
+ ['🏝️', true],
+ ['🏞️', true],
+ ['🏟️', true],
+ ['🏠', true],
+ ['🏡', true],
+ ['🏢', true],
+ ['🏣', true],
+ ['🏤', true],
+ ['🏥', true],
+ ['🏦', true],
+ ['🏧', true],
+ ['🏨', true],
+ ['🏩', true],
+ ['🏪', true],
+ ['🏫', true],
+ ['🏬', true],
+ ['🏭', true],
+ ['🏮', true],
+ ['🏯', true],
+ ['🏰', true],
+ ['🏳️‍🌈', true],
+ ['🏳️', true],
+ ['🏴‍☠️', true],
+ ['🏴󠁧󠁢󠁥󠁮󠁧󠁿', true],
+ ['🏴󠁧󠁢󠁳󠁣󠁴󠁿', true],
+ ['🏴󠁧󠁢󠁷󠁬󠁳󠁿', true],
+ ['🏴', true],
+ ['🏵️', true],
+ ['🏷️', true],
+ ['🏸', true],
+ ['🏹', true],
+ ['🏺', true],
+ ['🏻', true],
+ ['🏼', true],
+ ['🏽', true],
+ ['🏾', true],
+ ['🏿', true],
+ ['🐀', true],
+ ['🐁', true],
+ ['🐂', true],
+ ['🐃', true],
+ ['🐄', true],
+ ['🐅', true],
+ ['🐆', true],
+ ['🐇', true],
+ ['🐈', true],
+ ['🐉', true],
+ ['🐊', true],
+ ['🐋', true],
+ ['🐌', true],
+ ['🐍', true],
+ ['🐎', true],
+ ['🐏', true],
+ ['🐐', true],
+ ['🐑', true],
+ ['🐒', true],
+ ['🐓', true],
+ ['🐔', true],
+ ['🐕‍🦺', true],
+ ['🐕', true],
+ ['🐖', true],
+ ['🐗', true],
+ ['🐘', true],
+ ['🐙', true],
+ ['🐚', true],
+ ['🐛', true],
+ ['🐜', true],
+ ['🐝', true],
+ ['🐞', true],
+ ['🐟', true],
+ ['🐠', true],
+ ['🐡', true],
+ ['🐢', true],
+ ['🐣', true],
+ ['🐤', true],
+ ['🐥', true],
+ ['🐦', true],
+ ['🐧', true],
+ ['🐨', true],
+ ['🐩', true],
+ ['🐪', true],
+ ['🐫', true],
+ ['🐬', true],
+ ['🐭', true],
+ ['🐮', true],
+ ['🐯', true],
+ ['🐰', true],
+ ['🐱', true],
+ ['🐲', true],
+ ['🐳', true],
+ ['🐴', true],
+ ['🐵', true],
+ ['🐶', true],
+ ['🐷', true],
+ ['🐸', true],
+ ['🐹', true],
+ ['🐺', true],
+ ['🐻', true],
+ ['🐼', true],
+ ['🐽', true],
+ ['🐾', true],
+ ['🐿️', true],
+ ['👀', true],
+ ['👁‍🗨', true],
+ ['👁️', true],
+ ['👂🏻', true],
+ ['👂🏼', true],
+ ['👂🏽', true],
+ ['👂🏾', true],
+ ['👂🏿', true],
+ ['👂', true],
+ ['👃🏻', true],
+ ['👃🏼', true],
+ ['👃🏽', true],
+ ['👃🏾', true],
+ ['👃🏿', true],
+ ['👃', true],
+ ['👄', true],
+ ['👅', true],
+ ['👆🏻', true],
+ ['👆🏼', true],
+ ['👆🏽', true],
+ ['👆🏾', true],
+ ['👆🏿', true],
+ ['👆', true],
+ ['👇🏻', true],
+ ['👇🏼', true],
+ ['👇🏽', true],
+ ['👇🏾', true],
+ ['👇🏿', true],
+ ['👇', true],
+ ['👈🏻', true],
+ ['👈🏼', true],
+ ['👈🏽', true],
+ ['👈🏾', true],
+ ['👈🏿', true],
+ ['👈', true],
+ ['👉🏻', true],
+ ['👉🏼', true],
+ ['👉🏽', true],
+ ['👉🏾', true],
+ ['👉🏿', true],
+ ['👉', true],
+ ['👊🏻', true],
+ ['👊🏼', true],
+ ['👊🏽', true],
+ ['👊🏾', true],
+ ['👊🏿', true],
+ ['👊', true],
+ ['👋🏻', true],
+ ['👋🏼', true],
+ ['👋🏽', true],
+ ['👋🏾', true],
+ ['👋🏿', true],
+ ['👋', true],
+ ['👌🏻', true],
+ ['👌🏼', true],
+ ['👌🏽', true],
+ ['👌🏾', true],
+ ['👌🏿', true],
+ ['👌', true],
+ ['👍🏻', true],
+ ['👍🏼', true],
+ ['👍🏽', true],
+ ['👍🏾', true],
+ ['👍🏿', true],
+ ['👍', true],
+ ['👎🏻', true],
+ ['👎🏼', true],
+ ['👎🏽', true],
+ ['👎🏾', true],
+ ['👎🏿', true],
+ ['👎', true],
+ ['👏🏻', true],
+ ['👏🏼', true],
+ ['👏🏽', true],
+ ['👏🏾', true],
+ ['👏🏿', true],
+ ['👏', true],
+ ['👐🏻', true],
+ ['👐🏼', true],
+ ['👐🏽', true],
+ ['👐🏾', true],
+ ['👐🏿', true],
+ ['👐', true],
+ ['👑', true],
+ ['👒', true],
+ ['👓', true],
+ ['👔', true],
+ ['👕', true],
+ ['👖', true],
+ ['👗', true],
+ ['👘', true],
+ ['👙', true],
+ ['👚', true],
+ ['👛', true],
+ ['👜', true],
+ ['👝', true],
+ ['👞', true],
+ ['👟', true],
+ ['👠', true],
+ ['👡', true],
+ ['👢', true],
+ ['👣', true],
+ ['👤', true],
+ ['👥', true],
+ ['👦🏻', true],
+ ['👦🏼', true],
+ ['👦🏽', true],
+ ['👦🏾', true],
+ ['👦🏿', true],
+ ['👦', true],
+ ['👧🏻', true],
+ ['👧🏼', true],
+ ['👧🏽', true],
+ ['👧🏾', true],
+ ['👧🏿', true],
+ ['👧', true],
+ ['👨🏻‍🌾', true],
+ ['👨🏻‍🍳', true],
+ ['👨🏻‍🎓', true],
+ ['👨🏻‍🎤', true],
+ ['👨🏻‍🎨', true],
+ ['👨🏻‍🏫', true],
+ ['👨🏻‍🏭', true],
+ ['👨🏻‍💻', true],
+ ['👨🏻‍💼', true],
+ ['👨🏻‍🔧', true],
+ ['👨🏻‍🔬', true],
+ ['👨🏻‍🚀', true],
+ ['👨🏻‍🚒', true],
+ ['👨🏻‍🦯', true],
+ ['👨🏻‍🦰', true],
+ ['👨🏻‍🦱', true],
+ ['👨🏻‍🦲', true],
+ ['👨🏻‍🦳', true],
+ ['👨🏻‍🦼', true],
+ ['👨🏻‍🦽', true],
+ ['👨🏻‍⚕️', true],
+ ['👨🏻‍⚖️', true],
+ ['👨🏻‍✈️', true],
+ ['👨🏻', true],
+ ['👨🏼‍🌾', true],
+ ['👨🏼‍🍳', true],
+ ['👨🏼‍🎓', true],
+ ['👨🏼‍🎤', true],
+ ['👨🏼‍🎨', true],
+ ['👨🏼‍🏫', true],
+ ['👨🏼‍🏭', true],
+ ['👨🏼‍💻', true],
+ ['👨🏼‍💼', true],
+ ['👨🏼‍🔧', true],
+ ['👨🏼‍🔬', true],
+ ['👨🏼‍🚀', true],
+ ['👨🏼‍🚒', true],
+ ['👨🏼‍🤝‍👨🏻', true],
+ ['👨🏼‍🦯', true],
+ ['👨🏼‍🦰', true],
+ ['👨🏼‍🦱', true],
+ ['👨🏼‍🦲', true],
+ ['👨🏼‍🦳', true],
+ ['👨🏼‍🦼', true],
+ ['👨🏼‍🦽', true],
+ ['👨🏼‍⚕️', true],
+ ['👨🏼‍⚖️', true],
+ ['👨🏼‍✈️', true],
+ ['👨🏼', true],
+ ['👨🏽‍🌾', true],
+ ['👨🏽‍🍳', true],
+ ['👨🏽‍🎓', true],
+ ['👨🏽‍🎤', true],
+ ['👨🏽‍🎨', true],
+ ['👨🏽‍🏫', true],
+ ['👨🏽‍🏭', true],
+ ['👨🏽‍💻', true],
+ ['👨🏽‍💼', true],
+ ['👨🏽‍🔧', true],
+ ['👨🏽‍🔬', true],
+ ['👨🏽‍🚀', true],
+ ['👨🏽‍🚒', true],
+ ['👨🏽‍🤝‍👨🏻', true],
+ ['👨🏽‍🤝‍👨🏼', true],
+ ['👨🏽‍🦯', true],
+ ['👨🏽‍🦰', true],
+ ['👨🏽‍🦱', true],
+ ['👨🏽‍🦲', true],
+ ['👨🏽‍🦳', true],
+ ['👨🏽‍🦼', true],
+ ['👨🏽‍🦽', true],
+ ['👨🏽‍⚕️', true],
+ ['👨🏽‍⚖️', true],
+ ['👨🏽‍✈️', true],
+ ['👨🏽', true],
+ ['👨🏾‍🌾', true],
+ ['👨🏾‍🍳', true],
+ ['👨🏾‍🎓', true],
+ ['👨🏾‍🎤', true],
+ ['👨🏾‍🎨', true],
+ ['👨🏾‍🏫', true],
+ ['👨🏾‍🏭', true],
+ ['👨🏾‍💻', true],
+ ['👨🏾‍💼', true],
+ ['👨🏾‍🔧', true],
+ ['👨🏾‍🔬', true],
+ ['👨🏾‍🚀', true],
+ ['👨🏾‍🚒', true],
+ ['👨🏾‍🤝‍👨🏻', true],
+ ['👨🏾‍🤝‍👨🏼', true],
+ ['👨🏾‍🤝‍👨🏽', true],
+ ['👨🏾‍🦯', true],
+ ['👨🏾‍🦰', true],
+ ['👨🏾‍🦱', true],
+ ['👨🏾‍🦲', true],
+ ['👨🏾‍🦳', true],
+ ['👨🏾‍🦼', true],
+ ['👨🏾‍🦽', true],
+ ['👨🏾‍⚕️', true],
+ ['👨🏾‍⚖️', true],
+ ['👨🏾‍✈️', true],
+ ['👨🏾', true],
+ ['👨🏿‍🌾', true],
+ ['👨🏿‍🍳', true],
+ ['👨🏿‍🎓', true],
+ ['👨🏿‍🎤', true],
+ ['👨🏿‍🎨', true],
+ ['👨🏿‍🏫', true],
+ ['👨🏿‍🏭', true],
+ ['👨🏿‍💻', true],
+ ['👨🏿‍💼', true],
+ ['👨🏿‍🔧', true],
+ ['👨🏿‍🔬', true],
+ ['👨🏿‍🚀', true],
+ ['👨🏿‍🚒', true],
+ ['👨🏿‍🤝‍👨🏻', true],
+ ['👨🏿‍🤝‍👨🏼', true],
+ ['👨🏿‍🤝‍👨🏽', true],
+ ['👨🏿‍🤝‍👨🏾', true],
+ ['👨🏿‍🦯', true],
+ ['👨🏿‍🦰', true],
+ ['👨🏿‍🦱', true],
+ ['👨🏿‍🦲', true],
+ ['👨🏿‍🦳', true],
+ ['👨🏿‍🦼', true],
+ ['👨🏿‍🦽', true],
+ ['👨🏿‍⚕️', true],
+ ['👨🏿‍⚖️', true],
+ ['👨🏿‍✈️', true],
+ ['👨🏿', true],
+ ['👨‍🌾', true],
+ ['👨‍🍳', true],
+ ['👨‍🎓', true],
+ ['👨‍🎤', true],
+ ['👨‍🎨', true],
+ ['👨‍🏫', true],
+ ['👨‍🏭', true],
+ ['👨‍👦‍👦', true],
+ ['👨‍👦', true],
+ ['👨‍👧‍👦', true],
+ ['👨‍👧‍👧', true],
+ ['👨‍👧', true],
+ ['👨‍👨‍👦‍👦', true],
+ ['👨‍👨‍👦', true],
+ ['👨‍👨‍👧‍👦', true],
+ ['👨‍👨‍👧‍👧', true],
+ ['👨‍👨‍👧', true],
+ ['👨‍👩‍👦‍👦', true],
+ ['👨‍👩‍👦', true],
+ ['👨‍👩‍👧‍👦', true],
+ ['👨‍👩‍👧‍👧', true],
+ ['👨‍👩‍👧', true],
+ ['👨‍💻', true],
+ ['👨‍💼', true],
+ ['👨‍🔧', true],
+ ['👨‍🔬', true],
+ ['👨‍🚀', true],
+ ['👨‍🚒', true],
+ ['👨‍🦯', true],
+ ['👨‍🦰', true],
+ ['👨‍🦱', true],
+ ['👨‍🦲', true],
+ ['👨‍🦳', true],
+ ['👨‍🦼', true],
+ ['👨‍🦽', true],
+ ['👨‍⚕️', true],
+ ['👨‍⚖️', true],
+ ['👨‍✈️', true],
+ ['👨‍❤️‍👨', true],
+ ['👨‍❤️‍💋‍👨', true],
+ ['👨', true],
+ ['👩🏻‍🌾', true],
+ ['👩🏻‍🍳', true],
+ ['👩🏻‍🎓', true],
+ ['👩🏻‍🎤', true],
+ ['👩🏻‍🎨', true],
+ ['👩🏻‍🏫', true],
+ ['👩🏻‍🏭', true],
+ ['👩🏻‍💻', true],
+ ['👩🏻‍💼', true],
+ ['👩🏻‍🔧', true],
+ ['👩🏻‍🔬', true],
+ ['👩🏻‍🚀', true],
+ ['👩🏻‍🚒', true],
+ ['👩🏻‍🤝‍👨🏼', true],
+ ['👩🏻‍🤝‍👨🏽', true],
+ ['👩🏻‍🤝‍👨🏾', true],
+ ['👩🏻‍🤝‍👨🏿', true],
+ ['👩🏻‍🦯', true],
+ ['👩🏻‍🦰', true],
+ ['👩🏻‍🦱', true],
+ ['👩🏻‍🦲', true],
+ ['👩🏻‍🦳', true],
+ ['👩🏻‍🦼', true],
+ ['👩🏻‍🦽', true],
+ ['👩🏻‍⚕️', true],
+ ['👩🏻‍⚖️', true],
+ ['👩🏻‍✈️', true],
+ ['👩🏻', true],
+ ['👩🏼‍🌾', true],
+ ['👩🏼‍🍳', true],
+ ['👩🏼‍🎓', true],
+ ['👩🏼‍🎤', true],
+ ['👩🏼‍🎨', true],
+ ['👩🏼‍🏫', true],
+ ['👩🏼‍🏭', true],
+ ['👩🏼‍💻', true],
+ ['👩🏼‍💼', true],
+ ['👩🏼‍🔧', true],
+ ['👩🏼‍🔬', true],
+ ['👩🏼‍🚀', true],
+ ['👩🏼‍🚒', true],
+ ['👩🏼‍🤝‍👨🏻', true],
+ ['👩🏼‍🤝‍👨🏽', true],
+ ['👩🏼‍🤝‍👨🏾', true],
+ ['👩🏼‍🤝‍👨🏿', true],
+ ['👩🏼‍🤝‍👩🏻', true],
+ ['👩🏼‍🦯', true],
+ ['👩🏼‍🦰', true],
+ ['👩🏼‍🦱', true],
+ ['👩🏼‍🦲', true],
+ ['👩🏼‍🦳', true],
+ ['👩🏼‍🦼', true],
+ ['👩🏼‍🦽', true],
+ ['👩🏼‍⚕️', true],
+ ['👩🏼‍⚖️', true],
+ ['👩🏼‍✈️', true],
+ ['👩🏼', true],
+ ['👩🏽‍🌾', true],
+ ['👩🏽‍🍳', true],
+ ['👩🏽‍🎓', true],
+ ['👩🏽‍🎤', true],
+ ['👩🏽‍🎨', true],
+ ['👩🏽‍🏫', true],
+ ['👩🏽‍🏭', true],
+ ['👩🏽‍💻', true],
+ ['👩🏽‍💼', true],
+ ['👩🏽‍🔧', true],
+ ['👩🏽‍🔬', true],
+ ['👩🏽‍🚀', true],
+ ['👩🏽‍🚒', true],
+ ['👩🏽‍🤝‍👨🏻', true],
+ ['👩🏽‍🤝‍👨🏼', true],
+ ['👩🏽‍🤝‍👨🏾', true],
+ ['👩🏽‍🤝‍👨🏿', true],
+ ['👩🏽‍🤝‍👩🏻', true],
+ ['👩🏽‍🤝‍👩🏼', true],
+ ['👩🏽‍🦯', true],
+ ['👩🏽‍🦰', true],
+ ['👩🏽‍🦱', true],
+ ['👩🏽‍🦲', true],
+ ['👩🏽‍🦳', true],
+ ['👩🏽‍🦼', true],
+ ['👩🏽‍🦽', true],
+ ['👩🏽‍⚕️', true],
+ ['👩🏽‍⚖️', true],
+ ['👩🏽‍✈️', true],
+ ['👩🏽', true],
+ ['👩🏾‍🌾', true],
+ ['👩🏾‍🍳', true],
+ ['👩🏾‍🎓', true],
+ ['👩🏾‍🎤', true],
+ ['👩🏾‍🎨', true],
+ ['👩🏾‍🏫', true],
+ ['👩🏾‍🏭', true],
+ ['👩🏾‍💻', true],
+ ['👩🏾‍💼', true],
+ ['👩🏾‍🔧', true],
+ ['👩🏾‍🔬', true],
+ ['👩🏾‍🚀', true],
+ ['👩🏾‍🚒', true],
+ ['👩🏾‍🤝‍👨🏻', true],
+ ['👩🏾‍🤝‍👨🏼', true],
+ ['👩🏾‍🤝‍👨🏽', true],
+ ['👩🏾‍🤝‍👨🏿', true],
+ ['👩🏾‍🤝‍👩🏻', true],
+ ['👩🏾‍🤝‍👩🏼', true],
+ ['👩🏾‍🤝‍👩🏽', true],
+ ['👩🏾‍🦯', true],
+ ['👩🏾‍🦰', true],
+ ['👩🏾‍🦱', true],
+ ['👩🏾‍🦲', true],
+ ['👩🏾‍🦳', true],
+ ['👩🏾‍🦼', true],
+ ['👩🏾‍🦽', true],
+ ['👩🏾‍⚕️', true],
+ ['👩🏾‍⚖️', true],
+ ['👩🏾‍✈️', true],
+ ['👩🏾', true],
+ ['👩🏿‍🌾', true],
+ ['👩🏿‍🍳', true],
+ ['👩🏿‍🎓', true],
+ ['👩🏿‍🎤', true],
+ ['👩🏿‍🎨', true],
+ ['👩🏿‍🏫', true],
+ ['👩🏿‍🏭', true],
+ ['👩🏿‍💻', true],
+ ['👩🏿‍💼', true],
+ ['👩🏿‍🔧', true],
+ ['👩🏿‍🔬', true],
+ ['👩🏿‍🚀', true],
+ ['👩🏿‍🚒', true],
+ ['👩🏿‍🤝‍👨🏻', true],
+ ['👩🏿‍🤝‍👨🏼', true],
+ ['👩🏿‍🤝‍👨🏽', true],
+ ['👩🏿‍🤝‍👨🏾', true],
+ ['👩🏿‍🤝‍👩🏻', true],
+ ['👩🏿‍🤝‍👩🏼', true],
+ ['👩🏿‍🤝‍👩🏽', true],
+ ['👩🏿‍🤝‍👩🏾', true],
+ ['👩🏿‍🦯', true],
+ ['👩🏿‍🦰', true],
+ ['👩🏿‍🦱', true],
+ ['👩🏿‍🦲', true],
+ ['👩🏿‍🦳', true],
+ ['👩🏿‍🦼', true],
+ ['👩🏿‍🦽', true],
+ ['👩🏿‍⚕️', true],
+ ['👩🏿‍⚖️', true],
+ ['👩🏿‍✈️', true],
+ ['👩🏿', true],
+ ['👩‍🌾', true],
+ ['👩‍🍳', true],
+ ['👩‍🎓', true],
+ ['👩‍🎤', true],
+ ['👩‍🎨', true],
+ ['👩‍🏫', true],
+ ['👩‍🏭', true],
+ ['👩‍👦‍👦', true],
+ ['👩‍👦', true],
+ ['👩‍👧‍👦', true],
+ ['👩‍👧‍👧', true],
+ ['👩‍👧', true],
+ ['👩‍👩‍👦‍👦', true],
+ ['👩‍👩‍👦', true],
+ ['👩‍👩‍👧‍👦', true],
+ ['👩‍👩‍👧‍👧', true],
+ ['👩‍👩‍👧', true],
+ ['👩‍💻', true],
+ ['👩‍💼', true],
+ ['👩‍🔧', true],
+ ['👩‍🔬', true],
+ ['👩‍🚀', true],
+ ['👩‍🚒', true],
+ ['👩‍🦯', true],
+ ['👩‍🦰', true],
+ ['👩‍🦱', true],
+ ['👩‍🦲', true],
+ ['👩‍🦳', true],
+ ['👩‍🦼', true],
+ ['👩‍🦽', true],
+ ['👩‍⚕️', true],
+ ['👩‍⚖️', true],
+ ['👩‍✈️', true],
+ ['👩‍❤️‍👨', true],
+ ['👩‍❤️‍👩', true],
+ ['👩‍❤️‍💋‍👨', true],
+ ['👩‍❤️‍💋‍👩', true],
+ ['👩', true],
+ ['👪', true],
+ ['👫🏻', true],
+ ['👫🏼', true],
+ ['👫🏽', true],
+ ['👫🏾', true],
+ ['👫🏿', true],
+ ['👫', true],
+ ['👬🏻', true],
+ ['👬🏼', true],
+ ['👬🏽', true],
+ ['👬🏾', true],
+ ['👬🏿', true],
+ ['👬', true],
+ ['👭🏻', true],
+ ['👭🏼', true],
+ ['👭🏽', true],
+ ['👭🏾', true],
+ ['👭🏿', true],
+ ['👭', true],
+ ['👮🏻‍♀️', true],
+ ['👮🏻‍♂️', true],
+ ['👮🏻', true],
+ ['👮🏼‍♀️', true],
+ ['👮🏼‍♂️', true],
+ ['👮🏼', true],
+ ['👮🏽‍♀️', true],
+ ['👮🏽‍♂️', true],
+ ['👮🏽', true],
+ ['👮🏾‍♀️', true],
+ ['👮🏾‍♂️', true],
+ ['👮🏾', true],
+ ['👮🏿‍♀️', true],
+ ['👮🏿‍♂️', true],
+ ['👮🏿', true],
+ ['👮‍♀️', true],
+ ['👮‍♂️', true],
+ ['👮', true],
+ ['👯‍♀️', true],
+ ['👯‍♂️', true],
+ ['👯', true],
+ ['👰🏻', true],
+ ['👰🏼', true],
+ ['👰🏽', true],
+ ['👰🏾', true],
+ ['👰🏿', true],
+ ['👰', true],
+ ['👱🏻‍♀️', true],
+ ['👱🏻‍♂️', true],
+ ['👱🏻', true],
+ ['👱🏼‍♀️', true],
+ ['👱🏼‍♂️', true],
+ ['👱🏼', true],
+ ['👱🏽‍♀️', true],
+ ['👱🏽‍♂️', true],
+ ['👱🏽', true],
+ ['👱🏾‍♀️', true],
+ ['👱🏾‍♂️', true],
+ ['👱🏾', true],
+ ['👱🏿‍♀️', true],
+ ['👱🏿‍♂️', true],
+ ['👱🏿', true],
+ ['👱‍♀️', true],
+ ['👱‍♂️', true],
+ ['👱', true],
+ ['👲🏻', true],
+ ['👲🏼', true],
+ ['👲🏽', true],
+ ['👲🏾', true],
+ ['👲🏿', true],
+ ['👲', true],
+ ['👳🏻‍♀️', true],
+ ['👳🏻‍♂️', true],
+ ['👳🏻', true],
+ ['👳🏼‍♀️', true],
+ ['👳🏼‍♂️', true],
+ ['👳🏼', true],
+ ['👳🏽‍♀️', true],
+ ['👳🏽‍♂️', true],
+ ['👳🏽', true],
+ ['👳🏾‍♀️', true],
+ ['👳🏾‍♂️', true],
+ ['👳🏾', true],
+ ['👳🏿‍♀️', true],
+ ['👳🏿‍♂️', true],
+ ['👳🏿', true],
+ ['👳‍♀️', true],
+ ['👳‍♂️', true],
+ ['👳', true],
+ ['👴🏻', true],
+ ['👴🏼', true],
+ ['👴🏽', true],
+ ['👴🏾', true],
+ ['👴🏿', true],
+ ['👴', true],
+ ['👵🏻', true],
+ ['👵🏼', true],
+ ['👵🏽', true],
+ ['👵🏾', true],
+ ['👵🏿', true],
+ ['👵', true],
+ ['👶🏻', true],
+ ['👶🏼', true],
+ ['👶🏽', true],
+ ['👶🏾', true],
+ ['👶🏿', true],
+ ['👶', true],
+ ['👷🏻‍♀️', true],
+ ['👷🏻‍♂️', true],
+ ['👷🏻', true],
+ ['👷🏼‍♀️', true],
+ ['👷🏼‍♂️', true],
+ ['👷🏼', true],
+ ['👷🏽‍♀️', true],
+ ['👷🏽‍♂️', true],
+ ['👷🏽', true],
+ ['👷🏾‍♀️', true],
+ ['👷🏾‍♂️', true],
+ ['👷🏾', true],
+ ['👷🏿‍♀️', true],
+ ['👷🏿‍♂️', true],
+ ['👷🏿', true],
+ ['👷‍♀️', true],
+ ['👷‍♂️', true],
+ ['👷', true],
+ ['👸🏻', true],
+ ['👸🏼', true],
+ ['👸🏽', true],
+ ['👸🏾', true],
+ ['👸🏿', true],
+ ['👸', true],
+ ['👹', true],
+ ['👺', true],
+ ['👻', true],
+ ['👼🏻', true],
+ ['👼🏼', true],
+ ['👼🏽', true],
+ ['👼🏾', true],
+ ['👼🏿', true],
+ ['👼', true],
+ ['👽', true],
+ ['👾', true],
+ ['👿', true],
+ ['💀', true],
+ ['💁🏻‍♀️', true],
+ ['💁🏻‍♂️', true],
+ ['💁🏻', true],
+ ['💁🏼‍♀️', true],
+ ['💁🏼‍♂️', true],
+ ['💁🏼', true],
+ ['💁🏽‍♀️', true],
+ ['💁🏽‍♂️', true],
+ ['💁🏽', true],
+ ['💁🏾‍♀️', true],
+ ['💁🏾‍♂️', true],
+ ['💁🏾', true],
+ ['💁🏿‍♀️', true],
+ ['💁🏿‍♂️', true],
+ ['💁🏿', true],
+ ['💁‍♀️', true],
+ ['💁‍♂️', true],
+ ['💁', true],
+ ['💂🏻‍♀️', true],
+ ['💂🏻‍♂️', true],
+ ['💂🏻', true],
+ ['💂🏼‍♀️', true],
+ ['💂🏼‍♂️', true],
+ ['💂🏼', true],
+ ['💂🏽‍♀️', true],
+ ['💂🏽‍♂️', true],
+ ['💂🏽', true],
+ ['💂🏾‍♀️', true],
+ ['💂🏾‍♂️', true],
+ ['💂🏾', true],
+ ['💂🏿‍♀️', true],
+ ['💂🏿‍♂️', true],
+ ['💂🏿', true],
+ ['💂‍♀️', true],
+ ['💂‍♂️', true],
+ ['💂', true],
+ ['💃🏻', true],
+ ['💃🏼', true],
+ ['💃🏽', true],
+ ['💃🏾', true],
+ ['💃🏿', true],
+ ['💃', true],
+ ['💄', true],
+ ['💅🏻', true],
+ ['💅🏼', true],
+ ['💅🏽', true],
+ ['💅🏾', true],
+ ['💅🏿', true],
+ ['💅', true],
+ ['💆🏻‍♀️', true],
+ ['💆🏻‍♂️', true],
+ ['💆🏻', true],
+ ['💆🏼‍♀️', true],
+ ['💆🏼‍♂️', true],
+ ['💆🏼', true],
+ ['💆🏽‍♀️', true],
+ ['💆🏽‍♂️', true],
+ ['💆🏽', true],
+ ['💆🏾‍♀️', true],
+ ['💆🏾‍♂️', true],
+ ['💆🏾', true],
+ ['💆🏿‍♀️', true],
+ ['💆🏿‍♂️', true],
+ ['💆🏿', true],
+ ['💆‍♀️', true],
+ ['💆‍♂️', true],
+ ['💆', true],
+ ['💇🏻‍♀️', true],
+ ['💇🏻‍♂️', true],
+ ['💇🏻', true],
+ ['💇🏼‍♀️', true],
+ ['💇🏼‍♂️', true],
+ ['💇🏼', true],
+ ['💇🏽‍♀️', true],
+ ['💇🏽‍♂️', true],
+ ['💇🏽', true],
+ ['💇🏾‍♀️', true],
+ ['💇🏾‍♂️', true],
+ ['💇🏾', true],
+ ['💇🏿‍♀️', true],
+ ['💇🏿‍♂️', true],
+ ['💇🏿', true],
+ ['💇‍♀️', true],
+ ['💇‍♂️', true],
+ ['💇', true],
+ ['💈', true],
+ ['💉', true],
+ ['💊', true],
+ ['💋', true],
+ ['💌', true],
+ ['💍', true],
+ ['💎', true],
+ ['💏', true],
+ ['💐', true],
+ ['💑', true],
+ ['💒', true],
+ ['💓', true],
+ ['💔', true],
+ ['💕', true],
+ ['💖', true],
+ ['💗', true],
+ ['💘', true],
+ ['💙', true],
+ ['💚', true],
+ ['💛', true],
+ ['💜', true],
+ ['💝', true],
+ ['💞', true],
+ ['💟', true],
+ ['💠', true],
+ ['💡', true],
+ ['💢', true],
+ ['💣', true],
+ ['💤', true],
+ ['💥', true],
+ ['💦', true],
+ ['💧', true],
+ ['💨', true],
+ ['💩', true],
+ ['💪🏻', true],
+ ['💪🏼', true],
+ ['💪🏽', true],
+ ['💪🏾', true],
+ ['💪🏿', true],
+ ['💪', true],
+ ['💫', true],
+ ['💬', true],
+ ['💭', true],
+ ['💮', true],
+ ['💯', true],
+ ['💰', true],
+ ['💱', true],
+ ['💲', true],
+ ['💳', true],
+ ['💴', true],
+ ['💵', true],
+ ['💶', true],
+ ['💷', true],
+ ['💸', true],
+ ['💹', true],
+ ['💺', true],
+ ['💻', true],
+ ['💼', true],
+ ['💽', true],
+ ['💾', true],
+ ['💿', true],
+ ['📀', true],
+ ['📁', true],
+ ['📂', true],
+ ['📃', true],
+ ['📄', true],
+ ['📅', true],
+ ['📆', true],
+ ['📇', true],
+ ['📈', true],
+ ['📉', true],
+ ['📊', true],
+ ['📋', true],
+ ['📌', true],
+ ['📍', true],
+ ['📎', true],
+ ['📏', true],
+ ['📐', true],
+ ['📑', true],
+ ['📒', true],
+ ['📓', true],
+ ['📔', true],
+ ['📕', true],
+ ['📖', true],
+ ['📗', true],
+ ['📘', true],
+ ['📙', true],
+ ['📚', true],
+ ['📛', true],
+ ['📜', true],
+ ['📝', true],
+ ['📞', true],
+ ['📟', true],
+ ['📠', true],
+ ['📡', true],
+ ['📢', true],
+ ['📣', true],
+ ['📤', true],
+ ['📥', true],
+ ['📦', true],
+ ['📧', true],
+ ['📨', true],
+ ['📩', true],
+ ['📪', true],
+ ['📫', true],
+ ['📬', true],
+ ['📭', true],
+ ['📮', true],
+ ['📯', true],
+ ['📰', true],
+ ['📱', true],
+ ['📲', true],
+ ['📳', true],
+ ['📴', true],
+ ['📵', true],
+ ['📶', true],
+ ['📷', true],
+ ['📸', true],
+ ['📹', true],
+ ['📺', true],
+ ['📻', true],
+ ['📼', true],
+ ['📽️', true],
+ ['📿', true],
+ ['🔀', true],
+ ['🔁', true],
+ ['🔂', true],
+ ['🔃', true],
+ ['🔄', true],
+ ['🔅', true],
+ ['🔆', true],
+ ['🔇', true],
+ ['🔈', true],
+ ['🔉', true],
+ ['🔊', true],
+ ['🔋', true],
+ ['🔌', true],
+ ['🔍', true],
+ ['🔎', true],
+ ['🔏', true],
+ ['🔐', true],
+ ['🔑', true],
+ ['🔒', true],
+ ['🔓', true],
+ ['🔔', true],
+ ['🔕', true],
+ ['🔖', true],
+ ['🔗', true],
+ ['🔘', true],
+ ['🔙', true],
+ ['🔚', true],
+ ['🔛', true],
+ ['🔜', true],
+ ['🔝', true],
+ ['🔞', true],
+ ['🔟', true],
+ ['🔠', true],
+ ['🔡', true],
+ ['🔢', true],
+ ['🔣', true],
+ ['🔤', true],
+ ['🔥', true],
+ ['🔦', true],
+ ['🔧', true],
+ ['🔨', true],
+ ['🔩', true],
+ ['🔪', true],
+ ['🔫', true],
+ ['🔬', true],
+ ['🔭', true],
+ ['🔮', true],
+ ['🔯', true],
+ ['🔰', true],
+ ['🔱', true],
+ ['🔲', true],
+ ['🔳', true],
+ ['🔴', true],
+ ['🔵', true],
+ ['🔶', true],
+ ['🔷', true],
+ ['🔸', true],
+ ['🔹', true],
+ ['🔺', true],
+ ['🔻', true],
+ ['🔼', true],
+ ['🔽', true],
+ ['🕉️', true],
+ ['🕊️', true],
+ ['🕋', true],
+ ['🕌', true],
+ ['🕍', true],
+ ['🕎', true],
+ ['🕐', true],
+ ['🕑', true],
+ ['🕒', true],
+ ['🕓', true],
+ ['🕔', true],
+ ['🕕', true],
+ ['🕖', true],
+ ['🕗', true],
+ ['🕘', true],
+ ['🕙', true],
+ ['🕚', true],
+ ['🕛', true],
+ ['🕜', true],
+ ['🕝', true],
+ ['🕞', true],
+ ['🕟', true],
+ ['🕠', true],
+ ['🕡', true],
+ ['🕢', true],
+ ['🕣', true],
+ ['🕤', true],
+ ['🕥', true],
+ ['🕦', true],
+ ['🕧', true],
+ ['🕯️', true],
+ ['🕰️', true],
+ ['🕳️', true],
+ ['🕴🏻‍♀️', true],
+ ['🕴🏻‍♂️', true],
+ ['🕴🏻', true],
+ ['🕴🏼‍♀️', true],
+ ['🕴🏼‍♂️', true],
+ ['🕴🏼', true],
+ ['🕴🏽‍♀️', true],
+ ['🕴🏽‍♂️', true],
+ ['🕴🏽', true],
+ ['🕴🏾‍♀️', true],
+ ['🕴🏾‍♂️', true],
+ ['🕴🏾', true],
+ ['🕴🏿‍♀️', true],
+ ['🕴🏿‍♂️', true],
+ ['🕴🏿', true],
+ ['🕴️‍♀️', true],
+ ['🕴️‍♂️', true],
+ ['🕴️', true],
+ ['🕵🏻‍♀️', true],
+ ['🕵🏻‍♂️', true],
+ ['🕵🏻', true],
+ ['🕵🏼‍♀️', true],
+ ['🕵🏼‍♂️', true],
+ ['🕵🏼', true],
+ ['🕵🏽‍♀️', true],
+ ['🕵🏽‍♂️', true],
+ ['🕵🏽', true],
+ ['🕵🏾‍♀️', true],
+ ['🕵🏾‍♂️', true],
+ ['🕵🏾', true],
+ ['🕵🏿‍♀️', true],
+ ['🕵🏿‍♂️', true],
+ ['🕵🏿', true],
+ ['🕵️‍♀️', true],
+ ['🕵️‍♂️', true],
+ ['🕵️', true],
+ ['🕶️', true],
+ ['🕷️', true],
+ ['🕸️', true],
+ ['🕹️', true],
+ ['🕺🏻', true],
+ ['🕺🏼', true],
+ ['🕺🏽', true],
+ ['🕺🏾', true],
+ ['🕺🏿', true],
+ ['🕺', true],
+ ['🖇️', true],
+ ['🖊️', true],
+ ['🖋️', true],
+ ['🖌️', true],
+ ['🖍️', true],
+ ['🖐🏻', true],
+ ['🖐🏼', true],
+ ['🖐🏽', true],
+ ['🖐🏾', true],
+ ['🖐🏿', true],
+ ['🖐️', true],
+ ['🖕🏻', true],
+ ['🖕🏼', true],
+ ['🖕🏽', true],
+ ['🖕🏾', true],
+ ['🖕🏿', true],
+ ['🖕', true],
+ ['🖖🏻', true],
+ ['🖖🏼', true],
+ ['🖖🏽', true],
+ ['🖖🏾', true],
+ ['🖖🏿', true],
+ ['🖖', true],
+ ['🖤', true],
+ ['🖥️', true],
+ ['🖨️', true],
+ ['🖱️', true],
+ ['🖲️', true],
+ ['🖼️', true],
+ ['🗂️', true],
+ ['🗃️', true],
+ ['🗄️', true],
+ ['🗑️', true],
+ ['🗒️', true],
+ ['🗓️', true],
+ ['🗜️', true],
+ ['🗝️', true],
+ ['🗞️', true],
+ ['🗡️', true],
+ ['🗣️', true],
+ ['🗨️', true],
+ ['🗯️', true],
+ ['🗳️', true],
+ ['🗺️', true],
+ ['🗻', true],
+ ['🗼', true],
+ ['🗽', true],
+ ['🗾', true],
+ ['🗿', true],
+ ['😀', true],
+ ['😁', true],
+ ['😂', true],
+ ['😃', true],
+ ['😄', true],
+ ['😅', true],
+ ['😆', true],
+ ['😇', true],
+ ['😈', true],
+ ['😉', true],
+ ['😊', true],
+ ['😋', true],
+ ['😌', true],
+ ['😍', true],
+ ['😎', true],
+ ['😏', true],
+ ['😐', true],
+ ['😑', true],
+ ['😒', true],
+ ['😓', true],
+ ['😔', true],
+ ['😕', true],
+ ['😖', true],
+ ['😗', true],
+ ['😘', true],
+ ['😙', true],
+ ['😚', true],
+ ['😛', true],
+ ['😜', true],
+ ['😝', true],
+ ['😞', true],
+ ['😟', true],
+ ['😠', true],
+ ['😡', true],
+ ['😢', true],
+ ['😣', true],
+ ['😤', true],
+ ['😥', true],
+ ['😦', true],
+ ['😧', true],
+ ['😨', true],
+ ['😩', true],
+ ['😪', true],
+ ['😫', true],
+ ['😬', true],
+ ['😭', true],
+ ['😮', true],
+ ['😯', true],
+ ['😰', true],
+ ['😱', true],
+ ['😲', true],
+ ['😳', true],
+ ['😴', true],
+ ['😵', true],
+ ['😶', true],
+ ['😷', true],
+ ['😸', true],
+ ['😹', true],
+ ['😺', true],
+ ['😻', true],
+ ['😼', true],
+ ['😽', true],
+ ['😾', true],
+ ['😿', true],
+ ['🙀', true],
+ ['🙁', true],
+ ['🙂', true],
+ ['🙃', true],
+ ['🙄', true],
+ ['🙅🏻‍♀️', true],
+ ['🙅🏻‍♂️', true],
+ ['🙅🏻', true],
+ ['🙅🏼‍♀️', true],
+ ['🙅🏼‍♂️', true],
+ ['🙅🏼', true],
+ ['🙅🏽‍♀️', true],
+ ['🙅🏽‍♂️', true],
+ ['🙅🏽', true],
+ ['🙅🏾‍♀️', true],
+ ['🙅🏾‍♂️', true],
+ ['🙅🏾', true],
+ ['🙅🏿‍♀️', true],
+ ['🙅🏿‍♂️', true],
+ ['🙅🏿', true],
+ ['🙅‍♀️', true],
+ ['🙅‍♂️', true],
+ ['🙅', true],
+ ['🙆🏻‍♀️', true],
+ ['🙆🏻‍♂️', true],
+ ['🙆🏻', true],
+ ['🙆🏼‍♀️', true],
+ ['🙆🏼‍♂️', true],
+ ['🙆🏼', true],
+ ['🙆🏽‍♀️', true],
+ ['🙆🏽‍♂️', true],
+ ['🙆🏽', true],
+ ['🙆🏾‍♀️', true],
+ ['🙆🏾‍♂️', true],
+ ['🙆🏾', true],
+ ['🙆🏿‍♀️', true],
+ ['🙆🏿‍♂️', true],
+ ['🙆🏿', true],
+ ['🙆‍♀️', true],
+ ['🙆‍♂️', true],
+ ['🙆', true],
+ ['🙇🏻‍♀️', true],
+ ['🙇🏻‍♂️', true],
+ ['🙇🏻', true],
+ ['🙇🏼‍♀️', true],
+ ['🙇🏼‍♂️', true],
+ ['🙇🏼', true],
+ ['🙇🏽‍♀️', true],
+ ['🙇🏽‍♂️', true],
+ ['🙇🏽', true],
+ ['🙇🏾‍♀️', true],
+ ['🙇🏾‍♂️', true],
+ ['🙇🏾', true],
+ ['🙇🏿‍♀️', true],
+ ['🙇🏿‍♂️', true],
+ ['🙇🏿', true],
+ ['🙇‍♀️', true],
+ ['🙇‍♂️', true],
+ ['🙇', true],
+ ['🙈', true],
+ ['🙉', true],
+ ['🙊', true],
+ ['🙋🏻‍♀️', true],
+ ['🙋🏻‍♂️', true],
+ ['🙋🏻', true],
+ ['🙋🏼‍♀️', true],
+ ['🙋🏼‍♂️', true],
+ ['🙋🏼', true],
+ ['🙋🏽‍♀️', true],
+ ['🙋🏽‍♂️', true],
+ ['🙋🏽', true],
+ ['🙋🏾‍♀️', true],
+ ['🙋🏾‍♂️', true],
+ ['🙋🏾', true],
+ ['🙋🏿‍♀️', true],
+ ['🙋🏿‍♂️', true],
+ ['🙋🏿', true],
+ ['🙋‍♀️', true],
+ ['🙋‍♂️', true],
+ ['🙋', true],
+ ['🙌🏻', true],
+ ['🙌🏼', true],
+ ['🙌🏽', true],
+ ['🙌🏾', true],
+ ['🙌🏿', true],
+ ['🙌', true],
+ ['🙍🏻‍♀️', true],
+ ['🙍🏻‍♂️', true],
+ ['🙍🏻', true],
+ ['🙍🏼‍♀️', true],
+ ['🙍🏼‍♂️', true],
+ ['🙍🏼', true],
+ ['🙍🏽‍♀️', true],
+ ['🙍🏽‍♂️', true],
+ ['🙍🏽', true],
+ ['🙍🏾‍♀️', true],
+ ['🙍🏾‍♂️', true],
+ ['🙍🏾', true],
+ ['🙍🏿‍♀️', true],
+ ['🙍🏿‍♂️', true],
+ ['🙍🏿', true],
+ ['🙍‍♀️', true],
+ ['🙍‍♂️', true],
+ ['🙍', true],
+ ['🙎🏻‍♀️', true],
+ ['🙎🏻‍♂️', true],
+ ['🙎🏻', true],
+ ['🙎🏼‍♀️', true],
+ ['🙎🏼‍♂️', true],
+ ['🙎🏼', true],
+ ['🙎🏽‍♀️', true],
+ ['🙎🏽‍♂️', true],
+ ['🙎🏽', true],
+ ['🙎🏾‍♀️', true],
+ ['🙎🏾‍♂️', true],
+ ['🙎🏾', true],
+ ['🙎🏿‍♀️', true],
+ ['🙎🏿‍♂️', true],
+ ['🙎🏿', true],
+ ['🙎‍♀️', true],
+ ['🙎‍♂️', true],
+ ['🙎', true],
+ ['🙏🏻', true],
+ ['🙏🏼', true],
+ ['🙏🏽', true],
+ ['🙏🏾', true],
+ ['🙏🏿', true],
+ ['🙏', true],
+ ['🚀', true],
+ ['🚁', true],
+ ['🚂', true],
+ ['🚃', true],
+ ['🚄', true],
+ ['🚅', true],
+ ['🚆', true],
+ ['🚇', true],
+ ['🚈', true],
+ ['🚉', true],
+ ['🚊', true],
+ ['🚋', true],
+ ['🚌', true],
+ ['🚍', true],
+ ['🚎', true],
+ ['🚏', true],
+ ['🚐', true],
+ ['🚑', true],
+ ['🚒', true],
+ ['🚓', true],
+ ['🚔', true],
+ ['🚕', true],
+ ['🚖', true],
+ ['🚗', true],
+ ['🚘', true],
+ ['🚙', true],
+ ['🚚', true],
+ ['🚛', true],
+ ['🚜', true],
+ ['🚝', true],
+ ['🚞', true],
+ ['🚟', true],
+ ['🚠', true],
+ ['🚡', true],
+ ['🚢', true],
+ ['🚣🏻‍♀️', true],
+ ['🚣🏻‍♂️', true],
+ ['🚣🏻', true],
+ ['🚣🏼‍♀️', true],
+ ['🚣🏼‍♂️', true],
+ ['🚣🏼', true],
+ ['🚣🏽‍♀️', true],
+ ['🚣🏽‍♂️', true],
+ ['🚣🏽', true],
+ ['🚣🏾‍♀️', true],
+ ['🚣🏾‍♂️', true],
+ ['🚣🏾', true],
+ ['🚣🏿‍♀️', true],
+ ['🚣🏿‍♂️', true],
+ ['🚣🏿', true],
+ ['🚣‍♀️', true],
+ ['🚣‍♂️', true],
+ ['🚣', true],
+ ['🚤', true],
+ ['🚥', true],
+ ['🚦', true],
+ ['🚧', true],
+ ['🚨', true],
+ ['🚩', true],
+ ['🚪', true],
+ ['🚫', true],
+ ['🚬', true],
+ ['🚭', true],
+ ['🚮', true],
+ ['🚯', true],
+ ['🚰', true],
+ ['🚱', true],
+ ['🚲', true],
+ ['🚳', true],
+ ['🚴🏻‍♀️', true],
+ ['🚴🏻‍♂️', true],
+ ['🚴🏻', true],
+ ['🚴🏼‍♀️', true],
+ ['🚴🏼‍♂️', true],
+ ['🚴🏼', true],
+ ['🚴🏽‍♀️', true],
+ ['🚴🏽‍♂️', true],
+ ['🚴🏽', true],
+ ['🚴🏾‍♀️', true],
+ ['🚴🏾‍♂️', true],
+ ['🚴🏾', true],
+ ['🚴🏿‍♀️', true],
+ ['🚴🏿‍♂️', true],
+ ['🚴🏿', true],
+ ['🚴‍♀️', true],
+ ['🚴‍♂️', true],
+ ['🚴', true],
+ ['🚵🏻‍♀️', true],
+ ['🚵🏻‍♂️', true],
+ ['🚵🏻', true],
+ ['🚵🏼‍♀️', true],
+ ['🚵🏼‍♂️', true],
+ ['🚵🏼', true],
+ ['🚵🏽‍♀️', true],
+ ['🚵🏽‍♂️', true],
+ ['🚵🏽', true],
+ ['🚵🏾‍♀️', true],
+ ['🚵🏾‍♂️', true],
+ ['🚵🏾', true],
+ ['🚵🏿‍♀️', true],
+ ['🚵🏿‍♂️', true],
+ ['🚵🏿', true],
+ ['🚵‍♀️', true],
+ ['🚵‍♂️', true],
+ ['🚵', true],
+ ['🚶🏻‍♀️', true],
+ ['🚶🏻‍♂️', true],
+ ['🚶🏻', true],
+ ['🚶🏼‍♀️', true],
+ ['🚶🏼‍♂️', true],
+ ['🚶🏼', true],
+ ['🚶🏽‍♀️', true],
+ ['🚶🏽‍♂️', true],
+ ['🚶🏽', true],
+ ['🚶🏾‍♀️', true],
+ ['🚶🏾‍♂️', true],
+ ['🚶🏾', true],
+ ['🚶🏿‍♀️', true],
+ ['🚶🏿‍♂️', true],
+ ['🚶🏿', true],
+ ['🚶‍♀️', true],
+ ['🚶‍♂️', true],
+ ['🚶', true],
+ ['🚷', true],
+ ['🚸', true],
+ ['🚹', true],
+ ['🚺', true],
+ ['🚻', true],
+ ['🚼', true],
+ ['🚽', true],
+ ['🚾', true],
+ ['🚿', true],
+ ['🛀🏻', true],
+ ['🛀🏼', true],
+ ['🛀🏽', true],
+ ['🛀🏾', true],
+ ['🛀🏿', true],
+ ['🛀', true],
+ ['🛁', true],
+ ['🛂', true],
+ ['🛃', true],
+ ['🛄', true],
+ ['🛅', true],
+ ['🛋️', true],
+ ['🛌🏻', true],
+ ['🛌🏼', true],
+ ['🛌🏽', true],
+ ['🛌🏾', true],
+ ['🛌🏿', true],
+ ['🛌', true],
+ ['🛍️', true],
+ ['🛎️', true],
+ ['🛏️', true],
+ ['🛐', true],
+ ['🛑', true],
+ ['🛒', true],
+ ['🛕', true],
+ ['🛠️', true],
+ ['🛡️', true],
+ ['🛢️', true],
+ ['🛣️', true],
+ ['🛤️', true],
+ ['🛥️', true],
+ ['🛩️', true],
+ ['🛫', true],
+ ['🛬', true],
+ ['🛰️', true],
+ ['🛳️', true],
+ ['🛴', true],
+ ['🛵', true],
+ ['🛶', true],
+ ['🛷', true],
+ ['🛸', true],
+ ['🛹', true],
+ ['🛺', true],
+ ['🟠', true],
+ ['🟡', true],
+ ['🟢', true],
+ ['🟣', true],
+ ['🟤', true],
+ ['🟥', true],
+ ['🟦', true],
+ ['🟧', true],
+ ['🟨', true],
+ ['🟩', true],
+ ['🟪', true],
+ ['🟫', true],
+ ['🤍', true],
+ ['🤎', true],
+ ['🤏🏻', true],
+ ['🤏🏼', true],
+ ['🤏🏽', true],
+ ['🤏🏾', true],
+ ['🤏🏿', true],
+ ['🤏', true],
+ ['🤐', true],
+ ['🤑', true],
+ ['🤒', true],
+ ['🤓', true],
+ ['🤔', true],
+ ['🤕', true],
+ ['🤖', true],
+ ['🤗', true],
+ ['🤘🏻', true],
+ ['🤘🏼', true],
+ ['🤘🏽', true],
+ ['🤘🏾', true],
+ ['🤘🏿', true],
+ ['🤘', true],
+ ['🤙🏻', true],
+ ['🤙🏼', true],
+ ['🤙🏽', true],
+ ['🤙🏾', true],
+ ['🤙🏿', true],
+ ['🤙', true],
+ ['🤚🏻', true],
+ ['🤚🏼', true],
+ ['🤚🏽', true],
+ ['🤚🏾', true],
+ ['🤚🏿', true],
+ ['🤚', true],
+ ['🤛🏻', true],
+ ['🤛🏼', true],
+ ['🤛🏽', true],
+ ['🤛🏾', true],
+ ['🤛🏿', true],
+ ['🤛', true],
+ ['🤜🏻', true],
+ ['🤜🏼', true],
+ ['🤜🏽', true],
+ ['🤜🏾', true],
+ ['🤜🏿', true],
+ ['🤜', true],
+ ['🤝', true],
+ ['🤞🏻', true],
+ ['🤞🏼', true],
+ ['🤞🏽', true],
+ ['🤞🏾', true],
+ ['🤞🏿', true],
+ ['🤞', true],
+ ['🤟🏻', true],
+ ['🤟🏼', true],
+ ['🤟🏽', true],
+ ['🤟🏾', true],
+ ['🤟🏿', true],
+ ['🤟', true],
+ ['🤠', true],
+ ['🤡', true],
+ ['🤢', true],
+ ['🤣', true],
+ ['🤤', true],
+ ['🤥', true],
+ ['🤦🏻‍♀️', true],
+ ['🤦🏻‍♂️', true],
+ ['🤦🏻', true],
+ ['🤦🏼‍♀️', true],
+ ['🤦🏼‍♂️', true],
+ ['🤦🏼', true],
+ ['🤦🏽‍♀️', true],
+ ['🤦🏽‍♂️', true],
+ ['🤦🏽', true],
+ ['🤦🏾‍♀️', true],
+ ['🤦🏾‍♂️', true],
+ ['🤦🏾', true],
+ ['🤦🏿‍♀️', true],
+ ['🤦🏿‍♂️', true],
+ ['🤦🏿', true],
+ ['🤦‍♀️', true],
+ ['🤦‍♂️', true],
+ ['🤦', true],
+ ['🤧', true],
+ ['🤨', true],
+ ['🤩', true],
+ ['🤪', true],
+ ['🤫', true],
+ ['🤬', true],
+ ['🤭', true],
+ ['🤮', true],
+ ['🤯', true],
+ ['🤰🏻', true],
+ ['🤰🏼', true],
+ ['🤰🏽', true],
+ ['🤰🏾', true],
+ ['🤰🏿', true],
+ ['🤰', true],
+ ['🤱🏻', true],
+ ['🤱🏼', true],
+ ['🤱🏽', true],
+ ['🤱🏾', true],
+ ['🤱🏿', true],
+ ['🤱', true],
+ ['🤲🏻', true],
+ ['🤲🏼', true],
+ ['🤲🏽', true],
+ ['🤲🏾', true],
+ ['🤲🏿', true],
+ ['🤲', true],
+ ['🤳🏻', true],
+ ['🤳🏼', true],
+ ['🤳🏽', true],
+ ['🤳🏾', true],
+ ['🤳🏿', true],
+ ['🤳', true],
+ ['🤴🏻', true],
+ ['🤴🏼', true],
+ ['🤴🏽', true],
+ ['🤴🏾', true],
+ ['🤴🏿', true],
+ ['🤴', true],
+ ['🤵🏻‍♀️', true],
+ ['🤵🏻‍♂️', true],
+ ['🤵🏻', true],
+ ['🤵🏼‍♀️', true],
+ ['🤵🏼‍♂️', true],
+ ['🤵🏼', true],
+ ['🤵🏽‍♀️', true],
+ ['🤵🏽‍♂️', true],
+ ['🤵🏽', true],
+ ['🤵🏾‍♀️', true],
+ ['🤵🏾‍♂️', true],
+ ['🤵🏾', true],
+ ['🤵🏿‍♀️', true],
+ ['🤵🏿‍♂️', true],
+ ['🤵🏿', true],
+ ['🤵‍♀️', true],
+ ['🤵‍♂️', true],
+ ['🤵', true],
+ ['🤶🏻', true],
+ ['🤶🏼', true],
+ ['🤶🏽', true],
+ ['🤶🏾', true],
+ ['🤶🏿', true],
+ ['🤶', true],
+ ['🤷🏻‍♀️', true],
+ ['🤷🏻‍♂️', true],
+ ['🤷🏻', true],
+ ['🤷🏼‍♀️', true],
+ ['🤷🏼‍♂️', true],
+ ['🤷🏼', true],
+ ['🤷🏽‍♀️', true],
+ ['🤷🏽‍♂️', true],
+ ['🤷🏽', true],
+ ['🤷🏾‍♀️', true],
+ ['🤷🏾‍♂️', true],
+ ['🤷🏾', true],
+ ['🤷🏿‍♀️', true],
+ ['🤷🏿‍♂️', true],
+ ['🤷🏿', true],
+ ['🤷‍♀️', true],
+ ['🤷‍♂️', true],
+ ['🤷', true],
+ ['🤸🏻‍♀️', true],
+ ['🤸🏻‍♂️', true],
+ ['🤸🏻', true],
+ ['🤸🏼‍♀️', true],
+ ['🤸🏼‍♂️', true],
+ ['🤸🏼', true],
+ ['🤸🏽‍♀️', true],
+ ['🤸🏽‍♂️', true],
+ ['🤸🏽', true],
+ ['🤸🏾‍♀️', true],
+ ['🤸🏾‍♂️', true],
+ ['🤸🏾', true],
+ ['🤸🏿‍♀️', true],
+ ['🤸🏿‍♂️', true],
+ ['🤸🏿', true],
+ ['🤸‍♀️', true],
+ ['🤸‍♂️', true],
+ ['🤸', true],
+ ['🤹🏻‍♀️', true],
+ ['🤹🏻‍♂️', true],
+ ['🤹🏻', true],
+ ['🤹🏼‍♀️', true],
+ ['🤹🏼‍♂️', true],
+ ['🤹🏼', true],
+ ['🤹🏽‍♀️', true],
+ ['🤹🏽‍♂️', true],
+ ['🤹🏽', true],
+ ['🤹🏾‍♀️', true],
+ ['🤹🏾‍♂️', true],
+ ['🤹🏾', true],
+ ['🤹🏿‍♀️', true],
+ ['🤹🏿‍♂️', true],
+ ['🤹🏿', true],
+ ['🤹‍♀️', true],
+ ['🤹‍♂️', true],
+ ['🤹', true],
+ ['🤺', true],
+ ['🤼‍♀️', true],
+ ['🤼‍♂️', true],
+ ['🤼', true],
+ ['🤽🏻‍♀️', true],
+ ['🤽🏻‍♂️', true],
+ ['🤽🏻', true],
+ ['🤽🏼‍♀️', true],
+ ['🤽🏼‍♂️', true],
+ ['🤽🏼', true],
+ ['🤽🏽‍♀️', true],
+ ['🤽🏽‍♂️', true],
+ ['🤽🏽', true],
+ ['🤽🏾‍♀️', true],
+ ['🤽🏾‍♂️', true],
+ ['🤽🏾', true],
+ ['🤽🏿‍♀️', true],
+ ['🤽🏿‍♂️', true],
+ ['🤽🏿', true],
+ ['🤽‍♀️', true],
+ ['🤽‍♂️', true],
+ ['🤽', true],
+ ['🤾🏻‍♀️', true],
+ ['🤾🏻‍♂️', true],
+ ['🤾🏻', true],
+ ['🤾🏼‍♀️', true],
+ ['🤾🏼‍♂️', true],
+ ['🤾🏼', true],
+ ['🤾🏽‍♀️', true],
+ ['🤾🏽‍♂️', true],
+ ['🤾🏽', true],
+ ['🤾🏾‍♀️', true],
+ ['🤾🏾‍♂️', true],
+ ['🤾🏾', true],
+ ['🤾🏿‍♀️', true],
+ ['🤾🏿‍♂️', true],
+ ['🤾🏿', true],
+ ['🤾‍♀️', true],
+ ['🤾‍♂️', true],
+ ['🤾', true],
+ ['🤿', true],
+ ['🥀', true],
+ ['🥁', true],
+ ['🥂', true],
+ ['🥃', true],
+ ['🥄', true],
+ ['🥅', true],
+ ['🥇', true],
+ ['🥈', true],
+ ['🥉', true],
+ ['🥊', true],
+ ['🥋', true],
+ ['🥌', true],
+ ['🥍', true],
+ ['🥎', true],
+ ['🥏', true],
+ ['🥐', true],
+ ['🥑', true],
+ ['🥒', true],
+ ['🥓', true],
+ ['🥔', true],
+ ['🥕', true],
+ ['🥖', true],
+ ['🥗', true],
+ ['🥘', true],
+ ['🥙', true],
+ ['🥚', true],
+ ['🥛', true],
+ ['🥜', true],
+ ['🥝', true],
+ ['🥞', true],
+ ['🥟', true],
+ ['🥠', true],
+ ['🥡', true],
+ ['🥢', true],
+ ['🥣', true],
+ ['🥤', true],
+ ['🥥', true],
+ ['🥦', true],
+ ['🥧', true],
+ ['🥨', true],
+ ['🥩', true],
+ ['🥪', true],
+ ['🥫', true],
+ ['🥬', true],
+ ['🥭', true],
+ ['🥮', true],
+ ['🥯', true],
+ ['🥰', true],
+ ['🥱', true],
+ ['🥳', true],
+ ['🥴', true],
+ ['🥵', true],
+ ['🥶', true],
+ ['🥺', true],
+ ['🥻', true],
+ ['🥼', true],
+ ['🥽', true],
+ ['🥾', true],
+ ['🥿', true],
+ ['🦀', true],
+ ['🦁', true],
+ ['🦂', true],
+ ['🦃', true],
+ ['🦄', true],
+ ['🦅', true],
+ ['🦆', true],
+ ['🦇', true],
+ ['🦈', true],
+ ['🦉', true],
+ ['🦊', true],
+ ['🦋', true],
+ ['🦌', true],
+ ['🦍', true],
+ ['🦎', true],
+ ['🦏', true],
+ ['🦐', true],
+ ['🦑', true],
+ ['🦒', true],
+ ['🦓', true],
+ ['🦔', true],
+ ['🦕', true],
+ ['🦖', true],
+ ['🦗', true],
+ ['🦘', true],
+ ['🦙', true],
+ ['🦚', true],
+ ['🦛', true],
+ ['🦜', true],
+ ['🦝', true],
+ ['🦞', true],
+ ['🦟', true],
+ ['🦠', true],
+ ['🦡', true],
+ ['🦢', true],
+ ['🦥', true],
+ ['🦦', true],
+ ['🦧', true],
+ ['🦨', true],
+ ['🦩', true],
+ ['🦪', true],
+ ['🦮', true],
+ ['🦯', true],
+ ['🦰', true],
+ ['🦱', true],
+ ['🦲', true],
+ ['🦳', true],
+ ['🦴', true],
+ ['🦵🏻', true],
+ ['🦵🏼', true],
+ ['🦵🏽', true],
+ ['🦵🏾', true],
+ ['🦵🏿', true],
+ ['🦵', true],
+ ['🦶🏻', true],
+ ['🦶🏼', true],
+ ['🦶🏽', true],
+ ['🦶🏾', true],
+ ['🦶🏿', true],
+ ['🦶', true],
+ ['🦷', true],
+ ['🦸🏻‍♀️', true],
+ ['🦸🏻‍♂️', true],
+ ['🦸🏻', true],
+ ['🦸🏼‍♀️', true],
+ ['🦸🏼‍♂️', true],
+ ['🦸🏼', true],
+ ['🦸🏽‍♀️', true],
+ ['🦸🏽‍♂️', true],
+ ['🦸🏽', true],
+ ['🦸🏾‍♀️', true],
+ ['🦸🏾‍♂️', true],
+ ['🦸🏾', true],
+ ['🦸🏿‍♀️', true],
+ ['🦸🏿‍♂️', true],
+ ['🦸🏿', true],
+ ['🦸‍♀️', true],
+ ['🦸‍♂️', true],
+ ['🦸', true],
+ ['🦹🏻‍♀️', true],
+ ['🦹🏻‍♂️', true],
+ ['🦹🏻', true],
+ ['🦹🏼‍♀️', true],
+ ['🦹🏼‍♂️', true],
+ ['🦹🏼', true],
+ ['🦹🏽‍♀️', true],
+ ['🦹🏽‍♂️', true],
+ ['🦹🏽', true],
+ ['🦹🏾‍♀️', true],
+ ['🦹🏾‍♂️', true],
+ ['🦹🏾', true],
+ ['🦹🏿‍♀️', true],
+ ['🦹🏿‍♂️', true],
+ ['🦹🏿', true],
+ ['🦹‍♀️', true],
+ ['🦹‍♂️', true],
+ ['🦹', true],
+ ['🦺', true],
+ ['🦻🏻', true],
+ ['🦻🏼', true],
+ ['🦻🏽', true],
+ ['🦻🏾', true],
+ ['🦻🏿', true],
+ ['🦻', true],
+ ['🦼', true],
+ ['🦽', true],
+ ['🦾', true],
+ ['🦿', true],
+ ['🧀', true],
+ ['🧁', true],
+ ['🧂', true],
+ ['🧃', true],
+ ['🧄', true],
+ ['🧅', true],
+ ['🧆', true],
+ ['🧇', true],
+ ['🧈', true],
+ ['🧉', true],
+ ['🧊', true],
+ ['🧍🏻‍♀️', true],
+ ['🧍🏻‍♂️', true],
+ ['🧍🏻', true],
+ ['🧍🏼‍♀️', true],
+ ['🧍🏼‍♂️', true],
+ ['🧍🏼', true],
+ ['🧍🏽‍♀️', true],
+ ['🧍🏽‍♂️', true],
+ ['🧍🏽', true],
+ ['🧍🏾‍♀️', true],
+ ['🧍🏾‍♂️', true],
+ ['🧍🏾', true],
+ ['🧍🏿‍♀️', true],
+ ['🧍🏿‍♂️', true],
+ ['🧍🏿', true],
+ ['🧍‍♀️', true],
+ ['🧍‍♂️', true],
+ ['🧍', true],
+ ['🧎🏻‍♀️', true],
+ ['🧎🏻‍♂️', true],
+ ['🧎🏻', true],
+ ['🧎🏼‍♀️', true],
+ ['🧎🏼‍♂️', true],
+ ['🧎🏼', true],
+ ['🧎🏽‍♀️', true],
+ ['🧎🏽‍♂️', true],
+ ['🧎🏽', true],
+ ['🧎🏾‍♀️', true],
+ ['🧎🏾‍♂️', true],
+ ['🧎🏾', true],
+ ['🧎🏿‍♀️', true],
+ ['🧎🏿‍♂️', true],
+ ['🧎🏿', true],
+ ['🧎‍♀️', true],
+ ['🧎‍♂️', true],
+ ['🧎', true],
+ ['🧏🏻‍♀️', true],
+ ['🧏🏻‍♂️', true],
+ ['🧏🏻', true],
+ ['🧏🏼‍♀️', true],
+ ['🧏🏼‍♂️', true],
+ ['🧏🏼', true],
+ ['🧏🏽‍♀️', true],
+ ['🧏🏽‍♂️', true],
+ ['🧏🏽', true],
+ ['🧏🏾‍♀️', true],
+ ['🧏🏾‍♂️', true],
+ ['🧏🏾', true],
+ ['🧏🏿‍♀️', true],
+ ['🧏🏿‍♂️', true],
+ ['🧏🏿', true],
+ ['🧏‍♀️', true],
+ ['🧏‍♂️', true],
+ ['🧏', true],
+ ['🧐', true],
+ ['🧑🏻‍🤝‍🧑🏻', true],
+ ['🧑🏻', true],
+ ['🧑🏼‍🤝‍🧑🏻', true],
+ ['🧑🏼‍🤝‍🧑🏼', true],
+ ['🧑🏼', true],
+ ['🧑🏽‍🤝‍🧑🏻', true],
+ ['🧑🏽‍🤝‍🧑🏼', true],
+ ['🧑🏽‍🤝‍🧑🏽', true],
+ ['🧑🏽', true],
+ ['🧑🏾‍🤝‍🧑🏻', true],
+ ['🧑🏾‍🤝‍🧑🏼', true],
+ ['🧑🏾‍🤝‍🧑🏽', true],
+ ['🧑🏾‍🤝‍🧑🏾', true],
+ ['🧑🏾', true],
+ ['🧑🏿‍🤝‍🧑🏻', true],
+ ['🧑🏿‍🤝‍🧑🏼', true],
+ ['🧑🏿‍🤝‍🧑🏽', true],
+ ['🧑🏿‍🤝‍🧑🏾', true],
+ ['🧑🏿‍🤝‍🧑🏿', true],
+ ['🧑🏿', true],
+ ['🧑‍🤝‍🧑', true],
+ ['🧑', true],
+ ['🧒🏻', true],
+ ['🧒🏼', true],
+ ['🧒🏽', true],
+ ['🧒🏾', true],
+ ['🧒🏿', true],
+ ['🧒', true],
+ ['🧓🏻', true],
+ ['🧓🏼', true],
+ ['🧓🏽', true],
+ ['🧓🏾', true],
+ ['🧓🏿', true],
+ ['🧓', true],
+ ['🧔🏻', true],
+ ['🧔🏼', true],
+ ['🧔🏽', true],
+ ['🧔🏾', true],
+ ['🧔🏿', true],
+ ['🧔', true],
+ ['🧕🏻', true],
+ ['🧕🏼', true],
+ ['🧕🏽', true],
+ ['🧕🏾', true],
+ ['🧕🏿', true],
+ ['🧕', true],
+ ['🧖🏻‍♀️', true],
+ ['🧖🏻‍♂️', true],
+ ['🧖🏻', true],
+ ['🧖🏼‍♀️', true],
+ ['🧖🏼‍♂️', true],
+ ['🧖🏼', true],
+ ['🧖🏽‍♀️', true],
+ ['🧖🏽‍♂️', true],
+ ['🧖🏽', true],
+ ['🧖🏾‍♀️', true],
+ ['🧖🏾‍♂️', true],
+ ['🧖🏾', true],
+ ['🧖🏿‍♀️', true],
+ ['🧖🏿‍♂️', true],
+ ['🧖🏿', true],
+ ['🧖‍♀️', true],
+ ['🧖‍♂️', true],
+ ['🧖', true],
+ ['🧗🏻‍♀️', true],
+ ['🧗🏻‍♂️', true],
+ ['🧗🏻', true],
+ ['🧗🏼‍♀️', true],
+ ['🧗🏼‍♂️', true],
+ ['🧗🏼', true],
+ ['🧗🏽‍♀️', true],
+ ['🧗🏽‍♂️', true],
+ ['🧗🏽', true],
+ ['🧗🏾‍♀️', true],
+ ['🧗🏾‍♂️', true],
+ ['🧗🏾', true],
+ ['🧗🏿‍♀️', true],
+ ['🧗🏿‍♂️', true],
+ ['🧗🏿', true],
+ ['🧗‍♀️', true],
+ ['🧗‍♂️', true],
+ ['🧗', true],
+ ['🧘🏻‍♀️', true],
+ ['🧘🏻‍♂️', true],
+ ['🧘🏻', true],
+ ['🧘🏼‍♀️', true],
+ ['🧘🏼‍♂️', true],
+ ['🧘🏼', true],
+ ['🧘🏽‍♀️', true],
+ ['🧘🏽‍♂️', true],
+ ['🧘🏽', true],
+ ['🧘🏾‍♀️', true],
+ ['🧘🏾‍♂️', true],
+ ['🧘🏾', true],
+ ['🧘🏿‍♀️', true],
+ ['🧘🏿‍♂️', true],
+ ['🧘🏿', true],
+ ['🧘‍♀️', true],
+ ['🧘‍♂️', true],
+ ['🧘', true],
+ ['🧙🏻‍♀️', true],
+ ['🧙🏻‍♂️', true],
+ ['🧙🏻', true],
+ ['🧙🏼‍♀️', true],
+ ['🧙🏼‍♂️', true],
+ ['🧙🏼', true],
+ ['🧙🏽‍♀️', true],
+ ['🧙🏽‍♂️', true],
+ ['🧙🏽', true],
+ ['🧙🏾‍♀️', true],
+ ['🧙🏾‍♂️', true],
+ ['🧙🏾', true],
+ ['🧙🏿‍♀️', true],
+ ['🧙🏿‍♂️', true],
+ ['🧙🏿', true],
+ ['🧙‍♀️', true],
+ ['🧙‍♂️', true],
+ ['🧙', true],
+ ['🧚🏻‍♀️', true],
+ ['🧚🏻‍♂️', true],
+ ['🧚🏻', true],
+ ['🧚🏼‍♀️', true],
+ ['🧚🏼‍♂️', true],
+ ['🧚🏼', true],
+ ['🧚🏽‍♀️', true],
+ ['🧚🏽‍♂️', true],
+ ['🧚🏽', true],
+ ['🧚🏾‍♀️', true],
+ ['🧚🏾‍♂️', true],
+ ['🧚🏾', true],
+ ['🧚🏿‍♀️', true],
+ ['🧚🏿‍♂️', true],
+ ['🧚🏿', true],
+ ['🧚‍♀️', true],
+ ['🧚‍♂️', true],
+ ['🧚', true],
+ ['🧛🏻‍♀️', true],
+ ['🧛🏻‍♂️', true],
+ ['🧛🏻', true],
+ ['🧛🏼‍♀️', true],
+ ['🧛🏼‍♂️', true],
+ ['🧛🏼', true],
+ ['🧛🏽‍♀️', true],
+ ['🧛🏽‍♂️', true],
+ ['🧛🏽', true],
+ ['🧛🏾‍♀️', true],
+ ['🧛🏾‍♂️', true],
+ ['🧛🏾', true],
+ ['🧛🏿‍♀️', true],
+ ['🧛🏿‍♂️', true],
+ ['🧛🏿', true],
+ ['🧛‍♀️', true],
+ ['🧛‍♂️', true],
+ ['🧛', true],
+ ['🧜🏻‍♀️', true],
+ ['🧜🏻‍♂️', true],
+ ['🧜🏻', true],
+ ['🧜🏼‍♀️', true],
+ ['🧜🏼‍♂️', true],
+ ['🧜🏼', true],
+ ['🧜🏽‍♀️', true],
+ ['🧜🏽‍♂️', true],
+ ['🧜🏽', true],
+ ['🧜🏾‍♀️', true],
+ ['🧜🏾‍♂️', true],
+ ['🧜🏾', true],
+ ['🧜🏿‍♀️', true],
+ ['🧜🏿‍♂️', true],
+ ['🧜🏿', true],
+ ['🧜‍♀️', true],
+ ['🧜‍♂️', true],
+ ['🧜', true],
+ ['🧝🏻‍♀️', true],
+ ['🧝🏻‍♂️', true],
+ ['🧝🏻', true],
+ ['🧝🏼‍♀️', true],
+ ['🧝🏼‍♂️', true],
+ ['🧝🏼', true],
+ ['🧝🏽‍♀️', true],
+ ['🧝🏽‍♂️', true],
+ ['🧝🏽', true],
+ ['🧝🏾‍♀️', true],
+ ['🧝🏾‍♂️', true],
+ ['🧝🏾', true],
+ ['🧝🏿‍♀️', true],
+ ['🧝🏿‍♂️', true],
+ ['🧝🏿', true],
+ ['🧝‍♀️', true],
+ ['🧝‍♂️', true],
+ ['🧝', true],
+ ['🧞‍♀️', true],
+ ['🧞‍♂️', true],
+ ['🧞', true],
+ ['🧟‍♀️', true],
+ ['🧟‍♂️', true],
+ ['🧟', true],
+ ['🧠', true],
+ ['🧡', true],
+ ['🧢', true],
+ ['🧣', true],
+ ['🧤', true],
+ ['🧥', true],
+ ['🧦', true],
+ ['🧧', true],
+ ['🧨', true],
+ ['🧩', true],
+ ['🧪', true],
+ ['🧫', true],
+ ['🧬', true],
+ ['🧭', true],
+ ['🧮', true],
+ ['🧯', true],
+ ['🧰', true],
+ ['🧱', true],
+ ['🧲', true],
+ ['🧳', true],
+ ['🧴', true],
+ ['🧵', true],
+ ['🧶', true],
+ ['🧷', true],
+ ['🧸', true],
+ ['🧹', true],
+ ['🧺', true],
+ ['🧻', true],
+ ['🧼', true],
+ ['🧽', true],
+ ['🧾', true],
+ ['🧿', true],
+ ['🩰', true],
+ ['🩱', true],
+ ['🩲', true],
+ ['🩳', true],
+ ['🩸', true],
+ ['🩹', true],
+ ['🩺', true],
+ ['🪀', true],
+ ['🪁', true],
+ ['🪂', true],
+ ['🪐', true],
+ ['🪑', true],
+ ['🪒', true],
+ ['🪓', true],
+ ['🪔', true],
+ ['🪕', true],
+ ['‼️', true],
+ ['⁉️', true],
+ ['™️', true],
+ ['ℹ️', true],
+ ['↔️', true],
+ ['↕️', true],
+ ['↖️', true],
+ ['↗️', true],
+ ['↘️', true],
+ ['↙️', true],
+ ['↩️', true],
+ ['↪️', true],
+ ['#⃣', true],
+ ['⌚️', true],
+ ['⌛️', true],
+ ['⌨️', true],
+ ['⏏️', true],
+ ['⏩', true],
+ ['⏪', true],
+ ['⏫', true],
+ ['⏬', true],
+ ['⏭️', true],
+ ['⏮️', true],
+ ['⏯️', true],
+ ['⏰', true],
+ ['⏱️', true],
+ ['⏲️', true],
+ ['⏳', true],
+ ['⏸️', true],
+ ['⏹️', true],
+ ['⏺️', true],
+ ['Ⓜ️', true],
+ ['▪️', true],
+ ['▫️', true],
+ ['▶️', true],
+ ['◀️', true],
+ ['◻️', true],
+ ['◼️', true],
+ ['◽️', true],
+ ['◾️', true],
+ ['☀️', true],
+ ['☁️', true],
+ ['☂️', true],
+ ['☃️', true],
+ ['☄️', true],
+ ['☎️', true],
+ ['☑️', true],
+ ['☔️', true],
+ ['☕️', true],
+ ['☘️', true],
+ ['☝🏻', true],
+ ['☝🏼', true],
+ ['☝🏽', true],
+ ['☝🏾', true],
+ ['☝🏿', true],
+ ['☝️', true],
+ ['☠️', true],
+ ['☢️', true],
+ ['☣️', true],
+ ['☦️', true],
+ ['☪️', true],
+ ['☮️', true],
+ ['☯️', true],
+ ['☸️', true],
+ ['☹️', true],
+ ['☺️', true],
+ ['♀️', true],
+ ['♂️', true],
+ ['♈️', true],
+ ['♉️', true],
+ ['♊️', true],
+ ['♋️', true],
+ ['♌️', true],
+ ['♍️', true],
+ ['♎️', true],
+ ['♏️', true],
+ ['♐️', true],
+ ['♑️', true],
+ ['♒️', true],
+ ['♓️', true],
+ ['♟️', true],
+ ['♠️', true],
+ ['♣️', true],
+ ['♥️', true],
+ ['♦️', true],
+ ['♨️', true],
+ ['♻️', true],
+ ['♾', true],
+ ['♿️', true],
+ ['⚒️', true],
+ ['⚓️', true],
+ ['⚔️', true],
+ ['⚕️', true],
+ ['⚖️', true],
+ ['⚗️', true],
+ ['⚙️', true],
+ ['⚛️', true],
+ ['⚜️', true],
+ ['⚠️', true],
+ ['⚡️', true],
+ ['⚪️', true],
+ ['⚫️', true],
+ ['⚰️', true],
+ ['⚱️', true],
+ ['⚽️', true],
+ ['⚾️', true],
+ ['⛄️', true],
+ ['⛅️', true],
+ ['⛈️', true],
+ ['⛎', true],
+ ['⛏️', true],
+ ['⛑️', true],
+ ['⛓️', true],
+ ['⛔️', true],
+ ['⛩️', true],
+ ['⛪️', true],
+ ['⛰️', true],
+ ['⛱️', true],
+ ['⛲️', true],
+ ['⛳️', true],
+ ['⛴️', true],
+ ['⛵️', true],
+ ['⛷🏻', true],
+ ['⛷🏼', true],
+ ['⛷🏽', true],
+ ['⛷🏾', true],
+ ['⛷🏿', true],
+ ['⛷️', true],
+ ['⛸️', true],
+ ['⛹🏻‍♀️', true],
+ ['⛹🏻‍♂️', true],
+ ['⛹🏻', true],
+ ['⛹🏼‍♀️', true],
+ ['⛹🏼‍♂️', true],
+ ['⛹🏼', true],
+ ['⛹🏽‍♀️', true],
+ ['⛹🏽‍♂️', true],
+ ['⛹🏽', true],
+ ['⛹🏾‍♀️', true],
+ ['⛹🏾‍♂️', true],
+ ['⛹🏾', true],
+ ['⛹🏿‍♀️', true],
+ ['⛹🏿‍♂️', true],
+ ['⛹🏿', true],
+ ['⛹️‍♀️', true],
+ ['⛹️‍♂️', true],
+ ['⛹️', true],
+ ['⛺️', true],
+ ['⛽️', true],
+ ['✂️', true],
+ ['✅', true],
+ ['✈️', true],
+ ['✉️', true],
+ ['✊🏻', true],
+ ['✊🏼', true],
+ ['✊🏽', true],
+ ['✊🏾', true],
+ ['✊🏿', true],
+ ['✊', true],
+ ['✋🏻', true],
+ ['✋🏼', true],
+ ['✋🏽', true],
+ ['✋🏾', true],
+ ['✋🏿', true],
+ ['✋', true],
+ ['✌🏻', true],
+ ['✌🏼', true],
+ ['✌🏽', true],
+ ['✌🏾', true],
+ ['✌🏿', true],
+ ['✌️', true],
+ ['✍🏻', true],
+ ['✍🏼', true],
+ ['✍🏽', true],
+ ['✍🏾', true],
+ ['✍🏿', true],
+ ['✍️', true],
+ ['✏️', true],
+ ['✒️', true],
+ ['✔️', true],
+ ['✖️', true],
+ ['✝️', true],
+ ['✡️', true],
+ ['✨', true],
+ ['✳️', true],
+ ['✴️', true],
+ ['❄️', true],
+ ['❇️', true],
+ ['❌', true],
+ ['❎', true],
+ ['❓', true],
+ ['❔', true],
+ ['❕', true],
+ ['❗️', true],
+ ['❣️', true],
+ ['❤️', true],
+ ['➕', true],
+ ['➖', true],
+ ['➗', true],
+ ['➡️', true],
+ ['➰', true],
+ ['➿', true],
+ ['⤴️', true],
+ ['⤵️', true],
+ ['*⃣', true],
+ ['⬅️', true],
+ ['⬆️', true],
+ ['⬇️', true],
+ ['⬛️', true],
+ ['⬜️', true],
+ ['⭐️', true],
+ ['⭕️', true],
+ ['0⃣', true],
+ ['〰️', true],
+ ['〽️', true],
+ ['1⃣', true],
+ ['2⃣', true],
+ ['㊗️', true],
+ ['㊙️', true],
+ ['3⃣', true],
+ ['4⃣', true],
+ ['5⃣', true],
+ ['6⃣', true],
+ ['7⃣', true],
+ ['8⃣', true],
+ ['9⃣', true],
+ ['©️', true],
+ ['®️', true],
];
}
}
diff --git a/tests/lib/Encryption/DecryptAllTest.php b/tests/lib/Encryption/DecryptAllTest.php
index 81655e2be11..d073efc8235 100644
--- a/tests/lib/Encryption/DecryptAllTest.php
+++ b/tests/lib/Encryption/DecryptAllTest.php
@@ -38,16 +38,16 @@ class DecryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | View */
protected $view;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Input\InputInterface */
protected $inputInterface;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Output\OutputInterface */
protected $outputInterface;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\UserInterface */
protected $userInterface;
- /** @var DecryptAll */
+ /** @var DecryptAll */
protected $instance;
protected function setUp(): void {
@@ -98,7 +98,7 @@ class DecryptAllTest extends TestCase {
* @param string $user
* @param bool $userExistsChecked
*/
- public function testDecryptAll($prepareResult, $user, $userExistsChecked) {
+ public function testDecryptAll($prepareResult, $user, $userExistsChecked): void {
if ($userExistsChecked) {
$this->userManager->expects($this->once())->method('userExists')->willReturn(true);
} else {
@@ -135,7 +135,7 @@ class DecryptAllTest extends TestCase {
/**
* test decrypt all call with a user who doesn't exists
*/
- public function testDecryptAllWrongUser() {
+ public function testDecryptAllWrongUser(): void {
$this->userManager->expects($this->once())->method('userExists')->willReturn(false);
$this->outputInterface->expects($this->once())->method('writeln')
->with('User "user1" does not exist. Please check the username and try again');
@@ -156,7 +156,7 @@ class DecryptAllTest extends TestCase {
* @dataProvider dataTrueFalse
* @param bool $success
*/
- public function testPrepareEncryptionModules($success) {
+ public function testPrepareEncryptionModules($success): void {
$user = 'user1';
$dummyEncryptionModule = $this->getMockBuilder('OCP\Encryption\IEncryptionModule')
@@ -188,7 +188,7 @@ class DecryptAllTest extends TestCase {
/**
* @dataProvider dataTestDecryptAllUsersFiles
*/
- public function testDecryptAllUsersFiles($user) {
+ public function testDecryptAllUsersFiles($user): void {
/** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject | $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
@@ -233,7 +233,7 @@ class DecryptAllTest extends TestCase {
];
}
- public function testDecryptUsersFiles() {
+ public function testDecryptUsersFiles(): void {
/** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject $instance */
$instance = $this->getMockBuilder('OC\Encryption\DecryptAll')
->setConstructorArgs(
@@ -308,7 +308,7 @@ class DecryptAllTest extends TestCase {
/**
* @dataProvider dataTrueFalse
*/
- public function testDecryptFile($isEncrypted) {
+ public function testDecryptFile($isEncrypted): void {
$path = 'test.txt';
/** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject $instance */
@@ -348,7 +348,7 @@ class DecryptAllTest extends TestCase {
);
}
- public function testDecryptFileFailure() {
+ public function testDecryptFileFailure(): void {
$path = 'test.txt';
/** @var DecryptAll | \PHPUnit\Framework\MockObject\MockObject $instance */
diff --git a/tests/lib/Encryption/EncryptionWrapperTest.php b/tests/lib/Encryption/EncryptionWrapperTest.php
index 69bf297e21b..1ecb9dc89c7 100644
--- a/tests/lib/Encryption/EncryptionWrapperTest.php
+++ b/tests/lib/Encryption/EncryptionWrapperTest.php
@@ -15,16 +15,16 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class EncryptionWrapperTest extends TestCase {
- /** @var EncryptionWrapper */
+ /** @var EncryptionWrapper */
private $instance;
- /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | LoggerInterface */
private $logger;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Encryption\Manager */
private $manager;
- /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Memcache\ArrayCache */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | \OC\Memcache\ArrayCache */
private $arrayCache;
protected function setUp(): void {
@@ -41,7 +41,7 @@ class EncryptionWrapperTest extends TestCase {
/**
* @dataProvider provideWrapStorage
*/
- public function testWrapStorage($expectedWrapped, $wrappedStorages) {
+ public function testWrapStorage($expectedWrapped, $wrappedStorages): void {
$storage = $this->getMockBuilder(Storage::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index 1f6773b1663..2ce30105293 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -62,7 +62,7 @@ class StorageTest extends TestCase {
$this->storage = new Storage($this->view, $this->util, $this->crypto, $this->config);
}
- public function testSetFileKey() {
+ public function testSetFileKey(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -88,7 +88,7 @@ class StorageTest extends TestCase {
);
}
- public function testSetFileOld() {
+ public function testSetFileOld(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.0');
@@ -130,7 +130,7 @@ class StorageTest extends TestCase {
* @param bool $originalKeyExists
* @param string $expectedKeyContent
*/
- public function testGetFileKey($path, $strippedPartialName, $originalKeyExists, $expectedKeyContent) {
+ public function testGetFileKey($path, $strippedPartialName, $originalKeyExists, $expectedKeyContent): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -186,7 +186,7 @@ class StorageTest extends TestCase {
);
}
- public function testSetFileKeySystemWide() {
+ public function testSetFileKeySystemWide(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -218,7 +218,7 @@ class StorageTest extends TestCase {
);
}
- public function testGetFileKeySystemWide() {
+ public function testGetFileKeySystemWide(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -246,7 +246,7 @@ class StorageTest extends TestCase {
);
}
- public function testSetSystemUserKey() {
+ public function testSetSystemUserKey(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -266,7 +266,7 @@ class StorageTest extends TestCase {
);
}
- public function testSetUserKey() {
+ public function testSetUserKey(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -286,7 +286,7 @@ class StorageTest extends TestCase {
);
}
- public function testGetSystemUserKey() {
+ public function testGetSystemUserKey(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -309,7 +309,7 @@ class StorageTest extends TestCase {
);
}
- public function testGetUserKey() {
+ public function testGetUserKey(): void {
$this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -332,7 +332,7 @@ class StorageTest extends TestCase {
);
}
- public function testDeleteUserKey() {
+ public function testDeleteUserKey(): void {
$this->view->expects($this->once())
->method('file_exists')
->with($this->equalTo('/user1/files_encryption/encModule/user1.publicKey'))
@@ -347,7 +347,7 @@ class StorageTest extends TestCase {
);
}
- public function testDeleteSystemUserKey() {
+ public function testDeleteSystemUserKey(): void {
$this->view->expects($this->once())
->method('file_exists')
->with($this->equalTo('/files_encryption/encModule/shareKey_56884'))
@@ -362,7 +362,7 @@ class StorageTest extends TestCase {
);
}
- public function testDeleteFileKeySystemWide() {
+ public function testDeleteFileKeySystemWide(): void {
$this->util->expects($this->any())
->method('getUidAndFilename')
->willReturn(['user1', '/files/foo.txt']);
@@ -386,7 +386,7 @@ class StorageTest extends TestCase {
);
}
- public function testDeleteFileKey() {
+ public function testDeleteFileKey(): void {
$this->util->expects($this->any())
->method('getUidAndFilename')
->willReturn(['user1', '/files/foo.txt']);
@@ -413,7 +413,7 @@ class StorageTest extends TestCase {
/**
* @dataProvider dataProviderCopyRename
*/
- public function testRenameKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget) {
+ public function testRenameKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget): void {
$this->view->expects($this->any())
->method('file_exists')
->willReturn(true);
@@ -444,7 +444,7 @@ class StorageTest extends TestCase {
/**
* @dataProvider dataProviderCopyRename
*/
- public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget) {
+ public function testCopyKeys($source, $target, $systemWideMountSource, $systemWideMountTarget, $expectedSource, $expectedTarget): void {
$this->view->expects($this->any())
->method('file_exists')
->willReturn(true);
@@ -519,7 +519,7 @@ class StorageTest extends TestCase {
* @param string $storageRoot
* @param string $expected
*/
- public function testGetPathToKeys($path, $systemWideMountPoint, $storageRoot, $expected) {
+ public function testGetPathToKeys($path, $systemWideMountPoint, $storageRoot, $expected): void {
$this->invokePrivate($this->storage, 'root_dir', [$storageRoot]);
$this->util->expects($this->any())
@@ -543,7 +543,7 @@ class StorageTest extends TestCase {
];
}
- public function testKeySetPreparation() {
+ public function testKeySetPreparation(): void {
$this->view->expects($this->any())
->method('file_exists')
->willReturn(false);
@@ -574,7 +574,7 @@ class StorageTest extends TestCase {
* @dataProvider dataTestBackupUserKeys
* @param bool $createBackupDir
*/
- public function testBackupUserKeys($createBackupDir) {
+ public function testBackupUserKeys($createBackupDir): void {
$storage = $this->getMockBuilder('OC\Encryption\Keys\Storage')
->setConstructorArgs([$this->view, $this->util, $this->crypto, $this->config])
->setMethods(['getTimestamp'])
diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php
index d092068f6c6..8dd602349b6 100644
--- a/tests/lib/Encryption/ManagerTest.php
+++ b/tests/lib/Encryption/ManagerTest.php
@@ -49,16 +49,16 @@ class ManagerTest extends TestCase {
$this->manager = new Manager($this->config, $this->logger, $this->l10n, $this->view, $this->util, $this->arrayCache);
}
- public function testManagerIsDisabled() {
+ public function testManagerIsDisabled(): void {
$this->assertFalse($this->manager->isEnabled());
}
- public function testManagerIsDisabledIfEnabledButNoModules() {
+ public function testManagerIsDisabledIfEnabledButNoModules(): void {
$this->config->expects($this->any())->method('getAppValue')->willReturn(true);
$this->assertFalse($this->manager->isEnabled());
}
- public function testManagerIsDisabledIfDisabledButModules() {
+ public function testManagerIsDisabledIfDisabledButModules(): void {
$this->config->expects($this->any())->method('getAppValue')->willReturn(false);
$em = $this->createMock(IEncryptionModule::class);
$em->expects($this->any())->method('getId')->willReturn('id');
@@ -69,7 +69,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->isEnabled());
}
- public function testManagerIsEnabled() {
+ public function testManagerIsEnabled(): void {
$this->config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
$this->config->expects($this->any())->method('getAppValue')->willReturn('yes');
$this->assertTrue($this->manager->isEnabled());
@@ -87,14 +87,14 @@ class ManagerTest extends TestCase {
/**
* @depends testModuleRegistration
*/
- public function testModuleReRegistration($manager) {
+ public function testModuleReRegistration($manager): void {
$this->expectException(\OC\Encryption\Exceptions\ModuleAlreadyExistsException::class);
$this->expectExceptionMessage('Id "ID0" already used by encryption module "TestDummyModule0"');
$this->addNewEncryptionModule($manager, 0);
}
- public function testModuleUnRegistration() {
+ public function testModuleUnRegistration(): void {
$this->config->expects($this->any())->method('getAppValue')->willReturn(true);
$this->addNewEncryptionModule($this->manager, 0);
$this->assertCount(1, $this->manager->getEncryptionModules());
@@ -104,7 +104,7 @@ class ManagerTest extends TestCase {
}
- public function testGetEncryptionModuleUnknown() {
+ public function testGetEncryptionModuleUnknown(): void {
$this->expectException(\OC\Encryption\Exceptions\ModuleDoesNotExistsException::class);
$this->expectExceptionMessage('Module with ID: unknown does not exist.');
@@ -114,7 +114,7 @@ class ManagerTest extends TestCase {
$this->manager->getEncryptionModule('unknown');
}
- public function testGetEncryptionModuleEmpty() {
+ public function testGetEncryptionModuleEmpty(): void {
global $defaultId;
$defaultId = null;
@@ -138,7 +138,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('ID1', $this->manager->getEncryptionModule()->getId());
}
- public function testGetEncryptionModule() {
+ public function testGetEncryptionModule(): void {
global $defaultId;
$defaultId = null;
@@ -163,7 +163,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('ID0', $this->manager->getDefaultEncryptionModuleId());
}
- public function testSetDefaultEncryptionModule() {
+ public function testSetDefaultEncryptionModule(): void {
global $defaultId;
$defaultId = null;
diff --git a/tests/lib/Encryption/UpdateTest.php b/tests/lib/Encryption/UpdateTest.php
index 9f431b53d3e..2627e18601d 100644
--- a/tests/lib/Encryption/UpdateTest.php
+++ b/tests/lib/Encryption/UpdateTest.php
@@ -75,7 +75,7 @@ class UpdateTest extends TestCase {
* @param array $allFiles
* @param integer $numberOfFiles
*/
- public function testUpdate($path, $isDir, $allFiles, $numberOfFiles) {
+ public function testUpdate($path, $isDir, $allFiles, $numberOfFiles): void {
$this->encryptionManager->expects($this->once())
->method('getEncryptionModule')
->willReturn($this->encryptionModule);
@@ -120,7 +120,7 @@ class UpdateTest extends TestCase {
* @param string $target
* @param boolean $encryptionEnabled
*/
- public function testPostRename($source, $target, $encryptionEnabled) {
+ public function testPostRename($source, $target, $encryptionEnabled): void {
$updateMock = $this->getUpdateMock(['update', 'getOwnerPath']);
$this->encryptionManager->expects($this->once())
@@ -168,7 +168,7 @@ class UpdateTest extends TestCase {
*
* @param boolean $encryptionEnabled
*/
- public function testPostRestore($encryptionEnabled) {
+ public function testPostRestore($encryptionEnabled): void {
$updateMock = $this->getUpdateMock(['update']);
$this->encryptionManager->expects($this->once())
@@ -199,7 +199,7 @@ class UpdateTest extends TestCase {
/**
* create mock of the update method
*
- * @param array$methods methods which should be set
+ * @param array $methods methods which should be set
* @return \OC\Encryption\Update | \PHPUnit\Framework\MockObject\MockObject
*/
protected function getUpdateMock($methods) {
diff --git a/tests/lib/Encryption/UtilTest.php b/tests/lib/Encryption/UtilTest.php
index 813a288a470..62ef809a867 100644
--- a/tests/lib/Encryption/UtilTest.php
+++ b/tests/lib/Encryption/UtilTest.php
@@ -56,7 +56,7 @@ class UtilTest extends TestCase {
/**
* @dataProvider providesHeadersForEncryptionModule
*/
- public function testGetEncryptionModuleId($expected, $header) {
+ public function testGetEncryptionModuleId($expected, $header): void {
$id = $this->util->getEncryptionModuleId($header);
$this->assertEquals($expected, $id);
}
@@ -72,7 +72,7 @@ class UtilTest extends TestCase {
/**
* @dataProvider providesHeaders
*/
- public function testCreateHeader($expected, $header, $moduleId) {
+ public function testCreateHeader($expected, $header, $moduleId): void {
$em = $this->createMock(IEncryptionModule::class);
$em->expects($this->any())->method('getId')->willReturn($moduleId);
@@ -90,7 +90,7 @@ class UtilTest extends TestCase {
}
- public function testCreateHeaderFailed() {
+ public function testCreateHeaderFailed(): void {
$this->expectException(\OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException::class);
@@ -105,7 +105,7 @@ class UtilTest extends TestCase {
/**
* @dataProvider providePathsForTestIsExcluded
*/
- public function testIsExcluded($path, $keyStorageRoot, $expected) {
+ public function testIsExcluded($path, $keyStorageRoot, $expected): void {
$this->config->expects($this->once())
->method('getAppValue')
->with('core', 'encryption_key_storage_root', '')
@@ -146,7 +146,7 @@ class UtilTest extends TestCase {
/**
* @dataProvider dataTestIsFile
*/
- public function testIsFile($path, $expected) {
+ public function testIsFile($path, $expected): void {
$this->assertSame($expected,
$this->util->isFile($path)
);
@@ -170,7 +170,7 @@ class UtilTest extends TestCase {
* @param string $path
* @param string $expected
*/
- public function testStripPartialFileExtension($path, $expected) {
+ public function testStripPartialFileExtension($path, $expected): void {
$this->assertSame($expected,
$this->util->stripPartialFileExtension($path));
}
@@ -187,7 +187,7 @@ class UtilTest extends TestCase {
/**
* @dataProvider dataTestParseRawHeader
*/
- public function testParseRawHeader($rawHeader, $expected) {
+ public function testParseRawHeader($rawHeader, $expected): void {
$result = $this->util->parseRawHeader($rawHeader);
$this->assertSameSize($expected, $result);
foreach ($result as $key => $value) {
@@ -218,7 +218,7 @@ class UtilTest extends TestCase {
* @param string $storageRoot
* @param string $expected
*/
- public function testGetFileKeyDir($isSystemWideMountPoint, $storageRoot, $expected) {
+ public function testGetFileKeyDir($isSystemWideMountPoint, $storageRoot, $expected): void {
$path = '/user1/files/foo/bar.txt';
$owner = 'user1';
$relativePath = '/foo/bar.txt';
diff --git a/tests/lib/ErrorHandlerTest.php b/tests/lib/ErrorHandlerTest.php
index 72974a14550..0846d09fd47 100644
--- a/tests/lib/ErrorHandlerTest.php
+++ b/tests/lib/ErrorHandlerTest.php
@@ -53,7 +53,7 @@ class ErrorHandlerTest extends TestCase {
* @param string $username
* @param string $password
*/
- public function testRemovePasswordFromError($username, $password) {
+ public function testRemovePasswordFromError($username, $password): void {
$url = 'http://'.$username.':'.$password.'@owncloud.org';
$expectedResult = 'http://xxx:xxx@owncloud.org';
$this->logger->expects(self::once())
diff --git a/tests/lib/Federation/CloudIdTest.php b/tests/lib/Federation/CloudIdTest.php
index 4ac9bd92d64..4087f45622d 100644
--- a/tests/lib/Federation/CloudIdTest.php
+++ b/tests/lib/Federation/CloudIdTest.php
@@ -24,7 +24,7 @@ class CloudIdTest extends TestCase {
* @param string $id
* @param string $display
*/
- public function testGetDisplayCloudId($id, $display) {
+ public function testGetDisplayCloudId($id, $display): void {
$cloudId = new CloudId($id, '', '');
$this->assertEquals($display, $cloudId->getDisplayId());
}
diff --git a/tests/lib/Files/AppData/AppDataTest.php b/tests/lib/Files/AppData/AppDataTest.php
index 241e49a026f..494096d1ac3 100644
--- a/tests/lib/Files/AppData/AppDataTest.php
+++ b/tests/lib/Files/AppData/AppDataTest.php
@@ -49,7 +49,7 @@ class AppDataTest extends \Test\TestCase {
return $appFolder;
}
- public function testGetFolder() {
+ public function testGetFolder(): void {
$folder = $this->createMock(Folder::class);
$this->rootFolder->expects($this->once())
@@ -61,7 +61,7 @@ class AppDataTest extends \Test\TestCase {
$this->assertInstanceOf(ISimpleFolder::class, $result);
}
- public function testNewFolder() {
+ public function testNewFolder(): void {
$appFolder = $this->setupAppFolder();
$folder = $this->createMock(Folder::class);
@@ -75,7 +75,7 @@ class AppDataTest extends \Test\TestCase {
$this->assertInstanceOf(ISimpleFolder::class, $result);
}
- public function testGetDirectoryListing() {
+ public function testGetDirectoryListing(): void {
$appFolder = $this->setupAppFolder();
$file = $this->createMock(File::class);
diff --git a/tests/lib/Files/AppData/FactoryTest.php b/tests/lib/Files/AppData/FactoryTest.php
index 1aad461e633..dff999d8b48 100644
--- a/tests/lib/Files/AppData/FactoryTest.php
+++ b/tests/lib/Files/AppData/FactoryTest.php
@@ -28,7 +28,7 @@ class FactoryTest extends \Test\TestCase {
$this->factory = new Factory($this->rootFolder, $this->systemConfig);
}
- public function testGet() {
+ public function testGet(): void {
$this->rootFolder->expects($this->never())
->method($this->anything());
$this->systemConfig->expects($this->never())
diff --git a/tests/lib/Files/Cache/CacheTest.php b/tests/lib/Files/Cache/CacheTest.php
index faecbf54491..9e3460ab6f2 100644
--- a/tests/lib/Files/Cache/CacheTest.php
+++ b/tests/lib/Files/Cache/CacheTest.php
@@ -7,12 +7,12 @@
namespace Test\Files\Cache;
-use Doctrine\DBAL\Platforms\MySqlPlatform;
use OC\Files\Cache\Cache;
use OC\Files\Search\SearchComparison;
use OC\Files\Search\SearchQuery;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Search\ISearchComparison;
+use OCP\IDBConnection;
use OCP\IUser;
class LongId extends \OC\Files\Storage\Temporary {
@@ -47,11 +47,11 @@ class CacheTest extends \Test\TestCase {
*/
protected $cache2;
- public function testGetNumericId() {
+ public function testGetNumericId(): void {
$this->assertNotNull($this->cache->getNumericStorageId());
}
- public function testSimple() {
+ public function testSimple(): void {
$file1 = 'foo';
$file2 = 'foo/bar';
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/folder'];
@@ -97,7 +97,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($cacheData1, $this->cache->get($id1));
}
- public function testCacheEntryGetters() {
+ public function testCacheEntryGetters(): void {
$file1 = 'foo';
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/file'];
@@ -122,7 +122,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($entry->getUnencryptedSize(), 100);
}
- public function testPartial() {
+ public function testPartial(): void {
$file1 = 'foo';
$this->cache->put($file1, ['size' => 10]);
@@ -138,11 +138,11 @@ class CacheTest extends \Test\TestCase {
/**
* @dataProvider folderDataProvider
*/
- public function testFolder($folder) {
+ public function testFolder($folder): void {
if (strpos($folder, 'F09F9890')) {
// 4 byte UTF doesn't work on mysql
$params = \OC::$server->get(\OC\DB\Connection::class)->getParams();
- if (\OC::$server->getDatabaseConnection()->getDatabasePlatform() instanceof MySqlPlatform && $params['charset'] !== 'utf8mb4') {
+ if (\OC::$server->getDatabaseConnection()->getDatabaseProvider() === IDBConnection::PLATFORM_MYSQL && $params['charset'] !== 'utf8mb4') {
$this->markTestSkipped('MySQL doesn\'t support 4 byte UTF-8');
}
}
@@ -187,7 +187,7 @@ class CacheTest extends \Test\TestCase {
$this->assertFalse($this->cache->inCache($folder . '/bar'));
}
- public function testRemoveRecursive() {
+ public function testRemoveRecursive(): void {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$fileData = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'text/plain'];
$folders = ['folder', 'folder/subfolder', 'folder/sub2', 'folder/sub2/sub3'];
@@ -220,7 +220,7 @@ class CacheTest extends \Test\TestCase {
];
}
- public function testEncryptedFolder() {
+ public function testEncryptedFolder(): void {
$file1 = 'folder';
$file2 = 'folder/bar';
$file3 = 'folder/foo';
@@ -263,7 +263,7 @@ class CacheTest extends \Test\TestCase {
$this->assertFalse($this->cache->inCache('folder/bar'));
}
- public function testRootFolderSizeForNonHomeStorage() {
+ public function testRootFolderSizeForNonHomeStorage(): void {
$dir1 = 'knownsize';
$dir2 = 'unknownsize';
$fileData = [];
@@ -290,7 +290,7 @@ class CacheTest extends \Test\TestCase {
$this->assertFalse($this->cache->inCache($dir2));
}
- public function testStatus() {
+ public function testStatus(): void {
$this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->getStatus('foo'));
$this->cache->put('foo', ['size' => -1]);
$this->assertEquals(\OC\Files\Cache\Cache::PARTIAL, $this->cache->getStatus('foo'));
@@ -312,7 +312,7 @@ class CacheTest extends \Test\TestCase {
* @dataProvider putWithAllKindOfQuotesData
* @param $fileName
*/
- public function testPutWithAllKindOfQuotes($fileName) {
+ public function testPutWithAllKindOfQuotes($fileName): void {
$this->assertEquals(\OC\Files\Cache\Cache::NOT_FOUND, $this->cache->get($fileName));
$this->cache->put($fileName, ['size' => 20, 'mtime' => 25, 'mimetype' => 'foo/file', 'etag' => $fileName]);
@@ -321,7 +321,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($fileName, $cacheEntry['path']);
}
- public function testSearch() {
+ public function testSearch(): void {
$file1 = 'folder';
$file2 = 'folder/foobar';
$file3 = 'folder/foo';
@@ -350,7 +350,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(2, count($this->cache->searchByMime('foo/file')));
}
- public function testSearchQueryByTag() {
+ public function testSearchQueryByTag(): void {
$userId = static::getUniqueID('user');
\OC::$server->getUserManager()->createUser($userId, $userId);
static::loginAsUser($userId);
@@ -408,7 +408,7 @@ class CacheTest extends \Test\TestCase {
}
}
- public function testSearchByQuery() {
+ public function testSearchByQuery(): void {
$file1 = 'folder';
$file2 = 'folder/foobar';
$file3 = 'folder/foo';
@@ -448,7 +448,7 @@ class CacheTest extends \Test\TestCase {
/**
* @dataProvider movePathProvider
*/
- public function testMove($sourceFolder, $targetFolder, $children) {
+ public function testMove($sourceFolder, $targetFolder, $children): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'];
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
@@ -483,7 +483,24 @@ class CacheTest extends \Test\TestCase {
}
}
- public function testGetIncomplete() {
+ public function testMoveFromCache(): void {
+ $data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'foo/bar'];
+ $folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
+
+ $this->cache2->put('folder', $folderData);
+ $this->cache2->put('folder/sub', $data);
+
+
+ $this->cache->moveFromCache($this->cache2, 'folder', 'targetfolder');
+
+ $this->assertFalse($this->cache2->inCache('folder'));
+ $this->assertFalse($this->cache2->inCache('folder/sub'));
+
+ $this->assertTrue($this->cache->inCache('targetfolder'));
+ $this->assertTrue($this->cache->inCache('targetfolder/sub'));
+ }
+
+ public function testGetIncomplete(): void {
$file1 = 'folder1';
$file2 = 'folder2';
$file3 = 'folder3';
@@ -500,13 +517,13 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($file3, $this->cache->getIncomplete());
}
- public function testNonExisting() {
+ public function testNonExisting(): void {
$this->assertFalse($this->cache->get('foo.txt'));
$this->assertFalse($this->cache->get(-1));
$this->assertEquals([], $this->cache->getFolderContents('foo'));
}
- public function testGetById() {
+ public function testGetById(): void {
$storageId = $this->storage->getId();
$data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'];
$id = $this->cache->put('foo', $data);
@@ -517,7 +534,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals([$storageId, 'foo'], \OC\Files\Cache\Cache::getById($id));
}
- public function testStorageMTime() {
+ public function testStorageMTime(): void {
$data = ['size' => 1000, 'mtime' => 20, 'mimetype' => 'foo/file'];
$this->cache->put('foo', $data);
$cachedData = $this->cache->get('foo');
@@ -534,7 +551,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(25, $cachedData['mtime']);
}
- public function testLongId() {
+ public function testLongId(): void {
$storage = new LongId([]);
$cache = $storage->getCache();
$storageId = $storage->getId();
@@ -546,7 +563,7 @@ class CacheTest extends \Test\TestCase {
/**
* this test show the bug resulting if we have no normalizer installed
*/
- public function testWithoutNormalizer() {
+ public function testWithoutNormalizer(): void {
// folder name "Schön" with U+00F6 (normalized)
$folderWith00F6 = "\x53\x63\x68\xc3\xb6\x6e";
@@ -592,7 +609,7 @@ class CacheTest extends \Test\TestCase {
/**
* this test shows that there is no bug if we use the normalizer
*/
- public function testWithNormalizer() {
+ public function testWithNormalizer(): void {
if (!class_exists('Patchwork\PHP\Shim\Normalizer')) {
$this->markTestSkipped('The 3rdparty Normalizer extension is not available.');
return;
@@ -642,7 +659,7 @@ class CacheTest extends \Test\TestCase {
*
* @dataProvider bogusPathNamesProvider
*/
- public function testBogusPaths($bogusPath, $fixedBogusPath) {
+ public function testBogusPaths($bogusPath, $fixedBogusPath): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
// put root folder
@@ -664,7 +681,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals($newData, $newDataFromBogus);
}
- public function testNoReuseOfFileId() {
+ public function testNoReuseOfFileId(): void {
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'];
$this->cache->put('somefile.txt', $data1);
$info = $this->cache->get('somefile.txt');
@@ -689,7 +706,7 @@ class CacheTest extends \Test\TestCase {
* @param string $name
* @dataProvider escapingProvider
*/
- public function testEscaping($name) {
+ public function testEscaping($name): void {
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'];
$this->cache->put($name, $data);
$this->assertTrue($this->cache->inCache($name));
@@ -725,31 +742,31 @@ class CacheTest extends \Test\TestCase {
}
}
- public function testExtended() {
+ public function testExtended(): void {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
- $this->cache->put("", $folderData);
+ $this->cache->put('', $folderData);
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'creation_time' => 20];
- $id1 = $this->cache->put("foo1", $data);
+ $id1 = $this->cache->put('foo1', $data);
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'upload_time' => 30];
- $this->cache->put("foo2", $data);
+ $this->cache->put('foo2', $data);
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'metadata_etag' => 'foo'];
- $this->cache->put("foo3", $data);
+ $this->cache->put('foo3', $data);
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'];
- $id4 = $this->cache->put("foo4", $data);
+ $id4 = $this->cache->put('foo4', $data);
$entry = $this->cache->get($id1);
$this->assertEquals(20, $entry->getCreationTime());
$this->assertEquals(0, $entry->getUploadTime());
$this->assertEquals(null, $entry->getMetadataEtag());
- $entries = $this->cache->getFolderContents("");
+ $entries = $this->cache->getFolderContents('');
$this->assertCount(4, $entries);
- $this->assertEquals("foo1", $entries[0]->getName());
- $this->assertEquals("foo2", $entries[1]->getName());
- $this->assertEquals("foo3", $entries[2]->getName());
- $this->assertEquals("foo4", $entries[3]->getName());
+ $this->assertEquals('foo1', $entries[0]->getName());
+ $this->assertEquals('foo2', $entries[1]->getName());
+ $this->assertEquals('foo3', $entries[2]->getName());
+ $this->assertEquals('foo4', $entries[3]->getName());
$this->assertEquals(20, $entries[0]->getCreationTime());
$this->assertEquals(0, $entries[0]->getUploadTime());
@@ -774,11 +791,11 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(25, $entry->getUploadTime());
$this->assertEquals(null, $entry->getMetadataEtag());
- $this->cache->put("sub", $folderData);
+ $this->cache->put('sub', $folderData);
- $this->cache->move("foo1", "sub/foo1");
+ $this->cache->move('foo1', 'sub/foo1');
- $entries = $this->cache->getFolderContents("sub");
+ $entries = $this->cache->getFolderContents('sub');
$this->assertCount(1, $entries);
$this->assertEquals(20, $entries[0]->getCreationTime());
@@ -792,7 +809,7 @@ class CacheTest extends \Test\TestCase {
$this->assertEquals(25, $entry->getUploadTime());
$this->assertEquals(null, $entry->getMetadataEtag());
- $this->cache->remove("sub");
+ $this->cache->remove('sub');
}
protected function tearDown(): void {
diff --git a/tests/lib/Files/Cache/HomeCacheTest.php b/tests/lib/Files/Cache/HomeCacheTest.php
index 986d6df4c17..ad069de1fef 100644
--- a/tests/lib/Files/Cache/HomeCacheTest.php
+++ b/tests/lib/Files/Cache/HomeCacheTest.php
@@ -78,7 +78,7 @@ class HomeCacheTest extends \Test\TestCase {
* that have an unknown size. This makes sure that quota calculation still
* works as it's based on the "files" folder size.
*/
- public function testRootFolderSizeIgnoresUnknownUpdate() {
+ public function testRootFolderSizeIgnoresUnknownUpdate(): void {
$dir1 = 'files/knownsize';
$dir2 = 'files/unknownsize';
$fileData = [];
@@ -110,7 +110,7 @@ class HomeCacheTest extends \Test\TestCase {
$this->assertFalse($this->cache->inCache($dir2));
}
- public function testRootFolderSizeIsFilesSize() {
+ public function testRootFolderSizeIsFilesSize(): void {
$dir1 = 'files';
$afile = 'test.txt';
$fileData = [];
diff --git a/tests/lib/Files/Cache/LocalRootScannerTest.php b/tests/lib/Files/Cache/LocalRootScannerTest.php
index 204621bbd03..e683283b7e1 100644
--- a/tests/lib/Files/Cache/LocalRootScannerTest.php
+++ b/tests/lib/Files/Cache/LocalRootScannerTest.php
@@ -25,7 +25,7 @@ class LocalRootScannerTest extends TestCase {
$this->storage = new LocalRootStorage(['datadir' => $folder]);
}
- public function testDontScanUsers() {
+ public function testDontScanUsers(): void {
$this->storage->mkdir('foo');
$this->storage->mkdir('foo/bar');
@@ -33,7 +33,7 @@ class LocalRootScannerTest extends TestCase {
$this->assertFalse($this->storage->getCache()->inCache('foo'));
}
- public function testDoScanAppData() {
+ public function testDoScanAppData(): void {
$this->storage->mkdir('appdata_foo');
$this->storage->mkdir('appdata_foo/bar');
diff --git a/tests/lib/Files/Cache/PropagatorTest.php b/tests/lib/Files/Cache/PropagatorTest.php
index 8902034db02..e88816dfccc 100644
--- a/tests/lib/Files/Cache/PropagatorTest.php
+++ b/tests/lib/Files/Cache/PropagatorTest.php
@@ -16,7 +16,7 @@ use Test\TestCase;
* @group DB
*/
class PropagatorTest extends TestCase {
- /** @var IStorage */
+ /** @var IStorage */
private $storage;
protected function setUp(): void {
@@ -38,7 +38,7 @@ class PropagatorTest extends TestCase {
return array_combine($paths, $values);
}
- public function testEtagPropagation() {
+ public function testEtagPropagation(): void {
$paths = ['', 'foo', 'foo/bar'];
$oldInfos = $this->getFileInfos($paths);
$this->storage->getPropagator()->propagateChange('foo/bar/file.txt', time());
@@ -49,7 +49,7 @@ class PropagatorTest extends TestCase {
}
}
- public function testTimePropagation() {
+ public function testTimePropagation(): void {
$paths = ['', 'foo', 'foo/bar'];
$oldTime = time() - 200;
$targetTime = time() - 100;
@@ -69,7 +69,7 @@ class PropagatorTest extends TestCase {
$this->assertEquals($now, $newInfos['']->getMTime());
}
- public function testSizePropagation() {
+ public function testSizePropagation(): void {
$paths = ['', 'foo', 'foo/bar'];
$oldInfos = $this->getFileInfos($paths);
$this->storage->getPropagator()->propagateChange('foo/bar/file.txt', time(), 10);
@@ -80,7 +80,7 @@ class PropagatorTest extends TestCase {
}
}
- public function testSizePropagationNoNegative() {
+ public function testSizePropagationNoNegative(): void {
$paths = ['', 'foo', 'foo/bar'];
$oldInfos = $this->getFileInfos($paths);
$this->storage->getPropagator()->propagateChange('foo/bar/file.txt', time(), -100);
@@ -91,7 +91,7 @@ class PropagatorTest extends TestCase {
}
}
- public function testBatchedPropagation() {
+ public function testBatchedPropagation(): void {
$this->storage->mkdir('foo/baz');
$this->storage->mkdir('asd');
$this->storage->file_put_contents('asd/file.txt', 'bar');
@@ -122,7 +122,7 @@ class PropagatorTest extends TestCase {
foreach ($oldInfos as $i => $oldInfo) {
if ($oldInfo->getPath() !== 'foo/baz') {
- $this->assertNotEquals($oldInfo->getEtag(), $newInfos[$i]->getEtag());
+ $this->assertNotEquals($oldInfo->getEtag(), $newInfos[$i]->getEtag(), "etag for {$oldInfo->getPath()} not updated");
}
}
diff --git a/tests/lib/Files/Cache/ScannerTest.php b/tests/lib/Files/Cache/ScannerTest.php
index bc911baba0c..d78b7100d43 100644
--- a/tests/lib/Files/Cache/ScannerTest.php
+++ b/tests/lib/Files/Cache/ScannerTest.php
@@ -42,7 +42,7 @@ class ScannerTest extends TestCase {
parent::tearDown();
}
- public function testFile() {
+ public function testFile(): void {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo.txt', $data);
$this->scanner->scanFile('foo.txt');
@@ -63,7 +63,7 @@ class ScannerTest extends TestCase {
$this->assertEquals($cachedData['mimetype'], 'image/png');
}
- public function testFile4Byte() {
+ public function testFile4Byte(): void {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo🙈.txt', $data);
@@ -81,7 +81,7 @@ class ScannerTest extends TestCase {
}
}
- public function testFileInvalidChars() {
+ public function testFileInvalidChars(): void {
$data = "dummy file data\n";
$this->storage->file_put_contents("foo\nbar.txt", $data);
@@ -98,7 +98,7 @@ class ScannerTest extends TestCase {
$this->storage->file_put_contents('folder/bar.txt', $textData);
}
- public function testFolder() {
+ public function testFolder(): void {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -120,7 +120,7 @@ class ScannerTest extends TestCase {
$this->assertEquals($cachedDataFolder2['size'], $cachedDataText2['size']);
}
- public function testShallow() {
+ public function testShallow(): void {
$this->fillTestFolders();
$this->scanner->scan('', IScanner::SCAN_SHALLOW);
@@ -148,7 +148,7 @@ class ScannerTest extends TestCase {
$this->assertNotEquals($cachedDataFolder['size'], -1);
}
- public function testBackgroundScan() {
+ public function testBackgroundScan(): void {
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
@@ -170,7 +170,7 @@ class ScannerTest extends TestCase {
$this->assertFalse($this->cache->getIncomplete());
}
- public function testBackgroundScanOnlyRecurseIncomplete() {
+ public function testBackgroundScanOnlyRecurseIncomplete(): void {
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
@@ -196,7 +196,7 @@ class ScannerTest extends TestCase {
$this->assertFalse($this->cache->getIncomplete());
}
- public function testBackgroundScanNestedIncompleteFolders() {
+ public function testBackgroundScanNestedIncompleteFolders(): void {
$this->storage->mkdir('folder');
$this->scanner->backgroundScan();
@@ -234,7 +234,7 @@ class ScannerTest extends TestCase {
$this->assertEquals(6, $this->cache->get('folder/subfolder2')['size']);
}
- public function testReuseExisting() {
+ public function testReuseExisting(): void {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -273,7 +273,7 @@ class ScannerTest extends TestCase {
$this->assertEquals($oldData['size'], $newData['size']);
}
- public function testRemovedFile() {
+ public function testRemovedFile(): void {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -283,7 +283,7 @@ class ScannerTest extends TestCase {
$this->assertFalse($this->cache->inCache('foo.txt'));
}
- public function testRemovedFolder() {
+ public function testRemovedFolder(): void {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -294,7 +294,7 @@ class ScannerTest extends TestCase {
$this->assertFalse($this->cache->inCache('folder/bar.txt'));
}
- public function testScanRemovedFile() {
+ public function testScanRemovedFile(): void {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -304,7 +304,7 @@ class ScannerTest extends TestCase {
$this->assertFalse($this->cache->inCache('folder/bar.txt'));
}
- public function testETagRecreation() {
+ public function testETagRecreation(): void {
$this->fillTestFolders();
$this->scanner->scan('folder/bar.txt');
@@ -330,7 +330,7 @@ class ScannerTest extends TestCase {
$this->assertNotEmpty($newData0['etag']);
}
- public function testRepairParent() {
+ public function testRepairParent(): void {
$this->fillTestFolders();
$this->scanner->scan('');
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
@@ -356,7 +356,7 @@ class ScannerTest extends TestCase {
$this->assertEquals($newFolderId, $cachedData['parent']);
}
- public function testRepairParentShallow() {
+ public function testRepairParentShallow(): void {
$this->fillTestFolders();
$this->scanner->scan('');
$this->assertTrue($this->cache->inCache('folder/bar.txt'));
@@ -388,7 +388,7 @@ class ScannerTest extends TestCase {
* @param string $path
* @param bool $expected
*/
- public function testIsPartialFile($path, $expected) {
+ public function testIsPartialFile($path, $expected): void {
$this->assertSame($expected,
$this->scanner->isPartialFile($path)
);
@@ -404,7 +404,7 @@ class ScannerTest extends TestCase {
];
}
- public function testNoETagUnscannedFolder() {
+ public function testNoETagUnscannedFolder(): void {
$this->fillTestFolders();
$this->scanner->scan('');
@@ -423,7 +423,7 @@ class ScannerTest extends TestCase {
$this->assertNotEquals($newFolderEntry->getEtag(), $oldFolderEntry->getEtag());
}
- public function testNoETagUnscannedSubFolder() {
+ public function testNoETagUnscannedSubFolder(): void {
$this->fillTestFolders();
$this->storage->mkdir('folder/sub');
diff --git a/tests/lib/Files/Cache/SearchBuilderTest.php b/tests/lib/Files/Cache/SearchBuilderTest.php
index 57d890fcbcd..acb2e109144 100644
--- a/tests/lib/Files/Cache/SearchBuilderTest.php
+++ b/tests/lib/Files/Cache/SearchBuilderTest.php
@@ -175,7 +175,7 @@ class SearchBuilderTest extends TestCase {
* @param ISearchOperator $operator
* @param array $fileIds
*/
- public function testComparison(ISearchOperator $operator, array $fileIds) {
+ public function testComparison(ISearchOperator $operator, array $fileIds): void {
$fileId = [];
$fileId[] = $this->addCacheEntry([
'path' => 'foobar',
diff --git a/tests/lib/Files/Cache/UpdaterLegacyTest.php b/tests/lib/Files/Cache/UpdaterLegacyTest.php
index cb51afe7d6a..0f7e9d78d77 100644
--- a/tests/lib/Files/Cache/UpdaterLegacyTest.php
+++ b/tests/lib/Files/Cache/UpdaterLegacyTest.php
@@ -56,7 +56,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
self::$user = $this->getUniqueID();
}
- \OC::$server->getUserManager()->createUser(self::$user, 'password');
+ \OC::$server->getUserManager()->createUser(self::$user, 'NotAnEasyPassword123456+');
$this->loginAsUser(self::$user);
Filesystem::init(self::$user, '/' . self::$user . '/files');
@@ -86,7 +86,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
parent::tearDown();
}
- public function testWrite() {
+ public function testWrite(): void {
$textSize = strlen("dummy file data\n");
$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png');
$this->cache->put('foo.txt', ['mtime' => 100, 'storage_mtime' => 150]);
@@ -121,7 +121,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
$this->assertGreaterThanOrEqual($rootCachedData['mtime'], $mtime);
}
- public function testWriteWithMountPoints() {
+ public function testWriteWithMountPoints(): void {
$storage2 = new \OC\Files\Storage\Temporary([]);
$storage2->getScanner()->scan(''); //initialize etags
$cache2 = $storage2->getCache();
@@ -147,7 +147,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
$this->assertNotSame($oldEtag, $cachedData['etag']);
}
- public function testDelete() {
+ public function testDelete(): void {
$textSize = strlen("dummy file data\n");
$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png');
$rootCachedData = $this->cache->get('');
@@ -182,7 +182,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
$this->assertGreaterThanOrEqual($rootCachedData['mtime'], $cachedData['mtime']);
}
- public function testDeleteWithMountPoints() {
+ public function testDeleteWithMountPoints(): void {
$storage2 = new \OC\Files\Storage\Temporary([]);
$cache2 = $storage2->getCache();
Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage');
@@ -208,7 +208,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
$this->assertGreaterThanOrEqual($folderCachedData['mtime'], $cachedData['mtime']);
}
- public function testRename() {
+ public function testRename(): void {
$textSize = strlen("dummy file data\n");
$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo/logo.png');
$rootCachedData = $this->cache->get('');
@@ -230,7 +230,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
$this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
}
- public function testRenameExtension() {
+ public function testRenameExtension(): void {
$fooCachedData = $this->cache->get('foo.txt');
$this->assertEquals('text/plain', $fooCachedData['mimetype']);
Filesystem::rename('foo.txt', 'foo.abcd');
@@ -238,7 +238,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
$this->assertEquals('application/octet-stream', $fooCachedData['mimetype']);
}
- public function testRenameWithMountPoints() {
+ public function testRenameWithMountPoints(): void {
$storage2 = new \OC\Files\Storage\Temporary([]);
$cache2 = $storage2->getCache();
Filesystem::mount($storage2, [], '/' . self::$user . '/files/folder/substorage');
@@ -271,7 +271,7 @@ class UpdaterLegacyTest extends \Test\TestCase {
// $this->assertEquals($mtime, $cachedData['mtime']);
}
- public function testTouch() {
+ public function testTouch(): void {
$rootCachedData = $this->cache->get('');
$fooCachedData = $this->cache->get('foo.txt');
Filesystem::touch('foo.txt');
diff --git a/tests/lib/Files/Cache/UpdaterTest.php b/tests/lib/Files/Cache/UpdaterTest.php
index bfc17e64467..8b8697fc139 100644
--- a/tests/lib/Files/Cache/UpdaterTest.php
+++ b/tests/lib/Files/Cache/UpdaterTest.php
@@ -53,7 +53,7 @@ class UpdaterTest extends \Test\TestCase {
parent::tearDown();
}
- public function testNewFile() {
+ public function testNewFile(): void {
$this->storage->file_put_contents('foo.txt', 'bar');
$this->assertFalse($this->cache->inCache('foo.txt'));
@@ -65,7 +65,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertEquals('text/plain', $cached['mimetype']);
}
- public function testUpdatedFile() {
+ public function testUpdatedFile(): void {
$this->storage->file_put_contents('foo.txt', 'bar');
$this->updater->update('foo.txt');
@@ -84,7 +84,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertEquals(6, $cached['size']);
}
- public function testParentSize() {
+ public function testParentSize(): void {
$this->storage->getScanner()->scan('');
$parentCached = $this->cache->get('');
@@ -121,7 +121,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertEquals(0, $parentCached['size']);
}
- public function testMove() {
+ public function testMove(): void {
$this->storage->file_put_contents('foo.txt', 'qwerty');
$this->updater->update('foo.txt');
@@ -146,7 +146,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
}
- public function testMoveNonExistingOverwrite() {
+ public function testMoveNonExistingOverwrite(): void {
$this->storage->file_put_contents('bar.txt', 'qwerty');
$this->updater->update('bar.txt');
@@ -164,7 +164,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
}
- public function testUpdateStorageMTime() {
+ public function testUpdateStorageMTime(): void {
$this->storage->mkdir('sub');
$this->storage->mkdir('sub2');
$this->storage->file_put_contents('sub/foo.txt', 'qwerty');
@@ -205,7 +205,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertNotEquals($testmtime, $cachedTargetParent['mtime'], 'target folder mtime changed, not from storage');
}
- public function testNewFileDisabled() {
+ public function testNewFileDisabled(): void {
$this->storage->file_put_contents('foo.txt', 'bar');
$this->assertFalse($this->cache->inCache('foo.txt'));
@@ -215,7 +215,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertFalse($this->cache->inCache('foo.txt'));
}
- public function testMoveCrossStorage() {
+ public function testMoveCrossStorage(): void {
$storage2 = new Temporary([]);
$cache2 = $storage2->getCache();
Filesystem::mount($storage2, [], '/bar');
@@ -246,7 +246,7 @@ class UpdaterTest extends \Test\TestCase {
$this->assertEquals($cached['fileid'], $cachedTarget['fileid']);
}
- public function testMoveFolderCrossStorage() {
+ public function testMoveFolderCrossStorage(): void {
$storage2 = new Temporary([]);
$cache2 = $storage2->getCache();
Filesystem::mount($storage2, [], '/bar');
diff --git a/tests/lib/Files/Cache/WatcherTest.php b/tests/lib/Files/Cache/WatcherTest.php
index d4a44ca6aa0..7319aa9b68d 100644
--- a/tests/lib/Files/Cache/WatcherTest.php
+++ b/tests/lib/Files/Cache/WatcherTest.php
@@ -40,7 +40,7 @@ class WatcherTest extends \Test\TestCase {
/**
* @medium
*/
- public function testWatcher() {
+ public function testWatcher(): void {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
$updater = $storage->getWatcher();
@@ -81,7 +81,7 @@ class WatcherTest extends \Test\TestCase {
/**
* @medium
*/
- public function testFileToFolder() {
+ public function testFileToFolder(): void {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
$updater = $storage->getWatcher();
@@ -116,7 +116,7 @@ class WatcherTest extends \Test\TestCase {
$this->assertTrue($cache->inCache('foo.txt/bar.txt'));
}
- public function testPolicyNever() {
+ public function testPolicyNever(): void {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
$updater = $storage->getWatcher();
@@ -134,7 +134,7 @@ class WatcherTest extends \Test\TestCase {
$this->assertFalse($updater->checkUpdate('foo.txt'));
}
- public function testPolicyOnce() {
+ public function testPolicyOnce(): void {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
$updater = $storage->getWatcher();
@@ -152,7 +152,7 @@ class WatcherTest extends \Test\TestCase {
$this->assertFalse($updater->checkUpdate('foo.txt'));
}
- public function testPolicyAlways() {
+ public function testPolicyAlways(): void {
$storage = $this->getTestStorage();
$cache = $storage->getCache();
$updater = $storage->getWatcher();
diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
index d0a6f99cb19..697a506971b 100644
--- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php
@@ -36,7 +36,7 @@ class CacheJailTest extends CacheTest {
$this->cache = new \OC\Files\Cache\Wrapper\CacheJail($this->sourceCache, 'foo');
}
- public function testSearchOutsideJail() {
+ public function testSearchOutsideJail(): void {
$this->storage->getScanner()->scan('');
$file1 = 'foo/foobar';
$file2 = 'folder/foobar';
@@ -60,7 +60,7 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('foobar', $result[1]['path']);
}
- public function testSearchMimeOutsideJail() {
+ public function testSearchMimeOutsideJail(): void {
$this->storage->getScanner()->scan('');
$file1 = 'foo/foobar';
$file2 = 'folder/foobar';
@@ -76,7 +76,7 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('foobar', $result[0]['path']);
}
- public function testSearchQueryOutsideJail() {
+ public function testSearchQueryOutsideJail(): void {
$this->storage->getScanner()->scan('');
$file1 = 'foo/foobar';
$file2 = 'folder/foobar';
@@ -98,7 +98,7 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('', $result[0]['path']);
}
- public function testClearKeepEntriesOutsideJail() {
+ public function testClearKeepEntriesOutsideJail(): void {
$file1 = 'foo/foobar';
$file2 = 'foo/foobar/asd';
$file3 = 'folder/foobar';
@@ -115,7 +115,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('folder/foobar'));
}
- public function testGetById() {
+ public function testGetById(): void {
$data1 = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$id = $this->sourceCache->put('foo/bar', $data1);
@@ -129,12 +129,12 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('foo/bar', $path);
}
- public function testGetIncomplete() {
+ public function testGetIncomplete(): void {
//not supported
$this->addToAssertionCount(1);
}
- public function testMoveFromJail() {
+ public function testMoveFromJail(): void {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$this->sourceCache->put('source', $folderData);
@@ -150,7 +150,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
}
- public function testMoveToJail() {
+ public function testMoveToJail(): void {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$this->sourceCache->put('source', $folderData);
@@ -166,7 +166,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
}
- public function testMoveBetweenJail() {
+ public function testMoveBetweenJail(): void {
$folderData = ['size' => 100, 'mtime' => 50, 'mimetype' => 'httpd/unix-directory'];
$this->sourceCache->put('source', $folderData);
@@ -183,7 +183,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->sourceCache->inCache('target/foo/bar'));
}
- public function testSearchNested() {
+ public function testSearchNested(): void {
$this->storage->getScanner()->scan('');
$file1 = 'foo';
$file2 = 'foo/bar';
@@ -201,7 +201,7 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('asd', $result[0]['path']);
}
- public function testRootJail() {
+ public function testRootJail(): void {
$this->storage->getScanner()->scan('');
$file1 = 'foo';
$file2 = 'foo/bar';
@@ -219,7 +219,7 @@ class CacheJailTest extends CacheTest {
$this->assertEquals('foo/bar/asd', $result[0]['path']);
}
- public function testWatcher() {
+ public function testWatcher(): void {
$storage = new Jail([
'storage' => $this->storage,
'root' => 'foo'
@@ -232,7 +232,7 @@ class CacheJailTest extends CacheTest {
$this->assertTrue($this->cache->inCache('bar'));
}
- public function testWatcherAfterInnerWatcher() {
+ public function testWatcherAfterInnerWatcher(): void {
$storage = new Jail([
'storage' => $this->storage,
'root' => 'foo'
diff --git a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php
index d3eb8be7af9..afb5c6a5d4d 100644
--- a/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php
+++ b/tests/lib/Files/Cache/Wrapper/CachePermissionsMaskTest.php
@@ -47,7 +47,7 @@ class CachePermissionsMaskTest extends CacheTest {
* @dataProvider maskProvider
* @param int $mask
*/
- public function testGetMasked($mask) {
+ public function testGetMasked($mask): void {
$cache = $this->getMaskedCached($mask);
$data = ['size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain', 'permissions' => Constants::PERMISSION_ALL];
$this->sourceCache->put('foo', $data);
@@ -64,7 +64,7 @@ class CachePermissionsMaskTest extends CacheTest {
* @dataProvider maskProvider
* @param int $mask
*/
- public function testGetFolderContentMasked($mask) {
+ public function testGetFolderContentMasked($mask): void {
$this->storage->mkdir('foo');
$this->storage->file_put_contents('foo/bar', 'asd');
$this->storage->file_put_contents('foo/asd', 'bar');
@@ -83,7 +83,7 @@ class CachePermissionsMaskTest extends CacheTest {
* @dataProvider maskProvider
* @param int $mask
*/
- public function testSearchMasked($mask) {
+ public function testSearchMasked($mask): void {
$this->storage->mkdir('foo');
$this->storage->file_put_contents('foo/bar', 'asd');
$this->storage->file_put_contents('foo/foobar', 'bar');
diff --git a/tests/lib/Files/Config/UserMountCacheTest.php b/tests/lib/Files/Config/UserMountCacheTest.php
index 13690096d3a..a6f25026193 100644
--- a/tests/lib/Files/Config/UserMountCacheTest.php
+++ b/tests/lib/Files/Config/UserMountCacheTest.php
@@ -7,11 +7,13 @@
namespace Test\Files\Config;
+use OC\DB\Exceptions\DbalException;
use OC\DB\QueryBuilder\Literal;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\Storage;
use OC\User\Manager;
use OCP\Cache\CappedMemoryCache;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Diagnostics\IEventLogger;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Config\ICachedMountInfo;
@@ -121,7 +123,7 @@ class UserMountCacheTest extends TestCase {
return $mount->getStorageRootId().'::'.$mount->getMountPoint();
}
- public function testNewMounts() {
+ public function testNewMounts(): void {
$user = $this->userManager->get('u1');
[$storage] = $this->getStorage(10);
@@ -141,7 +143,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals($storage->getStorageCache()->getNumericId(), $cachedMount->getStorageId());
}
- public function testSameMounts() {
+ public function testSameMounts(): void {
$user = $this->userManager->get('u1');
[$storage] = $this->getStorage(10);
@@ -165,7 +167,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals($storage->getStorageCache()->getNumericId(), $cachedMount->getStorageId());
}
- public function testRemoveMounts() {
+ public function testRemoveMounts(): void {
$user = $this->userManager->get('u1');
[$storage] = $this->getStorage(10);
@@ -184,7 +186,7 @@ class UserMountCacheTest extends TestCase {
$this->assertCount(0, $cachedMounts);
}
- public function testChangeMounts() {
+ public function testChangeMounts(): void {
$user = $this->userManager->get('u1');
[$storage] = $this->getStorage(10);
@@ -207,7 +209,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals('/foo/', $cachedMount->getMountPoint());
}
- public function testChangeMountId() {
+ public function testChangeMountId(): void {
$user = $this->userManager->get('u1');
[$storage] = $this->getStorage(10);
@@ -230,7 +232,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals(1, $cachedMount->getMountId());
}
- public function testGetMountsForUser() {
+ public function testGetMountsForUser(): void {
$user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2');
$user3 = $this->userManager->get('u3');
@@ -267,7 +269,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEmpty($cachedMounts);
}
- public function testGetMountsByStorageId() {
+ public function testGetMountsByStorageId(): void {
$user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2');
@@ -297,7 +299,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals(2, $cachedMounts[1]->getStorageId());
}
- public function testGetMountsByRootId() {
+ public function testGetMountsByRootId(): void {
$user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2');
@@ -335,34 +337,43 @@ class UserMountCacheTest extends TestCase {
private function createCacheEntry($internalPath, $storageId, $size = 0) {
$internalPath = trim($internalPath, '/');
- $inserted = $this->connection->insertIfNotExist('*PREFIX*filecache', [
- 'storage' => $storageId,
- 'path' => $internalPath,
- 'path_hash' => md5($internalPath),
- 'parent' => -1,
- 'name' => basename($internalPath),
- 'mimetype' => 0,
- 'mimepart' => 0,
- 'size' => $size,
- 'storage_mtime' => 0,
- 'encrypted' => 0,
- 'unencrypted_size' => 0,
- 'etag' => '',
- 'permissions' => 31
- ], ['storage', 'path_hash']);
- if ($inserted) {
- $id = (int)$this->connection->lastInsertId('*PREFIX*filecache');
+ try {
+ $query = $this->connection->getQueryBuilder();
+ $query->insert('filecache')
+ ->values([
+ 'storage' => $query->createNamedParameter($storageId),
+ 'path' => $query->createNamedParameter($internalPath),
+ 'path_hash' => $query->createNamedParameter(md5($internalPath)),
+ 'parent' => $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT),
+ 'name' => $query->createNamedParameter(basename($internalPath)),
+ 'mimetype' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
+ 'mimepart' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
+ 'size' => $query->createNamedParameter($size),
+ 'storage_mtime' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
+ 'encrypted' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
+ 'unencrypted_size' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
+ 'etag' => $query->createNamedParameter(''),
+ 'permissions' => $query->createNamedParameter(31, IQueryBuilder::PARAM_INT),
+ ]);
+ $query->executeStatement();
+ $id = $query->getLastInsertId();
$this->fileIds[] = $id;
- } else {
- $sql = 'SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` =?';
- $query = $this->connection->prepare($sql);
- $query->execute([$storageId, md5($internalPath)]);
- return (int)$query->fetchOne();
+ } catch (DbalException $e) {
+ if ($e->getReason() === DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
+ $query = $this->connection->getQueryBuilder();
+ $query->select('fileid')
+ ->from('filecache')
+ ->where($query->expr()->eq('storage', $query->createNamedParameter($storageId)))
+ ->andWhere($query->expr()->eq('path_hash', $query->createNamedParameter(md5($internalPath))));
+ $id = (int)$query->execute()->fetchColumn();
+ } else {
+ throw $e;
+ }
}
return $id;
}
- public function testGetMountsForFileIdRootId() {
+ public function testGetMountsForFileIdRootId(): void {
$user1 = $this->userManager->get('u1');
[$storage1, $rootId] = $this->getStorage(2);
@@ -382,7 +393,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals(2, $cachedMounts[0]->getStorageId());
}
- public function testGetMountsForFileIdSubFolder() {
+ public function testGetMountsForFileIdSubFolder(): void {
$user1 = $this->userManager->get('u1');
$fileId = $this->createCacheEntry('/foo/bar', 2);
@@ -406,7 +417,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals('/foo/foo/bar', $cachedMounts[0]->getPath());
}
- public function testGetMountsForFileIdSubFolderMount() {
+ public function testGetMountsForFileIdSubFolderMount(): void {
$user1 = $this->userManager->get('u1');
[$storage1, $rootId] = $this->getStorage(2);
@@ -440,7 +451,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEquals('/bar', $cachedMounts[0]->getPath());
}
- public function testGetMountsForFileIdSubFolderMountOutside() {
+ public function testGetMountsForFileIdSubFolderMountOutside(): void {
$user1 = $this->userManager->get('u1');
[$storage1, $rootId] = $this->getStorage(2);
@@ -468,7 +479,7 @@ class UserMountCacheTest extends TestCase {
}
- public function testGetMountsForFileIdDeletedUser() {
+ public function testGetMountsForFileIdDeletedUser(): void {
$user1 = $this->userManager->get('u1');
[$storage1, $rootId] = $this->getStorage(2);
@@ -483,7 +494,7 @@ class UserMountCacheTest extends TestCase {
$this->assertEmpty($cachedMounts);
}
- public function testGetUsedSpaceForUsers() {
+ public function testGetUsedSpaceForUsers(): void {
$user1 = $this->userManager->get('u1');
$user2 = $this->userManager->get('u2');
@@ -514,7 +525,7 @@ class UserMountCacheTest extends TestCase {
}
- public function testMigrateMountProvider() {
+ public function testMigrateMountProvider(): void {
$user1 = $this->userManager->get('u1');
[$storage1, $rootId] = $this->getStorage(2);
diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php
index a109a17d250..dbf65eac439 100644
--- a/tests/lib/Files/EtagTest.php
+++ b/tests/lib/Files/EtagTest.php
@@ -55,7 +55,7 @@ class EtagTest extends \Test\TestCase {
parent::tearDown();
}
- public function testNewUser() {
+ public function testNewUser(): void {
$user1 = $this->getUniqueID('user_');
$this->userBackend->createUser($user1, '');
diff --git a/tests/lib/Files/FileInfoTest.php b/tests/lib/Files/FileInfoTest.php
index bc4a25ef622..2979252f78a 100644
--- a/tests/lib/Files/FileInfoTest.php
+++ b/tests/lib/Files/FileInfoTest.php
@@ -27,7 +27,7 @@ class FileInfoTest extends TestCase {
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
}
- public function testIsMountedHomeStorage() {
+ public function testIsMountedHomeStorage(): void {
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('foo');
@@ -45,7 +45,7 @@ class FileInfoTest extends TestCase {
$this->assertFalse($fileInfo->isMounted());
}
- public function testIsMountedNonHomeStorage() {
+ public function testIsMountedNonHomeStorage(): void {
$storage = new Temporary();
$fileInfo = new FileInfo(
'',
diff --git a/tests/lib/Files/FilenameValidatorTest.php b/tests/lib/Files/FilenameValidatorTest.php
new file mode 100644
index 00000000000..ac9ac032b64
--- /dev/null
+++ b/tests/lib/Files/FilenameValidatorTest.php
@@ -0,0 +1,287 @@
+<?php
+
+declare(strict_types=1);
+
+/*!
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Files;
+
+use OC\Files\FilenameValidator;
+use OCP\Files\EmptyFileNameException;
+use OCP\Files\FileNameTooLongException;
+use OCP\Files\InvalidCharacterInPathException;
+use OCP\Files\InvalidDirectoryException;
+use OCP\Files\InvalidPathException;
+use OCP\Files\ReservedWordException;
+use OCP\IConfig;
+use OCP\IDBConnection;
+use OCP\IL10N;
+use OCP\L10N\IFactory;
+use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
+use Test\TestCase;
+
+class FilenameValidatorTest extends TestCase {
+
+ protected IFactory&MockObject $l10n;
+ protected IConfig&MockObject $config;
+ protected IDBConnection&MockObject $database;
+ protected LoggerInterface&MockObject $logger;
+
+ protected function setUp(): void {
+ parent::setUp();
+ $l10n = $this->createMock(IL10N::class);
+ $l10n->method('t')
+ ->willReturnCallback(fn ($string, $params) => sprintf($string, ...$params));
+ $this->l10n = $this->createMock(IFactory::class);
+ $this->l10n
+ ->method('get')
+ ->with('core')
+ ->willReturn($l10n);
+
+ $this->config = $this->createMock(IConfig::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
+ $this->database = $this->createMock(IDBConnection::class);
+ $this->database->method('supports4ByteText')->willReturn(true);
+ }
+
+ /**
+ * @dataProvider dataValidateFilename
+ */
+ public function testValidateFilename(
+ string $filename,
+ array $forbiddenNames,
+ array $forbiddenBasenames,
+ array $forbiddenExtensions,
+ array $forbiddenCharacters,
+ ?string $exception,
+ ): void {
+ /** @var FilenameValidator&MockObject */
+ $validator = $this->getMockBuilder(FilenameValidator::class)
+ ->onlyMethods([
+ 'getForbiddenBasenames',
+ 'getForbiddenCharacters',
+ 'getForbiddenExtensions',
+ 'getForbiddenFilenames',
+ ])
+ ->setConstructorArgs([$this->l10n, $this->database, $this->config, $this->logger])
+ ->getMock();
+
+ $validator->method('getForbiddenBasenames')
+ ->willReturn($forbiddenBasenames);
+ $validator->method('getForbiddenCharacters')
+ ->willReturn($forbiddenCharacters);
+ $validator->method('getForbiddenExtensions')
+ ->willReturn($forbiddenExtensions);
+ $validator->method('getForbiddenFilenames')
+ ->willReturn($forbiddenNames);
+
+ if ($exception !== null) {
+ $this->expectException($exception);
+ } else {
+ $this->expectNotToPerformAssertions();
+ }
+ $validator->validateFilename($filename);
+ }
+
+ /**
+ * @dataProvider dataValidateFilename
+ */
+ public function testIsFilenameValid(
+ string $filename,
+ array $forbiddenNames,
+ array $forbiddenBasenames,
+ array $forbiddenExtensions,
+ array $forbiddenCharacters,
+ ?string $exception,
+ ): void {
+ /** @var FilenameValidator&MockObject */
+ $validator = $this->getMockBuilder(FilenameValidator::class)
+ ->onlyMethods([
+ 'getForbiddenBasenames',
+ 'getForbiddenExtensions',
+ 'getForbiddenFilenames',
+ 'getForbiddenCharacters',
+ ])
+ ->setConstructorArgs([$this->l10n, $this->database, $this->config, $this->logger])
+ ->getMock();
+
+ $validator->method('getForbiddenBasenames')
+ ->willReturn($forbiddenBasenames);
+ $validator->method('getForbiddenCharacters')
+ ->willReturn($forbiddenCharacters);
+ $validator->method('getForbiddenExtensions')
+ ->willReturn($forbiddenExtensions);
+ $validator->method('getForbiddenFilenames')
+ ->willReturn($forbiddenNames);
+
+
+ $this->assertEquals($exception === null, $validator->isFilenameValid($filename));
+ }
+
+ public function dataValidateFilename(): array {
+ return [
+ 'valid name' => [
+ 'a: b.txt', ['.htaccess'], [], [], [], null
+ ],
+ 'forbidden name in the middle is ok' => [
+ 'a.htaccess.txt', ['.htaccess'], [], [], [], null
+ ],
+ 'valid name with some more parameters' => [
+ 'a: b.txt', ['.htaccess'], [], ['exe'], ['~'], null
+ ],
+ 'valid name checks only the full name' => [
+ '.htaccess.sample', ['.htaccess'], [], [], [], null
+ ],
+ 'forbidden name' => [
+ '.htaccess', ['.htaccess'], [], [], [], ReservedWordException::class
+ ],
+ 'forbidden name - name is case insensitive' => [
+ 'COM1', ['.htaccess', 'com1'], [], [], [], ReservedWordException::class
+ ],
+ 'forbidden basename' => [
+ // needed for Windows namespaces
+ 'com1.suffix', ['.htaccess'], ['com1'], [], [], ReservedWordException::class
+ ],
+ 'forbidden basename for hidden files' => [
+ // needed for Windows namespaces
+ '.thumbs.db', ['.htaccess'], ['.thumbs'], [], [], ReservedWordException::class
+ ],
+ 'invalid character' => [
+ 'a: b.txt', ['.htaccess'], [], [], [':'], InvalidCharacterInPathException::class
+ ],
+ 'invalid path' => [
+ '../../foo.bar', ['.htaccess'], [], [], ['/', '\\'], InvalidCharacterInPathException::class,
+ ],
+ 'invalid extension' => [
+ 'a: b.txt', ['.htaccess'], [], ['.txt'], [], InvalidPathException::class
+ ],
+ 'empty filename' => [
+ '', [], [], [], [], EmptyFileNameException::class
+ ],
+ 'reserved unix name "."' => [
+ '.', [], [], [], [], InvalidDirectoryException::class
+ ],
+ 'reserved unix name ".."' => [
+ '..', [], [], [], [], InvalidDirectoryException::class
+ ],
+ 'weird but valid tripple dot name' => [
+ '...', [], [], [], [], null // is valid
+ ],
+ 'too long filename "."' => [
+ str_repeat('a', 251), [], [], [], [], FileNameTooLongException::class
+ ],
+ // make sure to not split the list entries as they migh contain Unicode sequences
+ // in this example the "face in clouds" emoji contains the clouds emoji so only having clouds is ok
+ ['🌫️.txt', ['.htaccess'], [], [], ['😶‍🌫️'], null],
+ // This is the reverse: clouds are forbidden -> so is also the face in the clouds emoji
+ ['😶‍🌫️.txt', ['.htaccess'], [], [], ['🌫️'], InvalidCharacterInPathException::class],
+ ];
+ }
+
+ /**
+ * @dataProvider data4ByteUnicode
+ */
+ public function testDatabaseDoesNotSupport4ByteText($filename): void {
+ $database = $this->createMock(IDBConnection::class);
+ $database->expects($this->once())
+ ->method('supports4ByteText')
+ ->willReturn(false);
+ $this->expectException(InvalidCharacterInPathException::class);
+ $validator = new FilenameValidator($this->l10n, $database, $this->config, $this->logger);
+ $validator->validateFilename($filename);
+ }
+
+ public function data4ByteUnicode(): array {
+ return [
+ ['plane 1 𐪅'],
+ ['emoji 😶‍🌫️'],
+
+ ];
+ }
+
+ /**
+ * @dataProvider dataInvalidAsciiCharacters
+ */
+ public function testInvalidAsciiCharactersAreAlwaysForbidden(string $filename): void {
+ $this->expectException(InvalidPathException::class);
+ $validator = new FilenameValidator($this->l10n, $this->database, $this->config, $this->logger);
+ $validator->validateFilename($filename);
+ }
+
+ public function dataInvalidAsciiCharacters(): array {
+ return [
+ [\chr(0)],
+ [\chr(1)],
+ [\chr(2)],
+ [\chr(3)],
+ [\chr(4)],
+ [\chr(5)],
+ [\chr(6)],
+ [\chr(7)],
+ [\chr(8)],
+ [\chr(9)],
+ [\chr(10)],
+ [\chr(11)],
+ [\chr(12)],
+ [\chr(13)],
+ [\chr(14)],
+ [\chr(15)],
+ [\chr(16)],
+ [\chr(17)],
+ [\chr(18)],
+ [\chr(19)],
+ [\chr(20)],
+ [\chr(21)],
+ [\chr(22)],
+ [\chr(23)],
+ [\chr(24)],
+ [\chr(25)],
+ [\chr(26)],
+ [\chr(27)],
+ [\chr(28)],
+ [\chr(29)],
+ [\chr(30)],
+ [\chr(31)],
+ ];
+ }
+
+ /**
+ * @dataProvider dataIsForbidden
+ */
+ public function testIsForbidden(string $filename, array $forbiddenNames, bool $expected): void {
+ /** @var FilenameValidator&MockObject */
+ $validator = $this->getMockBuilder(FilenameValidator::class)
+ ->onlyMethods(['getForbiddenFilenames'])
+ ->setConstructorArgs([$this->l10n, $this->database, $this->config, $this->logger])
+ ->getMock();
+
+ $validator->method('getForbiddenFilenames')
+ ->willReturn($forbiddenNames);
+
+ $this->assertEquals($expected, $validator->isForbidden($filename));
+ }
+
+ public function dataIsForbidden(): array {
+ return [
+ 'valid name' => [
+ 'a: b.txt', ['.htaccess'], false
+ ],
+ 'valid name with some more parameters' => [
+ 'a: b.txt', ['.htaccess'], false
+ ],
+ 'valid name as only full forbidden should be matched' => [
+ '.htaccess.sample', ['.htaccess'], false,
+ ],
+ 'forbidden name' => [
+ '.htaccess', ['.htaccess'], true
+ ],
+ 'forbidden name - name is case insensitive' => [
+ 'COM1', ['.htaccess', 'com1'], true,
+ ],
+ ];
+ }
+}
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index 4ab0456a810..91f0bb9b01d 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -44,8 +44,8 @@ class DummyMountProvider implements IMountProvider {
* @package Test\Files
*/
class FilesystemTest extends \Test\TestCase {
- public const TEST_FILESYSTEM_USER1 = "test-filesystem-user1";
- public const TEST_FILESYSTEM_USER2 = "test-filesystem-user1";
+ public const TEST_FILESYSTEM_USER1 = 'test-filesystem-user1';
+ public const TEST_FILESYSTEM_USER2 = 'test-filesystem-user1';
/**
* @var array tmpDirs
@@ -80,7 +80,7 @@ class FilesystemTest extends \Test\TestCase {
parent::tearDown();
}
- public function testMount() {
+ public function testMount(): void {
\OC\Files\Filesystem::mount('\OC\Files\Storage\Local', self::getStorageData(), '/');
$this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/'));
$this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/some/folder'));
@@ -195,7 +195,7 @@ class FilesystemTest extends \Test\TestCase {
/**
* @dataProvider normalizePathData
*/
- public function testNormalizePath($expected, $path, $stripTrailingSlash = true) {
+ public function testNormalizePath($expected, $path, $stripTrailingSlash = true): void {
$this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, $stripTrailingSlash));
}
@@ -213,11 +213,11 @@ class FilesystemTest extends \Test\TestCase {
/**
* @dataProvider normalizePathKeepUnicodeData
*/
- public function testNormalizePathKeepUnicode($expected, $path, $keepUnicode = false) {
+ public function testNormalizePathKeepUnicode($expected, $path, $keepUnicode = false): void {
$this->assertEquals($expected, \OC\Files\Filesystem::normalizePath($path, true, false, $keepUnicode));
}
- public function testNormalizePathKeepUnicodeCache() {
+ public function testNormalizePathKeepUnicodeCache(): void {
$nfdName = 'ümlaut';
$nfcName = 'ümlaut';
// call in succession due to cache
@@ -254,7 +254,7 @@ class FilesystemTest extends \Test\TestCase {
/**
* @dataProvider isValidPathData
*/
- public function testIsValidPath($path, $expected) {
+ public function testIsValidPath($path, $expected): void {
$this->assertSame($expected, \OC\Files\Filesystem::isValidPath($path));
}
@@ -276,11 +276,11 @@ class FilesystemTest extends \Test\TestCase {
/**
* @dataProvider isFileBlacklistedData
*/
- public function testIsFileBlacklisted($path, $expected) {
+ public function testIsFileBlacklisted($path, $expected): void {
$this->assertSame($expected, \OC\Files\Filesystem::isFileBlacklisted($path));
}
- public function testNormalizePathUTF8() {
+ public function testNormalizePathUTF8(): void {
if (!class_exists('Patchwork\PHP\Shim\Normalizer')) {
$this->markTestSkipped('UTF8 normalizer Patchwork was not found');
}
@@ -289,7 +289,7 @@ class FilesystemTest extends \Test\TestCase {
$this->assertEquals("/foo/bar\xC3\xBC", \OC\Files\Filesystem::normalizePath("\\foo\\baru\xCC\x88"));
}
- public function testHooks() {
+ public function testHooks(): void {
if (\OC\Files\Filesystem::getView()) {
$user = \OC_User::getUser();
} else {
@@ -324,7 +324,7 @@ class FilesystemTest extends \Test\TestCase {
* Tests that an exception is thrown when passed user does not exist.
*
*/
- public function testLocalMountWhenUserDoesNotExist() {
+ public function testLocalMountWhenUserDoesNotExist(): void {
$this->expectException(\OC\User\NoUserException::class);
$userId = $this->getUniqueID('user_');
@@ -333,13 +333,13 @@ class FilesystemTest extends \Test\TestCase {
}
- public function testNullUserThrows() {
+ public function testNullUserThrows(): void {
$this->expectException(\OC\User\NoUserException::class);
\OC\Files\Filesystem::initMountPoints(null);
}
- public function testNullUserThrowsTwice() {
+ public function testNullUserThrowsTwice(): void {
$thrown = 0;
try {
\OC\Files\Filesystem::initMountPoints(null);
@@ -357,7 +357,7 @@ class FilesystemTest extends \Test\TestCase {
/**
* Tests that an exception is thrown when passed user does not exist.
*/
- public function testLocalMountWhenUserDoesNotExistTwice() {
+ public function testLocalMountWhenUserDoesNotExistTwice(): void {
$thrown = 0;
$userId = $this->getUniqueID('user_');
@@ -379,7 +379,7 @@ class FilesystemTest extends \Test\TestCase {
/**
* Tests that the home storage is used for the user's mount point
*/
- public function testHomeMount() {
+ public function testHomeMount(): void {
$userId = $this->getUniqueID('user_');
\OC::$server->getUserManager()->createUser($userId, $userId);
@@ -409,7 +409,7 @@ class FilesystemTest extends \Test\TestCase {
/**
* Test that the default cache dir is part of the user's home
*/
- public function testMountDefaultCacheDir() {
+ public function testMountDefaultCacheDir(): void {
$userId = $this->getUniqueID('user_');
$config = \OC::$server->getConfig();
$oldCachePath = $config->getSystemValueString('cache_path', '');
@@ -438,7 +438,7 @@ class FilesystemTest extends \Test\TestCase {
* Test that an external cache is mounted into
* the user's home
*/
- public function testMountExternalCacheDir() {
+ public function testMountExternalCacheDir(): void {
$userId = $this->getUniqueID('user_');
$config = \OC::$server->getConfig();
@@ -465,7 +465,7 @@ class FilesystemTest extends \Test\TestCase {
$config->setSystemValue('cache_path', $oldCachePath);
}
- public function testRegisterMountProviderAfterSetup() {
+ public function testRegisterMountProviderAfterSetup(): void {
\OC\Files\Filesystem::initMountPoints(self::TEST_FILESYSTEM_USER2);
$this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/foo/bar'));
$mount = new MountPoint(new Temporary([]), '/foo/bar');
diff --git a/tests/lib/Files/Mount/ManagerTest.php b/tests/lib/Files/Mount/ManagerTest.php
index f8adb2bf1cf..fe166988687 100644
--- a/tests/lib/Files/Mount/ManagerTest.php
+++ b/tests/lib/Files/Mount/ManagerTest.php
@@ -27,7 +27,7 @@ class ManagerTest extends \Test\TestCase {
$this->manager = new \OC\Files\Mount\Manager($this->createMock(SetupManagerFactory::class));
}
- public function testFind() {
+ public function testFind(): void {
$rootMount = new \OC\Files\Mount\MountPoint(new Temporary([]), '/');
$this->manager->addMount($rootMount);
$this->assertEquals($rootMount, $this->manager->find('/'));
@@ -52,7 +52,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals([$mount1, $mount3], $this->manager->findByStorageId($id));
}
- public function testLong() {
+ public function testLong(): void {
$storage = new LongId([]);
$mount = new \OC\Files\Mount\MountPoint($storage, '/foo');
$this->manager->addMount($mount);
diff --git a/tests/lib/Files/Mount/MountPointTest.php b/tests/lib/Files/Mount/MountPointTest.php
index 189667df276..eda61feb249 100644
--- a/tests/lib/Files/Mount/MountPointTest.php
+++ b/tests/lib/Files/Mount/MountPointTest.php
@@ -14,7 +14,7 @@ class DummyStorage {
}
class MountPointTest extends \Test\TestCase {
- public function testGetStorage() {
+ public function testGetStorage(): void {
$storage = $this->createMock(Storage::class);
$storage->expects($this->once())
->method('getId')
@@ -41,7 +41,7 @@ class MountPointTest extends \Test\TestCase {
$this->assertEquals('/another/', $mountPoint->getMountPoint());
}
- public function testInvalidStorage() {
+ public function testInvalidStorage(): void {
$loader = $this->createMock(StorageFactory::class);
$loader->expects($this->once())
->method('wrap')
diff --git a/tests/lib/Files/Mount/MountTest.php b/tests/lib/Files/Mount/MountTest.php
index 0b4c6a214f3..76d70cdd214 100644
--- a/tests/lib/Files/Mount/MountTest.php
+++ b/tests/lib/Files/Mount/MountTest.php
@@ -11,7 +11,7 @@ use OC\Files\Storage\StorageFactory;
use OC\Files\Storage\Wrapper\Wrapper;
class MountTest extends \Test\TestCase {
- public function testFromStorageObject() {
+ public function testFromStorageObject(): void {
$storage = $this->getMockBuilder('\OC\Files\Storage\Temporary')
->disableOriginalConstructor()
->getMock();
@@ -19,12 +19,12 @@ class MountTest extends \Test\TestCase {
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
}
- public function testFromStorageClassname() {
+ public function testFromStorageClassname(): void {
$mount = new \OC\Files\Mount\MountPoint('\OC\Files\Storage\Temporary', '/foo');
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $mount->getStorage());
}
- public function testWrapper() {
+ public function testWrapper(): void {
$test = $this;
$wrapper = function ($mountPoint, $storage) use (&$test) {
$test->assertEquals('/foo/', $mountPoint);
diff --git a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
index 9b6aaeccfeb..f787c168130 100644
--- a/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
+++ b/tests/lib/Files/Mount/ObjectHomeMountProviderTest.php
@@ -34,7 +34,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->provider = new ObjectHomeMountProvider($this->config);
}
- public function testSingleBucket() {
+ public function testSingleBucket(): void {
$this->config->expects($this->once())
->method('getSystemValue')
->with($this->equalTo('objectstore'), '')
@@ -56,7 +56,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertInstanceOf('Test\Files\Mount\FakeObjectStore', $config['arguments']['objectstore']);
}
- public function testMultiBucket() {
+ public function testMultiBucket(): void {
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->with($this->equalTo('objectstore_multibucket'), '')
@@ -100,7 +100,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertEquals('49', $config['arguments']['bucket']);
}
- public function testMultiBucketWithPrefix() {
+ public function testMultiBucketWithPrefix(): void {
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->with('objectstore_multibucket')
@@ -147,7 +147,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertEquals('myBucketPrefix49', $config['arguments']['bucket']);
}
- public function testMultiBucketBucketAlreadySet() {
+ public function testMultiBucketBucketAlreadySet(): void {
$this->config->expects($this->once())
->method('getSystemValue')
->with('objectstore_multibucket')
@@ -187,7 +187,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertEquals('awesomeBucket1', $config['arguments']['bucket']);
}
- public function testMultiBucketConfigFirst() {
+ public function testMultiBucketConfigFirst(): void {
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->with('objectstore_multibucket')
@@ -203,7 +203,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertInstanceOf('OC\Files\Mount\MountPoint', $mount);
}
- public function testMultiBucketConfigFirstFallBackSingle() {
+ public function testMultiBucketConfigFirstFallBackSingle(): void {
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->withConsecutive(
@@ -224,7 +224,7 @@ class ObjectHomeMountProviderTest extends \Test\TestCase {
$this->assertInstanceOf('OC\Files\Mount\MountPoint', $mount);
}
- public function testNoObjectStore() {
+ public function testNoObjectStore(): void {
$this->config->expects($this->exactly(2))
->method('getSystemValue')
->willReturn('');
diff --git a/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php b/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
index b22224aa7db..9060bf0d5f5 100644
--- a/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
+++ b/tests/lib/Files/Mount/ObjectStorePreviewCacheMountProviderTest.php
@@ -43,7 +43,7 @@ class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
$this->provider = new ObjectStorePreviewCacheMountProvider($this->logger, $this->config);
}
- public function testNoMultibucketObjectStorage() {
+ public function testNoMultibucketObjectStorage(): void {
$this->config->expects($this->once())
->method('getSystemValue')
->with('objectstore_multibucket')
@@ -52,7 +52,7 @@ class ObjectStorePreviewCacheMountProviderTest extends \Test\TestCase {
$this->assertEquals([], $this->provider->getRootMounts($this->loader));
}
- public function testMultibucketObjectStorage() {
+ public function testMultibucketObjectStorage(): void {
$objectstoreConfig = [
'class' => S3::class,
'arguments' => [
diff --git a/tests/lib/Files/Mount/RootMountProviderTest.php b/tests/lib/Files/Mount/RootMountProviderTest.php
index 4a5048d2863..2613cfd4b7b 100644
--- a/tests/lib/Files/Mount/RootMountProviderTest.php
+++ b/tests/lib/Files/Mount/RootMountProviderTest.php
@@ -44,7 +44,7 @@ class RootMountProviderTest extends TestCase {
return $provider;
}
- public function testLocal() {
+ public function testLocal(): void {
$provider = $this->getProvider([
'datadirectory' => '/data',
]);
@@ -58,20 +58,20 @@ class RootMountProviderTest extends TestCase {
$this->assertEquals('/data/', $storage->getSourcePath(''));
}
- public function testObjectStore() {
+ public function testObjectStore(): void {
$provider = $this->getProvider([
'objectstore' => [
- "class" => "OC\Files\ObjectStore\S3",
- "arguments" => [
- "bucket" => "nextcloud",
- "autocreate" => true,
- "key" => "minio",
- "secret" => "minio123",
- "hostname" => "localhost",
- "port" => 9000,
- "use_ssl" => false,
- "use_path_style" => true,
- "uploadPartSize" => 52428800,
+ 'class' => "OC\Files\ObjectStore\S3",
+ 'arguments' => [
+ 'bucket' => 'nextcloud',
+ 'autocreate' => true,
+ 'key' => 'minio',
+ 'secret' => 'minio123',
+ 'hostname' => 'localhost',
+ 'port' => 9000,
+ 'use_ssl' => false,
+ 'use_path_style' => true,
+ 'uploadPartSize' => 52428800,
],
],
]);
@@ -91,20 +91,20 @@ class RootMountProviderTest extends TestCase {
$this->assertEquals('nextcloud', $objectStore->getBucket());
}
- public function testObjectStoreMultiBucket() {
+ public function testObjectStoreMultiBucket(): void {
$provider = $this->getProvider([
'objectstore_multibucket' => [
- "class" => "OC\Files\ObjectStore\S3",
- "arguments" => [
- "bucket" => "nextcloud",
- "autocreate" => true,
- "key" => "minio",
- "secret" => "minio123",
- "hostname" => "localhost",
- "port" => 9000,
- "use_ssl" => false,
- "use_path_style" => true,
- "uploadPartSize" => 52428800,
+ 'class' => "OC\Files\ObjectStore\S3",
+ 'arguments' => [
+ 'bucket' => 'nextcloud',
+ 'autocreate' => true,
+ 'key' => 'minio',
+ 'secret' => 'minio123',
+ 'hostname' => 'localhost',
+ 'port' => 9000,
+ 'use_ssl' => false,
+ 'use_path_style' => true,
+ 'uploadPartSize' => 52428800,
],
],
]);
diff --git a/tests/lib/Files/Node/FileTest.php b/tests/lib/Files/Node/FileTest.php
index 35c2443aeff..a67c9433663 100644
--- a/tests/lib/Files/Node/FileTest.php
+++ b/tests/lib/Files/Node/FileTest.php
@@ -35,7 +35,7 @@ class FileTest extends NodeTest {
return 'unlink';
}
- public function testGetContent() {
+ public function testGetContent(): void {
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
@@ -63,7 +63,7 @@ class FileTest extends NodeTest {
}
- public function testGetContentNotPermitted() {
+ public function testGetContentNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
@@ -84,7 +84,7 @@ class FileTest extends NodeTest {
$node->getContent();
}
- public function testPutContent() {
+ public function testPutContent(): void {
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
@@ -109,7 +109,7 @@ class FileTest extends NodeTest {
}
- public function testPutContentNotPermitted() {
+ public function testPutContentNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
@@ -126,7 +126,7 @@ class FileTest extends NodeTest {
$node->putContent('bar');
}
- public function testGetMimeType() {
+ public function testGetMimeType(): void {
/** @var \OC\Files\Node\Root|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
@@ -141,7 +141,7 @@ class FileTest extends NodeTest {
$this->assertEquals('text/plain', $node->getMimeType());
}
- public function testFOpenRead() {
+ public function testFOpenRead(): void {
$stream = fopen('php://memory', 'w+');
fwrite($stream, 'bar');
rewind($stream);
@@ -180,7 +180,7 @@ class FileTest extends NodeTest {
$this->assertEquals('bar', fread($fh, 3));
}
- public function testFOpenWrite() {
+ public function testFOpenWrite(): void {
$stream = fopen('php://memory', 'w+');
$root = new \OC\Files\Node\Root(
@@ -221,7 +221,7 @@ class FileTest extends NodeTest {
}
- public function testFOpenReadNotPermitted() {
+ public function testFOpenReadNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$root = new \OC\Files\Node\Root(
@@ -248,7 +248,7 @@ class FileTest extends NodeTest {
}
- public function testFOpenReadWriteNoReadPermissions() {
+ public function testFOpenReadWriteNoReadPermissions(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$root = new \OC\Files\Node\Root(
@@ -275,7 +275,7 @@ class FileTest extends NodeTest {
}
- public function testFOpenReadWriteNoWritePermissions() {
+ public function testFOpenReadWriteNoWritePermissions(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$root = new \OC\Files\Node\Root(
diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php
index 546c9f84a1a..2e3b6e369d3 100644
--- a/tests/lib/Files/Node/FolderTest.php
+++ b/tests/lib/Files/Node/FolderTest.php
@@ -29,6 +29,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\Search\ISearchOrder;
use OCP\Files\Storage;
+use PHPUnit\Framework\MockObject\MockObject;
/**
* Class FolderTest
@@ -61,7 +62,7 @@ class FolderTest extends NodeTest {
return 'rmdir';
}
- public function testGetDirectoryContent() {
+ public function testGetDirectoryContent(): void {
$manager = $this->createMock(Manager::class);
/**
* @var \OC\Files\View | \PHPUnit\Framework\MockObject\MockObject $view
@@ -96,7 +97,7 @@ class FolderTest extends NodeTest {
$this->assertEquals(3, $children[1]->getId());
}
- public function testGet() {
+ public function testGet(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -115,7 +116,7 @@ class FolderTest extends NodeTest {
self::assertEquals($node, $parentNode->get('asd'));
}
- public function testNodeExists() {
+ public function testNodeExists(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -135,7 +136,7 @@ class FolderTest extends NodeTest {
$this->assertTrue($node->nodeExists('asd'));
}
- public function testNodeExistsNotExists() {
+ public function testNodeExistsNotExists(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -153,7 +154,7 @@ class FolderTest extends NodeTest {
$this->assertFalse($node->nodeExists('asd'));
}
- public function testNewFolder() {
+ public function testNewFolder(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -177,7 +178,7 @@ class FolderTest extends NodeTest {
$this->assertEquals($child, $result);
}
- public function testNewFolderDeepParent() {
+ public function testNewFolderDeepParent(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -202,7 +203,7 @@ class FolderTest extends NodeTest {
}
- public function testNewFolderNotPermitted() {
+ public function testNewFolderNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$manager = $this->createMock(Manager::class);
@@ -221,7 +222,7 @@ class FolderTest extends NodeTest {
$node->newFolder('asd');
}
- public function testNewFile() {
+ public function testNewFile(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -246,7 +247,7 @@ class FolderTest extends NodeTest {
}
- public function testNewFileNotPermitted() {
+ public function testNewFileNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$manager = $this->createMock(Manager::class);
@@ -265,7 +266,7 @@ class FolderTest extends NodeTest {
$node->newFile('asd');
}
- public function testGetFreeSpace() {
+ public function testGetFreeSpace(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -282,7 +283,7 @@ class FolderTest extends NodeTest {
$this->assertEquals(100, $node->getFreeSpace());
}
- public function testSearch() {
+ public function testSearch(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -290,7 +291,7 @@ class FolderTest extends NodeTest {
->getMock();
$root->method('getUser')
->willReturn($this->user);
- /** @var Storage\IStorage $storage */
+ /** @var Storage\IStorage&MockObject $storage */
$storage = $this->createMock(Storage\IStorage::class);
$storage->method('getId')->willReturn('test::1');
$cache = new Cache($storage);
@@ -298,10 +299,17 @@ class FolderTest extends NodeTest {
$storage->method('getCache')
->willReturn($cache);
+ $storage->expects($this->atLeastOnce())
+ ->method('getOwner')
+ ->with('qwerty')
+ ->willReturn(false);
+
$mount = $this->createMock(IMountPoint::class);
- $mount->method('getStorage')
+ $mount->expects($this->atLeastOnce())
+ ->method('getStorage')
->willReturn($storage);
- $mount->method('getInternalPath')
+ $mount->expects($this->atLeastOnce())
+ ->method('getInternalPath')
->willReturn('foo');
$cache->insert('foo', ['size' => 200, 'mtime' => 55, 'mimetype' => ICacheEntry::DIRECTORY_MIMETYPE]);
@@ -322,7 +330,7 @@ class FolderTest extends NodeTest {
$this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
}
- public function testSearchInRoot() {
+ public function testSearchInRoot(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -363,7 +371,7 @@ class FolderTest extends NodeTest {
$this->assertEquals('/foo', $result[0]->getPath());
}
- public function testSearchInStorageRoot() {
+ public function testSearchInStorageRoot(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -403,7 +411,7 @@ class FolderTest extends NodeTest {
$this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
}
- public function testSearchSubStorages() {
+ public function testSearchSubStorages(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -461,7 +469,7 @@ class FolderTest extends NodeTest {
$this->assertEquals(2, count($result));
}
- public function testIsSubNode() {
+ public function testIsSubNode(): void {
$rootFolderMock = $this->createMock(IRootFolder::class);
$file = new Node($rootFolderMock, $this->view, '/foo/bar');
$folder = new Folder($rootFolderMock, $this->view, '/foo');
@@ -472,7 +480,7 @@ class FolderTest extends NodeTest {
$this->assertFalse($folder->isSubNode($file));
}
- public function testGetById() {
+ public function testGetById(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -519,7 +527,7 @@ class FolderTest extends NodeTest {
$this->assertEquals('/bar/foo/qwerty', $result[0]->getPath());
}
- public function testGetByIdMountRoot() {
+ public function testGetByIdMountRoot(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -562,7 +570,7 @@ class FolderTest extends NodeTest {
$this->assertEquals('/bar', $result[0]->getPath());
}
- public function testGetByIdOutsideFolder() {
+ public function testGetByIdOutsideFolder(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -604,7 +612,7 @@ class FolderTest extends NodeTest {
$this->assertEquals(0, count($result));
}
- public function testGetByIdMultipleStorages() {
+ public function testGetByIdMultipleStorages(): void {
$manager = $this->createMock(Manager::class);
$view = $this->getRootViewMock();
$root = $this->getMockBuilder(Root::class)
@@ -665,7 +673,7 @@ class FolderTest extends NodeTest {
/**
* @dataProvider uniqueNameProvider
*/
- public function testGetUniqueName($name, $existingFiles, $expected) {
+ public function testGetUniqueName($name, $existingFiles, $expected): void {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
$view = $this->getRootViewMock();
@@ -754,7 +762,7 @@ class FolderTest extends NodeTest {
$this->assertEquals([$id1, $id2, $id3], $ids);
}
- public function testRecentFolder() {
+ public function testRecentFolder(): void {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
$view = $this->getRootViewMock();
@@ -818,7 +826,7 @@ class FolderTest extends NodeTest {
$this->assertEquals($baseTime - 100, $nodes[1]->getMTime());
}
- public function testRecentJail() {
+ public function testRecentJail(): void {
$manager = $this->createMock(Manager::class);
$folderPath = '/bar/foo';
$view = $this->getRootViewMock();
@@ -901,7 +909,7 @@ class FolderTest extends NodeTest {
* @throws NotFoundException
* @throws \OCP\Files\InvalidPathException
*/
- public function testSearchSubStoragesLimitOffset(int $offset, int $limit, array $expectedPaths, array $ordering) {
+ public function testSearchSubStoragesLimitOffset(int $offset, int $limit, array $expectedPaths, array $ordering): void {
if (!$ordering) {
$ordering = [new SearchOrder(ISearchOrder::DIRECTION_ASCENDING, 'fileid')];
}
diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php
index 7cc2da516bb..1a3337b9ddc 100644
--- a/tests/lib/Files/Node/HookConnectorTest.php
+++ b/tests/lib/Files/Node/HookConnectorTest.php
@@ -49,7 +49,7 @@ class HookConnectorTest extends TestCase {
use UserTrait;
use MountProviderTrait;
- /** @var IEventDispatcher */
+ /** @var IEventDispatcher */
protected $eventDispatcher;
private LoggerInterface $logger;
@@ -152,7 +152,7 @@ class HookConnectorTest extends TestCase {
* @param string $expectedHook
* @dataProvider viewToNodeProvider
*/
- public function testViewToNode(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent) {
+ public function testViewToNode(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent): void {
$connector = new HookConnector($this->root, $this->view, $this->eventDispatcher, $this->logger);
$connector->viewToNode();
$hookCalled = false;
@@ -221,7 +221,7 @@ class HookConnectorTest extends TestCase {
* @param string $expectedHook
* @dataProvider viewToNodeProviderCopyRename
*/
- public function testViewToNodeCopyRename(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent) {
+ public function testViewToNodeCopyRename(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent): void {
$connector = new HookConnector($this->root, $this->view, $this->eventDispatcher, $this->logger);
$connector->viewToNode();
$hookCalled = false;
@@ -276,7 +276,7 @@ class HookConnectorTest extends TestCase {
$this->assertEquals('/' . $this->userId . '/files/target', $newDispatcherTargetNode->getPath());
}
- public function testPostDeleteMeta() {
+ public function testPostDeleteMeta(): void {
$connector = new HookConnector($this->root, $this->view, $this->eventDispatcher, $this->logger);
$connector->viewToNode();
$hookCalled = false;
diff --git a/tests/lib/Files/Node/IntegrationTest.php b/tests/lib/Files/Node/IntegrationTest.php
index 7d87cdb5dd0..c90a6115f2a 100644
--- a/tests/lib/Files/Node/IntegrationTest.php
+++ b/tests/lib/Files/Node/IntegrationTest.php
@@ -12,6 +12,7 @@ use OC\Files\Storage\Temporary;
use OC\Files\View;
use OC\Memcache\ArrayCache;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Config\IUserMountCache;
use OCP\Files\Mount\IMountManager;
use OCP\ICacheFactory;
use OCP\IUserManager;
@@ -46,8 +47,7 @@ class IntegrationTest extends \Test\TestCase {
protected function setUp(): void {
parent::setUp();
- /** @var IMountManager $manager */
- $manager = \OC::$server->get(IMountManager::class);
+ $manager = \OCP\Server::get(IMountManager::class);
\OC_Hook::clear('OC_Filesystem');
@@ -64,7 +64,7 @@ class IntegrationTest extends \Test\TestCase {
$manager,
$this->view,
$user,
- \OC::$server->getUserMountCache(),
+ \OCP\Server::get(IUserMountCache::class),
$this->createMock(LoggerInterface::class),
$this->createMock(IUserManager::class),
$this->createMock(IEventDispatcher::class),
@@ -88,7 +88,7 @@ class IntegrationTest extends \Test\TestCase {
parent::tearDown();
}
- public function testBasicFile() {
+ public function testBasicFile(): void {
$file = $this->root->newFile('/foo.txt');
$this->assertCount(2, $this->root->getDirectoryListing());
$this->assertTrue($this->root->nodeExists('/foo.txt'));
@@ -111,7 +111,7 @@ class IntegrationTest extends \Test\TestCase {
$this->assertEquals('qwerty', $file->getContent());
}
- public function testBasicFolder() {
+ public function testBasicFolder(): void {
$folder = $this->root->newFolder('/foo');
$this->assertTrue($this->root->nodeExists('/foo'));
$file = $folder->newFile('/bar');
diff --git a/tests/lib/Files/Node/NodeTest.php b/tests/lib/Files/Node/NodeTest.php
index b00d9e1b4de..d12448a2481 100644
--- a/tests/lib/Files/Node/NodeTest.php
+++ b/tests/lib/Files/Node/NodeTest.php
@@ -127,7 +127,7 @@ abstract class NodeTest extends \Test\TestCase {
return new FileInfo('', $this->getMockStorage(), $internalPath, $data, $mount);
}
- public function testDelete() {
+ public function testDelete(): void {
$this->root->expects($this->exactly(2))
->method('emit')
->willReturn(true);
@@ -149,7 +149,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->delete();
}
- public function testDeleteHooks() {
+ public function testDeleteHooks(): void {
$test = $this;
$hooksRun = 0;
/**
@@ -205,7 +205,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testDeleteNotPermitted() {
+ public function testDeleteNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->root->expects($this->any())
@@ -222,7 +222,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testStat() {
+ public function testStat(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -244,7 +244,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals($stat, $node->stat());
}
- public function testGetId() {
+ public function testGetId(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -265,7 +265,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(1, $node->getId());
}
- public function testGetSize() {
+ public function testGetSize(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -287,7 +287,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(100, $node->getSize());
}
- public function testGetEtag() {
+ public function testGetEtag(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -308,7 +308,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals('qwerty', $node->getEtag());
}
- public function testGetMTime() {
+ public function testGetMTime(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -329,7 +329,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(50, $node->getMTime());
}
- public function testGetStorage() {
+ public function testGetStorage(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -344,7 +344,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals($storage, $node->getStorage());
}
- public function testGetPath() {
+ public function testGetPath(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -353,7 +353,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals('/bar/foo', $node->getPath());
}
- public function testGetInternalPath() {
+ public function testGetInternalPath(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -374,7 +374,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals('foo', $node->getInternalPath());
}
- public function testGetName() {
+ public function testGetName(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -383,7 +383,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals('foo', $node->getName());
}
- public function testTouchSetMTime() {
+ public function testTouchSetMTime(): void {
$this->root->expects($this->any())
->method('getUser')
->willReturn($this->user);
@@ -403,7 +403,7 @@ abstract class NodeTest extends \Test\TestCase {
$this->assertEquals(100, $node->getMTime());
}
- public function testTouchHooks() {
+ public function testTouchHooks(): void {
$test = $this;
$hooksRun = 0;
/**
@@ -453,7 +453,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testTouchNotPermitted() {
+ public function testTouchNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->root->expects($this->any())
@@ -470,14 +470,14 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testInvalidPath() {
+ public function testInvalidPath(): void {
$this->expectException(\OCP\Files\InvalidPathException::class);
$node = $this->createTestNode($this->root, $this->view, '/../foo');
$node->getFileInfo();
}
- public function testCopySameStorage() {
+ public function testCopySameStorage(): void {
$this->view->expects($this->any())
->method('copy')
->with('/bar/foo', '/bar/asd')
@@ -503,7 +503,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testCopyNotPermitted() {
+ public function testCopyNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
/**
@@ -534,7 +534,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testCopyNoParent() {
+ public function testCopyNoParent(): void {
$this->expectException(\OCP\Files\NotFoundException::class);
$this->view->expects($this->never())
@@ -551,7 +551,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testCopyParentIsFile() {
+ public function testCopyParentIsFile(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->view->expects($this->never())
@@ -569,7 +569,7 @@ abstract class NodeTest extends \Test\TestCase {
$node->copy('/bar/asd');
}
- public function testMoveSameStorage() {
+ public function testMoveSameStorage(): void {
$this->view->expects($this->any())
->method('rename')
->with('/bar/foo', '/bar/asd')
@@ -606,7 +606,7 @@ abstract class NodeTest extends \Test\TestCase {
* @param string $preHookName
* @param string $postHookName
*/
- public function testMoveCopyHooks($operationMethod, $viewMethod, $preHookName, $postHookName) {
+ public function testMoveCopyHooks($operationMethod, $viewMethod, $preHookName, $postHookName): void {
/** @var IRootFolder|\PHPUnit\Framework\MockObject\MockObject $root */
$root = $this->getMockBuilder('\OC\Files\Node\Root')
->setConstructorArgs([$this->manager, $this->view, $this->user, $this->userMountCache, $this->logger, $this->userManager, $this->eventDispatcher, $this->cacheFactory])
@@ -674,7 +674,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testMoveNotPermitted() {
+ public function testMoveNotPermitted(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->view->expects($this->any())
@@ -696,7 +696,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testMoveNoParent() {
+ public function testMoveNoParent(): void {
$this->expectException(\OCP\Files\NotFoundException::class);
/**
@@ -718,7 +718,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testMoveParentIsFile() {
+ public function testMoveParentIsFile(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->view->expects($this->never())
@@ -736,7 +736,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testMoveFailed() {
+ public function testMoveFailed(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->view->expects($this->any())
@@ -759,7 +759,7 @@ abstract class NodeTest extends \Test\TestCase {
}
- public function testCopyFailed() {
+ public function testCopyFailed(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$this->view->expects($this->any())
diff --git a/tests/lib/Files/Node/RootTest.php b/tests/lib/Files/Node/RootTest.php
index 9b3139cf78b..f2ef1a0e3ee 100644
--- a/tests/lib/Files/Node/RootTest.php
+++ b/tests/lib/Files/Node/RootTest.php
@@ -75,7 +75,7 @@ class RootTest extends \Test\TestCase {
return new FileInfo('', null, '', $data, null);
}
- public function testGet() {
+ public function testGet(): void {
/**
* @var \OC\Files\Storage\Storage $storage
*/
@@ -106,7 +106,7 @@ class RootTest extends \Test\TestCase {
}
- public function testGetNotFound() {
+ public function testGetNotFound(): void {
$this->expectException(\OCP\Files\NotFoundException::class);
/**
@@ -137,7 +137,7 @@ class RootTest extends \Test\TestCase {
}
- public function testGetInvalidPath() {
+ public function testGetInvalidPath(): void {
$this->expectException(\OCP\Files\NotPermittedException::class);
$view = $this->getRootViewMock();
@@ -156,7 +156,7 @@ class RootTest extends \Test\TestCase {
}
- public function testGetNoStorages() {
+ public function testGetNoStorages(): void {
$this->expectException(\OCP\Files\NotFoundException::class);
$view = $this->getRootViewMock();
@@ -174,7 +174,7 @@ class RootTest extends \Test\TestCase {
$root->get('/bar/foo');
}
- public function testGetUserFolder() {
+ public function testGetUserFolder(): void {
$root = new \OC\Files\Node\Root(
$this->manager,
$this->getRootViewMock(),
@@ -213,7 +213,7 @@ class RootTest extends \Test\TestCase {
}
- public function testGetUserFolderWithNoUserObj() {
+ public function testGetUserFolderWithNoUserObj(): void {
$this->expectException(\OC\User\NoUserException::class);
$this->expectExceptionMessage('Backends provided no user object');
diff --git a/tests/lib/Files/ObjectStore/AzureTest.php b/tests/lib/Files/ObjectStore/AzureTest.php
index 5d4234532a6..c82ed988434 100644
--- a/tests/lib/Files/ObjectStore/AzureTest.php
+++ b/tests/lib/Files/ObjectStore/AzureTest.php
@@ -21,7 +21,7 @@ class AzureTest extends ObjectStoreTest {
return new Azure($config['arguments']);
}
- public function testFseekSize() {
+ public function testFseekSize(): void {
$this->markTestSkipped('azure does not support seeking at the moment');
}
}
diff --git a/tests/lib/Files/ObjectStore/MapperTest.php b/tests/lib/Files/ObjectStore/MapperTest.php
index 19269f13355..15a2d497fc3 100644
--- a/tests/lib/Files/ObjectStore/MapperTest.php
+++ b/tests/lib/Files/ObjectStore/MapperTest.php
@@ -47,7 +47,7 @@ class MapperTest extends \Test\TestCase {
* @param int $numBuckets
* @param string $expectedBucket
*/
- public function testGetBucket($username, $numBuckets, $bucketShift, $expectedBucket) {
+ public function testGetBucket($username, $numBuckets, $bucketShift, $expectedBucket): void {
$this->user->expects($this->once())
->method('getUID')
->willReturn($username);
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php b/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php
index 425dc8c2581..4f6254cdb94 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreScannerTest.php
@@ -31,7 +31,7 @@ class ObjectStoreScannerTest extends TestCase {
$this->realScanner = new Scanner($this->storage);
}
- public function testFile() {
+ public function testFile(): void {
$data = "dummy file data\n";
$this->storage->file_put_contents('foo.txt', $data);
@@ -51,7 +51,7 @@ class ObjectStoreScannerTest extends TestCase {
$this->storage->file_put_contents('folder/bar.txt', $textData);
}
- public function testFolder() {
+ public function testFolder(): void {
$this->fillTestFolders();
$this->assertEquals(
@@ -61,7 +61,7 @@ class ObjectStoreScannerTest extends TestCase {
);
}
- public function testBackgroundScan() {
+ public function testBackgroundScan(): void {
$this->fillTestFolders();
$this->storage->mkdir('folder2');
$this->storage->file_put_contents('folder2/bar.txt', 'foobar');
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
index 8ffd27f0069..09402d5706a 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreStorageTest.php
@@ -43,7 +43,7 @@ class ObjectStoreStorageTest extends Storage {
parent::tearDown();
}
- public function testStat() {
+ public function testStat(): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$ctimeStart = time();
$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
@@ -67,14 +67,14 @@ class ObjectStoreStorageTest extends Storage {
}
}
- public function testCheckUpdate() {
+ public function testCheckUpdate(): void {
$this->markTestSkipped('Detecting external changes is not supported on object storages');
}
/**
* @dataProvider copyAndMoveProvider
*/
- public function testMove($source, $target) {
+ public function testMove($source, $target): void {
$this->initSourceAndTarget($source);
$sourceId = $this->instance->getCache()->getId(ltrim('/', $source));
$this->assertNotEquals(-1, $sourceId);
@@ -89,7 +89,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break');
}
- public function testRenameDirectory() {
+ public function testRenameDirectory(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
$this->instance->file_put_contents('source/test2.txt', 'qwerty');
@@ -118,7 +118,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break');
}
- public function testRenameOverWriteDirectory() {
+ public function testRenameOverWriteDirectory(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
$sourceId = $this->instance->getCache()->getId('source');
@@ -138,7 +138,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break');
}
- public function testRenameOverWriteDirectoryOverFile() {
+ public function testRenameOverWriteDirectoryOverFile(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
$sourceId = $this->instance->getCache()->getId('source');
@@ -155,7 +155,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertSame($sourceId, $targetId, 'fileid must be stable on move or shares will break');
}
- public function testWriteObjectSilentFailure() {
+ public function testWriteObjectSilentFailure(): void {
$objectStore = $this->instance->getObjectStore();
$this->instance->setObjectStore(new FailWriteObjectStore($objectStore));
@@ -168,7 +168,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertFalse($this->instance->file_exists('test.txt'));
}
- public function testWriteObjectSilentFailureNoCheck() {
+ public function testWriteObjectSilentFailureNoCheck(): void {
$objectStore = $this->instance->getObjectStore();
$this->instance->setObjectStore(new FailWriteObjectStore($objectStore));
$this->instance->setValidateWrites(false);
@@ -177,7 +177,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertTrue($this->instance->file_exists('test.txt'));
}
- public function testDeleteObjectFailureKeepCache() {
+ public function testDeleteObjectFailureKeepCache(): void {
$objectStore = $this->instance->getObjectStore();
$this->instance->setObjectStore(new FailDeleteObjectStore($objectStore));
$cache = $this->instance->getCache();
@@ -202,7 +202,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertTrue($cache->inCache('foo/test.txt'));
}
- public function testCopyBetweenJails() {
+ public function testCopyBetweenJails(): void {
$this->instance->mkdir('a');
$this->instance->mkdir('b');
$jailA = new Jail([
@@ -225,7 +225,7 @@ class ObjectStoreStorageTest extends Storage {
$this->assertEquals('3', $this->instance->file_get_contents('b/target/sub/3.txt'));
}
- public function testCopyPreservesPermissions() {
+ public function testCopyPreservesPermissions(): void {
$cache = $this->instance->getCache();
$this->instance->file_put_contents('test.txt', 'foo');
@@ -244,7 +244,7 @@ class ObjectStoreStorageTest extends Storage {
* Test that copying files will drop permissions like local storage does
* TODO: Drop this and fix local storage
*/
- public function testCopyGrantsPermissions() {
+ public function testCopyGrantsPermissions(): void {
$config['objectstore'] = $this->objectStorage;
$config['handleCopiesAsOwned'] = true;
$instance = new ObjectStoreStorageOverwrite($config);
diff --git a/tests/lib/Files/ObjectStore/ObjectStoreTest.php b/tests/lib/Files/ObjectStore/ObjectStoreTest.php
index 74f047a8663..4a4f85dfb91 100644
--- a/tests/lib/Files/ObjectStore/ObjectStoreTest.php
+++ b/tests/lib/Files/ObjectStore/ObjectStoreTest.php
@@ -38,7 +38,7 @@ abstract class ObjectStoreTest extends TestCase {
return $stream;
}
- public function testWriteRead() {
+ public function testWriteRead(): void {
$stream = $this->stringToStream('foobar');
$instance = $this->getInstance();
@@ -51,7 +51,7 @@ abstract class ObjectStoreTest extends TestCase {
$this->assertEquals('foobar', stream_get_contents($result));
}
- public function testDelete() {
+ public function testDelete(): void {
$stream = $this->stringToStream('foobar');
$instance = $this->getInstance();
@@ -70,7 +70,7 @@ abstract class ObjectStoreTest extends TestCase {
}
}
- public function testReadNonExisting() {
+ public function testReadNonExisting(): void {
$instance = $this->getInstance();
try {
@@ -82,7 +82,7 @@ abstract class ObjectStoreTest extends TestCase {
}
}
- public function testDeleteNonExisting() {
+ public function testDeleteNonExisting(): void {
$instance = $this->getInstance();
try {
@@ -94,7 +94,7 @@ abstract class ObjectStoreTest extends TestCase {
}
}
- public function testExists() {
+ public function testExists(): void {
$stream = $this->stringToStream('foobar');
$instance = $this->getInstance();
@@ -109,7 +109,7 @@ abstract class ObjectStoreTest extends TestCase {
$this->assertFalse($instance->objectExists('2'));
}
- public function testCopy() {
+ public function testCopy(): void {
$this->cleanupAfter('source');
$this->cleanupAfter('target');
@@ -128,7 +128,7 @@ abstract class ObjectStoreTest extends TestCase {
$this->assertEquals('foobar', stream_get_contents($instance->readObject('target')));
}
- public function testFseekSize() {
+ public function testFseekSize(): void {
$instance = $this->getInstance();
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php
index cc3e91a4586..1501f575f9a 100644
--- a/tests/lib/Files/ObjectStore/S3Test.php
+++ b/tests/lib/Files/ObjectStore/S3Test.php
@@ -60,7 +60,7 @@ class S3Test extends ObjectStoreTest {
return new S3($config['arguments']);
}
- public function testUploadNonSeekable() {
+ public function testUploadNonSeekable(): void {
$this->cleanupAfter('multiparttest');
$s3 = $this->getInstance();
@@ -72,7 +72,7 @@ class S3Test extends ObjectStoreTest {
$this->assertEquals(file_get_contents(__FILE__), stream_get_contents($result));
}
- public function testSeek() {
+ public function testSeek(): void {
$this->cleanupAfter('seek');
$data = file_get_contents(__FILE__);
@@ -101,10 +101,10 @@ class S3Test extends ObjectStoreTest {
$this->assertArrayNotHasKey('Uploads', $uploads, 'Assert is not uploaded');
}
- public function testEmptyUpload() {
+ public function testEmptyUpload(): void {
$s3 = $this->getInstance();
- $emptyStream = fopen("php://memory", "r");
+ $emptyStream = fopen('php://memory', 'r');
fwrite($emptyStream, '');
$s3->writeObject('emptystream', $emptyStream);
@@ -133,7 +133,11 @@ class S3Test extends ObjectStoreTest {
}
/** @dataProvider dataFileSizes */
- public function testFileSizes($size) {
+ public function testFileSizes($size): void {
+ if (str_starts_with(PHP_VERSION, '8.3') && getenv('CI')) {
+ $this->markTestSkipped('Test is unreliable and skipped on 8.3');
+ }
+
$this->cleanupAfter('testfilesizes');
$s3 = $this->getInstance();
diff --git a/tests/lib/Files/ObjectStore/SwiftTest.php b/tests/lib/Files/ObjectStore/SwiftTest.php
index 8c9a0d524ed..8a34d25e57b 100644
--- a/tests/lib/Files/ObjectStore/SwiftTest.php
+++ b/tests/lib/Files/ObjectStore/SwiftTest.php
@@ -25,7 +25,7 @@ class SwiftTest extends ObjectStoreTest {
return new Swift($config['arguments']);
}
- public function testFseekSize() {
+ public function testFseekSize(): void {
$this->markTestSkipped('Swift does not support seeking at the moment');
}
}
diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php
index 4addd583354..fcbe0a6957f 100644
--- a/tests/lib/Files/PathVerificationTest.php
+++ b/tests/lib/Files/PathVerificationTest.php
@@ -30,9 +30,9 @@ class PathVerificationTest extends \Test\TestCase {
}
- public function testPathVerificationFileNameTooLong() {
+ public function testPathVerificationFileNameTooLong(): void {
$this->expectException(\OCP\Files\InvalidPathException::class);
- $this->expectExceptionMessage('File name is too long');
+ $this->expectExceptionMessage('Filename is too long');
$fileName = str_repeat('a', 500);
$this->view->verifyPath('', $fileName);
@@ -42,7 +42,7 @@ class PathVerificationTest extends \Test\TestCase {
/**
* @dataProvider providesEmptyFiles
*/
- public function testPathVerificationEmptyFileName($fileName) {
+ public function testPathVerificationEmptyFileName($fileName): void {
$this->expectException(\OCP\Files\InvalidPathException::class);
$this->expectExceptionMessage('Empty filename is not allowed');
@@ -59,7 +59,7 @@ class PathVerificationTest extends \Test\TestCase {
/**
* @dataProvider providesDotFiles
*/
- public function testPathVerificationDotFiles($fileName) {
+ public function testPathVerificationDotFiles($fileName): void {
$this->expectException(\OCP\Files\InvalidPathException::class);
$this->expectExceptionMessage('Dot files are not allowed');
@@ -82,7 +82,7 @@ class PathVerificationTest extends \Test\TestCase {
/**
* @dataProvider providesAstralPlane
*/
- public function testPathVerificationAstralPlane($fileName) {
+ public function testPathVerificationAstralPlane($fileName): void {
$connection = \OC::$server->getDatabaseConnection();
if (!$connection->supports4ByteText()) {
@@ -107,60 +107,9 @@ class PathVerificationTest extends \Test\TestCase {
}
/**
- * @dataProvider providesInvalidCharsPosix
- */
- public function testPathVerificationInvalidCharsPosix($fileName) {
- $this->expectException(\OCP\Files\InvalidCharacterInPathException::class);
-
- $storage = new Local(['datadir' => '']);
-
- $fileName = " 123{$fileName}456 ";
- self::invokePrivate($storage, 'verifyPosixPath', [$fileName]);
- }
-
- public function providesInvalidCharsPosix() {
- return [
- [\chr(0)],
- [\chr(1)],
- [\chr(2)],
- [\chr(3)],
- [\chr(4)],
- [\chr(5)],
- [\chr(6)],
- [\chr(7)],
- [\chr(8)],
- [\chr(9)],
- [\chr(10)],
- [\chr(11)],
- [\chr(12)],
- [\chr(13)],
- [\chr(14)],
- [\chr(15)],
- [\chr(16)],
- [\chr(17)],
- [\chr(18)],
- [\chr(19)],
- [\chr(20)],
- [\chr(21)],
- [\chr(22)],
- [\chr(23)],
- [\chr(24)],
- [\chr(25)],
- [\chr(26)],
- [\chr(27)],
- [\chr(28)],
- [\chr(29)],
- [\chr(30)],
- [\chr(31)],
- ['/'],
- ['\\'],
- ];
- }
-
- /**
* @dataProvider providesValidPosixPaths
*/
- public function testPathVerificationValidPaths($fileName) {
+ public function testPathVerificationValidPaths($fileName): void {
$storage = new Local(['datadir' => '']);
self::invokePrivate($storage, 'verifyPosixPath', [$fileName]);
diff --git a/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php b/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php
index 5c7c01da926..e6cb11a7eba 100644
--- a/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php
+++ b/tests/lib/Files/Search/QueryOptimizer/CombinedTests.php
@@ -21,21 +21,21 @@ class CombinedTests extends TestCase {
$this->optimizer = new QueryOptimizer();
}
- public function testBasicOrOfAnds() {
+ public function testBasicOrOfAnds(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
])
]
);
@@ -46,35 +46,35 @@ class CombinedTests extends TestCase {
$this->assertEquals('(storage eq 1 and path in ["foo","bar","asd"])', $operator->__toString());
}
- public function testComplexSearchPattern1() {
+ public function testComplexSearchPattern1(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "201"),
- new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "201/%"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '201'),
+ new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', '201/%'),
]),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "301"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '301'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "401"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '401'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "302"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '302'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "402"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '402'),
]),
]
);
@@ -85,33 +85,33 @@ class CombinedTests extends TestCase {
$this->assertEquals('(storage eq 1 or (storage eq 2 and (path eq "201" or path like "201\/%")) or (storage eq 3 and path in ["301","302"]) or (storage eq 4 and path in ["401","402"]))', $operator->__toString());
}
- public function testComplexSearchPattern2() {
+ public function testComplexSearchPattern2(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "201"),
- new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "201/%"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '201'),
+ new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', '201/%'),
]),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "301"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '301'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "401"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '401'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "302"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '302'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 4),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "402"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 4),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', '402'),
]),
]
);
@@ -122,30 +122,30 @@ class CombinedTests extends TestCase {
$this->assertEquals('(storage eq 1 or (storage eq 2 and (path eq "201" or path like "201\/%")) or (storage eq 3 and path in ["301","302"]) or (storage eq 4 and path in ["401","402"]))', $operator->__toString());
}
- public function testApplySearchConstraints1() {
+ public function testApplySearchConstraints1(): void {
$operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/png"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/jpeg"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/png'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpeg'),
]),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files"),
- new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "files/%"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files'),
+ new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'files/%'),
]),
]),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/301"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/301'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/302"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/302'),
]),
]),
]);
@@ -156,32 +156,32 @@ class CombinedTests extends TestCase {
$this->assertEquals('(mimetype in ["image\/png","image\/jpeg"] and ((storage eq 1 and (path eq "files" or path like "files\/%")) or storage eq 2 or (storage eq 3 and path in ["files\/301","files\/302"])))', $operator->__toString());
}
- public function testApplySearchConstraints2() {
+ public function testApplySearchConstraints2(): void {
$operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/png"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "image/jpeg"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/png'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'image/jpeg'),
]),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files"),
- new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "files/%"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files'),
+ new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'files/%'),
]),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/301"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/301'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "files/302"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'files/302'),
]),
]),
]);
diff --git a/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php b/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php
index 538ffc65f02..6777047d68b 100644
--- a/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php
+++ b/tests/lib/Files/Search/QueryOptimizer/FlattenNestedBoolTest.php
@@ -24,14 +24,14 @@ class FlattenNestedBoolTest extends TestCase {
$this->simplifier = new FlattenSingleArgumentBinaryOperation();
}
- public function testOrs() {
+ public function testOrs(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
])
]
);
diff --git a/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php b/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php
index abc9eca9a54..4f933d0c371 100644
--- a/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php
+++ b/tests/lib/Files/Search/QueryOptimizer/MergeDistributiveOperationsTest.php
@@ -24,21 +24,21 @@ class MergeDistributiveOperationsTest extends TestCase {
$this->simplifier = new FlattenSingleArgumentBinaryOperation();
}
- public function testBasicOrOfAnds() {
+ public function testBasicOrOfAnds(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
])
]
);
@@ -50,21 +50,21 @@ class MergeDistributiveOperationsTest extends TestCase {
$this->assertEquals('(storage eq 1 and (path eq "foo" or path eq "bar" or path eq "asd"))', $operator->__toString());
}
- public function testDontTouchIfNotSame() {
+ public function testDontTouchIfNotSame(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 3),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 3),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
])
]
);
@@ -76,21 +76,21 @@ class MergeDistributiveOperationsTest extends TestCase {
$this->assertEquals('((storage eq 1 and path eq "foo") or (storage eq 2 and path eq "bar") or (storage eq 3 and path eq "asd"))', $operator->__toString());
}
- public function testMergePartial() {
+ public function testMergePartial(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 2),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
])
]
);
@@ -102,7 +102,7 @@ class MergeDistributiveOperationsTest extends TestCase {
$this->assertEquals('((storage eq 1 and (path eq "foo" or path eq "bar")) or (storage eq 2 and path eq "asd"))', $operator->__toString());
}
- public function testOptimizeInside() {
+ public function testOptimizeInside(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_AND,
[
@@ -110,20 +110,20 @@ class MergeDistributiveOperationsTest extends TestCase {
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
])
]
),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "text")
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'text')
]
);
$this->assertEquals('(((storage eq 1 and path eq "foo") or (storage eq 1 and path eq "bar") or (storage eq 1 and path eq "asd")) and mimetype eq "text")', $operator->__toString());
@@ -134,22 +134,22 @@ class MergeDistributiveOperationsTest extends TestCase {
$this->assertEquals('((storage eq 1 and (path eq "foo" or path eq "bar" or path eq "asd")) and mimetype eq "text")', $operator->__toString());
}
- public function testMoveInnerOperations() {
+ public function testMoveInnerOperations(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]),
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "storage", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
- new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, "size", "100"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'storage', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
+ new SearchComparison(ISearchComparison::COMPARE_GREATER_THAN, 'size', '100'),
])
]
);
diff --git a/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php b/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php
index 5ea27eb88b9..8b1c3b992b2 100644
--- a/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php
+++ b/tests/lib/Files/Search/QueryOptimizer/OrEqualsToInTest.php
@@ -24,13 +24,13 @@ class OrEqualsToInTest extends TestCase {
$this->simplifier = new FlattenSingleArgumentBinaryOperation();
}
- public function testOrs() {
+ public function testOrs(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
]
);
$this->assertEquals('(path eq "foo" or path eq "bar" or path eq "asd")', $operator->__toString());
@@ -41,15 +41,15 @@ class OrEqualsToInTest extends TestCase {
$this->assertEquals('path in ["foo","bar","asd"]', $operator->__toString());
}
- public function testOrsMultipleFields() {
+ public function testOrsMultipleFields(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "fileid", 1),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "fileid", 2),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'fileid', 1),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'fileid', 2),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'asd'),
]
);
$this->assertEquals('(path eq "foo" or path eq "bar" or fileid eq 1 or fileid eq 2 or mimetype eq "asd")', $operator->__toString());
@@ -60,13 +60,13 @@ class OrEqualsToInTest extends TestCase {
$this->assertEquals('(path in ["foo","bar"] or fileid in [1,2] or mimetype eq "asd")', $operator->__toString());
}
- public function testPreserveHints() {
+ public function testPreserveHints(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
]
);
foreach ($operator->getArguments() as $argument) {
@@ -81,13 +81,13 @@ class OrEqualsToInTest extends TestCase {
$this->assertEquals(false, $operator->getQueryHint(ISearchComparison::HINT_PATH_EQ_HASH, true));
}
- public function testOrSomeEq() {
+ public function testOrSomeEq(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
- new SearchComparison(ISearchComparison::COMPARE_LIKE, "path", "foo%"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
+ new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', 'foo%'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
]
);
$this->assertEquals('(path eq "foo" or path like "foo%" or path eq "bar")', $operator->__toString());
@@ -98,17 +98,17 @@ class OrEqualsToInTest extends TestCase {
$this->assertEquals('(path in ["foo","bar"] or path like "foo%")', $operator->__toString());
}
- public function testOrsInside() {
+ public function testOrsInside(): void {
$operator = new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_AND,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "mimetype", "text"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', 'text'),
new SearchBinaryOperator(
ISearchBinaryOperator::OPERATOR_OR,
[
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "foo"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "bar"),
- new SearchComparison(ISearchComparison::COMPARE_EQUAL, "path", "asd"),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'foo'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'bar'),
+ new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'path', 'asd'),
]
)
]
diff --git a/tests/lib/Files/Search/SearchIntegrationTest.php b/tests/lib/Files/Search/SearchIntegrationTest.php
index b24f927219e..0ca67285fd5 100644
--- a/tests/lib/Files/Search/SearchIntegrationTest.php
+++ b/tests/lib/Files/Search/SearchIntegrationTest.php
@@ -29,12 +29,12 @@ class SearchIntegrationTest extends TestCase {
}
- public function testThousandAndOneFilters() {
- $id = $this->cache->put("file10", ['size' => 1, 'mtime' => 50, 'mimetype' => 'foo/folder']);
+ public function testThousandAndOneFilters(): void {
+ $id = $this->cache->put('file10', ['size' => 1, 'mtime' => 50, 'mimetype' => 'foo/folder']);
$comparisons = [];
- for($i = 1; $i <= 1001; $i++) {
- $comparisons[] = new SearchComparison(ISearchComparison::COMPARE_EQUAL, "name", "file$i");
+ for ($i = 1; $i <= 1001; $i++) {
+ $comparisons[] = new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'name', "file$i");
}
$operator = new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_OR, $comparisons);
$query = new SearchQuery($operator, 10, 0, []);
diff --git a/tests/lib/Files/SimpleFS/InMemoryFileTest.php b/tests/lib/Files/SimpleFS/InMemoryFileTest.php
index dfd6c44ac7e..43587acdce9 100644
--- a/tests/lib/Files/SimpleFS/InMemoryFileTest.php
+++ b/tests/lib/Files/SimpleFS/InMemoryFileTest.php
@@ -44,7 +44,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testPutContent() {
+ public function testPutContent(): void {
$this->testPdf->putContent('test');
self::assertEquals('test', $this->testPdf->getContent());
}
@@ -54,7 +54,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testDelete() {
+ public function testDelete(): void {
$this->testPdf->delete();
// assert true, otherwise phpunit complains about not doing any assert
self::assertTrue(true);
@@ -65,7 +65,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testGetName() {
+ public function testGetName(): void {
self::assertEquals('test.pdf', $this->testPdf->getName());
}
@@ -74,7 +74,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testGetSize() {
+ public function testGetSize(): void {
self::assertEquals(7083, $this->testPdf->getSize());
}
@@ -83,7 +83,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testGetContent() {
+ public function testGetContent(): void {
self::assertEquals(
file_get_contents(__DIR__ . '/../../../data/test.pdf'),
$this->testPdf->getContent()
@@ -95,7 +95,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testGetMTime() {
+ public function testGetMTime(): void {
self::assertTrue(is_int($this->testPdf->getMTime()));
}
@@ -104,7 +104,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testGetMimeType() {
+ public function testGetMimeType(): void {
self::assertEquals('application/pdf', $this->testPdf->getMimeType());
}
@@ -114,7 +114,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testRead() {
+ public function testRead(): void {
self::expectException(NotPermittedException::class);
$this->testPdf->read();
}
@@ -124,7 +124,7 @@ class InMemoryFileTest extends TestCase {
*
* @return void
*/
- public function testWrite() {
+ public function testWrite(): void {
self::expectException(NotPermittedException::class);
$this->testPdf->write();
}
diff --git a/tests/lib/Files/SimpleFS/SimpleFileTest.php b/tests/lib/Files/SimpleFS/SimpleFileTest.php
index 6dbd663068e..d0676eae70f 100644
--- a/tests/lib/Files/SimpleFS/SimpleFileTest.php
+++ b/tests/lib/Files/SimpleFS/SimpleFileTest.php
@@ -25,7 +25,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->simpleFile = new SimpleFile($this->file);
}
- public function testGetName() {
+ public function testGetName(): void {
$this->file->expects($this->once())
->method('getName')
->willReturn('myname');
@@ -33,7 +33,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals('myname', $this->simpleFile->getName());
}
- public function testGetSize() {
+ public function testGetSize(): void {
$this->file->expects($this->once())
->method('getSize')
->willReturn(42);
@@ -41,7 +41,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals(42, $this->simpleFile->getSize());
}
- public function testGetETag() {
+ public function testGetETag(): void {
$this->file->expects($this->once())
->method('getETag')
->willReturn('etag');
@@ -49,7 +49,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals('etag', $this->simpleFile->getETag());
}
- public function testGetMTime() {
+ public function testGetMTime(): void {
$this->file->expects($this->once())
->method('getMTime')
->willReturn(101);
@@ -57,7 +57,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals(101, $this->simpleFile->getMTime());
}
- public function testGetContent() {
+ public function testGetContent(): void {
$this->file->expects($this->once())
->method('getContent')
->willReturn('foo');
@@ -65,7 +65,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals('foo', $this->simpleFile->getContent());
}
- public function testPutContent() {
+ public function testPutContent(): void {
$this->file->expects($this->once())
->method('putContent')
->with($this->equalTo('bar'));
@@ -73,14 +73,14 @@ class SimpleFileTest extends \Test\TestCase {
$this->simpleFile->putContent('bar');
}
- public function testDelete() {
+ public function testDelete(): void {
$this->file->expects($this->once())
->method('delete');
$this->simpleFile->delete();
}
- public function testGetMimeType() {
+ public function testGetMimeType(): void {
$this->file->expects($this->once())
->method('getMimeType')
->willReturn('app/awesome');
@@ -88,7 +88,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->assertEquals('app/awesome', $this->simpleFile->getMimeType());
}
- public function testGetContentInvalidAppData() {
+ public function testGetContentInvalidAppData(): void {
$this->file->method('getContent')
->willReturn(false);
$this->file->method('stat')->willReturn(false);
@@ -107,7 +107,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->simpleFile->getContent();
}
- public function testRead() {
+ public function testRead(): void {
$this->file->expects($this->once())
->method('fopen')
->with('r');
@@ -115,7 +115,7 @@ class SimpleFileTest extends \Test\TestCase {
$this->simpleFile->read();
}
- public function testWrite() {
+ public function testWrite(): void {
$this->file->expects($this->once())
->method('fopen')
->with('w');
diff --git a/tests/lib/Files/SimpleFS/SimpleFolderTest.php b/tests/lib/Files/SimpleFS/SimpleFolderTest.php
index 139a6cb703c..6897aab1f02 100644
--- a/tests/lib/Files/SimpleFS/SimpleFolderTest.php
+++ b/tests/lib/Files/SimpleFS/SimpleFolderTest.php
@@ -47,24 +47,24 @@ class SimpleFolderTest extends \Test\TestCase {
$this->simpleFolder = new SimpleFolder($this->folder);
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertEquals('test', $this->simpleFolder->getName());
}
- public function testDelete() {
+ public function testDelete(): void {
$this->assertTrue($this->parentFolder->nodeExists('test'));
$this->simpleFolder->delete();
$this->assertFalse($this->parentFolder->nodeExists('test'));
}
- public function testFileExists() {
+ public function testFileExists(): void {
$this->folder->newFile('exists');
$this->assertFalse($this->simpleFolder->fileExists('not-exists'));
$this->assertTrue($this->simpleFolder->fileExists('exists'));
}
- public function testGetFile() {
+ public function testGetFile(): void {
$this->folder->newFile('exists');
$result = $this->simpleFolder->getFile('exists');
@@ -74,7 +74,7 @@ class SimpleFolderTest extends \Test\TestCase {
$this->simpleFolder->getFile('not-exists');
}
- public function testNewFile() {
+ public function testNewFile(): void {
$result = $this->simpleFolder->newFile('file');
$this->assertInstanceOf(ISimpleFile::class, $result);
$this->assertFalse($this->folder->nodeExists('file'));
@@ -84,7 +84,7 @@ class SimpleFolderTest extends \Test\TestCase {
$this->assertEquals('bar', $result->getContent());
}
- public function testGetDirectoryListing() {
+ public function testGetDirectoryListing(): void {
$this->folder->newFile('file1');
$this->folder->newFile('file2');
@@ -94,7 +94,7 @@ class SimpleFolderTest extends \Test\TestCase {
$this->assertInstanceOf(ISimpleFile::class, $result[1]);
}
- public function testGetFolder() {
+ public function testGetFolder(): void {
$this->folder->newFolder('exists');
$result = $this->simpleFolder->getFolder('exists');
@@ -104,7 +104,7 @@ class SimpleFolderTest extends \Test\TestCase {
$this->simpleFolder->getFolder('not-exists');
}
- public function testNewFolder() {
+ public function testNewFolder(): void {
$result = $this->simpleFolder->newFolder('folder');
$this->assertInstanceOf(ISimpleFolder::class, $result);
$result->newFile('file');
diff --git a/tests/lib/Files/Storage/CommonTest.php b/tests/lib/Files/Storage/CommonTest.php
index bd22d93fb69..b51b35be8f9 100644
--- a/tests/lib/Files/Storage/CommonTest.php
+++ b/tests/lib/Files/Storage/CommonTest.php
@@ -9,7 +9,10 @@ namespace Test\Files\Storage;
use OC\Files\Storage\Wrapper\Jail;
use OC\Files\Storage\Wrapper\Wrapper;
+use OCP\Files\IFilenameValidator;
+use OCP\Files\InvalidCharacterInPathException;
use OCP\Files\InvalidPathException;
+use OCP\ITempManager;
use PHPUnit\Framework\MockObject\MockObject;
/**
@@ -20,68 +23,46 @@ use PHPUnit\Framework\MockObject\MockObject;
* @package Test\Files\Storage
*/
class CommonTest extends Storage {
- /**
- * @var string tmpDir
- */
- private $tmpDir;
- private array $invalidCharsBackup;
+ private string $tmpDir;
+ private IFilenameValidator&MockObject $filenameValidator;
protected function setUp(): void {
parent::setUp();
- $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
+ $this->filenameValidator = $this->createMock(IFilenameValidator::class);
+ $this->overwriteService(IFilenameValidator::class, $this->filenameValidator);
+ $this->tmpDir = \OCP\Server::get(ITempManager::class)->getTemporaryFolder();
$this->instance = new \OC\Files\Storage\CommonTest(['datadir' => $this->tmpDir]);
- $this->invalidCharsBackup = \OC::$server->getConfig()->getSystemValue('forbidden_chars', []);
}
protected function tearDown(): void {
\OC_Helper::rmdirr($this->tmpDir);
- \OC::$server->getConfig()->setSystemValue('forbidden_chars', $this->invalidCharsBackup);
+ $this->restoreService(IFilenameValidator::class);
parent::tearDown();
}
- /**
- * @dataProvider dataVerifyPath
- */
- public function testVerifyPath(string $filename, array $additionalChars, bool $throws) {
- /** @var \OC\Files\Storage\CommonTest|MockObject $instance */
- $instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class)
- ->onlyMethods(['copyFromStorage', 'rmdir', 'unlink'])
- ->setConstructorArgs([['datadir' => $this->tmpDir]])
- ->getMock();
- $instance->method('copyFromStorage')
- ->willThrowException(new \Exception('copy'));
+ public function testVerifyPath(): void {
+ $this->filenameValidator
+ ->expects($this->once())
+ ->method('validateFilename')
+ ->with('invalid:char.txt')
+ ->willThrowException(new InvalidCharacterInPathException());
+ $this->expectException(InvalidPathException::class);
- \OC::$server->getConfig()->setSystemValue('forbidden_chars', $additionalChars);
-
- if ($throws) {
- $this->expectException(InvalidPathException::class);
- } else {
- $this->expectNotToPerformAssertions();
- }
- $instance->verifyPath('/', $filename);
+ $this->instance->verifyPath('/', 'invalid:char.txt');
}
- public function dataVerifyPath(): array {
- return [
- // slash is always forbidden
- 'invalid slash' => ['a/b.txt', [], true],
- // backslash is also forbidden
- 'invalid backslash' => ['a\\b.txt', [], true],
- // by default colon is not forbidden
- 'valid name' => ['a: b.txt', [], false],
- // colon can be added to the list of forbidden character
- 'invalid custom character' => ['a: b.txt', [':'], true],
- // make sure to not split the list entries as they migh contain Unicode sequences
- // in this example the "face in clouds" emoji contains the clouds emoji so only having clouds is ok
- 'valid unicode sequence' => ['🌫️.txt', ['😶‍🌫️'], false],
- // This is the reverse: clouds are forbidden -> so is also the face in the clouds emoji
- 'valid unicode sequence' => ['😶‍🌫️.txt', ['🌫️'], true],
- ];
+ public function testVerifyPathSucceed(): void {
+ $this->filenameValidator
+ ->expects($this->once())
+ ->method('validateFilename')
+ ->with('valid-char.txt');
+
+ $this->instance->verifyPath('/', 'valid-char.txt');
}
- public function testMoveFromStorageWrapped() {
+ public function testMoveFromStorageWrapped(): void {
/** @var \OC\Files\Storage\CommonTest|MockObject $instance */
$instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class)
->onlyMethods(['copyFromStorage', 'rmdir', 'unlink'])
@@ -99,7 +80,7 @@ class CommonTest extends Storage {
$this->assertTrue($instance->file_exists('bar.txt'));
}
- public function testMoveFromStorageJailed() {
+ public function testMoveFromStorageJailed(): void {
/** @var \OC\Files\Storage\CommonTest|MockObject $instance */
$instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class)
->onlyMethods(['copyFromStorage', 'rmdir', 'unlink'])
@@ -122,7 +103,7 @@ class CommonTest extends Storage {
$this->assertTrue($instance->file_exists('bar.txt'));
}
- public function testMoveFromStorageNestedJail() {
+ public function testMoveFromStorageNestedJail(): void {
/** @var \OC\Files\Storage\CommonTest|MockObject $instance */
$instance = $this->getMockBuilder(\OC\Files\Storage\CommonTest::class)
->onlyMethods(['copyFromStorage', 'rmdir', 'unlink'])
diff --git a/tests/lib/Files/Storage/HomeTest.php b/tests/lib/Files/Storage/HomeTest.php
index c3111e74259..b6d0f1aa85a 100644
--- a/tests/lib/Files/Storage/HomeTest.php
+++ b/tests/lib/Files/Storage/HomeTest.php
@@ -69,18 +69,18 @@ class HomeTest extends Storage {
/**
* Tests that the home id is in the format home::user1
*/
- public function testId() {
+ public function testId(): void {
$this->assertEquals('home::' . $this->userId, $this->instance->getId());
}
/**
* Tests that getCache() returns an instance of HomeCache
*/
- public function testGetCacheReturnsHomeCache() {
+ public function testGetCacheReturnsHomeCache(): void {
$this->assertInstanceOf('\OC\Files\Cache\HomeCache', $this->instance->getCache());
}
- public function testGetOwner() {
+ public function testGetOwner(): void {
$this->assertEquals($this->userId, $this->instance->getOwner(''));
}
}
diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php
index efe5dd04e47..4a98970f233 100644
--- a/tests/lib/Files/Storage/LocalTest.php
+++ b/tests/lib/Files/Storage/LocalTest.php
@@ -32,14 +32,14 @@ class LocalTest extends Storage {
parent::tearDown();
}
- public function testStableEtag() {
+ public function testStableEtag(): void {
$this->instance->file_put_contents('test.txt', 'foobar');
$etag1 = $this->instance->getETag('test.txt');
$etag2 = $this->instance->getETag('test.txt');
$this->assertEquals($etag1, $etag2);
}
- public function testEtagChange() {
+ public function testEtagChange(): void {
$this->instance->file_put_contents('test.txt', 'foo');
$this->instance->touch('test.txt', time() - 2);
$etag1 = $this->instance->getETag('test.txt');
@@ -49,21 +49,21 @@ class LocalTest extends Storage {
}
- public function testInvalidArgumentsEmptyArray() {
+ public function testInvalidArgumentsEmptyArray(): void {
$this->expectException(\InvalidArgumentException::class);
new \OC\Files\Storage\Local([]);
}
- public function testInvalidArgumentsNoArray() {
+ public function testInvalidArgumentsNoArray(): void {
$this->expectException(\InvalidArgumentException::class);
new \OC\Files\Storage\Local(null);
}
- public function testDisallowSymlinksOutsideDatadir() {
+ public function testDisallowSymlinksOutsideDatadir(): void {
$this->expectException(\OCP\Files\ForbiddenException::class);
$subDir1 = $this->tmpDir . 'sub1';
@@ -79,7 +79,7 @@ class LocalTest extends Storage {
$storage->file_put_contents('sym/foo', 'bar');
}
- public function testDisallowSymlinksInsideDatadir() {
+ public function testDisallowSymlinksInsideDatadir(): void {
$subDir1 = $this->tmpDir . 'sub1';
$subDir2 = $this->tmpDir . 'sub1/sub2';
$sym = $this->tmpDir . 'sub1/sym';
@@ -94,21 +94,21 @@ class LocalTest extends Storage {
$this->addToAssertionCount(1);
}
- public function testWriteUmaskFilePutContents() {
+ public function testWriteUmaskFilePutContents(): void {
$oldMask = umask(0333);
$this->instance->file_put_contents('test.txt', 'sad');
umask($oldMask);
$this->assertTrue($this->instance->isUpdatable('test.txt'));
}
- public function testWriteUmaskMkdir() {
+ public function testWriteUmaskMkdir(): void {
$oldMask = umask(0333);
$this->instance->mkdir('test.txt');
umask($oldMask);
$this->assertTrue($this->instance->isUpdatable('test.txt'));
}
- public function testWriteUmaskFopen() {
+ public function testWriteUmaskFopen(): void {
$oldMask = umask(0333);
$handle = $this->instance->fopen('test.txt', 'w');
fwrite($handle, 'foo');
@@ -117,7 +117,7 @@ class LocalTest extends Storage {
$this->assertTrue($this->instance->isUpdatable('test.txt'));
}
- public function testWriteUmaskCopy() {
+ public function testWriteUmaskCopy(): void {
$this->instance->file_put_contents('source.txt', 'sad');
$oldMask = umask(0333);
$this->instance->copy('source.txt', 'test.txt');
@@ -125,12 +125,12 @@ class LocalTest extends Storage {
$this->assertTrue($this->instance->isUpdatable('test.txt'));
}
- public function testUnavailableExternal() {
+ public function testUnavailableExternal(): void {
$this->expectException(\OCP\Files\StorageNotAvailableException::class);
$this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist', 'isExternal' => true]);
}
- public function testUnavailableNonExternal() {
+ public function testUnavailableNonExternal(): void {
$this->instance = new \OC\Files\Storage\Local(['datadir' => $this->tmpDir . '/unexist']);
// no exception thrown
$this->assertNotNull($this->instance);
diff --git a/tests/lib/Files/Storage/Storage.php b/tests/lib/Files/Storage/Storage.php
index 0a170a0e7d5..5b0bbf2f95b 100644
--- a/tests/lib/Files/Storage/Storage.php
+++ b/tests/lib/Files/Storage/Storage.php
@@ -30,7 +30,7 @@ abstract class Storage extends \Test\TestCase {
/**
* the root folder of the storage should always exist, be readable and be recognized as a directory
*/
- public function testRoot() {
+ public function testRoot(): void {
$this->assertTrue($this->instance->file_exists('/'), 'Root folder does not exist');
$this->assertTrue($this->instance->isReadable('/'), 'Root folder is not readable');
$this->assertTrue($this->instance->is_dir('/'), 'Root folder is not a directory');
@@ -44,14 +44,14 @@ abstract class Storage extends \Test\TestCase {
/**
* Check that the test() function works
*/
- public function testTestFunction() {
+ public function testTestFunction(): void {
$this->assertTrue($this->instance->test());
}
/**
* @dataProvider directoryProvider
*/
- public function testDirectories($directory) {
+ public function testDirectories($directory): void {
$this->assertFalse($this->instance->file_exists('/' . $directory));
$this->assertTrue($this->instance->mkdir('/' . $directory));
@@ -66,7 +66,7 @@ abstract class Storage extends \Test\TestCase {
$dh = $this->instance->opendir('/');
$content = [];
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if ($file != '.' and $file != '..') {
$content[] = $file;
}
@@ -99,7 +99,7 @@ abstract class Storage extends \Test\TestCase {
$dh = $this->instance->opendir('/');
$content = [];
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if ($file != '.' and $file != '..') {
$content[] = $file;
}
@@ -144,7 +144,7 @@ abstract class Storage extends \Test\TestCase {
*
* @dataProvider loremFileProvider
*/
- public function testGetPutContents($sourceFile) {
+ public function testGetPutContents($sourceFile): void {
$sourceText = file_get_contents($sourceFile);
//fill a file with string data
@@ -160,7 +160,7 @@ abstract class Storage extends \Test\TestCase {
/**
* test various known mimetypes
*/
- public function testMimeType() {
+ public function testMimeType(): void {
$this->assertEquals('httpd/unix-directory', $this->instance->getMimeType('/'));
$this->assertEquals(false, $this->instance->getMimeType('/non/existing/file'));
@@ -212,7 +212,7 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider copyAndMoveProvider
*/
- public function testCopy($source, $target) {
+ public function testCopy($source, $target): void {
$this->initSourceAndTarget($source);
$this->instance->copy($source, $target);
@@ -225,7 +225,7 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider copyAndMoveProvider
*/
- public function testMove($source, $target) {
+ public function testMove($source, $target): void {
$this->initSourceAndTarget($source);
$this->instance->rename($source, $target);
@@ -239,7 +239,7 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider copyAndMoveProvider
*/
- public function testCopyOverwrite($source, $target) {
+ public function testCopyOverwrite($source, $target): void {
$this->initSourceAndTarget($source, $target);
$this->instance->copy($source, $target);
@@ -253,7 +253,7 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider copyAndMoveProvider
*/
- public function testMoveOverwrite($source, $target) {
+ public function testMoveOverwrite($source, $target): void {
$this->initSourceAndTarget($source, $target);
$this->instance->rename($source, $target);
@@ -263,7 +263,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertSameAsLorem($target);
}
- public function testLocal() {
+ public function testLocal(): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
$localFile = $this->instance->getLocalFile('/lorem.txt');
@@ -290,7 +290,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals(file_get_contents($localFile), 'foo');
}
- public function testStat() {
+ public function testStat(): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$ctimeStart = time();
$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
@@ -325,7 +325,7 @@ abstract class Storage extends \Test\TestCase {
* Test whether checkUpdate properly returns false when there was
* no change.
*/
- public function testCheckUpdate() {
+ public function testCheckUpdate(): void {
if ($this->instance instanceof \OC\Files\Storage\Wrapper\Wrapper) {
$this->markTestSkipped('Cannot test update check on wrappers');
}
@@ -337,7 +337,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertFalse($watcher->checkUpdate('/lorem.txt'), 'No update');
}
- public function testUnlink() {
+ public function testUnlink(): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
@@ -352,7 +352,7 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider fileNameProvider
*/
- public function testFOpen($fileName) {
+ public function testFOpen($fileName): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$fh = @$this->instance->fopen($fileName, 'r');
@@ -372,14 +372,14 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals(file_get_contents($textFile), $content);
}
- public function testTouchCreateFile() {
+ public function testTouchCreateFile(): void {
$this->assertFalse($this->instance->file_exists('touch'));
// returns true on success
$this->assertTrue($this->instance->touch('touch'));
$this->assertTrue($this->instance->file_exists('touch'));
}
- public function testRecursiveRmdir() {
+ public function testRecursiveRmdir(): void {
$this->instance->mkdir('folder');
$this->instance->mkdir('folder/bar');
$this->wait();
@@ -393,14 +393,14 @@ abstract class Storage extends \Test\TestCase {
$this->assertFalse($this->instance->file_exists('folder'));
}
- public function testRmdirEmptyFolder() {
+ public function testRmdirEmptyFolder(): void {
$this->assertTrue($this->instance->mkdir('empty'));
$this->wait();
$this->assertTrue($this->instance->rmdir('empty'));
$this->assertFalse($this->instance->file_exists('empty'));
}
- public function testRecursiveUnlink() {
+ public function testRecursiveUnlink(): void {
$this->instance->mkdir('folder');
$this->instance->mkdir('folder/bar');
$this->instance->file_put_contents('folder/asd.txt', 'foobar');
@@ -424,13 +424,13 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider hashProvider
*/
- public function testHash($data, $type) {
+ public function testHash($data, $type): void {
$this->instance->file_put_contents('hash.txt', $data);
$this->assertEquals(hash($type, $data), $this->instance->hash($type, 'hash.txt'));
$this->assertEquals(hash($type, $data, true), $this->instance->hash($type, 'hash.txt', true));
}
- public function testHashInFileName() {
+ public function testHashInFileName(): void {
$this->instance->file_put_contents('#test.txt', 'data');
$this->assertEquals('data', $this->instance->file_get_contents('#test.txt'));
@@ -449,14 +449,14 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals(['test.txt'], $content);
}
- public function testCopyOverWriteFile() {
+ public function testCopyOverWriteFile(): void {
$this->instance->file_put_contents('target.txt', 'foo');
$this->instance->file_put_contents('source.txt', 'bar');
$this->instance->copy('source.txt', 'target.txt');
$this->assertEquals('bar', $this->instance->file_get_contents('target.txt'));
}
- public function testRenameOverWriteFile() {
+ public function testRenameOverWriteFile(): void {
$this->instance->file_put_contents('target.txt', 'foo');
$this->instance->file_put_contents('source.txt', 'bar');
$this->instance->rename('source.txt', 'target.txt');
@@ -464,7 +464,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertFalse($this->instance->file_exists('source.txt'));
}
- public function testRenameDirectory() {
+ public function testRenameDirectory(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
$this->instance->file_put_contents('source/test2.txt', 'qwerty');
@@ -492,7 +492,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('bar', $this->instance->file_get_contents('target/subfolder/test.txt'));
}
- public function testRenameOverWriteDirectory() {
+ public function testRenameOverWriteDirectory(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
@@ -508,7 +508,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'), 'target/test1.txt has not been overwritten');
}
- public function testRenameOverWriteDirectoryOverFile() {
+ public function testRenameOverWriteDirectoryOverFile(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
@@ -521,7 +521,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'));
}
- public function testCopyDirectory() {
+ public function testCopyDirectory(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
$this->instance->file_put_contents('source/test2.txt', 'qwerty');
@@ -546,7 +546,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('bar', $this->instance->file_get_contents('target/subfolder/test.txt'));
}
- public function testCopyOverWriteDirectory() {
+ public function testCopyOverWriteDirectory(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
@@ -560,7 +560,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'));
}
- public function testCopyOverWriteDirectoryOverFile() {
+ public function testCopyOverWriteDirectoryOverFile(): void {
$this->instance->mkdir('source');
$this->instance->file_put_contents('source/test1.txt', 'foo');
@@ -571,7 +571,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('foo', $this->instance->file_get_contents('target/test1.txt'));
}
- public function testInstanceOfStorage() {
+ public function testInstanceOfStorage(): void {
$this->assertTrue($this->instance->instanceOfStorage('\OCP\Files\Storage'));
$this->assertTrue($this->instance->instanceOfStorage(get_class($this->instance)));
$this->assertFalse($this->instance->instanceOfStorage('\OC'));
@@ -580,7 +580,7 @@ abstract class Storage extends \Test\TestCase {
/**
* @dataProvider copyAndMoveProvider
*/
- public function testCopyFromSameStorage($source, $target) {
+ public function testCopyFromSameStorage($source, $target): void {
$this->initSourceAndTarget($source);
$this->instance->copyFromStorage($this->instance, $source, $target);
@@ -590,32 +590,32 @@ abstract class Storage extends \Test\TestCase {
$this->assertTrue($this->instance->file_exists($source), $source . ' was deleted');
}
- public function testIsCreatable() {
+ public function testIsCreatable(): void {
$this->instance->mkdir('source');
$this->assertTrue($this->instance->isCreatable('source'));
}
- public function testIsReadable() {
+ public function testIsReadable(): void {
$this->instance->mkdir('source');
$this->assertTrue($this->instance->isReadable('source'));
}
- public function testIsUpdatable() {
+ public function testIsUpdatable(): void {
$this->instance->mkdir('source');
$this->assertTrue($this->instance->isUpdatable('source'));
}
- public function testIsDeletable() {
+ public function testIsDeletable(): void {
$this->instance->mkdir('source');
$this->assertTrue($this->instance->isDeletable('source'));
}
- public function testIsShareable() {
+ public function testIsShareable(): void {
$this->instance->mkdir('source');
$this->assertTrue($this->instance->isSharable('source'));
}
- public function testStatAfterWrite() {
+ public function testStatAfterWrite(): void {
$this->instance->file_put_contents('foo.txt', 'bar');
$stat = $this->instance->stat('foo.txt');
$this->assertEquals(3, $stat['size']);
@@ -628,13 +628,13 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals(6, $stat['size']);
}
- public function testPartFile() {
+ public function testPartFile(): void {
$this->instance->file_put_contents('bar.txt.part', 'bar');
$this->instance->rename('bar.txt.part', 'bar.txt');
$this->assertEquals('bar', $this->instance->file_get_contents('bar.txt'));
}
- public function testWriteStream() {
+ public function testWriteStream(): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
if (!$this->instance->instanceOfStorage(IWriteStreamStorage::class)) {
@@ -651,7 +651,7 @@ abstract class Storage extends \Test\TestCase {
$this->assertEquals('resource (closed)', gettype($source));
}
- public function testFseekSize() {
+ public function testFseekSize(): void {
$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
$this->instance->file_put_contents('bar.txt', file_get_contents($textFile));
diff --git a/tests/lib/Files/Storage/StorageFactoryTest.php b/tests/lib/Files/Storage/StorageFactoryTest.php
index ee23f6199c9..66f2a2af9a6 100644
--- a/tests/lib/Files/Storage/StorageFactoryTest.php
+++ b/tests/lib/Files/Storage/StorageFactoryTest.php
@@ -25,7 +25,7 @@ class DummyWrapper extends Wrapper {
}
class StorageFactoryTest extends TestCase {
- public function testSimpleWrapper() {
+ public function testSimpleWrapper(): void {
$instance = new \OC\Files\Storage\StorageFactory();
$mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance);
$instance->addStorageWrapper('dummy', function ($mountPoint, IStorage $storage, IMountPoint $mount) {
@@ -38,7 +38,7 @@ class StorageFactoryTest extends TestCase {
$this->assertInstanceOf('\Test\Files\Storage\DummyWrapper', $wrapped);
}
- public function testRemoveWrapper() {
+ public function testRemoveWrapper(): void {
$instance = new \OC\Files\Storage\StorageFactory();
$mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance);
$instance->addStorageWrapper('dummy', function ($mountPoint, IStorage $storage) {
@@ -49,7 +49,7 @@ class StorageFactoryTest extends TestCase {
$this->assertInstanceOf('\OC\Files\Storage\Temporary', $wrapped);
}
- public function testWrapperPriority() {
+ public function testWrapperPriority(): void {
$instance = new \OC\Files\Storage\StorageFactory();
$mount = new MountPoint('\OC\Files\Storage\Temporary', '/foo', [[]], $instance);
$instance->addStorageWrapper('dummy1', function ($mountPoint, IStorage $storage) {
diff --git a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
index ef7b457636c..616fd023414 100644
--- a/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
+++ b/tests/lib/Files/Storage/Wrapper/AvailabilityTest.php
@@ -17,7 +17,7 @@ class AvailabilityTest extends \Test\TestCase {
protected $storageCache;
/** @var \PHPUnit\Framework\MockObject\MockObject|Temporary */
protected $storage;
- /** @var Availability */
+ /** @var Availability */
protected $wrapper;
protected function setUp(): void {
@@ -36,7 +36,7 @@ class AvailabilityTest extends \Test\TestCase {
/**
* Storage is available
*/
- public function testAvailable() {
+ public function testAvailable(): void {
$this->storage->expects($this->once())
->method('getAvailability')
->willReturn(['available' => true, 'last_checked' => 0]);
@@ -52,7 +52,7 @@ class AvailabilityTest extends \Test\TestCase {
* Storage marked unavailable, TTL not expired
*
*/
- public function testUnavailable() {
+ public function testUnavailable(): void {
$this->expectException(\OCP\Files\StorageNotAvailableException::class);
$this->storage->expects($this->once())
@@ -69,7 +69,7 @@ class AvailabilityTest extends \Test\TestCase {
/**
* Storage marked unavailable, TTL expired
*/
- public function testUnavailableRecheck() {
+ public function testUnavailableRecheck(): void {
$this->storage->expects($this->once())
->method('getAvailability')
->willReturn(['available' => false, 'last_checked' => 0]);
@@ -92,7 +92,7 @@ class AvailabilityTest extends \Test\TestCase {
* Storage marked available, but throws StorageNotAvailableException
*
*/
- public function testAvailableThrowStorageNotAvailable() {
+ public function testAvailableThrowStorageNotAvailable(): void {
$this->expectException(\OCP\Files\StorageNotAvailableException::class);
$this->storage->expects($this->once())
@@ -114,7 +114,7 @@ class AvailabilityTest extends \Test\TestCase {
* Storage available, but call fails
* Method failure does not indicate storage unavailability
*/
- public function testAvailableFailure() {
+ public function testAvailableFailure(): void {
$this->storage->expects($this->once())
->method('getAvailability')
->willReturn(['available' => true, 'last_checked' => 0]);
@@ -134,7 +134,7 @@ class AvailabilityTest extends \Test\TestCase {
* Standard exception does not indicate storage unavailability
*
*/
- public function testAvailableThrow() {
+ public function testAvailableThrow(): void {
$this->expectException(\Exception::class);
$this->storage->expects($this->once())
diff --git a/tests/lib/Files/Storage/Wrapper/EncodingTest.php b/tests/lib/Files/Storage/Wrapper/EncodingTest.php
index bc9355d7bfb..4256337f08e 100644
--- a/tests/lib/Files/Storage/Wrapper/EncodingTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncodingTest.php
@@ -57,7 +57,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider accessNameProvider
*/
- public function testFputEncoding($accessName) {
+ public function testFputEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$this->assertEquals('bar', $this->instance->file_get_contents($accessName));
}
@@ -65,7 +65,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider accessNameProvider
*/
- public function testFopenReadEncoding($accessName) {
+ public function testFopenReadEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$fh = $this->instance->fopen($accessName, 'r');
$data = fgets($fh);
@@ -76,7 +76,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider accessNameProvider
*/
- public function testFopenOverwriteEncoding($accessName) {
+ public function testFopenOverwriteEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$fh = $this->instance->fopen($accessName, 'w');
$data = fputs($fh, 'test');
@@ -89,7 +89,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider accessNameProvider
*/
- public function testFileExistsEncoding($accessName) {
+ public function testFileExistsEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$this->assertTrue($this->instance->file_exists($accessName));
}
@@ -97,14 +97,14 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider accessNameProvider
*/
- public function testUnlinkEncoding($accessName) {
+ public function testUnlinkEncoding($accessName): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'bar');
$this->assertTrue($this->instance->unlink($accessName));
$this->assertFalse($this->sourceStorage->file_exists(self::NFC_NAME));
$this->assertFalse($this->sourceStorage->file_exists(self::NFD_NAME));
}
- public function testNfcHigherPriority() {
+ public function testNfcHigherPriority(): void {
$this->sourceStorage->file_put_contents(self::NFC_NAME, 'nfc');
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'nfd');
$this->assertEquals('nfc', $this->instance->file_get_contents(self::NFC_NAME));
@@ -121,7 +121,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider encodedDirectoriesProvider
*/
- public function testOperationInsideDirectory($sourceDir, $accessDir) {
+ public function testOperationInsideDirectory($sourceDir, $accessDir): void {
$this->sourceStorage->mkdir($sourceDir);
$this->instance->file_put_contents($accessDir . '/test.txt', 'bar');
$this->assertTrue($this->instance->file_exists($accessDir . '/test.txt'));
@@ -138,7 +138,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertTrue($this->instance->file_exists($accessDir . '/' . self::NFC_NAME));
}
- public function testCacheExtraSlash() {
+ public function testCacheExtraSlash(): void {
$this->sourceStorage->file_put_contents(self::NFD_NAME, 'foo');
$this->assertEquals(3, $this->instance->file_put_contents(self::NFC_NAME, 'bar'));
$this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME));
@@ -162,7 +162,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider sourceAndTargetDirectoryProvider
*/
- public function testCopyAndMoveEncodedFolder($sourceDir, $targetDir) {
+ public function testCopyAndMoveEncodedFolder($sourceDir, $targetDir): void {
$this->sourceStorage->mkdir($sourceDir);
$this->sourceStorage->mkdir($targetDir);
$this->sourceStorage->file_put_contents($sourceDir . '/test.txt', 'bar');
@@ -182,7 +182,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
/**
* @dataProvider sourceAndTargetDirectoryProvider
*/
- public function testCopyAndMoveFromStorageEncodedFolder($sourceDir, $targetDir) {
+ public function testCopyAndMoveFromStorageEncodedFolder($sourceDir, $targetDir): void {
$this->sourceStorage->mkdir($sourceDir);
$this->sourceStorage->mkdir($targetDir);
$this->sourceStorage->file_put_contents($sourceDir . '/test.txt', 'bar');
@@ -199,7 +199,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertEquals('bar', $this->instance->file_get_contents(self::NFC_NAME . '2/test2.txt'));
}
- public function testNormalizedDirectoryEntriesOpenDir() {
+ public function testNormalizedDirectoryEntriesOpenDir(): void {
$this->sourceStorage->mkdir('/test');
$this->sourceStorage->mkdir('/test/' . self::NFD_NAME);
@@ -208,7 +208,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$dh = $this->instance->opendir('/test');
$content = [];
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if ($file != '.' and $file != '..') {
$content[] = $file;
}
@@ -218,7 +218,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertEquals(self::NFC_NAME, $content[0]);
}
- public function testNormalizedDirectoryEntriesGetDirectoryContent() {
+ public function testNormalizedDirectoryEntriesGetDirectoryContent(): void {
$this->sourceStorage->mkdir('/test');
$this->sourceStorage->mkdir('/test/' . self::NFD_NAME);
@@ -230,7 +230,7 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$this->assertEquals(self::NFC_NAME, $content[0]['name']);
}
- public function testNormalizedGetMetaData() {
+ public function testNormalizedGetMetaData(): void {
$this->sourceStorage->mkdir('/test');
$this->sourceStorage->mkdir('/test/' . self::NFD_NAME);
diff --git a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
index a6e0260fde6..2a131a1ea39 100644
--- a/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
+++ b/tests/lib/Files/Storage/Wrapper/EncryptionTest.php
@@ -105,11 +105,11 @@ class EncryptionTest extends Storage {
*/
private $config;
- /** @var \OC\Memcache\ArrayCache | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var \OC\Memcache\ArrayCache | \PHPUnit\Framework\MockObject\MockObject */
private $arrayCache;
- /** @var integer dummy unencrypted size */
+ /** @var integer dummy unencrypted size */
private $dummySize = -1;
protected function setUp(): void {
@@ -251,7 +251,7 @@ class EncryptionTest extends Storage {
* @param int $storedUnencryptedSize
* @param array $expected
*/
- public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected) {
+ public function testGetMetaData($path, $metaData, $encrypted, $unencryptedSizeSet, $storedUnencryptedSize, $expected): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -329,7 +329,7 @@ class EncryptionTest extends Storage {
];
}
- public function testFilesize() {
+ public function testFilesize(): void {
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')
->disableOriginalConstructor()->getMock();
$cache->expects($this->any())
@@ -369,7 +369,7 @@ class EncryptionTest extends Storage {
* @param bool $failure
* @param int $expected
*/
- public function testVerifyUnencryptedSize($encryptedSize, $unencryptedSize, $failure, $expected) {
+ public function testVerifyUnencryptedSize($encryptedSize, $unencryptedSize, $failure, $expected): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -428,7 +428,7 @@ class EncryptionTest extends Storage {
public function testRename($source,
$target,
$encryptionEnabled,
- $renameKeysReturn) {
+ $renameKeysReturn): void {
if ($encryptionEnabled) {
$this->keyStore
->expects($this->once())
@@ -448,7 +448,7 @@ class EncryptionTest extends Storage {
$this->instance->rename($source, $target);
}
- public function testCopyEncryption() {
+ public function testCopyEncryption(): void {
$this->instance->file_put_contents('source.txt', 'bar');
$this->instance->copy('source.txt', 'target.txt');
$this->assertSame('bar', $this->instance->file_get_contents('target.txt'));
@@ -473,7 +473,7 @@ class EncryptionTest extends Storage {
];
}
- public function testIsLocal() {
+ public function testIsLocal(): void {
$this->encryptionManager->expects($this->once())
->method('isEnabled')->willReturn(true);
$this->assertFalse($this->instance->isLocal());
@@ -487,7 +487,7 @@ class EncryptionTest extends Storage {
* @param boolean $isExcluded
* @param boolean $encryptionEnabled
*/
- public function testRmdir($path, $rmdirResult, $isExcluded, $encryptionEnabled) {
+ public function testRmdir($path, $rmdirResult, $isExcluded, $encryptionEnabled): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -536,7 +536,7 @@ class EncryptionTest extends Storage {
* @param boolean $excluded
* @param boolean $expected
*/
- public function testCopyKeys($excluded, $expected) {
+ public function testCopyKeys($excluded, $expected): void {
$this->util->expects($this->once())
->method('isExcluded')
->willReturn($excluded);
@@ -566,7 +566,7 @@ class EncryptionTest extends Storage {
* @param bool $strippedPathExists
* @param string $strippedPath
*/
- public function testGetHeader($path, $strippedPathExists, $strippedPath) {
+ public function testGetHeader($path, $strippedPathExists, $strippedPath): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -647,7 +647,7 @@ class EncryptionTest extends Storage {
*
* @dataProvider dataTestGetHeaderAddLegacyModule
*/
- public function testGetHeaderAddLegacyModule($header, $isEncrypted, $exists, $expected) {
+ public function testGetHeaderAddLegacyModule($header, $isEncrypted, $exists, $expected): void {
$sourceStorage = $this->getMockBuilder('\OC\Files\Storage\Storage')
->disableOriginalConstructor()->getMock();
@@ -717,7 +717,7 @@ class EncryptionTest extends Storage {
];
}
- public function testCopyBetweenStorageMinimumEncryptedVersion() {
+ public function testCopyBetweenStorageMinimumEncryptedVersion(): void {
$storage2 = $this->createMock(\OC\Files\Storage\Storage::class);
$sourceInternalPath = $targetInternalPath = 'file.txt';
@@ -766,7 +766,7 @@ class EncryptionTest extends Storage {
* @param bool $mountPointEncryptionEnabled
* @param bool $expectedEncrypted
*/
- public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryptionEnabled, $expectedEncrypted) {
+ public function testCopyBetweenStorage($encryptionEnabled, $mountPointEncryptionEnabled, $expectedEncrypted): void {
$storage2 = $this->createMock(\OC\Files\Storage\Storage::class);
$sourceInternalPath = $targetInternalPath = 'file.txt';
@@ -827,7 +827,7 @@ class EncryptionTest extends Storage {
* @param bool $copyResult
* @param bool $encrypted
*/
- public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted) {
+ public function testCopyBetweenStorageVersions($sourceInternalPath, $targetInternalPath, $copyResult, $encrypted): void {
$sourceStorage = $this->createMock(\OC\Files\Storage\Storage::class);
$targetStorage = $this->createMock(\OC\Files\Storage\Storage::class);
@@ -919,7 +919,7 @@ class EncryptionTest extends Storage {
* @param string $path
* @param bool $expected
*/
- public function testIsVersion($path, $expected) {
+ public function testIsVersion($path, $expected): void {
$this->assertSame($expected,
$this->invokePrivate($this->instance, 'isVersion', [$path])
);
@@ -949,7 +949,7 @@ class EncryptionTest extends Storage {
$encryptionModule,
$encryptionModuleShouldEncrypt,
$expected
- ) {
+ ): void {
$encryptionManager = $this->createMock(\OC\Encryption\Manager::class);
$util = $this->createMock(Util::class);
$fileHelper = $this->createMock(IFile::class);
diff --git a/tests/lib/Files/Storage/Wrapper/JailTest.php b/tests/lib/Files/Storage/Wrapper/JailTest.php
index c48f52ecce7..fbc4e1d09ee 100644
--- a/tests/lib/Files/Storage/Wrapper/JailTest.php
+++ b/tests/lib/Files/Storage/Wrapper/JailTest.php
@@ -27,7 +27,7 @@ class JailTest extends \Test\Files\Storage\Storage {
// test that nothing outside our jail is touched
$contents = [];
$dh = $this->sourceStorage->opendir('');
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
$contents[] = $file;
}
@@ -37,12 +37,12 @@ class JailTest extends \Test\Files\Storage\Storage {
parent::tearDown();
}
- public function testMkDirRooted() {
+ public function testMkDirRooted(): void {
$this->instance->mkdir('bar');
$this->assertTrue($this->sourceStorage->is_dir('foo/bar'));
}
- public function testFilePutContentsRooted() {
+ public function testFilePutContentsRooted(): void {
$this->instance->file_put_contents('bar', 'asd');
$this->assertEquals('asd', $this->sourceStorage->file_get_contents('foo/bar'));
}
diff --git a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php
index ccc95de1002..bbeb48c5cef 100644
--- a/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php
+++ b/tests/lib/Files/Storage/Wrapper/KnownMtimeTest.php
@@ -50,7 +50,7 @@ class KnownMtimeTest extends Storage {
]);
}
- public function testNewerKnownMtime() {
+ public function testNewerKnownMtime(): void {
$future = time() + 1000;
$this->fakeTime = $future;
diff --git a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
index 0b2d444700a..5c0a035d094 100644
--- a/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
+++ b/tests/lib/Files/Storage/Wrapper/PermissionsMaskTest.php
@@ -38,13 +38,13 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
]);
}
- public function testMkdirNoCreate() {
+ public function testMkdirNoCreate(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
$this->assertFalse($storage->mkdir('foo'));
$this->assertFalse($storage->file_exists('foo'));
}
- public function testRmdirNoDelete() {
+ public function testRmdirNoDelete(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE);
$this->assertTrue($storage->mkdir('foo'));
$this->assertTrue($storage->file_exists('foo'));
@@ -52,25 +52,25 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
$this->assertTrue($storage->file_exists('foo'));
}
- public function testTouchNewFileNoCreate() {
+ public function testTouchNewFileNoCreate(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
$this->assertFalse($storage->touch('foo'));
$this->assertFalse($storage->file_exists('foo'));
}
- public function testTouchNewFileNoUpdate() {
+ public function testTouchNewFileNoUpdate(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
$this->assertTrue($storage->touch('foo'));
$this->assertTrue($storage->file_exists('foo'));
}
- public function testTouchExistingFileNoUpdate() {
+ public function testTouchExistingFileNoUpdate(): void {
$this->sourceStorage->touch('foo');
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
$this->assertFalse($storage->touch('foo'));
}
- public function testUnlinkNoDelete() {
+ public function testUnlinkNoDelete(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_DELETE);
$this->assertTrue($storage->touch('foo'));
$this->assertTrue($storage->file_exists('foo'));
@@ -78,35 +78,35 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
$this->assertTrue($storage->file_exists('foo'));
}
- public function testPutContentsNewFileNoUpdate() {
+ public function testPutContentsNewFileNoUpdate(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
$this->assertEquals(3, $storage->file_put_contents('foo', 'bar'));
$this->assertEquals('bar', $storage->file_get_contents('foo'));
}
- public function testPutContentsNewFileNoCreate() {
+ public function testPutContentsNewFileNoCreate(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
$this->assertFalse($storage->file_put_contents('foo', 'bar'));
}
- public function testPutContentsExistingFileNoUpdate() {
+ public function testPutContentsExistingFileNoUpdate(): void {
$this->sourceStorage->touch('foo');
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
$this->assertFalse($storage->file_put_contents('foo', 'bar'));
}
- public function testFopenExistingFileNoUpdate() {
+ public function testFopenExistingFileNoUpdate(): void {
$this->sourceStorage->touch('foo');
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_UPDATE);
$this->assertFalse($storage->fopen('foo', 'w'));
}
- public function testFopenNewFileNoCreate() {
+ public function testFopenNewFileNoCreate(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE);
$this->assertFalse($storage->fopen('foo', 'w'));
}
- public function testScanNewFiles() {
+ public function testScanNewFiles(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE);
$storage->file_put_contents('foo', 'bar');
$storage->getScanner()->scan('');
@@ -115,7 +115,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
$this->assertEquals(Constants::PERMISSION_READ, $storage->getCache()->get('foo')->getPermissions());
}
- public function testScanNewWrappedFiles() {
+ public function testScanNewWrappedFiles(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE);
$wrappedStorage = new Wrapper(['storage' => $storage]);
$wrappedStorage->file_put_contents('foo', 'bar');
@@ -125,7 +125,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
$this->assertEquals(Constants::PERMISSION_READ, $storage->getCache()->get('foo')->getPermissions());
}
- public function testScanNewFilesNested() {
+ public function testScanNewFilesNested(): void {
$storage = $this->getMaskedStorage(Constants::PERMISSION_READ + Constants::PERMISSION_CREATE + Constants::PERMISSION_UPDATE);
$nestedStorage = new \OC\Files\Storage\Wrapper\PermissionsMask([
'storage' => $storage,
@@ -140,7 +140,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
$this->assertEquals(Constants::PERMISSION_READ, $wrappedStorage->getCache()->get('foo')->getPermissions());
}
- public function testScanUnchanged() {
+ public function testScanUnchanged(): void {
$this->sourceStorage->mkdir('foo');
$this->sourceStorage->file_put_contents('foo/bar.txt', 'bar');
@@ -157,7 +157,7 @@ class PermissionsMaskTest extends \Test\Files\Storage\Storage {
$this->assertFalse($called);
}
- public function testScanUnchangedWrapped() {
+ public function testScanUnchangedWrapped(): void {
$this->sourceStorage->mkdir('foo');
$this->sourceStorage->file_put_contents('foo/bar.txt', 'bar');
diff --git a/tests/lib/Files/Storage/Wrapper/QuotaTest.php b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
index b24b44c6a56..f07e6021e4e 100644
--- a/tests/lib/Files/Storage/Wrapper/QuotaTest.php
+++ b/tests/lib/Files/Storage/Wrapper/QuotaTest.php
@@ -49,24 +49,24 @@ class QuotaTest extends \Test\Files\Storage\Storage {
return new \OC\Files\Storage\Wrapper\Quota(['storage' => $storage, 'quota' => $limit]);
}
- public function testFilePutContentsNotEnoughSpace() {
+ public function testFilePutContentsNotEnoughSpace(): void {
$instance = $this->getLimitedStorage(3);
$this->assertFalse($instance->file_put_contents('files/foo', 'foobar'));
}
- public function testCopyNotEnoughSpace() {
+ public function testCopyNotEnoughSpace(): void {
$instance = $this->getLimitedStorage(9);
$this->assertEquals(6, $instance->file_put_contents('files/foo', 'foobar'));
$instance->getScanner()->scan('');
$this->assertFalse($instance->copy('files/foo', 'files/bar'));
}
- public function testFreeSpace() {
+ public function testFreeSpace(): void {
$instance = $this->getLimitedStorage(9);
$this->assertEquals(9, $instance->free_space(''));
}
- public function testFreeSpaceWithUsedSpace() {
+ public function testFreeSpaceWithUsedSpace(): void {
$instance = $this->getLimitedStorage(9);
$instance->getCache()->put(
'', ['size' => 3]
@@ -74,7 +74,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertEquals(6, $instance->free_space(''));
}
- public function testFreeSpaceWithUnknownDiskSpace() {
+ public function testFreeSpaceWithUnknownDiskSpace(): void {
$storage = $this->getMockBuilder(Local::class)
->setMethods(['free_space'])
->setConstructorArgs([['datadir' => $this->tmpDir]])
@@ -91,7 +91,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertEquals(6, $instance->free_space(''));
}
- public function testFreeSpaceWithUsedSpaceAndEncryption() {
+ public function testFreeSpaceWithUsedSpaceAndEncryption(): void {
$instance = $this->getLimitedStorage(9);
$instance->getCache()->put(
'', ['size' => 7]
@@ -99,7 +99,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertEquals(2, $instance->free_space(''));
}
- public function testFWriteNotEnoughSpace() {
+ public function testFWriteNotEnoughSpace(): void {
$instance = $this->getLimitedStorage(9);
$stream = $instance->fopen('files/foo', 'w+');
$this->assertEquals(6, fwrite($stream, 'foobar'));
@@ -108,7 +108,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertEquals('foobarqwe', $instance->file_get_contents('files/foo'));
}
- public function testStreamCopyWithEnoughSpace() {
+ public function testStreamCopyWithEnoughSpace(): void {
$instance = $this->getLimitedStorage(16);
$inputStream = fopen('data://text/plain,foobarqwerty', 'r');
$outputStream = $instance->fopen('files/foo', 'w+');
@@ -119,7 +119,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
fclose($outputStream);
}
- public function testStreamCopyNotEnoughSpace() {
+ public function testStreamCopyNotEnoughSpace(): void {
$instance = $this->getLimitedStorage(9);
$inputStream = fopen('data://text/plain,foobarqwerty', 'r');
$outputStream = $instance->fopen('files/foo', 'w+');
@@ -130,7 +130,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
fclose($outputStream);
}
- public function testReturnFalseWhenFopenFailed() {
+ public function testReturnFalseWhenFopenFailed(): void {
$failStorage = $this->getMockBuilder(Local::class)
->setMethods(['fopen'])
->setConstructorArgs([['datadir' => $this->tmpDir]])
@@ -144,7 +144,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertFalse($instance->fopen('failedfopen', 'r'));
}
- public function testReturnRegularStreamOnRead() {
+ public function testReturnRegularStreamOnRead(): void {
$instance = $this->getLimitedStorage(9);
// create test file first
@@ -163,7 +163,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
fclose($stream);
}
- public function testReturnRegularStreamWhenOutsideFiles() {
+ public function testReturnRegularStreamWhenOutsideFiles(): void {
$instance = $this->getLimitedStorage(9);
$instance->mkdir('files_other');
@@ -174,7 +174,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
fclose($stream);
}
- public function testReturnQuotaStreamOnWrite() {
+ public function testReturnQuotaStreamOnWrite(): void {
$instance = $this->getLimitedStorage(9);
$stream = $instance->fopen('files/foo', 'w+');
$meta = stream_get_meta_data($stream);
@@ -183,7 +183,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
fclose($stream);
}
- public function testSpaceRoot() {
+ public function testSpaceRoot(): void {
$storage = $this->getMockBuilder(Local::class)->disableOriginalConstructor()->getMock();
$cache = $this->getMockBuilder('\OC\Files\Cache\Cache')->disableOriginalConstructor()->getMock();
$storage->expects($this->once())
@@ -202,19 +202,19 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertEquals(1024 - 50, $instance->free_space(''));
}
- public function testInstanceOfStorageWrapper() {
+ public function testInstanceOfStorageWrapper(): void {
$this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Local'));
$this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Wrapper'));
$this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Quota'));
}
- public function testNoMkdirQuotaZero() {
+ public function testNoMkdirQuotaZero(): void {
$instance = $this->getLimitedStorage(0.0);
$this->assertFalse($instance->mkdir('files'));
$this->assertFalse($instance->mkdir('files/foobar'));
}
- public function testMkdirQuotaZeroTrashbin() {
+ public function testMkdirQuotaZeroTrashbin(): void {
$instance = $this->getLimitedStorage(0.0);
$this->assertTrue($instance->mkdir('files_trashbin'));
$this->assertTrue($instance->mkdir('files_trashbin/files'));
@@ -222,7 +222,7 @@ class QuotaTest extends \Test\Files\Storage\Storage {
$this->assertTrue($instance->mkdir('cache'));
}
- public function testNoTouchQuotaZero() {
+ public function testNoTouchQuotaZero(): void {
$instance = $this->getLimitedStorage(0.0);
$this->assertFalse($instance->touch('foobar'));
}
diff --git a/tests/lib/Files/Storage/Wrapper/WrapperTest.php b/tests/lib/Files/Storage/Wrapper/WrapperTest.php
index 0244c78da8b..1d0f41bf3ed 100644
--- a/tests/lib/Files/Storage/Wrapper/WrapperTest.php
+++ b/tests/lib/Files/Storage/Wrapper/WrapperTest.php
@@ -26,7 +26,7 @@ class WrapperTest extends \Test\Files\Storage\Storage {
parent::tearDown();
}
- public function testInstanceOfStorageWrapper() {
+ public function testInstanceOfStorageWrapper(): void {
$this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Local'));
$this->assertTrue($this->instance->instanceOfStorage('\OC\Files\Storage\Wrapper\Wrapper'));
}
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index b6650b56a85..c29a38f2b09 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -17,7 +17,7 @@ use OCP\IConfig;
class EncryptionTest extends \Test\TestCase {
public const DEFAULT_WRAPPER = '\OC\Files\Stream\Encryption';
- /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject */
+ /** @var \OCP\Encryption\IEncryptionModule | \PHPUnit\Framework\MockObject\MockObject */
private $encryptionModule;
/**
@@ -88,10 +88,10 @@ class EncryptionTest extends \Test\TestCase {
$expectedSharePath,
$expectedSize,
$expectedUnencryptedSize,
- $expectedReadOnly) {
+ $expectedReadOnly): void {
// build mocks
$encryptionModuleMock = $this->getMockBuilder('\OCP\Encryption\IEncryptionModule')
- ->disableOriginalConstructor()->getMock();
+ ->disableOriginalConstructor()->getMock();
$encryptionModuleMock->expects($this->any())->method('needDetailedAccessList')->willReturn(!$isMasterKeyUsed);
$encryptionModuleMock->expects($this->once())
->method('getUnencryptedBlockSize')->willReturn(99);
@@ -189,8 +189,8 @@ class EncryptionTest extends \Test\TestCase {
];
}
- public function testWriteRead() {
- $fileName = tempnam("/tmp", "FOO");
+ public function testWriteRead(): void {
+ $fileName = tempnam('/tmp', 'FOO');
$stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, 6);
$this->assertEquals(6, fwrite($stream, 'foobar'));
fclose($stream);
@@ -210,8 +210,8 @@ class EncryptionTest extends \Test\TestCase {
unlink($fileName);
}
- public function testRewind() {
- $fileName = tempnam("/tmp", "FOO");
+ public function testRewind(): void {
+ $fileName = tempnam('/tmp', 'FOO');
$stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, 6);
$this->assertEquals(6, fwrite($stream, 'foobar'));
$this->assertEquals(true, rewind($stream));
@@ -227,8 +227,8 @@ class EncryptionTest extends \Test\TestCase {
unlink($fileName);
}
- public function testSeek() {
- $fileName = tempnam("/tmp", "FOO");
+ public function testSeek(): void {
+ $fileName = tempnam('/tmp', 'FOO');
$stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, 9);
$this->assertEquals(6, fwrite($stream, 'foobar'));
@@ -260,10 +260,10 @@ class EncryptionTest extends \Test\TestCase {
/**
* @dataProvider dataFilesProvider
*/
- public function testWriteReadBigFile($testFile) {
+ public function testWriteReadBigFile($testFile): void {
$expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile);
// write it
- $fileName = tempnam("/tmp", "FOO");
+ $fileName = tempnam('/tmp', 'FOO');
$stream = $this->getStream($fileName, 'w+', 0, self::DEFAULT_WRAPPER, strlen($expectedData));
// while writing the file from the beginning to the end we should never try
// to read parts of the file. This should only happen for write operations
@@ -297,14 +297,14 @@ class EncryptionTest extends \Test\TestCase {
*
* @dataProvider dataFilesProvider
*/
- public function testWriteToNonSeekableStorage($testFile) {
+ public function testWriteToNonSeekableStorage($testFile): void {
$wrapper = $this->getMockBuilder('\OC\Files\Stream\Encryption')
->setMethods(['parentSeekStream'])->getMock();
$wrapper->expects($this->any())->method('parentSeekStream')->willReturn(false);
$expectedData = file_get_contents(\OC::$SERVERROOT . '/tests/data/' . $testFile);
// write it
- $fileName = tempnam("/tmp", "FOO");
+ $fileName = tempnam('/tmp', 'FOO');
$stream = $this->getStream($fileName, 'w+', 0, '\Test\Files\Stream\DummyEncryptionWrapper', strlen($expectedData));
// while writing the file from the beginning to the end we should never try
// to read parts of the file. This should only happen for write operations
diff --git a/tests/lib/Files/Stream/HashWrapperTest.php b/tests/lib/Files/Stream/HashWrapperTest.php
index 686fcbec82a..ee50fe3b13a 100644
--- a/tests/lib/Files/Stream/HashWrapperTest.php
+++ b/tests/lib/Files/Stream/HashWrapperTest.php
@@ -15,7 +15,7 @@ class HashWrapperTest extends TestCase {
/**
* @dataProvider hashProvider
*/
- public function testHashStream($data, string $algo, string $hash) {
+ public function testHashStream($data, string $algo, string $hash): void {
if (!is_resource($data)) {
$tmpData = fopen('php://temp', 'r+');
if ($data !== null) {
diff --git a/tests/lib/Files/Stream/QuotaTest.php b/tests/lib/Files/Stream/QuotaTest.php
index 17ad14b7e44..2df767d6c60 100644
--- a/tests/lib/Files/Stream/QuotaTest.php
+++ b/tests/lib/Files/Stream/QuotaTest.php
@@ -18,21 +18,21 @@ class QuotaTest extends \Test\TestCase {
return \OC\Files\Stream\Quota::wrap($source, $limit);
}
- public function testWriteEnoughSpace() {
+ public function testWriteEnoughSpace(): void {
$stream = $this->getStream('w+', 100);
$this->assertEquals(6, fwrite($stream, 'foobar'));
rewind($stream);
$this->assertEquals('foobar', fread($stream, 100));
}
- public function testWriteNotEnoughSpace() {
+ public function testWriteNotEnoughSpace(): void {
$stream = $this->getStream('w+', 3);
$this->assertEquals(3, fwrite($stream, 'foobar'));
rewind($stream);
$this->assertEquals('foo', fread($stream, 100));
}
- public function testWriteNotEnoughSpaceSecondTime() {
+ public function testWriteNotEnoughSpaceSecondTime(): void {
$stream = $this->getStream('w+', 9);
$this->assertEquals(6, fwrite($stream, 'foobar'));
$this->assertEquals(3, fwrite($stream, 'qwerty'));
@@ -40,7 +40,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('foobarqwe', fread($stream, 100));
}
- public function testWriteEnoughSpaceRewind() {
+ public function testWriteEnoughSpaceRewind(): void {
$stream = $this->getStream('w+', 6);
$this->assertEquals(6, fwrite($stream, 'foobar'));
rewind($stream);
@@ -49,7 +49,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('qwebar', fread($stream, 100));
}
- public function testWriteNotEnoughSpaceRead() {
+ public function testWriteNotEnoughSpaceRead(): void {
$stream = $this->getStream('w+', 6);
$this->assertEquals(6, fwrite($stream, 'foobar'));
rewind($stream);
@@ -57,7 +57,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals(0, fwrite($stream, 'qwe'));
}
- public function testWriteNotEnoughSpaceExistingStream() {
+ public function testWriteNotEnoughSpaceExistingStream(): void {
$source = fopen('php://temp', 'w+');
fwrite($source, 'foobar');
$stream = \OC\Files\Stream\Quota::wrap($source, 3);
@@ -66,7 +66,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('foobarfoo', fread($stream, 100));
}
- public function testWriteNotEnoughSpaceExistingStreamRewind() {
+ public function testWriteNotEnoughSpaceExistingStreamRewind(): void {
$source = fopen('php://temp', 'w+');
fwrite($source, 'foobar');
$stream = \OC\Files\Stream\Quota::wrap($source, 3);
@@ -76,7 +76,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('qwerty', fread($stream, 100));
}
- public function testFseekReturnsSuccess() {
+ public function testFseekReturnsSuccess(): void {
$stream = $this->getStream('w+', 100);
fwrite($stream, '0123456789');
$this->assertEquals(0, fseek($stream, 3, SEEK_SET));
@@ -84,7 +84,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals(0, fseek($stream, -4, SEEK_END));
}
- public function testWriteAfterSeekEndWithEnoughSpace() {
+ public function testWriteAfterSeekEndWithEnoughSpace(): void {
$stream = $this->getStream('w+', 100);
fwrite($stream, '0123456789');
fseek($stream, -3, SEEK_END);
@@ -93,7 +93,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('0123456abcdefghijk', fread($stream, 100));
}
- public function testWriteAfterSeekEndWithNotEnoughSpace() {
+ public function testWriteAfterSeekEndWithNotEnoughSpace(): void {
$stream = $this->getStream('w+', 13);
fwrite($stream, '0123456789');
// seek forward first to potentially week out
@@ -106,7 +106,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('0123456abcdef', fread($stream, 100));
}
- public function testWriteAfterSeekSetWithEnoughSpace() {
+ public function testWriteAfterSeekSetWithEnoughSpace(): void {
$stream = $this->getStream('w+', 100);
fwrite($stream, '0123456789');
fseek($stream, 7, SEEK_SET);
@@ -115,7 +115,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('0123456abcdefghijk', fread($stream, 100));
}
- public function testWriteAfterSeekSetWithNotEnoughSpace() {
+ public function testWriteAfterSeekSetWithNotEnoughSpace(): void {
$stream = $this->getStream('w+', 13);
fwrite($stream, '0123456789');
fseek($stream, 7, SEEK_SET);
@@ -124,7 +124,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('0123456abcdef', fread($stream, 100));
}
- public function testWriteAfterSeekCurWithEnoughSpace() {
+ public function testWriteAfterSeekCurWithEnoughSpace(): void {
$stream = $this->getStream('w+', 100);
fwrite($stream, '0123456789');
rewind($stream);
@@ -136,7 +136,7 @@ class QuotaTest extends \Test\TestCase {
$this->assertEquals('0123456abcdefghijk', fread($stream, 100));
}
- public function testWriteAfterSeekCurWithNotEnoughSpace() {
+ public function testWriteAfterSeekCurWithNotEnoughSpace(): void {
$stream = $this->getStream('w+', 13);
fwrite($stream, '0123456789');
rewind($stream);
diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php
index e647fa064d4..dcbb455efc9 100644
--- a/tests/lib/Files/Type/DetectionTest.php
+++ b/tests/lib/Files/Type/DetectionTest.php
@@ -117,7 +117,7 @@ class DetectionTest extends \Test\TestCase {
$this->assertEquals($expected, $this->detection->getSecureMimeType($mimeType));
}
- public function testMimeTypeIcon() {
+ public function testMimeTypeIcon(): void {
if (!class_exists('org\\bovigo\\vfs\\vfsStream')) {
$this->markTestSkipped('Package vfsStream not installed');
}
diff --git a/tests/lib/Files/Type/LoaderTest.php b/tests/lib/Files/Type/LoaderTest.php
index cd2788bd208..6eaf6ac2013 100644
--- a/tests/lib/Files/Type/LoaderTest.php
+++ b/tests/lib/Files/Type/LoaderTest.php
@@ -30,7 +30,7 @@ class LoaderTest extends TestCase {
}
- public function testGetMimetype() {
+ public function testGetMimetype(): void {
$qb = $this->db->getQueryBuilder();
$qb->insert('mimetypes')
->values([
@@ -46,13 +46,13 @@ class LoaderTest extends TestCase {
$this->assertEquals('testing/mymimetype', $mimetype);
}
- public function testGetNonexistentMimetype() {
+ public function testGetNonexistentMimetype(): void {
$this->assertFalse($this->loader->exists('testing/nonexistent'));
// hopefully this ID doesn't exist
$this->assertNull($this->loader->getMimetypeById(12345));
}
- public function testStore() {
+ public function testStore(): void {
$this->assertFalse($this->loader->exists('testing/mymimetype'));
$mimetypeId = $this->loader->getId('testing/mymimetype');
@@ -70,7 +70,7 @@ class LoaderTest extends TestCase {
$this->assertEquals($mimetypeId, $this->loader->getId('testing/mymimetype'));
}
- public function testStoreExists() {
+ public function testStoreExists(): void {
$mimetypeId = $this->loader->getId('testing/mymimetype');
$mimetypeId2 = $this->loader->getId('testing/mymimetype');
diff --git a/tests/lib/Files/Utils/ScannerTest.php b/tests/lib/Files/Utils/ScannerTest.php
index c3ba696ac5c..f66bb72e865 100644
--- a/tests/lib/Files/Utils/ScannerTest.php
+++ b/tests/lib/Files/Utils/ScannerTest.php
@@ -61,7 +61,7 @@ class ScannerTest extends \Test\TestCase {
parent::tearDown();
}
- public function testReuseExistingRoot() {
+ public function testReuseExistingRoot(): void {
$storage = new Temporary([]);
$mount = new MountPoint($storage, '');
Filesystem::getMountManager()->addMount($mount);
@@ -83,7 +83,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertEquals($oldRoot, $newRoot);
}
- public function testReuseExistingFile() {
+ public function testReuseExistingFile(): void {
$storage = new Temporary([]);
$mount = new MountPoint($storage, '');
Filesystem::getMountManager()->addMount($mount);
@@ -105,7 +105,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertEquals($old, $new);
}
- public function testScanSubMount() {
+ public function testScanSubMount(): void {
$uid = $this->getUniqueID();
$this->userBackend->createUser($uid, 'test');
@@ -159,7 +159,7 @@ class ScannerTest extends \Test\TestCase {
* @dataProvider invalidPathProvider
* @param string $invalidPath
*/
- public function testInvalidPathScanning($invalidPath) {
+ public function testInvalidPathScanning($invalidPath): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid path to scan');
@@ -167,7 +167,7 @@ class ScannerTest extends \Test\TestCase {
$scanner->scan($invalidPath);
}
- public function testPropagateEtag() {
+ public function testPropagateEtag(): void {
$storage = new Temporary([]);
$mount = new MountPoint($storage, '');
Filesystem::getMountManager()->addMount($mount);
@@ -191,7 +191,7 @@ class ScannerTest extends \Test\TestCase {
$this->assertNotEquals($oldRoot->getEtag(), $newRoot->getEtag());
}
- public function testShallow() {
+ public function testShallow(): void {
$storage = new Temporary([]);
$mount = new MountPoint($storage, '');
Filesystem::getMountManager()->addMount($mount);
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 43a25150eaf..0a029889fb1 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -147,7 +147,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testCacheAPI() {
+ public function testCacheAPI(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$storage3 = $this->getTestStorage();
@@ -230,7 +230,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testGetPath() {
+ public function testGetPath(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$storage3 = $this->getTestStorage();
@@ -257,7 +257,7 @@ class ViewTest extends \Test\TestCase {
}
- public function testGetPathNotExisting() {
+ public function testGetPathNotExisting(): void {
$this->expectException(\OCP\Files\NotFoundException::class);
$storage1 = $this->getTestStorage();
@@ -274,7 +274,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testMountPointOverwrite() {
+ public function testMountPointOverwrite(): void {
$storage1 = $this->getTestStorage(false);
$storage2 = $this->getTestStorage();
$storage1->mkdir('substorage');
@@ -296,7 +296,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider sharingDisabledPermissionProvider
*/
- public function testRemoveSharePermissionWhenSharingDisabledForUser($excludeGroups, $excludeGroupsList, $expectedShareable) {
+ public function testRemoveSharePermissionWhenSharingDisabledForUser($excludeGroups, $excludeGroupsList, $expectedShareable): void {
// Reset sharing disabled for users cache
self::invokePrivate(\OC::$server->get(ShareDisableChecker::class), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
@@ -326,7 +326,7 @@ class ViewTest extends \Test\TestCase {
self::invokePrivate(\OC::$server->get(ShareDisableChecker::class), 'sharingDisabledForUsersCache', [new CappedMemoryCache()]);
}
- public function testCacheIncompleteFolder() {
+ public function testCacheIncompleteFolder(): void {
$storage1 = $this->getTestStorage(false);
Filesystem::mount($storage1, [], '/incomplete');
$rootView = new View('/incomplete');
@@ -339,7 +339,7 @@ class ViewTest extends \Test\TestCase {
$this->assertCount(1, $entries);
}
- public function testAutoScan() {
+ public function testAutoScan(): void {
$storage1 = $this->getTestStorage(false);
$storage2 = $this->getTestStorage(false);
Filesystem::mount($storage1, [], '/');
@@ -360,7 +360,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testSearch() {
+ public function testSearch(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$storage3 = $this->getTestStorage();
@@ -410,7 +410,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testWatcher() {
+ public function testWatcher(): void {
$storage1 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
$storage1->getWatcher()->setPolicy(Watcher::CHECK_ALWAYS);
@@ -431,7 +431,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testCopyBetweenStorageNoCross() {
+ public function testCopyBetweenStorageNoCross(): void {
$storage1 = $this->getTestStorage(true, TemporaryNoCross::class);
$storage2 = $this->getTestStorage(true, TemporaryNoCross::class);
$this->copyBetweenStorages($storage1, $storage2);
@@ -440,7 +440,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testCopyBetweenStorageCross() {
+ public function testCopyBetweenStorageCross(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->copyBetweenStorages($storage1, $storage2);
@@ -449,7 +449,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testCopyBetweenStorageCrossNonLocal() {
+ public function testCopyBetweenStorageCrossNonLocal(): void {
$storage1 = $this->getTestStorage(true, TemporaryNoLocal::class);
$storage2 = $this->getTestStorage(true, TemporaryNoLocal::class);
$this->copyBetweenStorages($storage1, $storage2);
@@ -477,7 +477,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testMoveBetweenStorageNoCross() {
+ public function testMoveBetweenStorageNoCross(): void {
$storage1 = $this->getTestStorage(true, TemporaryNoCross::class);
$storage2 = $this->getTestStorage(true, TemporaryNoCross::class);
$this->moveBetweenStorages($storage1, $storage2);
@@ -486,7 +486,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testMoveBetweenStorageCross() {
+ public function testMoveBetweenStorageCross(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$this->moveBetweenStorages($storage1, $storage2);
@@ -495,7 +495,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testMoveBetweenStorageCrossNonLocal() {
+ public function testMoveBetweenStorageCrossNonLocal(): void {
$storage1 = $this->getTestStorage(true, TemporaryNoLocal::class);
$storage2 = $this->getTestStorage(true, TemporaryNoLocal::class);
$this->moveBetweenStorages($storage1, $storage2);
@@ -518,7 +518,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testUnlink() {
+ public function testUnlink(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
@@ -545,7 +545,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider rmdirOrUnlinkDataProvider
*/
- public function testRmdir($method) {
+ public function testRmdir($method): void {
$storage1 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
@@ -564,7 +564,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testUnlinkRootMustFail() {
+ public function testUnlinkRootMustFail(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
@@ -583,7 +583,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testTouch() {
+ public function testTouch(): void {
$storage = $this->getTestStorage(true, TemporaryNoTouch::class);
Filesystem::mount($storage, [], '/');
@@ -607,7 +607,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testTouchFloat() {
+ public function testTouchFloat(): void {
$storage = $this->getTestStorage(true, TemporaryNoTouch::class);
Filesystem::mount($storage, [], '/');
@@ -624,7 +624,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testViewHooks() {
+ public function testViewHooks(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$defaultRoot = Filesystem::getRoot();
@@ -649,7 +649,7 @@ class ViewTest extends \Test\TestCase {
$this->hookPath = $params['path'];
}
- public function testSearchNotOutsideView() {
+ public function testSearchNotOutsideView(): void {
$storage1 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
$storage1->rename('folder', 'foo');
@@ -690,7 +690,7 @@ class ViewTest extends \Test\TestCase {
/**
* @medium
*/
- public function testViewHooksIfRootStartsTheSame() {
+ public function testViewHooksIfRootStartsTheSame(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$defaultRoot = Filesystem::getRoot();
@@ -721,7 +721,7 @@ class ViewTest extends \Test\TestCase {
$this->hookCreatePath = $params['path'];
}
- public function testEditNoCreateHook() {
+ public function testEditNoCreateHook(): void {
$storage1 = $this->getTestStorage();
$storage2 = $this->getTestStorage();
$defaultRoot = Filesystem::getRoot();
@@ -754,7 +754,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider resolvePathTestProvider
*/
- public function testResolvePath($expected, $pathToTest) {
+ public function testResolvePath($expected, $pathToTest): void {
$storage1 = $this->getTestStorage();
Filesystem::mount($storage1, [], '/');
@@ -785,7 +785,7 @@ class ViewTest extends \Test\TestCase {
];
}
- public function testUTF8Names() {
+ public function testUTF8Names(): void {
$names = ['虚', '和知しゃ和で', 'regular ascii', 'sɨˈrɪlɪk', 'ѨѬ', 'أنا أحب القراءة كثيرا'];
$storage = new Temporary([]);
@@ -864,7 +864,7 @@ class ViewTest extends \Test\TestCase {
}
}
- public function testTouchNotSupported() {
+ public function testTouchNotSupported(): void {
$storage = new TemporaryNoTouch([]);
$scanner = $storage->getScanner();
Filesystem::mount($storage, [], '/test/');
@@ -881,7 +881,7 @@ class ViewTest extends \Test\TestCase {
$this->assertSame($info['etag'], $info2['etag']);
}
- public function testWatcherEtagCrossStorage() {
+ public function testWatcherEtagCrossStorage(): void {
$storage1 = new Temporary([]);
$storage2 = new Temporary([]);
$scanner1 = $storage1->getScanner();
@@ -916,12 +916,12 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider absolutePathProvider
*/
- public function testGetAbsolutePath($expectedPath, $relativePath) {
+ public function testGetAbsolutePath($expectedPath, $relativePath): void {
$view = new View('/files');
$this->assertEquals($expectedPath, $view->getAbsolutePath($relativePath));
}
- public function testPartFileInfo() {
+ public function testPartFileInfo(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
Filesystem::mount($storage, [], '/test/');
@@ -950,7 +950,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider chrootRelativePathProvider
*/
- public function testChrootGetRelativePath($root, $absolutePath, $expectedPath) {
+ public function testChrootGetRelativePath($root, $absolutePath, $expectedPath): void {
$view = new View('/files');
$view->chroot($root);
$this->assertEquals($expectedPath, $view->getRelativePath($absolutePath));
@@ -963,7 +963,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider initRelativePathProvider
*/
- public function testInitGetRelativePath($root, $absolutePath, $expectedPath) {
+ public function testInitGetRelativePath($root, $absolutePath, $expectedPath): void {
$view = new View($root);
$this->assertEquals($expectedPath, $view->getRelativePath($absolutePath));
}
@@ -1043,7 +1043,7 @@ class ViewTest extends \Test\TestCase {
];
}
- public function testFileView() {
+ public function testFileView(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$storage->file_put_contents('foo.txt', 'bar');
@@ -1062,7 +1062,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider tooLongPathDataProvider
*/
- public function testTooLongPath($operation, $param0 = null) {
+ public function testTooLongPath($operation, $param0 = null): void {
$this->expectException(\OCP\Files\InvalidPathException::class);
@@ -1137,7 +1137,7 @@ class ViewTest extends \Test\TestCase {
];
}
- public function testRenameCrossStoragePreserveMtime() {
+ public function testRenameCrossStoragePreserveMtime(): void {
$storage1 = new Temporary([]);
$storage2 = new Temporary([]);
$storage1->mkdir('sub');
@@ -1162,11 +1162,11 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals($time, $view->filemtime('/test/sub/storage/foo/bar.txt'));
}
- public function testRenameFailDeleteTargetKeepSource() {
+ public function testRenameFailDeleteTargetKeepSource(): void {
$this->doTestCopyRenameFail('rename');
}
- public function testCopyFailDeleteTargetKeepSource() {
+ public function testCopyFailDeleteTargetKeepSource(): void {
$this->doTestCopyRenameFail('copy');
}
@@ -1179,7 +1179,7 @@ class ViewTest extends \Test\TestCase {
->getMock();
$storage2->method('writeStream')
- ->willThrowException(new GenericFileException("Failed to copy stream"));
+ ->willThrowException(new GenericFileException('Failed to copy stream'));
$storage1->mkdir('sub');
$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');
@@ -1217,7 +1217,7 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($storage2->getCache()->get('dirtomove/indir2.txt'));
}
- public function testDeleteFailKeepCache() {
+ public function testDeleteFailKeepCache(): void {
/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
$storage = $this->getMockBuilder(Temporary::class)
->setConstructorArgs([[]])
@@ -1250,13 +1250,13 @@ class ViewTest extends \Test\TestCase {
* @dataProvider directoryTraversalProvider
* @param string $root
*/
- public function testConstructDirectoryTraversalException($root) {
+ public function testConstructDirectoryTraversalException($root): void {
$this->expectException(\Exception::class);
new View($root);
}
- public function testRenameOverWrite() {
+ public function testRenameOverWrite(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$storage->mkdir('sub');
@@ -1269,7 +1269,7 @@ class ViewTest extends \Test\TestCase {
$this->assertTrue($view->rename('/test/foo.txt', '/test/foo/bar.txt'));
}
- public function testSetMountOptionsInStorage() {
+ public function testSetMountOptionsInStorage(): void {
$mount = new MountPoint(Temporary::class, '/asd/', [[]], Filesystem::getLoader(), ['foo' => 'bar']);
Filesystem::getMountManager()->addMount($mount);
/** @var \OC\Files\Storage\Common $storage */
@@ -1277,7 +1277,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals($storage->getMountOption('foo'), 'bar');
}
- public function testSetMountOptionsWatcherPolicy() {
+ public function testSetMountOptionsWatcherPolicy(): void {
$mount = new MountPoint(Temporary::class, '/asd/', [[]], Filesystem::getLoader(), ['filesystem_check_changes' => Watcher::CHECK_NEVER]);
Filesystem::getMountManager()->addMount($mount);
/** @var \OC\Files\Storage\Common $storage */
@@ -1286,18 +1286,18 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals(Watcher::CHECK_NEVER, $watcher->getPolicy());
}
- public function testGetAbsolutePathOnNull() {
+ public function testGetAbsolutePathOnNull(): void {
$view = new View();
$this->assertNull($view->getAbsolutePath(null));
}
- public function testGetRelativePathOnNull() {
+ public function testGetRelativePathOnNull(): void {
$view = new View();
$this->assertNull($view->getRelativePath(null));
}
- public function testNullAsRoot() {
+ public function testNullAsRoot(): void {
$this->expectException(\TypeError::class);
new View(null);
@@ -1312,7 +1312,7 @@ class ViewTest extends \Test\TestCase {
* @param string $rootPath
* @param string $pathPrefix
*/
- public function testReadFromWriteLockedPath($rootPath, $pathPrefix) {
+ public function testReadFromWriteLockedPath($rootPath, $pathPrefix): void {
$this->expectException(\OCP\Lock\LockedException::class);
$rootPath = str_replace('{folder}', 'files', $rootPath);
@@ -1333,7 +1333,7 @@ class ViewTest extends \Test\TestCase {
* @param string $rootPath
* @param string $pathPrefix
*/
- public function testReadFromWriteUnlockablePath($rootPath, $pathPrefix) {
+ public function testReadFromWriteUnlockablePath($rootPath, $pathPrefix): void {
$rootPath = str_replace('{folder}', 'files_encryption', $rootPath);
$pathPrefix = str_replace('{folder}', 'files_encryption', $pathPrefix);
@@ -1353,7 +1353,7 @@ class ViewTest extends \Test\TestCase {
* @param string $rootPath
* @param string $pathPrefix
*/
- public function testWriteToReadLockedFile($rootPath, $pathPrefix) {
+ public function testWriteToReadLockedFile($rootPath, $pathPrefix): void {
$this->expectException(\OCP\Lock\LockedException::class);
$rootPath = str_replace('{folder}', 'files', $rootPath);
@@ -1374,7 +1374,7 @@ class ViewTest extends \Test\TestCase {
* @param string $rootPath
* @param string $pathPrefix
*/
- public function testWriteToReadUnlockableFile($rootPath, $pathPrefix) {
+ public function testWriteToReadUnlockableFile($rootPath, $pathPrefix): void {
$rootPath = str_replace('{folder}', 'files_encryption', $rootPath);
$pathPrefix = str_replace('{folder}', 'files_encryption', $pathPrefix);
@@ -1388,7 +1388,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test that locks are on mount point paths instead of mount root
*/
- public function testLockLocalMountPointPathInsteadOfStorageRoot() {
+ public function testLockLocalMountPointPathInsteadOfStorageRoot(): void {
$lockingProvider = \OC::$server->get(ILockingProvider::class);
$view = new View('/testuser/files/');
$storage = new Temporary([]);
@@ -1418,7 +1418,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test that locks are on mount point paths and also mount root when requested
*/
- public function testLockStorageRootButNotLocalMountPoint() {
+ public function testLockStorageRootButNotLocalMountPoint(): void {
$lockingProvider = \OC::$server->get(ILockingProvider::class);
$view = new View('/testuser/files/');
$storage = new Temporary([]);
@@ -1448,7 +1448,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test that locks are on mount point paths and also mount root when requested
*/
- public function testLockMountPointPathFailReleasesBoth() {
+ public function testLockMountPointPathFailReleasesBoth(): void {
$lockingProvider = \OC::$server->get(ILockingProvider::class);
$view = new View('/testuser/files/');
$storage = new Temporary([]);
@@ -1499,7 +1499,7 @@ class ViewTest extends \Test\TestCase {
/**
* @dataProvider pathRelativeToFilesProvider
*/
- public function testGetPathRelativeToFiles($path, $expectedPath) {
+ public function testGetPathRelativeToFiles($path, $expectedPath): void {
$view = new View();
$this->assertEquals($expectedPath, $view->getPathRelativeToFiles($path));
}
@@ -1518,7 +1518,7 @@ class ViewTest extends \Test\TestCase {
* @dataProvider pathRelativeToFilesProviderExceptionCases
* @param string $path
*/
- public function testGetPathRelativeToFilesWithInvalidArgument($path) {
+ public function testGetPathRelativeToFilesWithInvalidArgument($path): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('$absolutePath must be relative to "files"');
@@ -1526,7 +1526,7 @@ class ViewTest extends \Test\TestCase {
$view->getPathRelativeToFiles($path);
}
- public function testChangeLock() {
+ public function testChangeLock(): void {
$view = new View('/testuser/files/');
$storage = new Temporary([]);
Filesystem::mount($storage, [], '/');
@@ -1565,7 +1565,7 @@ class ViewTest extends \Test\TestCase {
* @param $path
* @param $shouldEmit
*/
- public function testHookPaths($root, $path, $shouldEmit) {
+ public function testHookPaths($root, $path, $shouldEmit): void {
$filesystemReflection = new \ReflectionClass(Filesystem::class);
$defaultRootValue = $filesystemReflection->getProperty('defaultInstance');
$defaultRootValue->setAccessible(true);
@@ -1617,7 +1617,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test mount point move
*/
- public function testMountPointMove() {
+ public function testMountPointMove(): void {
self::loginAsUser($this->user);
[$mount1, $mount2] = $this->createTestMovableMountPoints([
@@ -1642,7 +1642,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test that moving a mount point into another is forbidden
*/
- public function testMoveMountPointIntoAnother() {
+ public function testMoveMountPointIntoAnother(): void {
self::loginAsUser($this->user);
[$mount1, $mount2] = $this->createTestMovableMountPoints([
@@ -1665,20 +1665,27 @@ class ViewTest extends \Test\TestCase {
/**
* Test that moving a mount point into a shared folder is forbidden
*/
- public function testMoveMountPointIntoSharedFolder() {
+ public function testMoveMountPointIntoSharedFolder(): void {
self::loginAsUser($this->user);
- [$mount1] = $this->createTestMovableMountPoints([
+ [$mount1, $mount2] = $this->createTestMovableMountPoints([
$this->user . '/files/mount1',
+ $this->user . '/files/mount2',
]);
$mount1->expects($this->never())
->method('moveMount');
+ $mount2->expects($this->once())
+ ->method('moveMount')
+ ->willReturn(true);
+
$view = new View('/' . $this->user . '/files/');
$view->mkdir('shareddir');
$view->mkdir('shareddir/sub');
$view->mkdir('shareddir/sub2');
+ // Create a similar named but non-shared folder
+ $view->mkdir('shareddir notshared');
$fileId = $view->getFileInfo('shareddir')->getId();
$userObject = \OC::$server->getUserManager()->createUser('test2', 'IHateNonMockableStaticClasses');
@@ -1697,6 +1704,7 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($view->rename('mount1', 'shareddir'), 'Cannot overwrite shared folder');
$this->assertFalse($view->rename('mount1', 'shareddir/sub'), 'Cannot move mount point into shared folder');
$this->assertFalse($view->rename('mount1', 'shareddir/sub/sub2'), 'Cannot move mount point into shared subfolder');
+ $this->assertTrue($view->rename('mount2', 'shareddir notshared/sub'), 'Can move mount point into a similarly named but non-shared folder');
$shareManager->deleteShare($share);
$userObject->delete();
@@ -1836,7 +1844,7 @@ class ViewTest extends \Test\TestCase {
* @param int $expectedLockDuring expected lock during operation
* @param int $expectedLockAfter expected lock during post hooks
* @param int $expectedStrayLock expected lock after returning, should
- * be null (unlock) for most operations
+ * be null (unlock) for most operations
*/
public function testLockBasicOperation(
$operation,
@@ -1848,7 +1856,7 @@ class ViewTest extends \Test\TestCase {
$expectedLockAfter = ILockingProvider::LOCK_SHARED,
$expectedStrayLock = null,
$returnValue = true,
- ) {
+ ): void {
$view = new View('/' . $this->user . '/files/');
/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
@@ -1897,7 +1905,7 @@ class ViewTest extends \Test\TestCase {
* Test locks for file_put_content with stream.
* This code path uses $storage->fopen instead
*/
- public function testLockFilePutContentWithStream() {
+ public function testLockFilePutContentWithStream(): void {
$view = new View('/' . $this->user . '/files/');
$path = 'test_file_put_contents.txt';
@@ -1936,7 +1944,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test locks for fopen with fclose at the end
*/
- public function testLockFopen() {
+ public function testLockFopen(): void {
$view = new View('/' . $this->user . '/files/');
$path = 'test_file_put_contents.txt';
@@ -1989,9 +1997,9 @@ class ViewTest extends \Test\TestCase {
$operation,
$operationArgs,
$path
- ) {
+ ): void {
if ($operation === 'touch') {
- $this->markTestSkipped("touch handles storage exceptions internally");
+ $this->markTestSkipped('touch handles storage exceptions internally');
}
$view = new View('/' . $this->user . '/files/');
@@ -2028,7 +2036,7 @@ class ViewTest extends \Test\TestCase {
$this->assertNull($this->getFileLockType($view, $path), 'File got unlocked after exception');
}
- public function testLockBasicOperationUnlocksAfterLockException() {
+ public function testLockBasicOperationUnlocksAfterLockException(): void {
$view = new View('/' . $this->user . '/files/');
$storage = new Temporary([]);
@@ -2074,7 +2082,7 @@ class ViewTest extends \Test\TestCase {
$operationArgs,
$path,
$hookType
- ) {
+ ): void {
$view = new View('/' . $this->user . '/files/');
/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
@@ -2111,9 +2119,9 @@ class ViewTest extends \Test\TestCase {
*
* @param string $operation operation to be done on the view
* @param int $expectedLockTypeSourceDuring expected lock type on source file during
- * the operation
+ * the operation
*/
- public function testLockFileRename($operation, $expectedLockTypeSourceDuring) {
+ public function testLockFileRename($operation, $expectedLockTypeSourceDuring): void {
$view = new View('/' . $this->user . '/files/');
/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
@@ -2177,7 +2185,7 @@ class ViewTest extends \Test\TestCase {
* We expect that we catch the exception, free the lock and re-throw it.
*
*/
- public function testLockFileCopyException() {
+ public function testLockFileCopyException(): void {
$this->expectException(\Exception::class);
$view = new View('/' . $this->user . '/files/');
@@ -2220,7 +2228,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test rename operation: unlock first path when second path was locked
*/
- public function testLockFileRenameUnlockOnException() {
+ public function testLockFileRenameUnlockOnException(): void {
self::loginAsUser('test');
$view = new View('/' . $this->user . '/files/');
@@ -2253,7 +2261,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test rename operation: unlock first path when second path was locked
*/
- public function testGetOwner() {
+ public function testGetOwner(): void {
self::loginAsUser('test');
$view = new View('/test/files/');
@@ -2296,9 +2304,9 @@ class ViewTest extends \Test\TestCase {
* @param string $viewOperation operation to be done on the view
* @param string $storageOperation operation to be mocked on the storage
* @param int $expectedLockTypeSourceDuring expected lock type on source file during
- * the operation
+ * the operation
*/
- public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring) {
+ public function testLockFileRenameCrossStorage($viewOperation, $storageOperation, $expectedLockTypeSourceDuring): void {
$view = new View('/' . $this->user . '/files/');
/** @var Temporary|\PHPUnit\Framework\MockObject\MockObject $storage */
@@ -2367,7 +2375,7 @@ class ViewTest extends \Test\TestCase {
/**
* Test locks when moving a mount point
*/
- public function testLockMoveMountPoint() {
+ public function testLockMoveMountPoint(): void {
self::loginAsUser('test');
[$mount] = $this->createTestMovableMountPoints([
@@ -2434,7 +2442,7 @@ class ViewTest extends \Test\TestCase {
* @param int $lockTypePre variable to receive lock type that was active in the pre-hook
* @param int $lockTypePost variable to receive lock type that was active in the post-hook
* @param bool $onMountPoint true to check the mount point instead of the
- * mounted storage
+ * mounted storage
*/
private function connectMockHooks($hookType, $view, $path, &$lockTypePre, &$lockTypePost, $onMountPoint = false) {
if ($hookType === null) {
@@ -2482,7 +2490,7 @@ class ViewTest extends \Test\TestCase {
* @param View $view view
* @param string $path path
* @param bool $onMountPoint true to check the mount point instead of the
- * mounted storage
+ * mounted storage
*
* @return int lock type or null if file was not locked
*/
@@ -2496,7 +2504,7 @@ class ViewTest extends \Test\TestCase {
}
- public function testRemoveMoveableMountPoint() {
+ public function testRemoveMoveableMountPoint(): void {
$mountPoint = '/' . $this->user . '/files/mount/';
// Mock the mount point
@@ -2557,7 +2565,7 @@ class ViewTest extends \Test\TestCase {
* @param string[] $expected
* @dataProvider mimeFilterProvider
*/
- public function testGetDirectoryContentMimeFilter($filter, $expected) {
+ public function testGetDirectoryContentMimeFilter($filter, $expected): void {
$storage1 = new Temporary();
$root = self::getUniqueID('/');
Filesystem::mount($storage1, [], $root . '/');
@@ -2578,7 +2586,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals($expected, $files);
}
- public function testFilePutContentsClearsChecksum() {
+ public function testFilePutContentsClearsChecksum(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$storage->file_put_contents('foo.txt', 'bar');
@@ -2599,7 +2607,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals('', $data->getChecksum());
}
- public function testDeleteGhostFile() {
+ public function testDeleteGhostFile(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$cache = $storage->getCache();
@@ -2622,7 +2630,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals(0, $newInfo->getSize());
}
- public function testDeleteGhostFolder() {
+ public function testDeleteGhostFolder(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$cache = $storage->getCache();
@@ -2648,7 +2656,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals(0, $newInfo->getSize());
}
- public function testCreateParentDirectories() {
+ public function testCreateParentDirectories(): void {
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->setMethods([
@@ -2687,7 +2695,7 @@ class ViewTest extends \Test\TestCase {
$this->assertTrue(self::invokePrivate($view, 'createParentDirectories', ['/new/folder/structure']));
}
- public function testCreateParentDirectoriesWithExistingFile() {
+ public function testCreateParentDirectoriesWithExistingFile(): void {
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()
->setMethods([
@@ -2705,7 +2713,7 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse(self::invokePrivate($view, 'createParentDirectories', ['/file.txt/folder/structure']));
}
- public function testCacheExtension() {
+ public function testCacheExtension(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$storage->file_put_contents('foo.txt', 'bar');
@@ -2725,7 +2733,7 @@ class ViewTest extends \Test\TestCase {
$this->assertEquals(0, $info->getCreationTime());
}
- public function testFopenGone() {
+ public function testFopenGone(): void {
$storage = new Temporary([]);
$scanner = $storage->getScanner();
$storage->file_put_contents('foo.txt', 'bar');
@@ -2743,4 +2751,35 @@ class ViewTest extends \Test\TestCase {
$this->assertFalse($cache->inCache('foo.txt'));
}
+
+ public function testMountpointParentsCreated(): void {
+ $storage1 = $this->getTestStorage();
+ Filesystem::mount($storage1, [], '/');
+
+ $storage2 = $this->getTestStorage();
+ Filesystem::mount($storage2, [], '/A/B/C');
+
+ $rootView = new View('');
+
+ $folderData = $rootView->getDirectoryContent('/');
+ $this->assertCount(4, $folderData);
+ $this->assertEquals('folder', $folderData[0]['name']);
+ $this->assertEquals('foo.png', $folderData[1]['name']);
+ $this->assertEquals('foo.txt', $folderData[2]['name']);
+ $this->assertEquals('A', $folderData[3]['name']);
+
+ $folderData = $rootView->getDirectoryContent('/A');
+ $this->assertCount(1, $folderData);
+ $this->assertEquals('B', $folderData[0]['name']);
+
+ $folderData = $rootView->getDirectoryContent('/A/B');
+ $this->assertCount(1, $folderData);
+ $this->assertEquals('C', $folderData[0]['name']);
+
+ $folderData = $rootView->getDirectoryContent('/A/B/C');
+ $this->assertCount(3, $folderData);
+ $this->assertEquals('folder', $folderData[0]['name']);
+ $this->assertEquals('foo.png', $folderData[1]['name']);
+ $this->assertEquals('foo.txt', $folderData[2]['name']);
+ }
}
diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php
index b64a3bf2224..aa001268ecd 100644
--- a/tests/lib/GlobalScale/ConfigTest.php
+++ b/tests/lib/GlobalScale/ConfigTest.php
@@ -11,7 +11,7 @@ use OCP\IConfig;
use Test\TestCase;
class ConfigTest extends TestCase {
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
+ /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
private $config;
protected function setUp(): void {
@@ -35,7 +35,7 @@ class ConfigTest extends TestCase {
return new Config($this->config);
}
- public function testIsGlobalScaleEnabled() {
+ public function testIsGlobalScaleEnabled(): void {
$gsConfig = $this->getInstance();
$this->config->expects($this->once())->method('getSystemValueBool')
->with('gs.enabled', false)->willReturn(true);
@@ -53,7 +53,7 @@ class ConfigTest extends TestCase {
* @param string $gsFederation
* @param bool $expected
*/
- public function testOnlyInternalFederation($gsEnabled, $gsFederation, $expected) {
+ public function testOnlyInternalFederation($gsEnabled, $gsFederation, $expected): void {
$gsConfig = $this->getInstance(['isGlobalScaleEnabled']);
$gsConfig->expects($this->any())->method('isGlobalScaleEnabled')->willReturn($gsEnabled);
diff --git a/tests/lib/Group/Backend.php b/tests/lib/Group/Backend.php
index 7eb71d0f22c..1b6bfe840f8 100644
--- a/tests/lib/Group/Backend.php
+++ b/tests/lib/Group/Backend.php
@@ -42,7 +42,7 @@ abstract class Backend extends \Test\TestCase {
return $this->getUniqueID('test_');
}
- public function testAddRemove() {
+ public function testAddRemove(): void {
//get the number of groups we start with, in case there are exising groups
$startCount = count($this->backend->getGroups());
@@ -66,7 +66,7 @@ abstract class Backend extends \Test\TestCase {
$this->assertFalse((array_search($name2, $this->backend->getGroups()) !== false));
}
- public function testUser() {
+ public function testUser(): void {
$group1 = $this->getGroupName();
$group2 = $this->getGroupName();
$this->backend->createGroup($group1);
@@ -101,7 +101,7 @@ abstract class Backend extends \Test\TestCase {
$this->assertFalse($this->backend->inGroup($user1, $group1));
}
- public function testSearchGroups() {
+ public function testSearchGroups(): void {
$name1 = $this->getGroupName('foobarbaz');
$name2 = $this->getGroupName('bazbarfoo');
$name3 = $this->getGroupName('notme');
@@ -114,7 +114,7 @@ abstract class Backend extends \Test\TestCase {
$this->assertSame(2, count($result));
}
- public function testSearchUsers() {
+ public function testSearchUsers(): void {
$group = $this->getGroupName();
$this->backend->createGroup($group);
@@ -133,7 +133,7 @@ abstract class Backend extends \Test\TestCase {
$this->assertSame(2, $result);
}
- public function testAddDouble() {
+ public function testAddDouble(): void {
$group = $this->getGroupName();
$this->backend->createGroup($group);
diff --git a/tests/lib/Group/GroupTest.php b/tests/lib/Group/GroupTest.php
index 9ca178d4a41..0730f827c64 100644
--- a/tests/lib/Group/GroupTest.php
+++ b/tests/lib/Group/GroupTest.php
@@ -60,7 +60,7 @@ class GroupTest extends \Test\TestCase {
return $userManager;
}
- public function testGetUsersSingleBackend() {
+ public function testGetUsersSingleBackend(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -81,7 +81,7 @@ class GroupTest extends \Test\TestCase {
$this->assertEquals('user2', $user2->getUID());
}
- public function testGetUsersMultipleBackends() {
+ public function testGetUsersMultipleBackends(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -112,7 +112,7 @@ class GroupTest extends \Test\TestCase {
$this->assertEquals('user3', $user3->getUID());
}
- public function testInGroupSingleBackend() {
+ public function testInGroupSingleBackend(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -130,7 +130,7 @@ class GroupTest extends \Test\TestCase {
$this->assertTrue($group->inGroup($this->newUser('user1', $userBackend)));
}
- public function testInGroupMultipleBackends() {
+ public function testInGroupMultipleBackends(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -156,7 +156,7 @@ class GroupTest extends \Test\TestCase {
$this->assertTrue($group->inGroup($this->newUser('user1', $userBackend)));
}
- public function testAddUser() {
+ public function testAddUser(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -181,7 +181,7 @@ class GroupTest extends \Test\TestCase {
$group->addUser($this->newUser('user1', $userBackend));
}
- public function testAddUserAlreadyInGroup() {
+ public function testAddUserAlreadyInGroup(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -205,7 +205,7 @@ class GroupTest extends \Test\TestCase {
$group->addUser($this->newUser('user1', $userBackend));
}
- public function testRemoveUser() {
+ public function testRemoveUser(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -230,7 +230,7 @@ class GroupTest extends \Test\TestCase {
$group->removeUser($this->newUser('user1', $userBackend));
}
- public function testRemoveUserNotInGroup() {
+ public function testRemoveUserNotInGroup(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -254,7 +254,7 @@ class GroupTest extends \Test\TestCase {
$group->removeUser($this->newUser('user1', $userBackend));
}
- public function testRemoveUserMultipleBackends() {
+ public function testRemoveUserMultipleBackends(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -294,7 +294,7 @@ class GroupTest extends \Test\TestCase {
$group->removeUser($this->newUser('user1', $userBackend));
}
- public function testSearchUsers() {
+ public function testSearchUsers(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -313,7 +313,7 @@ class GroupTest extends \Test\TestCase {
$this->assertEquals('user2', $user2->getUID());
}
- public function testSearchUsersMultipleBackends() {
+ public function testSearchUsersMultipleBackends(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -339,7 +339,7 @@ class GroupTest extends \Test\TestCase {
$this->assertEquals('user2', $user2->getUID());
}
- public function testSearchUsersLimitAndOffset() {
+ public function testSearchUsersLimitAndOffset(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -358,7 +358,7 @@ class GroupTest extends \Test\TestCase {
$this->assertEquals('user2', $user2->getUID());
}
- public function testSearchUsersMultipleBackendsLimitAndOffset() {
+ public function testSearchUsersMultipleBackendsLimitAndOffset(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -386,7 +386,7 @@ class GroupTest extends \Test\TestCase {
$this->assertEquals('user1', $user1->getUID());
}
- public function testCountUsers() {
+ public function testCountUsers(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -407,7 +407,7 @@ class GroupTest extends \Test\TestCase {
$this->assertSame(3, $users);
}
- public function testCountUsersMultipleBackends() {
+ public function testCountUsersMultipleBackends(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -438,7 +438,7 @@ class GroupTest extends \Test\TestCase {
$this->assertSame(7, $users);
}
- public function testCountUsersNoMethod() {
+ public function testCountUsersNoMethod(): void {
$backend1 = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
@@ -456,7 +456,7 @@ class GroupTest extends \Test\TestCase {
$this->assertSame(false, $users);
}
- public function testDelete() {
+ public function testDelete(): void {
$backend = $this->getMockBuilder('OC\Group\Database')
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/Group/ManagerTest.php b/tests/lib/Group/ManagerTest.php
index 81fd77cc78a..0f8d7a5ecc3 100644
--- a/tests/lib/Group/ManagerTest.php
+++ b/tests/lib/Group/ManagerTest.php
@@ -16,6 +16,7 @@ use OCP\Group\Backend\ISearchableGroupBackend;
use OCP\GroupInterface;
use OCP\ICacheFactory;
use OCP\IUser;
+use OCP\Security\Ip\IRemoteAddress;
use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
use Test\TestCase;
@@ -32,6 +33,8 @@ class ManagerTest extends TestCase {
protected $logger;
/** @var ICacheFactory|MockObject */
private $cache;
+ /** @var IRemoteAddress|MockObject */
+ private $remoteIpAddress;
protected function setUp(): void {
parent::setUp();
@@ -40,6 +43,9 @@ class ManagerTest extends TestCase {
$this->dispatcher = $this->createMock(IEventDispatcher::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->cache = $this->createMock(ICacheFactory::class);
+
+ $this->remoteIpAddress = $this->createMock(IRemoteAddress::class);
+ $this->remoteIpAddress->method('allowsAdminActions')->willReturn(true);
}
private function getTestUser($userId) {
@@ -93,7 +99,7 @@ class ManagerTest extends TestCase {
return $backend;
}
- public function testGet() {
+ public function testGet(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -103,7 +109,7 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$group = $manager->get('group1');
@@ -111,13 +117,13 @@ class ManagerTest extends TestCase {
$this->assertEquals('group1', $group->getGID());
}
- public function testGetNoBackend() {
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ public function testGetNoBackend(): void {
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$this->assertNull($manager->get('group1'));
}
- public function testGetNotExists() {
+ public function testGetNotExists(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -127,17 +133,17 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(false);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$this->assertNull($manager->get('group1'));
}
- public function testGetDeleted() {
+ public function testGetDeleted(): void {
$backend = new \Test\Util\Group\Dummy();
$backend->createGroup('group1');
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$group = $manager->get('group1');
@@ -145,7 +151,7 @@ class ManagerTest extends TestCase {
$this->assertNull($manager->get('group1'));
}
- public function testGetMultipleBackends() {
+ public function testGetMultipleBackends(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
@@ -164,7 +170,7 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend1);
$manager->addBackend($backend2);
@@ -173,8 +179,8 @@ class ManagerTest extends TestCase {
$this->assertEquals('group1', $group->getGID());
}
- public function testCreate() {
- /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
+ public function testCreate(): void {
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backendGroupCreated = false;
$backend = $this->getTestBackend();
$backend->expects($this->any())
@@ -190,15 +196,15 @@ class ManagerTest extends TestCase {
return true;
});
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$group = $manager->createGroup('group1');
$this->assertEquals('group1', $group->getGID());
}
- public function testCreateFailure() {
- /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
+ public function testCreateFailure(): void {
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backendGroupCreated = false;
$backend = $this->getTestBackend(
GroupInterface::ADD_TO_GROUP |
@@ -219,15 +225,15 @@ class ManagerTest extends TestCase {
->method('getGroupDetails')
->willReturn([]);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$group = $manager->createGroup('group1');
$this->assertEquals(null, $group);
}
- public function testCreateTooLong() {
- /**@var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
+ public function testCreateTooLong(): void {
+ /** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backendGroupCreated = false;
$backend = $this->getTestBackend(
GroupInterface::ADD_TO_GROUP |
@@ -243,14 +249,14 @@ class ManagerTest extends TestCase {
->with($groupName)
->willReturn(false);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$this->expectException(\Exception::class);
$group = $manager->createGroup($groupName);
}
- public function testCreateExists() {
+ public function testCreateExists(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backend = $this->getTestBackend();
$backend->expects($this->any())
@@ -260,14 +266,14 @@ class ManagerTest extends TestCase {
$backend->expects($this->never())
->method('createGroup');
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$group = $manager->createGroup('group1');
$this->assertEquals('group1', $group->getGID());
}
- public function testSearch() {
+ public function testSearch(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -281,7 +287,7 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$groups = $manager->search('1');
@@ -290,7 +296,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('group1', $group1->getGID());
}
- public function testSearchMultipleBackends() {
+ public function testSearchMultipleBackends(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
@@ -315,7 +321,7 @@ class ManagerTest extends TestCase {
->method('groupExists')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend1);
$manager->addBackend($backend2);
@@ -327,7 +333,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('group12', $group12->getGID());
}
- public function testSearchMultipleBackendsLimitAndOffset() {
+ public function testSearchMultipleBackendsLimitAndOffset(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
@@ -352,7 +358,7 @@ class ManagerTest extends TestCase {
->method('groupExists')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend1);
$manager->addBackend($backend2);
@@ -364,7 +370,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('group12', $group12->getGID());
}
- public function testSearchResultExistsButGroupDoesNot() {
+ public function testSearchResultExistsButGroupDoesNot(): void {
/** @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend */
$backend = $this->createMock(Database::class);
$backend->expects($this->once())
@@ -381,14 +387,14 @@ class ManagerTest extends TestCase {
/** @var \OC\User\Manager $userManager */
$userManager = $this->createMock(Manager::class);
- $manager = new \OC\Group\Manager($userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$groups = $manager->search('1');
$this->assertEmpty($groups);
}
- public function testGetUserGroups() {
+ public function testGetUserGroups(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -402,7 +408,7 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$groups = $manager->getUserGroups($this->getTestUser('user1'));
@@ -411,7 +417,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('group1', $group1->getGID());
}
- public function testGetUserGroupIds() {
+ public function testGetUserGroupIds(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -420,7 +426,7 @@ class ManagerTest extends TestCase {
->with('myUID')
->willReturn(['123', 'abc']);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
/** @var \OC\User\User|\PHPUnit\Framework\MockObject\MockObject $user */
@@ -436,7 +442,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetUserGroupsWithDeletedGroup() {
+ public function testGetUserGroupsWithDeletedGroup(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -450,7 +456,7 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(false);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
/** @var \OC\User\User|\PHPUnit\Framework\MockObject\MockObject $user */
@@ -463,7 +469,7 @@ class ManagerTest extends TestCase {
$this->assertEmpty($groups);
}
- public function testInGroup() {
+ public function testInGroup(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -476,13 +482,13 @@ class ManagerTest extends TestCase {
->method('groupExists')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$this->assertTrue($manager->isInGroup('user1', 'group1'));
}
- public function testIsAdmin() {
+ public function testIsAdmin(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -495,13 +501,13 @@ class ManagerTest extends TestCase {
->method('groupExists')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$this->assertTrue($manager->isAdmin('user1'));
}
- public function testNotAdmin() {
+ public function testNotAdmin(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -514,13 +520,13 @@ class ManagerTest extends TestCase {
->method('groupExists')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$this->assertFalse($manager->isAdmin('user1'));
}
- public function testGetUserGroupsMultipleBackends() {
+ public function testGetUserGroupsMultipleBackends(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend1
*/
@@ -545,7 +551,7 @@ class ManagerTest extends TestCase {
->method('groupExists')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend1);
$manager->addBackend($backend2);
@@ -557,7 +563,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('group2', $group2->getGID());
}
- public function testDisplayNamesInGroupWithOneUserBackend() {
+ public function testDisplayNamesInGroupWithOneUserBackend(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -604,7 +610,7 @@ class ManagerTest extends TestCase {
}
});
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$users = $manager->displayNamesInGroup('testgroup', 'user3');
@@ -615,7 +621,7 @@ class ManagerTest extends TestCase {
$this->assertTrue(isset($users['user33']));
}
- public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified() {
+ public function testDisplayNamesInGroupWithOneUserBackendWithLimitSpecified(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -664,7 +670,7 @@ class ManagerTest extends TestCase {
}
});
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$users = $manager->displayNamesInGroup('testgroup', 'user3', 1);
@@ -676,7 +682,7 @@ class ManagerTest extends TestCase {
$this->assertFalse(isset($users['user333']));
}
- public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpecified() {
+ public function testDisplayNamesInGroupWithOneUserBackendWithLimitAndOffsetSpecified(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -728,7 +734,7 @@ class ManagerTest extends TestCase {
}
});
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$users = $manager->displayNamesInGroup('testgroup', 'user3', 1, 1);
@@ -740,7 +746,7 @@ class ManagerTest extends TestCase {
$this->assertTrue(isset($users['user333']));
}
- public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty() {
+ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmpty(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject|\OC\Group\Backend $backend
*/
@@ -757,7 +763,7 @@ class ManagerTest extends TestCase {
$this->userManager->expects($this->never())->method('get');
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$users = $manager->displayNamesInGroup('testgroup', '');
@@ -768,7 +774,7 @@ class ManagerTest extends TestCase {
$this->assertTrue(isset($users['user33']));
}
- public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitSpecified() {
+ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitSpecified(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -785,7 +791,7 @@ class ManagerTest extends TestCase {
$this->userManager->expects($this->never())->method('get');
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$users = $manager->displayNamesInGroup('testgroup', '', 1);
@@ -796,7 +802,7 @@ class ManagerTest extends TestCase {
$this->assertFalse(isset($users['user33']));
}
- public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitAndOffsetSpecified() {
+ public function testDisplayNamesInGroupWithOneUserBackendAndSearchEmptyAndLimitAndOffsetSpecified(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -813,7 +819,7 @@ class ManagerTest extends TestCase {
$this->userManager->expects($this->never())->method('get');
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$users = $manager->displayNamesInGroup('testgroup', '', 1, 1);
@@ -824,7 +830,7 @@ class ManagerTest extends TestCase {
$this->assertTrue(isset($users['user33']));
}
- public function testGetUserGroupsWithAddUser() {
+ public function testGetUserGroupsWithAddUser(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -841,7 +847,7 @@ class ManagerTest extends TestCase {
->with('group1')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
// prime cache
@@ -861,7 +867,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('group1', $group1->getGID());
}
- public function testGetUserGroupsWithRemoveUser() {
+ public function testGetUserGroupsWithRemoveUser(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -884,7 +890,7 @@ class ManagerTest extends TestCase {
->method('removeFromGroup')
->willReturn(true);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
// prime cache
@@ -904,7 +910,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expectedGroups, $groups);
}
- public function testGetUserIdGroups() {
+ public function testGetUserIdGroups(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -914,14 +920,14 @@ class ManagerTest extends TestCase {
->with('user1')
->willReturn(null);
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
$groups = $manager->getUserIdGroups('user1');
$this->assertEquals([], $groups);
}
- public function testGroupDisplayName() {
+ public function testGroupDisplayName(): void {
/**
* @var \PHPUnit\Framework\MockObject\MockObject | \OC\Group\Backend $backend
*/
@@ -939,8 +945,7 @@ class ManagerTest extends TestCase {
['group1', ['gid' => 'group1', 'displayName' => 'Group One']],
['group2', ['gid' => 'group2']],
]);
-
- $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache);
+ $manager = new \OC\Group\Manager($this->userManager, $this->dispatcher, $this->logger, $this->cache, $this->remoteIpAddress);
$manager->addBackend($backend);
// group with display name
diff --git a/tests/lib/Group/MetaDataTest.php b/tests/lib/Group/MetaDataTest.php
index 2ae33c63a25..70f2022ae78 100644
--- a/tests/lib/Group/MetaDataTest.php
+++ b/tests/lib/Group/MetaDataTest.php
@@ -10,14 +10,11 @@ namespace Test\Group;
use OCP\IUserSession;
class MetaDataTest extends \Test\TestCase {
- /** @var \OC\Group\Manager */
- private $groupManager;
- /** @var \OCP\IUserSession */
- private $userSession;
- /** @var \OC\Group\MetaData */
- private $groupMetadata;
- /** @var bool */
- private $isAdmin = true;
+ private \OC\Group\Manager $groupManager;
+ private IUserSession $userSession;
+ private \OC\Group\MetaData $groupMetadata;
+ private bool $isAdmin = true;
+ private bool $isDelegatedAdmin = true;
protected function setUp(): void {
parent::setUp();
@@ -28,6 +25,7 @@ class MetaDataTest extends \Test\TestCase {
$this->groupMetadata = new \OC\Group\MetaData(
'foo',
$this->isAdmin,
+ $this->isDelegatedAdmin,
$this->groupManager,
$this->userSession
);
@@ -61,7 +59,7 @@ class MetaDataTest extends \Test\TestCase {
}
- public function testGet() {
+ public function testGet(): void {
$group = $this->getGroupMock();
$groups = array_fill(0, 3, $group);
@@ -80,7 +78,7 @@ class MetaDataTest extends \Test\TestCase {
$this->assertSame(0, $ordinaryGroups[0]['usercount']);
}
- public function testGetWithSorting() {
+ public function testGetWithSorting(): void {
$this->groupMetadata->setSorting(1);
$group = $this->getGroupMock(3);
$groups = array_fill(0, 3, $group);
@@ -99,7 +97,7 @@ class MetaDataTest extends \Test\TestCase {
$this->assertSame(5, $ordinaryGroups[0]['usercount']);
}
- public function testGetWithCache() {
+ public function testGetWithCache(): void {
$group = $this->getGroupMock();
$groups = array_fill(0, 3, $group);
@@ -117,7 +115,7 @@ class MetaDataTest extends \Test\TestCase {
//get() does not need to be tested with search parameters, because they are
//solely and only passed to GroupManager and Group.
- public function testGetGroupsAsAdmin() {
+ public function testGetGroupsAsAdmin(): void {
$this->groupManager
->expects($this->once())
->method('search')
diff --git a/tests/lib/HelperStorageTest.php b/tests/lib/HelperStorageTest.php
index ddf32d94724..4d5002de3ab 100644
--- a/tests/lib/HelperStorageTest.php
+++ b/tests/lib/HelperStorageTest.php
@@ -84,7 +84,7 @@ class HelperStorageTest extends \Test\TestCase {
/**
* Test getting the storage info
*/
- public function testGetStorageInfo() {
+ public function testGetStorageInfo(): void {
$homeStorage = $this->getStorageMock(12);
\OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files');
$homeStorage->file_put_contents('test.txt', '01234');
@@ -111,7 +111,7 @@ class HelperStorageTest extends \Test\TestCase {
/**
* Test getting the storage info, ignoring extra mount points
*/
- public function testGetStorageInfoExcludingExtStorage() {
+ public function testGetStorageInfoExcludingExtStorage(): void {
$homeStorage = $this->getStorageMock(12);
\OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files');
$homeStorage->file_put_contents('test.txt', '01234');
@@ -133,7 +133,7 @@ class HelperStorageTest extends \Test\TestCase {
/**
* Test getting the storage info, including extra mount points
*/
- public function testGetStorageInfoIncludingExtStorage() {
+ public function testGetStorageInfoIncludingExtStorage(): void {
$homeStorage = new \OC\Files\Storage\Temporary([]);
\OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files');
$homeStorage->file_put_contents('test.txt', '01234');
@@ -162,7 +162,7 @@ class HelperStorageTest extends \Test\TestCase {
* when user has no quota set, even when quota ext storage option
* was set
*/
- public function testGetStorageInfoIncludingExtStorageWithNoUserQuota() {
+ public function testGetStorageInfoIncludingExtStorageWithNoUserQuota(): void {
$homeStorage = $this->getStorageMock(12);
\OC\Files\Filesystem::mount($homeStorage, [], '/' . $this->user . '/files');
$homeStorage->file_put_contents('test.txt', '01234');
@@ -186,7 +186,7 @@ class HelperStorageTest extends \Test\TestCase {
/**
* Test getting the storage info with quota enabled
*/
- public function testGetStorageInfoWithQuota() {
+ public function testGetStorageInfoWithQuota(): void {
$homeStorage = $this->getStorageMock(12);
$homeStorage->file_put_contents('test.txt', '01234');
$homeStorage = new \OC\Files\Storage\Wrapper\Quota(
@@ -206,7 +206,7 @@ class HelperStorageTest extends \Test\TestCase {
/**
* Test getting the storage info when data exceeds quota
*/
- public function testGetStorageInfoWhenSizeExceedsQuota() {
+ public function testGetStorageInfoWhenSizeExceedsQuota(): void {
$homeStorage = $this->getStorageMock(12);
$homeStorage->file_put_contents('test.txt', '0123456789');
$homeStorage = new \OC\Files\Storage\Wrapper\Quota(
@@ -228,7 +228,7 @@ class HelperStorageTest extends \Test\TestCase {
* Test getting the storage info when the remaining
* free storage space is less than the quota
*/
- public function testGetStorageInfoWhenFreeSpaceLessThanQuota() {
+ public function testGetStorageInfoWhenFreeSpaceLessThanQuota(): void {
$homeStorage = $this->getStorageMock(12);
$homeStorage->file_put_contents('test.txt', '01234');
$homeStorage = new \OC\Files\Storage\Wrapper\Quota(
diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php
index 82e5a64ecae..98f746d38ae 100644
--- a/tests/lib/Hooks/BasicEmitterTest.php
+++ b/tests/lib/Hooks/BasicEmitterTest.php
@@ -50,7 +50,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testAnonymousFunction() {
+ public function testAnonymousFunction(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$this->emitter->listen('Test', 'test', function () {
@@ -60,7 +60,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testStaticCallback() {
+ public function testStaticCallback(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$this->emitter->listen('Test', 'test', ['\Test\Hooks\BasicEmitterTest', 'staticCallBack']);
@@ -68,14 +68,14 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testNonStaticCallback() {
+ public function testNonStaticCallback(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$this->emitter->listen('Test', 'test', [$this, 'nonStaticCallBack']);
$this->emitter->emitEvent('Test', 'test');
}
- public function testOnlyCallOnce() {
+ public function testOnlyCallOnce(): void {
$count = 0;
$listener = function () use (&$count) {
$count++;
@@ -86,7 +86,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->assertEquals(1, $count, 'Listener called an invalid number of times (' . $count . ') expected 1');
}
- public function testDifferentMethods() {
+ public function testDifferentMethods(): void {
$count = 0;
$listener = function () use (&$count) {
$count++;
@@ -98,7 +98,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->assertEquals(2, $count, 'Listener called an invalid number of times (' . $count . ') expected 2');
}
- public function testDifferentScopes() {
+ public function testDifferentScopes(): void {
$count = 0;
$listener = function () use (&$count) {
$count++;
@@ -110,7 +110,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->assertEquals(2, $count, 'Listener called an invalid number of times (' . $count . ') expected 2');
}
- public function testDifferentCallbacks() {
+ public function testDifferentCallbacks(): void {
$count = 0;
$listener1 = function () use (&$count) {
$count++;
@@ -125,7 +125,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testArguments() {
+ public function testArguments(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$this->emitter->listen('Test', 'test', function ($foo, $bar) {
@@ -137,7 +137,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testNamedArguments() {
+ public function testNamedArguments(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$this->emitter->listen('Test', 'test', function ($foo, $bar) {
@@ -148,7 +148,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->emitter->emitEvent('Test', 'test', ['foo' => 'foo', 'bar' => 'bar']);
}
- public function testRemoveAllSpecified() {
+ public function testRemoveAllSpecified(): void {
$listener = function () {
throw new EmittedException;
};
@@ -159,7 +159,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testRemoveWildcardListener() {
+ public function testRemoveWildcardListener(): void {
$listener1 = function () {
throw new EmittedException;
};
@@ -174,7 +174,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testRemoveWildcardMethod() {
+ public function testRemoveWildcardMethod(): void {
$listener = function () {
throw new EmittedException;
};
@@ -187,7 +187,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testRemoveWildcardScope() {
+ public function testRemoveWildcardScope(): void {
$listener = function () {
throw new EmittedException;
};
@@ -200,7 +200,7 @@ class BasicEmitterTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testRemoveWildcardScopeAndMethod() {
+ public function testRemoveWildcardScopeAndMethod(): void {
$listener = function () {
throw new EmittedException;
};
@@ -216,7 +216,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testRemoveKeepOtherCallback() {
+ public function testRemoveKeepOtherCallback(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$listener1 = function () {
@@ -234,7 +234,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testRemoveKeepOtherMethod() {
+ public function testRemoveKeepOtherMethod(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$listener = function () {
@@ -249,7 +249,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testRemoveKeepOtherScope() {
+ public function testRemoveKeepOtherScope(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$listener = function () {
@@ -264,7 +264,7 @@ class BasicEmitterTest extends \Test\TestCase {
}
- public function testRemoveNonExistingName() {
+ public function testRemoveNonExistingName(): void {
$this->expectException(\Test\Hooks\EmittedException::class);
$listener = function () {
diff --git a/tests/lib/Http/Client/ClientServiceTest.php b/tests/lib/Http/Client/ClientServiceTest.php
index a50428e514a..7c9cd55a6cc 100644
--- a/tests/lib/Http/Client/ClientServiceTest.php
+++ b/tests/lib/Http/Client/ClientServiceTest.php
@@ -59,7 +59,7 @@ class ClientServiceTest extends \Test\TestCase {
$stack = HandlerStack::create($handler);
$stack->push($dnsPinMiddleware->addDnsPinning());
$stack->push(Middleware::tap(function (RequestInterface $request) use ($eventLogger) {
- $eventLogger->start('http:request', $request->getMethod() . " request to " . $request->getRequestTarget());
+ $eventLogger->start('http:request', $request->getMethod() . ' request to ' . $request->getRequestTarget());
}, function () use ($eventLogger) {
$eventLogger->end('http:request');
}), 'event logger');
@@ -107,7 +107,7 @@ class ClientServiceTest extends \Test\TestCase {
$handler = new CurlHandler();
$stack = HandlerStack::create($handler);
$stack->push(Middleware::tap(function (RequestInterface $request) use ($eventLogger) {
- $eventLogger->start('http:request', $request->getMethod() . " request to " . $request->getRequestTarget());
+ $eventLogger->start('http:request', $request->getMethod() . ' request to ' . $request->getRequestTarget());
}, function () use ($eventLogger) {
$eventLogger->end('http:request');
}), 'event logger');
diff --git a/tests/lib/Http/Client/DnsPinMiddlewareTest.php b/tests/lib/Http/Client/DnsPinMiddlewareTest.php
index d265ce3e71c..9d71af15c5d 100644
--- a/tests/lib/Http/Client/DnsPinMiddlewareTest.php
+++ b/tests/lib/Http/Client/DnsPinMiddlewareTest.php
@@ -42,7 +42,7 @@ class DnsPinMiddlewareTest extends TestCase {
->getMock();
}
- public function testPopulateDnsCacheIPv4() {
+ public function testPopulateDnsCacheIPv4(): void {
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {
self::arrayHasKey('curl', $options);
@@ -135,7 +135,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testPopulateDnsCacheIPv6() {
+ public function testPopulateDnsCacheIPv6(): void {
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {
self::arrayHasKey('curl', $options);
@@ -250,7 +250,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testAllowLocalAddress() {
+ public function testAllowLocalAddress(): void {
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {
self::assertArrayNotHasKey('curl', $options);
@@ -268,7 +268,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testRejectIPv4() {
+ public function testRejectIPv4(): void {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('violates local access rules');
@@ -315,7 +315,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testRejectIPv6() {
+ public function testRejectIPv6(): void {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('violates local access rules');
@@ -362,7 +362,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testRejectCanonicalName() {
+ public function testRejectCanonicalName(): void {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('violates local access rules');
@@ -452,7 +452,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testRejectFaultyResponse() {
+ public function testRejectFaultyResponse(): void {
$this->expectException(LocalServerException::class);
$this->expectExceptionMessage('No DNS record found for www.example.com');
@@ -478,7 +478,7 @@ class DnsPinMiddlewareTest extends TestCase {
);
}
- public function testIgnoreSubdomainForSoaQuery() {
+ public function testIgnoreSubdomainForSoaQuery(): void {
$mockHandler = new MockHandler([
static function (RequestInterface $request, array $options) {
// The handler should not be called
diff --git a/tests/lib/Http/Client/NegativeDnsCacheTest.php b/tests/lib/Http/Client/NegativeDnsCacheTest.php
index af0575b0cd7..ba91e95a906 100644
--- a/tests/lib/Http/Client/NegativeDnsCacheTest.php
+++ b/tests/lib/Http/Client/NegativeDnsCacheTest.php
@@ -40,16 +40,16 @@ class NegativeDnsCacheTest extends \Test\TestCase {
->method('set')
->with('www.example.com-1', 'true', 3600);
- $this->negativeDnsCache->setNegativeCacheForDnsType("www.example.com", DNS_A, 3600);
+ $this->negativeDnsCache->setNegativeCacheForDnsType('www.example.com', DNS_A, 3600);
}
- public function testIsNegativeCached() {
+ public function testIsNegativeCached(): void {
$this->cache
->expects($this->once())
->method('hasKey')
->with('www.example.com-1')
->willReturn(true);
- $this->assertTrue($this->negativeDnsCache->isNegativeCached("www.example.com", DNS_A));
+ $this->assertTrue($this->negativeDnsCache->isNegativeCached('www.example.com', DNS_A));
}
}
diff --git a/tests/lib/Http/Client/ResponseTest.php b/tests/lib/Http/Client/ResponseTest.php
index c0d9770e2fb..291dc287148 100644
--- a/tests/lib/Http/Client/ResponseTest.php
+++ b/tests/lib/Http/Client/ResponseTest.php
@@ -23,22 +23,22 @@ class ResponseTest extends \Test\TestCase {
$this->guzzleResponse = new GuzzleResponse(418);
}
- public function testGetBody() {
+ public function testGetBody(): void {
$response = new Response($this->guzzleResponse->withBody(Utils::streamFor('MyResponse')));
$this->assertSame('MyResponse', $response->getBody());
}
- public function testGetStatusCode() {
+ public function testGetStatusCode(): void {
$response = new Response($this->guzzleResponse);
$this->assertSame(418, $response->getStatusCode());
}
- public function testGetHeader() {
+ public function testGetHeader(): void {
$response = new Response($this->guzzleResponse->withHeader('bar', 'foo'));
$this->assertSame('foo', $response->getHeader('bar'));
}
- public function testGetHeaders() {
+ public function testGetHeaders(): void {
$response = new Response($this->guzzleResponse
->withHeader('bar', 'foo')
->withHeader('x-awesome', 'yes')
diff --git a/tests/lib/Http/WellKnown/JrdResponseTest.php b/tests/lib/Http/WellKnown/JrdResponseTest.php
index 0f500f96eef..375f244d618 100644
--- a/tests/lib/Http/WellKnown/JrdResponseTest.php
+++ b/tests/lib/Http/WellKnown/JrdResponseTest.php
@@ -15,7 +15,7 @@ use Test\TestCase;
class JrdResponseTest extends TestCase {
public function testEmptyToHttpResponse(): void {
- $response = new JrdResponse("subject");
+ $response = new JrdResponse('subject');
$httpResponse = $response->toHttpResponse();
self::assertTrue($response->isEmpty());
@@ -30,7 +30,7 @@ class JrdResponseTest extends TestCase {
}
public function testComplexToHttpResponse(): void {
- $response = new JrdResponse("subject");
+ $response = new JrdResponse('subject');
$response->addAlias('alias');
$response->addAlias('blias');
$response->addProperty('propa', 'a');
diff --git a/tests/lib/Http/WellKnown/RequestManagerTest.php b/tests/lib/Http/WellKnown/RequestManagerTest.php
index 1ee2fa1139d..3ab6cb190b2 100644
--- a/tests/lib/Http/WellKnown/RequestManagerTest.php
+++ b/tests/lib/Http/WellKnown/RequestManagerTest.php
@@ -57,7 +57,7 @@ class RequestManagerTest extends TestCase {
$request = $this->createMock(IRequest::class);
$this->expectException(RuntimeException::class);
- $this->manager->process("webfinger", $request);
+ $this->manager->process('webfinger', $request);
}
public function testProcessNoHandlersRegistered(): void {
@@ -70,7 +70,7 @@ class RequestManagerTest extends TestCase {
->method('getWellKnownHandlers')
->willReturn([]);
- $response = $this->manager->process("webfinger", $request);
+ $response = $this->manager->process('webfinger', $request);
self::assertNull($response);
}
@@ -91,11 +91,11 @@ class RequestManagerTest extends TestCase {
$this->container->expects(self::once())
->method('get')
->with(get_class($handler))
- ->willThrowException(new QueryException(""));
+ ->willThrowException(new QueryException(''));
$this->logger->expects(self::once())
->method('error');
- $response = $this->manager->process("webfinger", $request);
+ $response = $this->manager->process('webfinger', $request);
self::assertNull($response);
}
@@ -120,7 +120,7 @@ class RequestManagerTest extends TestCase {
$this->logger->expects(self::once())
->method('error');
- $response = $this->manager->process("webfinger", $request);
+ $response = $this->manager->process('webfinger', $request);
self::assertNull($response);
}
@@ -146,7 +146,7 @@ class RequestManagerTest extends TestCase {
->with(get_class($handler))
->willReturn($handler);
- $response = $this->manager->process("webfinger", $request);
+ $response = $this->manager->process('webfinger', $request);
self::assertNotNull($response);
self::assertInstanceOf(JrdResponse::class, $response);
diff --git a/tests/lib/ImageTest.php b/tests/lib/ImageTest.php
index 6028f1b89fa..76b110df521 100644
--- a/tests/lib/ImageTest.php
+++ b/tests/lib/ImageTest.php
@@ -8,6 +8,8 @@
namespace Test;
use OC;
+use OC\Image;
+use OCP\IAppConfig;
use OCP\IConfig;
class ImageTest extends \Test\TestCase {
@@ -18,114 +20,114 @@ class ImageTest extends \Test\TestCase {
parent::tearDownAfterClass();
}
- public function testConstructDestruct() {
- $img = new \OC_Image();
+ public function testConstructDestruct(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
- $this->assertInstanceOf('\OC_Image', $img);
+ $this->assertInstanceOf('\OC\Image', $img);
$this->assertInstanceOf('\OCP\IImage', $img);
unset($img);
$imgcreate = imagecreatefromjpeg(OC::$SERVERROOT.'/tests/data/testimage.jpg');
- $img = new \OC_Image();
+ $img = new Image();
$img->setResource($imgcreate);
- $this->assertInstanceOf('\OC_Image', $img);
+ $this->assertInstanceOf('\OC\Image', $img);
$this->assertInstanceOf('\OCP\IImage', $img);
unset($img);
$base64 = base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'));
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64($base64);
- $this->assertInstanceOf('\OC_Image', $img);
+ $this->assertInstanceOf('\OC\Image', $img);
$this->assertInstanceOf('\OCP\IImage', $img);
unset($img);
- $img = new \OC_Image();
- $this->assertInstanceOf('\OC_Image', $img);
+ $img = new Image();
+ $this->assertInstanceOf('\OC\Image', $img);
$this->assertInstanceOf('\OCP\IImage', $img);
unset($img);
}
- public function testValid() {
- $img = new \OC_Image();
+ public function testValid(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->valid());
- $text = base64_encode("Lorem ipsum dolor sir amet …");
- $img = new \OC_Image();
+ $text = base64_encode('Lorem ipsum dolor sir amet …');
+ $img = new Image();
$img->loadFromBase64($text);
$this->assertFalse($img->valid());
- $img = new \OC_Image();
+ $img = new Image();
$this->assertFalse($img->valid());
}
- public function testMimeType() {
- $img = new \OC_Image();
+ public function testMimeType(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals('image/png', $img->mimeType());
- $img = new \OC_Image();
+ $img = new Image();
$this->assertEquals('', $img->mimeType());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->assertEquals('image/jpeg', $img->mimeType());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$this->assertEquals('image/gif', $img->mimeType());
}
- public function testWidth() {
- $img = new \OC_Image();
+ public function testWidth(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals(128, $img->width());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->assertEquals(1680, $img->width());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$this->assertEquals(64, $img->width());
- $img = new \OC_Image();
+ $img = new Image();
$this->assertEquals(-1, $img->width());
}
- public function testHeight() {
- $img = new \OC_Image();
+ public function testHeight(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertEquals(128, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->assertEquals(1050, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$this->assertEquals(64, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$this->assertEquals(-1, $img->height());
}
- public function testSave() {
- $img = new \OC_Image();
+ public function testSave(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$img->resize(16);
$img->save(OC::$SERVERROOT.'/tests/data/testimage2.png');
$this->assertEquals(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage2.png'), $img->data());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.jpg');
$img->resize(128);
$img->save(OC::$SERVERROOT.'/tests/data/testimage2.jpg');
$this->assertEquals(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage2.jpg'), $img->data());
}
- public function testData() {
- $img = new \OC_Image();
+ public function testData(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.png'));
// Preserve transparency
@@ -136,16 +138,17 @@ class ImageTest extends \Test\TestCase {
$expected = ob_get_clean();
$this->assertEquals($expected, $img->data());
+ $appConfig = $this->createMock(IAppConfig::class);
+ $appConfig->expects($this->once())
+ ->method('getValueInt')
+ ->with('preview', 'jpeg_quality', 80)
+ ->willReturn(80);
$config = $this->createMock(IConfig::class);
$config->expects($this->once())
- ->method('getAppValue')
- ->with('preview', 'jpeg_quality', '80')
- ->willReturn(null);
- $config->expects($this->once())
->method('getSystemValueInt')
->with('preview_max_memory', 256)
->willReturn(256);
- $img = new \OC_Image(null, null, $config);
+ $img = new Image(null, $appConfig, $config);
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.jpg');
$raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
imageinterlace($raw, true);
@@ -154,7 +157,7 @@ class ImageTest extends \Test\TestCase {
$expected = ob_get_clean();
$this->assertEquals($expected, $img->data());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif');
$raw = imagecreatefromstring(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif'));
ob_start();
@@ -163,105 +166,105 @@ class ImageTest extends \Test\TestCase {
$this->assertEquals($expected, $img->data());
}
- public function testDataNoResource() {
- $img = new \OC_Image();
+ public function testDataNoResource(): void {
+ $img = new Image();
$this->assertNull($img->data());
}
/**
* @depends testData
*/
- public function testToString() {
- $img = new \OC_Image();
+ public function testToString(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$expected = base64_encode($img->data());
$this->assertEquals($expected, (string)$img);
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$expected = base64_encode($img->data());
$this->assertEquals($expected, (string)$img);
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.gif');
$expected = base64_encode($img->data());
$this->assertEquals($expected, (string)$img);
}
- public function testResize() {
- $img = new \OC_Image();
+ public function testResize(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->resize(32));
$this->assertEquals(32, $img->width());
$this->assertEquals(32, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->assertTrue($img->resize(840));
$this->assertEquals(840, $img->width());
$this->assertEquals(525, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$this->assertTrue($img->resize(100));
$this->assertEquals(100, $img->width());
$this->assertEquals(100, $img->height());
}
- public function testPreciseResize() {
- $img = new \OC_Image();
+ public function testPreciseResize(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->preciseResize(128, 512));
$this->assertEquals(128, $img->width());
$this->assertEquals(512, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->assertTrue($img->preciseResize(64, 840));
$this->assertEquals(64, $img->width());
$this->assertEquals(840, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$this->assertTrue($img->preciseResize(1000, 1337));
$this->assertEquals(1000, $img->width());
$this->assertEquals(1337, $img->height());
}
- public function testCenterCrop() {
- $img = new \OC_Image();
+ public function testCenterCrop(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$img->centerCrop();
$this->assertEquals(128, $img->width());
$this->assertEquals(128, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$img->centerCrop();
$this->assertEquals(1050, $img->width());
$this->assertEquals(1050, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$img->centerCrop(512);
$this->assertEquals(512, $img->width());
$this->assertEquals(512, $img->height());
}
- public function testCrop() {
- $img = new \OC_Image();
+ public function testCrop(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$this->assertTrue($img->crop(0, 0, 50, 20));
$this->assertEquals(50, $img->width());
$this->assertEquals(20, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.jpg'));
$this->assertTrue($img->crop(500, 700, 550, 300));
$this->assertEquals(550, $img->width());
$this->assertEquals(300, $img->height());
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromBase64(base64_encode(file_get_contents(OC::$SERVERROOT.'/tests/data/testimage.gif')));
$this->assertTrue($img->crop(10, 10, 15, 15));
$this->assertEquals(15, $img->width());
@@ -283,8 +286,8 @@ class ImageTest extends \Test\TestCase {
* @param int[] $asked
* @param int[] $expected
*/
- public function testFitIn($filename, $asked, $expected) {
- $img = new \OC_Image();
+ public function testFitIn($filename, $asked, $expected): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT . '/tests/data/' . $filename);
$this->assertTrue($img->fitIn($asked[0], $asked[1]));
$this->assertEquals($expected[0], $img->width());
@@ -306,8 +309,8 @@ class ImageTest extends \Test\TestCase {
*
* @param string $filename
*/
- public function testScaleDownToFitWhenSmallerAlready($filename) {
- $img = new \OC_Image();
+ public function testScaleDownToFitWhenSmallerAlready($filename): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename);
$currentWidth = $img->width();
$currentHeight = $img->height();
@@ -339,8 +342,8 @@ class ImageTest extends \Test\TestCase {
* @param int[] $asked
* @param int[] $expected
*/
- public function testScaleDownWhenBigger($filename, $asked, $expected) {
- $img = new \OC_Image();
+ public function testScaleDownWhenBigger($filename, $asked, $expected): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/' . $filename);
//$this->assertTrue($img->scaleDownToFit($asked[0], $asked[1]));
$img->scaleDownToFit($asked[0], $asked[1]);
@@ -359,8 +362,8 @@ class ImageTest extends \Test\TestCase {
/**
* @dataProvider convertDataProvider
*/
- public function testConvert($mimeType) {
- $img = new \OC_Image();
+ public function testConvert($mimeType): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage.png');
$tempFile = tempnam(sys_get_temp_dir(), 'img-test');
@@ -368,15 +371,15 @@ class ImageTest extends \Test\TestCase {
$this->assertEquals($mimeType, image_type_to_mime_type(exif_imagetype($tempFile)));
}
- public function testMemoryLimitFromFile() {
- $img = new \OC_Image();
+ public function testMemoryLimitFromFile(): void {
+ $img = new Image();
$img->loadFromFile(OC::$SERVERROOT.'/tests/data/testimage-badheader.jpg');
$this->assertFalse($img->valid());
}
- public function testMemoryLimitFromData() {
+ public function testMemoryLimitFromData(): void {
$data = file_get_contents(OC::$SERVERROOT.'/tests/data/testimage-badheader.jpg');
- $img = new \OC_Image();
+ $img = new Image();
$img->loadFromData($data);
$this->assertFalse($img->valid());
}
diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php
index 702eca4c0ce..461a2ecafa8 100644
--- a/tests/lib/InfoXmlTest.php
+++ b/tests/lib/InfoXmlTest.php
@@ -7,6 +7,7 @@
namespace Test;
use OCP\App\IAppManager;
+use OCP\Server;
/**
* Class InfoXmlTest
@@ -15,6 +16,13 @@ use OCP\App\IAppManager;
* @package Test
*/
class InfoXmlTest extends TestCase {
+ private IAppManager $appManager;
+
+ protected function setUp(): void {
+ parent::setUp();
+ $this->appManager = Server::get(IAppManager::class);
+ }
+
public function dataApps() {
return [
['admin_audit'],
@@ -44,9 +52,9 @@ class InfoXmlTest extends TestCase {
*
* @param string $app
*/
- public function testClasses($app) {
- $appInfo = \OCP\Server::get(IAppManager::class)->getAppInfo($app);
- $appPath = \OC_App::getAppPath($app);
+ public function testClasses($app): void {
+ $appInfo = $this->appManager->getAppInfo($app);
+ $appPath = $this->appManager->getAppPath($app);
\OC_App::registerAutoloading($app, $appPath);
//Add the appcontainer
diff --git a/tests/lib/InitialStateServiceTest.php b/tests/lib/InitialStateServiceTest.php
index a919832d3e4..f58d54cb26b 100644
--- a/tests/lib/InitialStateServiceTest.php
+++ b/tests/lib/InitialStateServiceTest.php
@@ -21,7 +21,7 @@ use function json_encode;
class InitialStateServiceTest extends TestCase {
/** @var InitialStateService */
private $service;
- /** @var MockObject|LoggerInterface|(LoggerInterface&MockObject) */
+ /** @var MockObject|LoggerInterface|(LoggerInterface&MockObject) */
protected $logger;
protected function setUp(): void {
diff --git a/tests/lib/InstallerTest.php b/tests/lib/InstallerTest.php
index 1fd48ea4fc9..d27ca6e2159 100644
--- a/tests/lib/InstallerTest.php
+++ b/tests/lib/InstallerTest.php
@@ -86,7 +86,7 @@ class InstallerTest extends TestCase {
parent::tearDown();
}
- public function testInstallApp() {
+ public function testInstallApp(): void {
// Read the current version of the app to check for bug #2572
\OCP\Server::get(IAppManager::class)->getAppVersion('testapp', true);
@@ -149,7 +149,7 @@ class InstallerTest extends TestCase {
* @param array $appArray
* @param string|bool $updateAvailable
*/
- public function testIsUpdateAvailable(array $appArray, $updateAvailable) {
+ public function testIsUpdateAvailable(array $appArray, $updateAvailable): void {
$this->appFetcher
->expects($this->once())
->method('get')
@@ -161,7 +161,7 @@ class InstallerTest extends TestCase {
}
- public function testDownloadAppWithRevokedCertificate() {
+ public function testDownloadAppWithRevokedCertificate(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate "4112" has been revoked');
@@ -205,7 +205,7 @@ gLgK8d8sKL60JMmKHN3boHrsThKBVA==
}
- public function testDownloadAppWithNotNextcloudCertificate() {
+ public function testDownloadAppWithNotNextcloudCertificate(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App with id news has a certificate not issued by a trusted Code Signing Authority');
@@ -248,7 +248,7 @@ YSu356M=
}
- public function testDownloadAppWithDifferentCN() {
+ public function testDownloadAppWithDifferentCN(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App with id news has a cert issued to passman');
@@ -291,7 +291,7 @@ u/spPSSVhaun5BA1FlphB2TkgnzlCmxJa63nFY045e/Jq+IKMcqqZl/092gbI2EQ
}
- public function testDownloadAppWithInvalidSignature() {
+ public function testDownloadAppWithInvalidSignature(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App with id passman has invalid signature');
@@ -359,7 +359,7 @@ u/spPSSVhaun5BA1FlphB2TkgnzlCmxJa63nFY045e/Jq+IKMcqqZl/092gbI2EQ
}
- public function testDownloadAppWithMoreThanOneFolderDownloaded() {
+ public function testDownloadAppWithMoreThanOneFolderDownloaded(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Extracted app testapp has more than 1 folder');
@@ -443,7 +443,7 @@ YwDVP+QmNRzx72jtqAN/Kc3CvQ9nkgYhU65B95aX0xA=',
}
- public function testDownloadAppWithMismatchingIdentifier() {
+ public function testDownloadAppWithMismatchingIdentifier(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App for id testapp has a wrong app ID in info.xml: testapp1');
@@ -525,7 +525,7 @@ YwDVP+QmNRzx72jtqAN/Kc3CvQ9nkgYhU65B95aX0xA=',
$installer->downloadApp('testapp');
}
- public function testDownloadAppSuccessful() {
+ public function testDownloadAppSuccessful(): void {
$appArray = [
[
'id' => 'testapp',
@@ -608,7 +608,7 @@ MPLX6f5V9tCJtlH6ztmEcDROfvuVc0U3rEhqx2hphoyo+MZrPFpdcJL8KkIdMKbY
}
- public function testDownloadAppWithDowngrade() {
+ public function testDownloadAppWithDowngrade(): void {
// Use previous test to download the application in version 0.9
$this->testDownloadAppSuccessful();
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 21714e96f01..8d579cda529 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -74,7 +74,7 @@ class CheckerTest extends TestCase {
}
- public function testWriteAppSignatureOfNotExistingApp() {
+ public function testWriteAppSignatureOfNotExistingApp(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Exception message');
@@ -99,7 +99,7 @@ class CheckerTest extends TestCase {
}
- public function testWriteAppSignatureWrongPermissions() {
+ public function testWriteAppSignatureWrongPermissions(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessageMatches('/[a-zA-Z\\/_-]+ is not writable/');
@@ -117,7 +117,7 @@ class CheckerTest extends TestCase {
$this->checker->writeAppSignature(\OC::$SERVERROOT . '/tests/data/integritycheck/app/', $x509, $rsa);
}
- public function testWriteAppSignature() {
+ public function testWriteAppSignature(): void {
$expectedSignatureFileData = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -148,16 +148,16 @@ class CheckerTest extends TestCase {
$this->checker->writeAppSignature(\OC::$SERVERROOT . '/tests/data/integritycheck/app/', $x509, $rsa);
}
- public function testVerifyAppSignatureWithoutSignatureData() {
+ public function testVerifyAppSignatureWithoutSignatureData(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$expected = [
'EXCEPTION' => [
@@ -168,22 +168,22 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp'));
}
- public function testVerifyAppSignatureWithValidSignatureData() {
+ public function testVerifyAppSignatureWithValidSignatureData(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->appLocator
- ->expects($this->once())
- ->method('getAppPath')
- ->with('SomeApp')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->once())
+ ->method('getAppPath')
+ ->with('SomeApp')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -207,22 +207,22 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
- public function testVerifyAppSignatureWithTamperedSignatureData() {
+ public function testVerifyAppSignatureWithTamperedSignatureData(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->appLocator
- ->expects($this->once())
- ->method('getAppPath')
- ->with('SomeApp')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->once())
+ ->method('getAppPath')
+ ->with('SomeApp')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "tampered",
@@ -252,22 +252,22 @@ class CheckerTest extends TestCase {
$this->assertEquals($expected, $this->checker->verifyAppSignature('SomeApp'));
}
- public function testVerifyAppSignatureWithTamperedFiles() {
+ public function testVerifyAppSignatureWithTamperedFiles(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->appLocator
- ->expects($this->once())
- ->method('getAppPath')
- ->with('SomeApp')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
+ ->expects($this->once())
+ ->method('getAppPath')
+ ->with('SomeApp')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -313,21 +313,21 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp'));
}
- public function testVerifyAppSignatureWithTamperedFilesAndAlternatePath() {
+ public function testVerifyAppSignatureWithTamperedFilesAndAlternatePath(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->appLocator
- ->expects($this->never())
- ->method('getAppPath')
- ->with('SomeApp');
+ ->expects($this->never())
+ ->method('getAppPath')
+ ->with('SomeApp');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -373,22 +373,22 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp', \OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/'));
}
- public function testVerifyAppWithDifferentScope() {
+ public function testVerifyAppWithDifferentScope(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->appLocator
- ->expects($this->once())
- ->method('getAppPath')
- ->with('SomeApp')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
+ ->expects($this->once())
+ ->method('getAppPath')
+ ->with('SomeApp')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -417,22 +417,22 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp'));
}
- public function testVerifyAppWithDifferentScopeAndAlwaysTrustedCore() {
+ public function testVerifyAppWithDifferentScopeAndAlwaysTrustedCore(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->appLocator
- ->expects($this->once())
- ->method('getAppPath')
- ->with('SomeApp')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->once())
+ ->method('getAppPath')
+ ->with('SomeApp')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -456,7 +456,7 @@ class CheckerTest extends TestCase {
}
- public function testWriteCoreSignatureWithException() {
+ public function testWriteCoreSignatureWithException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Exception message');
@@ -480,7 +480,7 @@ class CheckerTest extends TestCase {
}
- public function testWriteCoreSignatureWrongPermissions() {
+ public function testWriteCoreSignatureWrongPermissions(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessageMatches('/[a-zA-Z\\/_-]+ is not writable/');
@@ -503,7 +503,7 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, __DIR__);
}
- public function testWriteCoreSignature() {
+ public function testWriteCoreSignature(): void {
$expectedSignatureFileData = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -513,21 +513,21 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$this->fileAccessHelper
- ->expects($this->once())
- ->method('file_put_contents')
- ->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json',
- $this->callback(function ($signature) use ($expectedSignatureFileData) {
- $expectedArray = json_decode($expectedSignatureFileData, true);
- $actualArray = json_decode($signature, true);
- $this->assertEquals($expectedArray, $actualArray);
- return true;
- })
- );
+ ->expects($this->once())
+ ->method('file_put_contents')
+ ->with(
+ \OC::$SERVERROOT . '/tests/data/integritycheck/app//core/signature.json',
+ $this->callback(function ($signature) use ($expectedSignatureFileData) {
+ $expectedArray = json_decode($expectedSignatureFileData, true);
+ $actualArray = json_decode($signature, true);
+ $this->assertEquals($expectedArray, $actualArray);
+ return true;
+ })
+ );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
$rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key');
@@ -538,7 +538,7 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/app/');
}
- public function testWriteCoreSignatureWithUnmodifiedHtaccess() {
+ public function testWriteCoreSignatureWithUnmodifiedHtaccess(): void {
$expectedSignatureFileData = '{
"hashes": {
".htaccess": "dc479770a6232061e04a768ee1f9133fdb3aea7b3a99f7105b0e0b6197474733e8d14b5b2bbad054e6b62a410fe5d0b3d790242dee1e0f11274af2100f5289e2",
@@ -548,21 +548,21 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
$this->fileAccessHelper
- ->expects($this->once())
- ->method('file_put_contents')
- ->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
- $this->callback(function ($signature) use ($expectedSignatureFileData) {
- $expectedArray = json_decode($expectedSignatureFileData, true);
- $actualArray = json_decode($signature, true);
- $this->assertEquals($expectedArray, $actualArray);
- return true;
- })
- );
+ ->expects($this->once())
+ ->method('file_put_contents')
+ ->with(
+ \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified//core/signature.json',
+ $this->callback(function ($signature) use ($expectedSignatureFileData) {
+ $expectedArray = json_decode($expectedSignatureFileData, true);
+ $actualArray = json_decode($signature, true);
+ $this->assertEquals($expectedArray, $actualArray);
+ return true;
+ })
+ );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
$rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key');
@@ -573,7 +573,7 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessUnmodified/');
}
- public function testWriteCoreSignatureWithInvalidModifiedHtaccess() {
+ public function testWriteCoreSignatureWithInvalidModifiedHtaccess(): void {
$expectedSignatureFileData = '{
"hashes": {
".htaccess": "4a54273dc8d697b2ca615acf2ae2c1ee3c1c643492cb04f42b10984fa9aacff1420dc829fd82f93ad3476fbd0cdab0251142c887dc8f872d03e39a3a3eb6d381"
@@ -582,17 +582,17 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->fileAccessHelper
- ->expects($this->once())
- ->method('file_put_contents')
- ->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
- $this->callback(function ($signature) use ($expectedSignatureFileData) {
- $expectedArray = json_decode($expectedSignatureFileData, true);
- $actualArray = json_decode($signature, true);
- $this->assertEquals($expectedArray, $actualArray);
- return true;
- })
- );
+ ->expects($this->once())
+ ->method('file_put_contents')
+ ->with(
+ \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent//core/signature.json',
+ $this->callback(function ($signature) use ($expectedSignatureFileData) {
+ $expectedArray = json_decode($expectedSignatureFileData, true);
+ $actualArray = json_decode($signature, true);
+ $this->assertEquals($expectedArray, $actualArray);
+ return true;
+ })
+ );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
$rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key');
@@ -603,7 +603,7 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithInvalidModifiedContent/');
}
- public function testWriteCoreSignatureWithValidModifiedHtaccess() {
+ public function testWriteCoreSignatureWithValidModifiedHtaccess(): void {
$expectedSignatureFileData = '{
"hashes": {
".htaccess": "7e6a7a4d8ee4f3fbc45dd579407c643471575a9d127d1c75f6d0a49e80766c3c587104b2139ef76d2a4bffce3f45777900605aaa49519c9532909b71e5030227",
@@ -613,21 +613,21 @@ class CheckerTest extends TestCase {
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIEvjCCAqagAwIBAgIUc\/0FxYrsgSs9rDxp03EJmbjN0NwwDQYJKoZIhvcNAQEF\r\nBQAwIzEhMB8GA1UECgwYb3duQ2xvdWQgQ29kZSBTaWduaW5nIENBMB4XDTE1MTEw\r\nMzIxMDMzM1oXDTE2MTEwMzIxMDMzM1owDzENMAsGA1UEAwwEY29yZTCCAiIwDQYJ\r\nKoZIhvcNAQEBBQADggIPADCCAgoCggIBALb6EgHpkAqZbO5vRO8XSh7G7XGWHw5s\r\niOf4RwPXR6SE9bWZEm\/b72SfWk\/\/J6AbrD8WiOzBuT\/ODy6k5T1arEdHO+Pux0W1\r\nMxYJJI4kH74KKgMpC0SB0Rt+8WrMqV1r3hhJ46df6Xr\/xolP3oD+eLbShPcblhdS\r\nVtkZEkoev8Sh6L2wDCeHDyPxzvj1w2dTdGVO9Kztn0xIlyfEBakqvBWtcxyi3Ln0\r\nklnxlMx3tPDUE4kqvpia9qNiB1AN2PV93eNr5\/2riAzIssMFSCarWCx0AKYb54+d\r\nxLpcYFyqPJ0ydBCkF78DD45RCZet6PNYkdzgbqlUWEGGomkuDoJbBg4wzgzO0D77\r\nH87KFhYW8tKFFvF1V3AHl\/sFQ9tDHaxM9Y0pZ2jPp\/ccdiqnmdkBxBDqsiRvHvVB\r\nCn6qpb4vWGFC7vHOBfYspmEL1zLlKXZv3ezMZEZw7O9ZvUP3VO\/wAtd2vUW8UFiq\r\ns2v1QnNLN6jNh51obcwmrBvWhJy9vQIdtIjQbDxqWTHh1zUSrw9wrlklCBZ\/zrM0\r\ni8nfCFwTxWRxp3H9KoECzO\/zS5R5KIS7s3\/wq\/w9T2Ie4rcecgXwDizwnn0C\/aKc\r\nbDIjujpL1s9HO05pcD\/V3wKcPZ1izymBkmMyIbL52iRVN5FTVHeZdXPpFuq+CTQJ\r\nQ238lC+A\/KOVAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAGoKTnh8RfJV4sQItVC2\r\nAvfJagkrIqZ3iiQTUBQGTKBsTnAqE1H7QgUSV9vSd+8rgvHkyZsRjmtyR1e3A6Ji\r\noNCXUbExC\/0iCPUqdHZIVb+Lc\/vWuv4ByFMybGPydgtLoEUX2ZrKFWmcgZFDUSRd\r\n9Uj26vtUhCC4bU4jgu6hIrR9IuxOBLQUxGTRZyAcXvj7obqRAEZwFAKQgFpfpqTb\r\nH+kjcbZSaAlLVSF7vBc1syyI8RGYbqpwvtREqJtl5IEIwe6huEqJ3zPnlP2th\/55\r\ncf3Fovj6JJgbb9XFxrdnsOsDOu\/tpnaRWlvv5ib4+SzG5wWFT5UUEo4Wg2STQiiX\r\nuVSRQxK1LE1yg84bs3NZk9FSQh4B8vZVuRr5FaJsZZkwlFlhRO\/\/+TJtXRbyNgsf\r\noMRZGi8DLGU2SGEAHcRH\/QZHq\/XDUWVzdxrSBYcy7GSpT7UDVzGv1rEJUrn5veP1\r\n0KmauAqtiIaYRm4f6YBsn0INcZxzIPZ0p8qFtVZBPeHhvQtvOt0iXI\/XUxEWOa2F\r\nK2EqhErgMK\/N07U1JJJay5tYZRtvkGq46oP\/5kQG8hYST0MDK6VihJoPpvCmAm4E\r\npEYKQ96x6A4EH9Y9mZlYozH\/eqmxPbTK8n89\/p7Ydun4rI+B2iiLnY8REWWy6+UQ\r\nV204fGUkJqW5CrKy3P3XvY9X\r\n-----END CERTIFICATE-----"
}';
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
$this->fileAccessHelper
- ->expects($this->once())
- ->method('file_put_contents')
- ->with(
- \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
- $this->callback(function ($signature) use ($expectedSignatureFileData) {
- $expectedArray = json_decode($expectedSignatureFileData, true);
- $actualArray = json_decode($signature, true);
- $this->assertEquals($expectedArray, $actualArray);
- return true;
- })
- );
+ ->expects($this->once())
+ ->method('file_put_contents')
+ ->with(
+ \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent/core/signature.json',
+ $this->callback(function ($signature) use ($expectedSignatureFileData) {
+ $expectedArray = json_decode($expectedSignatureFileData, true);
+ $actualArray = json_decode($signature, true);
+ $this->assertEquals($expectedArray, $actualArray);
+ return true;
+ })
+ );
$keyBundle = file_get_contents(__DIR__ .'/../../data/integritycheck/core.crt');
$rsaPrivateKey = file_get_contents(__DIR__ .'/../../data/integritycheck/core.key');
@@ -638,16 +638,16 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, \OC::$SERVERROOT . '/tests/data/integritycheck/htaccessWithValidModifiedContent');
}
- public function testVerifyCoreSignatureWithoutSignatureData() {
+ public function testVerifyCoreSignatureWithoutSignatureData(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$expected = [
'EXCEPTION' => [
@@ -658,21 +658,21 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreSignatureWithValidSignatureData() {
+ public function testVerifyCoreSignatureWithValidSignatureData(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -695,7 +695,7 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreSignatureWithValidModifiedHtaccessSignatureData() {
+ public function testVerifyCoreSignatureWithValidModifiedHtaccessSignatureData(): void {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
@@ -736,7 +736,7 @@ class CheckerTest extends TestCase {
/**
* See inline instruction on how to update the test assets when changing mimetypealiases.dist.json
*/
- public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData() {
+ public function testVerifyCoreSignatureWithModifiedMimetypelistSignatureData(): void {
$shippedMimetypeAliases = (array)json_decode(file_get_contents(\OC::$SERVERROOT . '/resources/config/mimetypealiases.dist.json'));
$allAliases = array_merge($shippedMimetypeAliases, ['my-custom/mimetype' => 'custom']);
@@ -785,21 +785,21 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreSignatureWithValidSignatureDataAndNotAlphabeticOrder() {
+ public function testVerifyCoreSignatureWithValidSignatureDataAndNotAlphabeticOrder(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -822,21 +822,21 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreSignatureWithTamperedSignatureData() {
+ public function testVerifyCoreSignatureWithTamperedSignatureData(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "tampered",
@@ -865,21 +865,21 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreSignatureWithTamperedFiles() {
+ public function testVerifyCoreSignatureWithTamperedFiles(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/appWithInvalidData/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -923,21 +923,21 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreWithInvalidCertificate() {
+ public function testVerifyCoreWithInvalidCertificate(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -966,21 +966,21 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyCoreSignature());
}
- public function testVerifyCoreWithDifferentScope() {
+ public function testVerifyCoreWithDifferentScope(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(false);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(false);
$this->environmentHelper
- ->expects($this->any())
- ->method('getServerRoot')
- ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
+ ->expects($this->any())
+ ->method('getServerRoot')
+ ->willReturn(\OC::$SERVERROOT . '/tests/data/integritycheck/app/');
$signatureDataFile = '{
"hashes": {
"AnotherFile.txt": "1570ca9420e37629de4328f48c51da29840ddeaa03ae733da4bf1d854b8364f594aac560601270f9e1797ed4cd57c1aea87bf44cf4245295c94f2e935a2f0112",
@@ -1009,7 +1009,7 @@ class CheckerTest extends TestCase {
$this->assertSame($expected, $this->checker->verifyCoreSignature());
}
- public function testRunInstanceVerification() {
+ public function testRunInstanceVerification(): void {
$this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
->setConstructorArgs([
$this->environmentHelper,
@@ -1030,9 +1030,9 @@ class CheckerTest extends TestCase {
$this->checker
->expects($this->once())
->method('verifyCoreSignature');
- $this->appLocator
+ $this->appManager
->expects($this->once())
- ->method('getAllApps')
+ ->method('getAllAppsInAppsFolders')
->willReturn([
'files',
'calendar',
@@ -1089,16 +1089,16 @@ class CheckerTest extends TestCase {
$this->checker->runInstanceVerification();
}
- public function testVerifyAppSignatureWithoutSignatureDataAndCodeCheckerDisabled() {
+ public function testVerifyAppSignatureWithoutSignatureDataAndCodeCheckerDisabled(): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn('stable');
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn('stable');
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(true);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(true);
$expected = [];
$this->assertSame($expected, $this->checker->verifyAppSignature('SomeApp'));
@@ -1119,7 +1119,7 @@ class CheckerTest extends TestCase {
* @param bool $isCodeSigningEnforced
* @dataProvider channelDataProvider
*/
- public function testIsCodeCheckEnforced($channel, $isCodeSigningEnforced) {
+ public function testIsCodeCheckEnforced($channel, $isCodeSigningEnforced): void {
$this->environmentHelper
->expects($this->once())
->method('getChannel')
@@ -1137,16 +1137,16 @@ class CheckerTest extends TestCase {
* @param string $channel
* @dataProvider channelDataProvider
*/
- public function testIsCodeCheckEnforcedWithDisabledConfigSwitch($channel) {
+ public function testIsCodeCheckEnforcedWithDisabledConfigSwitch($channel): void {
$this->environmentHelper
- ->expects($this->once())
- ->method('getChannel')
- ->willReturn($channel);
+ ->expects($this->once())
+ ->method('getChannel')
+ ->willReturn($channel);
$this->config
- ->expects($this->any())
- ->method('getSystemValueBool')
- ->with('integrity.check.disabled', false)
- ->willReturn(true);
+ ->expects($this->any())
+ ->method('getSystemValueBool')
+ ->with('integrity.check.disabled', false)
+ ->willReturn(true);
$this->assertFalse(self::invokePrivate($this->checker, 'isCodeCheckEnforced'));
}
diff --git a/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php
index a86507f6bb2..6d3006bb3c4 100644
--- a/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php
@@ -19,19 +19,15 @@ class AppLocatorTest extends TestCase {
$this->locator = new AppLocator();
}
- public function testGetAppPath() {
+ public function testGetAppPath(): void {
$this->assertSame(\OC_App::getAppPath('files'), $this->locator->getAppPath('files'));
}
- public function testGetAppPathNotExistentApp() {
+ public function testGetAppPathNotExistentApp(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App not found');
$this->locator->getAppPath('aTotallyNotExistingApp');
}
-
- public function testGetAllApps() {
- $this->assertSame(\OC_App::getAllApps(), $this->locator->getAllApps());
- }
}
diff --git a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
index 001733309a3..b8280d9816a 100644
--- a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
@@ -19,11 +19,11 @@ class EnvironmentHelperTest extends TestCase {
parent::setUp();
}
- public function testGetServerRoot() {
+ public function testGetServerRoot(): void {
$this->assertSame(\OC::$SERVERROOT, $this->environmentHelper->getServerRoot());
}
- public function testGetChannel() {
+ public function testGetChannel(): void {
$this->assertSame(\OC_Util::getChannel(), $this->environmentHelper->getChannel());
}
}
diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
index ea90b611f5e..866850b7cff 100644
--- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
@@ -19,7 +19,7 @@ class FileAccessHelperTest extends TestCase {
$this->fileAccessHelper = new FileAccessHelper();
}
- public function testReadAndWrite() {
+ public function testReadAndWrite(): void {
$tempManager = \OC::$server->getTempManager();
$filePath = $tempManager->getTemporaryFile();
$data = 'SomeDataGeneratedByIntegrityCheck';
@@ -29,27 +29,27 @@ class FileAccessHelperTest extends TestCase {
}
- public function testFile_put_contentsWithException() {
+ public function testFile_put_contentsWithException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Failed to write into /anabsolutelynotexistingfolder/on/the/system.txt');
$this->fileAccessHelper->file_put_contents('/anabsolutelynotexistingfolder/on/the/system.txt', 'MyFiles');
}
- public function testIs_writable() {
+ public function testIs_writable(): void {
$this->assertFalse($this->fileAccessHelper->is_writable('/anabsolutelynotexistingfolder/on/the/system.txt'));
$this->assertTrue($this->fileAccessHelper->is_writable(\OC::$server->getTempManager()->getTemporaryFile('MyFile')));
}
- public function testAssertDirectoryExistsWithException() {
+ public function testAssertDirectoryExistsWithException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Directory /anabsolutelynotexistingfolder/on/the/system does not exist.');
$this->fileAccessHelper->assertDirectoryExists('/anabsolutelynotexistingfolder/on/the/system');
}
- public function testAssertDirectoryExists() {
+ public function testAssertDirectoryExists(): void {
$this->fileAccessHelper->assertDirectoryExists(\OC::$server->getTempManager()->getTemporaryFolder('/testfolder/'));
$this->addToAssertionCount(1);
}
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index 16113c0972f..0f243c124ca 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -112,9 +112,9 @@ class FactoryTest extends TestCase {
$factory = $this->getFactory(['languageExists']);
$this->invokePrivate($factory, 'requestLanguage', ['de']);
$factory->expects(self::once())
- ->method('languageExists')
- ->with('MyApp', 'de')
- ->willReturn(true);
+ ->method('languageExists')
+ ->with('MyApp', 'de')
+ ->willReturn(true);
self::assertSame('de', $factory->findLanguage('MyApp'));
}
@@ -123,15 +123,15 @@ class FactoryTest extends TestCase {
$factory = $this->getFactory(['languageExists']);
$this->invokePrivate($factory, 'requestLanguage', ['de']);
$factory->expects($this->exactly(2))
- ->method('languageExists')
- ->withConsecutive(
- ['MyApp', 'de'],
- ['MyApp', 'jp'],
- )
- ->willReturnOnConsecutiveCalls(
- false,
- true,
- );
+ ->method('languageExists')
+ ->withConsecutive(
+ ['MyApp', 'de'],
+ ['MyApp', 'jp'],
+ )
+ ->willReturnOnConsecutiveCalls(
+ false,
+ true,
+ );
$this->config
->expects($this->exactly(1))
->method('getSystemValue')
@@ -150,10 +150,10 @@ class FactoryTest extends TestCase {
->method('getUser')
->willReturn($user);
$this->config
- ->expects(self::once())
- ->method('getUserValue')
- ->with('MyUserUid', 'core', 'lang', null)
- ->willReturn('jp');
+ ->expects(self::once())
+ ->method('getUserValue')
+ ->with('MyUserUid', 'core', 'lang', null)
+ ->willReturn('jp');
self::assertSame('jp', $factory->findLanguage('MyApp'));
}
@@ -178,17 +178,17 @@ class FactoryTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)
->getMock();
$user->expects(self::once())
- ->method('getUID')
- ->willReturn('MyUserUid');
+ ->method('getUID')
+ ->willReturn('MyUserUid');
$this->userSession
- ->expects(self::exactly(2))
- ->method('getUser')
- ->willReturn($user);
+ ->expects(self::exactly(2))
+ ->method('getUser')
+ ->willReturn($user);
$this->config
- ->expects(self::once())
- ->method('getUserValue')
- ->with('MyUserUid', 'core', 'lang', null)
- ->willReturn('jp');
+ ->expects(self::once())
+ ->method('getUserValue')
+ ->with('MyUserUid', 'core', 'lang', null)
+ ->willReturn('jp');
self::assertSame('es', $factory->findLanguage('MyApp'));
}
@@ -213,17 +213,17 @@ class FactoryTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)
->getMock();
$user->expects(self::once())
- ->method('getUID')
- ->willReturn('MyUserUid');
+ ->method('getUID')
+ ->willReturn('MyUserUid');
$this->userSession
- ->expects(self::exactly(2))
- ->method('getUser')
- ->willReturn($user);
+ ->expects(self::exactly(2))
+ ->method('getUser')
+ ->willReturn($user);
$this->config
- ->expects(self::once())
- ->method('getUserValue')
- ->with('MyUserUid', 'core', 'lang', null)
- ->willReturn('jp');
+ ->expects(self::once())
+ ->method('getUserValue')
+ ->with('MyUserUid', 'core', 'lang', null)
+ ->willReturn('jp');
$this->config
->expects(self::never())
->method('setUserValue');
@@ -251,21 +251,21 @@ class FactoryTest extends TestCase {
$user = $this->getMockBuilder(IUser::class)
->getMock();
$user->expects(self::once())
- ->method('getUID')
- ->willReturn('MyUserUid');
+ ->method('getUID')
+ ->willReturn('MyUserUid');
$this->userSession
- ->expects(self::exactly(2))
- ->method('getUser')
- ->willReturn($user);
+ ->expects(self::exactly(2))
+ ->method('getUser')
+ ->willReturn($user);
$this->config
- ->expects(self::once())
- ->method('getUserValue')
- ->with('MyUserUid', 'core', 'lang', null)
- ->willReturn('jp');
+ ->expects(self::once())
+ ->method('getUserValue')
+ ->with('MyUserUid', 'core', 'lang', null)
+ ->willReturn('jp');
$this->config
- ->expects(self::never())
- ->method('setUserValue')
- ->with('MyUserUid', 'core', 'lang', 'en');
+ ->expects(self::never())
+ ->method('setUserValue')
+ ->with('MyUserUid', 'core', 'lang', 'en');
self::assertSame('en', $factory->findLanguage('MyApp'));
diff --git a/tests/lib/L10N/L10nTest.php b/tests/lib/L10N/L10nTest.php
index 38d0a5626b0..26f39e41c13 100644
--- a/tests/lib/L10N/L10nTest.php
+++ b/tests/lib/L10N/L10nTest.php
@@ -46,15 +46,15 @@ class L10nTest extends TestCase {
$this->assertEquals('Files:', $l->t('Files:'));
}
- public function testGermanPluralTranslations() {
+ public function testGermanPluralTranslations(): void {
$transFile = \OC::$SERVERROOT.'/tests/data/l10n/de.json';
$l = new L10N($this->getFactory(), 'test', 'de', 'de_AT', [$transFile]);
- $this->assertEquals('1 Datei', (string) $l->n('%n file', '%n files', 1));
- $this->assertEquals('2 Dateien', (string) $l->n('%n file', '%n files', 2));
+ $this->assertEquals('1 Datei', (string)$l->n('%n file', '%n files', 1));
+ $this->assertEquals('2 Dateien', (string)$l->n('%n file', '%n files', 2));
}
- public function testRussianPluralTranslations() {
+ public function testRussianPluralTranslations(): void {
$transFile = \OC::$SERVERROOT.'/tests/data/l10n/ru.json';
$l = new L10N($this->getFactory(), 'test', 'ru', 'ru_UA', [$transFile]);
@@ -78,7 +78,7 @@ class L10nTest extends TestCase {
*/
}
- public function testCzechPluralTranslations() {
+ public function testCzechPluralTranslations(): void {
$transFile = \OC::$SERVERROOT.'/tests/data/l10n/cs.json';
$l = new L10N($this->getFactory(), 'test', 'cs', 'cs_CZ', [$transFile]);
@@ -87,13 +87,13 @@ class L10nTest extends TestCase {
$this->assertEquals('5 oken', (string)$l->n('%n window', '%n windows', 5));
}
- public function testGermanPluralWithCzechLocaleTranslations() {
+ public function testGermanPluralWithCzechLocaleTranslations(): void {
$transFile = \OC::$SERVERROOT.'/tests/data/l10n/de.json';
$l = new L10N($this->getFactory(), 'test', 'de', 'cs_CZ', [$transFile]);
- $this->assertEquals('1 Datei', (string) $l->n('%n file', '%n files', 1));
- $this->assertEquals('2 Dateien', (string) $l->n('%n file', '%n files', 2));
- $this->assertEquals('5 Dateien', (string) $l->n('%n file', '%n files', 5));
+ $this->assertEquals('1 Datei', (string)$l->n('%n file', '%n files', 1));
+ $this->assertEquals('2 Dateien', (string)$l->n('%n file', '%n files', 2));
+ $this->assertEquals('5 Dateien', (string)$l->n('%n file', '%n files', 5));
}
public function dataPlaceholders(): array {
@@ -156,7 +156,7 @@ class L10nTest extends TestCase {
/**
* @dataProvider localizationData
*/
- public function testNumericStringLocalization($expectedDate, $lang, $locale, $type, $value) {
+ public function testNumericStringLocalization($expectedDate, $lang, $locale, $type, $value): void {
$l = new L10N($this->getFactory(), 'test', $lang, $locale, []);
$this->assertSame($expectedDate, $l->l($type, $value));
}
@@ -174,7 +174,7 @@ class L10nTest extends TestCase {
* @param $lang
* @param $locale
*/
- public function testFirstWeekDay($expected, $lang, $locale) {
+ public function testFirstWeekDay($expected, $lang, $locale): void {
$l = new L10N($this->getFactory(), 'test', $lang, $locale, []);
$this->assertSame($expected, $l->l('firstday', 'firstday'));
}
@@ -192,22 +192,22 @@ class L10nTest extends TestCase {
* @param $lang
* @param $locale
*/
- public function testJSDate($expected, $lang, $locale) {
+ public function testJSDate($expected, $lang, $locale): void {
$l = new L10N($this->getFactory(), 'test', $lang, $locale, []);
$this->assertSame($expected, $l->l('jsdate', 'jsdate'));
}
- public function testFactoryGetLanguageCode() {
+ public function testFactoryGetLanguageCode(): void {
$l = $this->getFactory()->get('lib', 'de');
$this->assertEquals('de', $l->getLanguageCode());
}
- public function testServiceGetLanguageCode() {
+ public function testServiceGetLanguageCode(): void {
$l = \OCP\Util::getL10N('lib', 'de');
$this->assertEquals('de', $l->getLanguageCode());
}
- public function testWeekdayName() {
+ public function testWeekdayName(): void {
$l = \OCP\Util::getL10N('lib', 'de');
$this->assertEquals('Mo.', $l->l('weekdayName', new \DateTime('2017-11-6'), ['width' => 'abbreviated']));
}
@@ -217,7 +217,7 @@ class L10nTest extends TestCase {
* @param $locale
* @param $language
*/
- public function testFindLanguageFromLocale($locale, $language) {
+ public function testFindLanguageFromLocale($locale, $language): void {
$this->assertEquals(
$language,
\OC::$server->get(IFactory::class)->findLanguageFromLocale('lib', $locale)
diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php
index 02c17a842d3..79998c36354 100644
--- a/tests/lib/L10N/LanguageIteratorTest.php
+++ b/tests/lib/L10N/LanguageIteratorTest.php
@@ -60,7 +60,7 @@ class LanguageIteratorTest extends TestCase {
/**
* @dataProvider languageSettingsProvider
*/
- public function testIterator($forcedLang, $userLang, $sysLang, $expectedValues) {
+ public function testIterator($forcedLang, $userLang, $sysLang, $expectedValues): void {
$this->config->expects($this->any())
->method('getSystemValue')
->willReturnMap([
diff --git a/tests/lib/LargeFileHelperGetFileSizeTest.php b/tests/lib/LargeFileHelperGetFileSizeTest.php
index b239c10e20a..247886fee6a 100644
--- a/tests/lib/LargeFileHelperGetFileSizeTest.php
+++ b/tests/lib/LargeFileHelperGetFileSizeTest.php
@@ -58,7 +58,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
/**
* @dataProvider dataFileNameProvider
*/
- public function testGetFileSizeViaExec($filename, $fileSize) {
+ public function testGetFileSizeViaExec($filename, $fileSize): void {
if (escapeshellarg('strängé') !== '\'strängé\'') {
$this->markTestSkipped('Your escapeshell args removes accents');
}
@@ -76,7 +76,7 @@ class LargeFileHelperGetFileSizeTest extends TestCase {
/**
* @dataProvider dataFileNameProvider
*/
- public function testGetFileSizeNative($filename, $fileSize) {
+ public function testGetFileSizeNative($filename, $fileSize): void {
$this->assertSame(
$fileSize,
$this->helper->getFileSizeNative($filename)
diff --git a/tests/lib/LargeFileHelperTest.php b/tests/lib/LargeFileHelperTest.php
index 9008a42f77e..2cccfa441ab 100644
--- a/tests/lib/LargeFileHelperTest.php
+++ b/tests/lib/LargeFileHelperTest.php
@@ -15,21 +15,21 @@ class LargeFileHelperTest extends TestCase {
$this->helper = new \OC\LargeFileHelper;
}
- public function testFormatUnsignedIntegerFloat() {
+ public function testFormatUnsignedIntegerFloat(): void {
$this->assertSame(
'9007199254740992',
- $this->helper->formatUnsignedInteger((float) 9007199254740992)
+ $this->helper->formatUnsignedInteger((float)9007199254740992)
);
}
- public function testFormatUnsignedIntegerInt() {
+ public function testFormatUnsignedIntegerInt(): void {
$this->assertSame(
PHP_INT_SIZE === 4 ? '4294967295' : '18446744073709551615',
$this->helper->formatUnsignedInteger(-1)
);
}
- public function testFormatUnsignedIntegerString() {
+ public function testFormatUnsignedIntegerString(): void {
$this->assertSame(
'9007199254740993',
$this->helper->formatUnsignedInteger('9007199254740993')
@@ -37,7 +37,7 @@ class LargeFileHelperTest extends TestCase {
}
- public function testFormatUnsignedIntegerStringException() {
+ public function testFormatUnsignedIntegerStringException(): void {
$this->expectException(\UnexpectedValueException::class);
$this->helper->formatUnsignedInteger('900ABCD254740993');
diff --git a/tests/lib/LegacyHelperTest.php b/tests/lib/LegacyHelperTest.php
index 7d6be9dea7e..ea359d4e50c 100644
--- a/tests/lib/LegacyHelperTest.php
+++ b/tests/lib/LegacyHelperTest.php
@@ -26,7 +26,7 @@ class LegacyHelperTest extends \Test\TestCase {
/**
* @dataProvider humanFileSizeProvider
*/
- public function testHumanFileSize($expected, $input) {
+ public function testHumanFileSize($expected, $input): void {
$result = OC_Helper::humanFileSize($input);
$this->assertEquals($expected, $result);
}
@@ -46,166 +46,166 @@ class LegacyHelperTest extends \Test\TestCase {
/**
* @dataProvider providesComputerFileSize
*/
- public function testComputerFileSize($expected, $input) {
+ public function testComputerFileSize($expected, $input): void {
$result = OC_Helper::computerFileSize($input);
$this->assertEquals($expected, $result);
}
public function providesComputerFileSize() {
return [
- [0.0, "0 B"],
- [1024.0, "1 KB"],
+ [0.0, '0 B'],
+ [1024.0, '1 KB'],
[1395864371.0, '1.3 GB'],
- [9961472.0, "9.5 MB"],
- [500041567437.0, "465.7 GB"],
- [false, "12 GB etfrhzui"]
+ [9961472.0, '9.5 MB'],
+ [500041567437.0, '465.7 GB'],
+ [false, '12 GB etfrhzui']
];
}
- public function testMb_array_change_key_case() {
+ public function testMb_array_change_key_case(): void {
$arrayStart = [
- "Foo" => "bar",
- "Bar" => "foo",
+ 'Foo' => 'bar',
+ 'Bar' => 'foo',
];
$arrayResult = [
- "foo" => "bar",
- "bar" => "foo",
+ 'foo' => 'bar',
+ 'bar' => 'foo',
];
$result = OC_Helper::mb_array_change_key_case($arrayStart);
$expected = $arrayResult;
$this->assertEquals($result, $expected);
$arrayStart = [
- "foo" => "bar",
- "bar" => "foo",
+ 'foo' => 'bar',
+ 'bar' => 'foo',
];
$arrayResult = [
- "FOO" => "bar",
- "BAR" => "foo",
+ 'FOO' => 'bar',
+ 'BAR' => 'foo',
];
$result = OC_Helper::mb_array_change_key_case($arrayStart, MB_CASE_UPPER);
$expected = $arrayResult;
$this->assertEquals($result, $expected);
}
- public function testRecursiveArraySearch() {
+ public function testRecursiveArraySearch(): void {
$haystack = [
- "Foo" => "own",
- "Bar" => "Cloud",
+ 'Foo' => 'own',
+ 'Bar' => 'Cloud',
];
- $result = OC_Helper::recursiveArraySearch($haystack, "own");
- $expected = "Foo";
+ $result = OC_Helper::recursiveArraySearch($haystack, 'own');
+ $expected = 'Foo';
$this->assertEquals($result, $expected);
- $result = OC_Helper::recursiveArraySearch($haystack, "NotFound");
+ $result = OC_Helper::recursiveArraySearch($haystack, 'NotFound');
$this->assertFalse($result);
}
- public function testBuildNotExistingFileNameForView() {
+ public function testBuildNotExistingFileNameForView(): void {
$viewMock = $this->createMock(View::class);
$this->assertEquals('/filename', OC_Helper::buildNotExistingFileNameForView('/', 'filename', $viewMock));
$this->assertEquals('dir/filename.ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(2))
- ->method('file_exists')
- ->withConsecutive(
- // Conflict on filename.ext
- ['dir/filename.ext'],
- ['dir/filename (2).ext'],
- )
- ->will($this->onConsecutiveCalls(true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ // Conflict on filename.ext
+ ['dir/filename.ext'],
+ ['dir/filename (2).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, false));
$this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(3))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename.ext'],
- ['dir/filename (2).ext'],
- ['dir/filename (3).ext'],
- )
- ->will($this->onConsecutiveCalls(true, true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename.ext'],
+ ['dir/filename (2).ext'],
+ ['dir/filename (3).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, true, false));
$this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename.ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(2))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename (1).ext'],
- ['dir/filename (2).ext'],
- )
- ->will($this->onConsecutiveCalls(true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename (1).ext'],
+ ['dir/filename (2).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, false));
$this->assertEquals('dir/filename (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (1).ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(2))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename (2).ext'],
- ['dir/filename (3).ext'],
- )
- ->will($this->onConsecutiveCalls(true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename (2).ext'],
+ ['dir/filename (3).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, false));
$this->assertEquals('dir/filename (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(3))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename (2).ext'],
- ['dir/filename (3).ext'],
- ['dir/filename (4).ext'],
- )
- ->will($this->onConsecutiveCalls(true, true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename (2).ext'],
+ ['dir/filename (3).ext'],
+ ['dir/filename (4).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, true, false));
$this->assertEquals('dir/filename (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename (2).ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(2))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename(1).ext'],
- ['dir/filename(2).ext'],
- )
- ->will($this->onConsecutiveCalls(true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename(1).ext'],
+ ['dir/filename(2).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, false));
$this->assertEquals('dir/filename(2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1).ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(2))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename(1) (1).ext'],
- ['dir/filename(1) (2).ext'],
- )
- ->will($this->onConsecutiveCalls(true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename(1) (1).ext'],
+ ['dir/filename(1) (2).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, false));
$this->assertEquals('dir/filename(1) (2).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(3))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename(1) (1).ext'],
- ['dir/filename(1) (2).ext'],
- ['dir/filename(1) (3).ext'],
- )
- ->will($this->onConsecutiveCalls(true, true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename(1) (1).ext'],
+ ['dir/filename(1) (2).ext'],
+ ['dir/filename(1) (3).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, true, false));
$this->assertEquals('dir/filename(1) (3).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (1).ext', $viewMock));
$viewMock = $this->createMock(View::class);
$viewMock->expects($this->exactly(2))
- ->method('file_exists')
- ->withConsecutive(
- ['dir/filename(1) (2) (3).ext'],
- ['dir/filename(1) (2) (4).ext'],
- )
- ->will($this->onConsecutiveCalls(true, false));
+ ->method('file_exists')
+ ->withConsecutive(
+ ['dir/filename(1) (2) (3).ext'],
+ ['dir/filename(1) (2) (4).ext'],
+ )
+ ->will($this->onConsecutiveCalls(true, false));
$this->assertEquals('dir/filename(1) (2) (4).ext', OC_Helper::buildNotExistingFileNameForView('dir', 'filename(1) (2) (3).ext', $viewMock));
}
/**
* @dataProvider streamCopyDataProvider
*/
- public function testStreamCopy($expectedCount, $expectedResult, $source, $target) {
+ public function testStreamCopy($expectedCount, $expectedResult, $source, $target): void {
if (is_string($source)) {
$source = fopen($source, 'r');
}
@@ -239,7 +239,7 @@ class LegacyHelperTest extends \Test\TestCase {
/**
* Tests recursive folder deletion with rmdirr()
*/
- public function testRecursiveFolderDeletion() {
+ public function testRecursiveFolderDeletion(): void {
$baseDir = \OC::$server->getTempManager()->getTemporaryFolder() . '/';
mkdir($baseDir . 'a/b/c/d/e', 0777, true);
mkdir($baseDir . 'a/b/c1/d/e', 0777, true);
diff --git a/tests/lib/Lock/DBLockingProviderTest.php b/tests/lib/Lock/DBLockingProviderTest.php
index 356b55f577e..1c02e8d7d77 100644
--- a/tests/lib/Lock/DBLockingProviderTest.php
+++ b/tests/lib/Lock/DBLockingProviderTest.php
@@ -59,7 +59,7 @@ class DBLockingProviderTest extends LockingProvider {
parent::tearDown();
}
- public function testCleanEmptyLocks() {
+ public function testCleanEmptyLocks(): void {
$this->currentTime = 100;
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->instance->acquireLock('asd', ILockingProvider::LOCK_EXCLUSIVE);
@@ -96,7 +96,7 @@ class DBLockingProviderTest extends LockingProvider {
return $rows;
}
- public function testDoubleShared() {
+ public function testDoubleShared(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
diff --git a/tests/lib/Lock/LockingProvider.php b/tests/lib/Lock/LockingProvider.php
index 2aa3980542b..b7e301c55a6 100644
--- a/tests/lib/Lock/LockingProvider.php
+++ b/tests/lib/Lock/LockingProvider.php
@@ -27,19 +27,19 @@ abstract class LockingProvider extends TestCase {
$this->instance = $this->getInstance();
}
- public function testExclusiveLock() {
+ public function testExclusiveLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- public function testSharedLock() {
+ public function testSharedLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- public function testDoubleSharedLock() {
+ public function testDoubleSharedLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
@@ -47,7 +47,7 @@ abstract class LockingProvider extends TestCase {
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
}
- public function testReleaseSharedLock() {
+ public function testReleaseSharedLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
@@ -60,7 +60,7 @@ abstract class LockingProvider extends TestCase {
}
- public function testDoubleExclusiveLock() {
+ public function testDoubleExclusiveLock(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
@@ -68,7 +68,7 @@ abstract class LockingProvider extends TestCase {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- public function testReleaseExclusiveLock() {
+ public function testReleaseExclusiveLock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
$this->instance->releaseLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
@@ -77,7 +77,7 @@ abstract class LockingProvider extends TestCase {
}
- public function testExclusiveLockAfterShared() {
+ public function testExclusiveLockAfterShared(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
@@ -85,7 +85,7 @@ abstract class LockingProvider extends TestCase {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- public function testExclusiveLockAfterSharedReleased() {
+ public function testExclusiveLockAfterSharedReleased(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
$this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);
@@ -93,7 +93,7 @@ abstract class LockingProvider extends TestCase {
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAll() {
+ public function testReleaseAll(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
@@ -108,7 +108,7 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('fizz#A=23', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAllAfterChange() {
+ public function testReleaseAllAfterChange(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
@@ -124,7 +124,7 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAllAfterUnlock() {
+ public function testReleaseAllAfterUnlock(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('bar', ILockingProvider::LOCK_SHARED);
@@ -138,7 +138,7 @@ abstract class LockingProvider extends TestCase {
$this->assertFalse($this->instance->isLocked('asd', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testReleaseAfterReleaseAll() {
+ public function testReleaseAfterReleaseAll(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
@@ -151,7 +151,7 @@ abstract class LockingProvider extends TestCase {
- public function testSharedLockAfterExclusive() {
+ public function testSharedLockAfterExclusive(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
@@ -159,7 +159,7 @@ abstract class LockingProvider extends TestCase {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
}
- public function testLockedExceptionHasPathForShared() {
+ public function testLockedExceptionHasPathForShared(): void {
try {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
@@ -171,7 +171,7 @@ abstract class LockingProvider extends TestCase {
}
}
- public function testLockedExceptionHasPathForExclusive() {
+ public function testLockedExceptionHasPathForExclusive(): void {
try {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
@@ -183,14 +183,14 @@ abstract class LockingProvider extends TestCase {
}
}
- public function testChangeLockToExclusive() {
+ public function testChangeLockToExclusive(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_SHARED));
$this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
}
- public function testChangeLockToShared() {
+ public function testChangeLockToShared(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
$this->assertFalse($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE));
@@ -198,7 +198,7 @@ abstract class LockingProvider extends TestCase {
}
- public function testChangeLockToExclusiveDoubleShared() {
+ public function testChangeLockToExclusiveDoubleShared(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
@@ -207,14 +207,14 @@ abstract class LockingProvider extends TestCase {
}
- public function testChangeLockToExclusiveNoShared() {
+ public function testChangeLockToExclusiveNoShared(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->changeLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
}
- public function testChangeLockToExclusiveFromExclusive() {
+ public function testChangeLockToExclusiveFromExclusive(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_EXCLUSIVE);
@@ -222,21 +222,21 @@ abstract class LockingProvider extends TestCase {
}
- public function testChangeLockToSharedNoExclusive() {
+ public function testChangeLockToSharedNoExclusive(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
- public function testChangeLockToSharedFromShared() {
+ public function testChangeLockToSharedFromShared(): void {
$this->expectException(\OCP\Lock\LockedException::class);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->changeLock('foo', ILockingProvider::LOCK_SHARED);
}
- public function testReleaseNonExistingShared() {
+ public function testReleaseNonExistingShared(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->releaseLock('foo', ILockingProvider::LOCK_SHARED);
diff --git a/tests/lib/Lock/NonCachingDBLockingProviderTest.php b/tests/lib/Lock/NonCachingDBLockingProviderTest.php
index 5750d02fc4e..b79709a08e7 100644
--- a/tests/lib/Lock/NonCachingDBLockingProviderTest.php
+++ b/tests/lib/Lock/NonCachingDBLockingProviderTest.php
@@ -22,7 +22,7 @@ class NonCachingDBLockingProviderTest extends DBLockingProviderTest {
return new \OC\Lock\DBLockingProvider($this->connection, $this->timeFactory, 3600, false);
}
- public function testDoubleShared() {
+ public function testDoubleShared(): void {
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
$this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED);
diff --git a/tests/lib/Lockdown/Filesystem/NoFSTest.php b/tests/lib/Lockdown/Filesystem/NoFSTest.php
index 7a636fbaaaa..dedcf580992 100644
--- a/tests/lib/Lockdown/Filesystem/NoFSTest.php
+++ b/tests/lib/Lockdown/Filesystem/NoFSTest.php
@@ -38,7 +38,7 @@ class NoFSTest extends \Test\TestCase {
$this->createUser('foo', 'var');
}
- public function testSetupFS() {
+ public function testSetupFS(): void {
\OC_Util::tearDownFS();
\OC_Util::setupFS('foo');
diff --git a/tests/lib/Lockdown/Filesystem/NullCacheTest.php b/tests/lib/Lockdown/Filesystem/NullCacheTest.php
index eda4e10b1a6..5e120e9bdc7 100644
--- a/tests/lib/Lockdown/Filesystem/NullCacheTest.php
+++ b/tests/lib/Lockdown/Filesystem/NullCacheTest.php
@@ -22,15 +22,15 @@ class NulLCacheTest extends \Test\TestCase {
$this->cache = new NullCache();
}
- public function testGetNumericStorageId() {
+ public function testGetNumericStorageId(): void {
$this->assertSame(-1, $this->cache->getNumericStorageId());
}
- public function testGetEmpty() {
+ public function testGetEmpty(): void {
$this->assertNull($this->cache->get('foo'));
}
- public function testGet() {
+ public function testGet(): void {
$data = $this->cache->get('');
$this->assertEquals(-1, $data['fileid']);
@@ -44,63 +44,63 @@ class NulLCacheTest extends \Test\TestCase {
$this->assertEquals(Constants::PERMISSION_READ, $data['permissions']);
}
- public function testGetFolderContents() {
+ public function testGetFolderContents(): void {
$this->assertSame([], $this->cache->getFolderContents('foo'));
}
- public function testGetFolderContentsById() {
+ public function testGetFolderContentsById(): void {
$this->assertSame([], $this->cache->getFolderContentsById(42));
}
- public function testPut() {
+ public function testPut(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->put('foo', ['size' => 100]);
}
- public function testInsert() {
+ public function testInsert(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->insert('foo', ['size' => 100]);
}
- public function testUpdate() {
+ public function testUpdate(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->update('foo', ['size' => 100]);
}
- public function testGetId() {
+ public function testGetId(): void {
$this->assertSame(-1, $this->cache->getId('foo'));
}
- public function testGetParentId() {
+ public function testGetParentId(): void {
$this->assertSame(-1, $this->cache->getParentId('foo'));
}
- public function testInCache() {
+ public function testInCache(): void {
$this->assertTrue($this->cache->inCache(''));
$this->assertFalse($this->cache->inCache('foo'));
}
- public function testRemove() {
+ public function testRemove(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->remove('foo');
}
- public function testMove() {
+ public function testMove(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->move('foo', 'bar');
}
- public function testMoveFromCache() {
+ public function testMoveFromCache(): void {
$sourceCache = $this->createMock(ICache::class);
$this->expectException(ForbiddenException::class);
@@ -109,27 +109,27 @@ class NulLCacheTest extends \Test\TestCase {
$this->cache->moveFromCache($sourceCache, 'foo', 'bar');
}
- public function testGetStatus() {
+ public function testGetStatus(): void {
$this->assertSame(ICache::COMPLETE, $this->cache->getStatus('foo'));
}
- public function testSearch() {
+ public function testSearch(): void {
$this->assertSame([], $this->cache->search('foo'));
}
- public function testSearchByMime() {
+ public function testSearchByMime(): void {
$this->assertSame([], $this->cache->searchByMime('foo'));
}
- public function testGetIncomplete() {
+ public function testGetIncomplete(): void {
$this->assertSame([], $this->cache->getIncomplete());
}
- public function testGetPathById() {
+ public function testGetPathById(): void {
$this->assertSame('', $this->cache->getPathById(42));
}
- public function testNormalize() {
+ public function testNormalize(): void {
$this->assertSame('foo/ bar /', $this->cache->normalize('foo/ bar /'));
}
}
diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php
index 727ccb83e21..331adeb8a54 100644
--- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php
+++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php
@@ -24,178 +24,178 @@ class NullStorageTest extends TestCase {
$this->storage = new NullStorage([]);
}
- public function testGetId() {
+ public function testGetId(): void {
$this->assertSame('null', $this->storage->getId());
}
- public function testMkdir() {
+ public function testMkdir(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->mkdir('foo');
}
- public function testRmdir() {
+ public function testRmdir(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->rmdir('foo');
}
- public function testOpendir() {
+ public function testOpendir(): void {
$this->assertInstanceOf(IteratorDirectory::class, $this->storage->opendir('foo'));
}
- public function testIs_dir() {
+ public function testIs_dir(): void {
$this->assertTrue($this->storage->is_dir(''));
$this->assertFalse($this->storage->is_dir('foo'));
}
- public function testIs_file() {
+ public function testIs_file(): void {
$this->assertFalse($this->storage->is_file('foo'));
}
- public function testStat() {
+ public function testStat(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->stat('foo');
}
- public function testFiletype() {
+ public function testFiletype(): void {
$this->assertSame('dir', $this->storage->filetype(''));
$this->assertFalse($this->storage->filetype('foo'));
}
- public function testFilesize() {
+ public function testFilesize(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->filesize('foo');
}
- public function testIsCreatable() {
+ public function testIsCreatable(): void {
$this->assertFalse($this->storage->isCreatable('foo'));
}
- public function testIsReadable() {
+ public function testIsReadable(): void {
$this->assertTrue($this->storage->isReadable(''));
$this->assertFalse($this->storage->isReadable('foo'));
}
- public function testIsUpdatable() {
+ public function testIsUpdatable(): void {
$this->assertFalse($this->storage->isUpdatable('foo'));
}
- public function testIsDeletable() {
+ public function testIsDeletable(): void {
$this->assertFalse($this->storage->isDeletable('foo'));
}
- public function testIsSharable() {
+ public function testIsSharable(): void {
$this->assertFalse($this->storage->isSharable('foo'));
}
- public function testGetPermissions() {
+ public function testGetPermissions(): void {
$this->assertNull($this->storage->getPermissions('foo'));
}
- public function testFile_exists() {
+ public function testFile_exists(): void {
$this->assertTrue($this->storage->file_exists(''));
$this->assertFalse($this->storage->file_exists('foo'));
}
- public function testFilemtime() {
+ public function testFilemtime(): void {
$this->assertFalse($this->storage->filemtime('foo'));
}
- public function testFile_get_contents() {
+ public function testFile_get_contents(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->file_get_contents('foo');
}
- public function testFile_put_contents() {
+ public function testFile_put_contents(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->file_put_contents('foo', 'bar');
}
- public function testUnlink() {
+ public function testUnlink(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->unlink('foo');
}
- public function testRename() {
+ public function testRename(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->rename('foo', 'bar');
}
- public function testCopy() {
+ public function testCopy(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->copy('foo', 'bar');
}
- public function testFopen() {
+ public function testFopen(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->fopen('foo', 'R');
}
- public function testGetMimeType() {
+ public function testGetMimeType(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->getMimeType('foo');
}
- public function testHash() {
+ public function testHash(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->hash('md5', 'foo', true);
}
- public function testFree_space() {
+ public function testFree_space(): void {
$this->assertSame(FileInfo::SPACE_UNKNOWN, $this->storage->free_space('foo'));
}
- public function testTouch() {
+ public function testTouch(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->touch('foo');
}
- public function testGetLocalFile() {
+ public function testGetLocalFile(): void {
$this->assertFalse($this->storage->getLocalFile('foo'));
}
- public function testHasUpdated() {
+ public function testHasUpdated(): void {
$this->assertFalse($this->storage->hasUpdated('foo', 42));
}
- public function testGetETag() {
+ public function testGetETag(): void {
$this->assertSame('', $this->storage->getETag('foo'));
}
- public function testIsLocal() {
+ public function testIsLocal(): void {
$this->assertFalse($this->storage->isLocal());
}
- public function testGetDirectDownload() {
+ public function testGetDirectDownload(): void {
$this->assertFalse($this->storage->getDirectDownload('foo'));
}
- public function testCopyFromStorage() {
+ public function testCopyFromStorage(): void {
$sourceStorage = $this->createMock(Storage::class);
$this->expectException(ForbiddenException::class);
@@ -204,7 +204,7 @@ class NullStorageTest extends TestCase {
$this->storage->copyFromStorage($sourceStorage, 'foo', 'bar');
}
- public function testMoveFromStorage() {
+ public function testMoveFromStorage(): void {
$sourceStorage = $this->createMock(Storage::class);
$this->expectException(ForbiddenException::class);
@@ -218,11 +218,11 @@ class NullStorageTest extends TestCase {
return true;
}
- public function testGetOwner() {
+ public function testGetOwner(): void {
$this->assertNull($this->storage->getOwner('foo'));
}
- public function testGetCache() {
+ public function testGetCache(): void {
$this->assertInstanceOf(NullCache::class, $this->storage->getCache('foo'));
}
}
diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php
index bb71a6e63de..1f747378c02 100644
--- a/tests/lib/Lockdown/LockdownManagerTest.php
+++ b/tests/lib/Lockdown/LockdownManagerTest.php
@@ -23,12 +23,12 @@ class LockdownManagerTest extends TestCase {
};
}
- public function testCanAccessFilesystemDisabled() {
+ public function testCanAccessFilesystemDisabled(): void {
$manager = new LockdownManager($this->sessionCallback);
$this->assertTrue($manager->canAccessFilesystem());
}
- public function testCanAccessFilesystemAllowed() {
+ public function testCanAccessFilesystemAllowed(): void {
$token = new PublicKeyToken();
$token->setScope([IToken::SCOPE_FILESYSTEM => true]);
$manager = new LockdownManager($this->sessionCallback);
@@ -36,7 +36,7 @@ class LockdownManagerTest extends TestCase {
$this->assertTrue($manager->canAccessFilesystem());
}
- public function testCanAccessFilesystemNotAllowed() {
+ public function testCanAccessFilesystemNotAllowed(): void {
$token = new PublicKeyToken();
$token->setScope([IToken::SCOPE_FILESYSTEM => false]);
$manager = new LockdownManager($this->sessionCallback);
diff --git a/tests/lib/Log/ExceptionSerializerTest.php b/tests/lib/Log/ExceptionSerializerTest.php
index 1ec422fb53d..6d5bc5cf19f 100644
--- a/tests/lib/Log/ExceptionSerializerTest.php
+++ b/tests/lib/Log/ExceptionSerializerTest.php
@@ -42,7 +42,7 @@ class ExceptionSerializerTest extends TestCase {
* exception was passed to the logger. The token was replaced, the original
* variable overwritten.
*/
- public function testSerializer() {
+ public function testSerializer(): void {
try {
$secret = ['Secret'];
$this->emit([&$secret]);
@@ -53,7 +53,7 @@ class ExceptionSerializerTest extends TestCase {
}
}
- public function testSerializerWithRegisteredMethods() {
+ public function testSerializerWithRegisteredMethods(): void {
$this->serializer->enlistSensitiveMethods(self::class, ['customMagicAuthThing']);
try {
$this->customMagicAuthThing('u57474', 'Secret');
diff --git a/tests/lib/Log/FileTest.php b/tests/lib/Log/FileTest.php
index 37219b5c2b1..b483da969f4 100644
--- a/tests/lib/Log/FileTest.php
+++ b/tests/lib/Log/FileTest.php
@@ -25,29 +25,29 @@ class FileTest extends TestCase {
protected function setUp(): void {
parent::setUp();
$config = \OC::$server->getSystemConfig();
- $this->restore_logfile = $config->getValue("logfile");
+ $this->restore_logfile = $config->getValue('logfile');
$this->restore_logdateformat = $config->getValue('logdateformat');
- $config->setValue("logfile", $config->getValue('datadirectory') . "/logtest.log");
+ $config->setValue('logfile', $config->getValue('datadirectory') . '/logtest.log');
$this->logFile = new File($config->getValue('datadirectory') . '/logtest.log', '', $config);
}
protected function tearDown(): void {
$config = \OC::$server->getSystemConfig();
if (isset($this->restore_logfile)) {
- $config->getValue("logfile", $this->restore_logfile);
+ $config->getValue('logfile', $this->restore_logfile);
} else {
- $config->deleteValue("logfile");
+ $config->deleteValue('logfile');
}
if (isset($this->restore_logdateformat)) {
- $config->getValue("logdateformat", $this->restore_logdateformat);
+ $config->getValue('logdateformat', $this->restore_logdateformat);
} else {
- $config->deleteValue("logdateformat");
+ $config->deleteValue('logdateformat');
}
$this->logFile = new File($this->restore_logfile, '', $config);
parent::tearDown();
}
- public function testLogging() {
+ public function testLogging(): void {
$config = \OC::$server->get(IConfig::class);
# delete old logfile
unlink($config->getSystemValue('logfile'));
@@ -62,13 +62,13 @@ class FileTest extends TestCase {
fclose($handle);
# check log has data content
- $values = (array) json_decode($line, true);
+ $values = (array)json_decode($line, true);
$this->assertArrayNotHasKey('message', $values['data']);
$this->assertEquals('extra', $values['data']['something']);
$this->assertEquals('Testing logging', $values['message']);
}
- public function testMicrosecondsLogTimestamp() {
+ public function testMicrosecondsLogTimestamp(): void {
$config = \OC::$server->getConfig();
# delete old logfile
unlink($config->getSystemValue('logfile'));
@@ -83,7 +83,7 @@ class FileTest extends TestCase {
fclose($handle);
# check timestamp has microseconds part
- $values = (array) json_decode($line);
+ $values = (array)json_decode($line);
$microseconds = $values['time'];
$this->assertNotEquals(0, $microseconds);
}
diff --git a/tests/lib/Log/LogFactoryTest.php b/tests/lib/Log/LogFactoryTest.php
index c1232f7b28d..22ee0dfb268 100644
--- a/tests/lib/Log/LogFactoryTest.php
+++ b/tests/lib/Log/LogFactoryTest.php
@@ -61,7 +61,7 @@ class LogFactoryTest extends TestCase {
* @dataProvider fileTypeProvider
* @throws \OCP\AppFramework\QueryException
*/
- public function testFile(string $type) {
+ public function testFile(string $type): void {
$datadir = \OC::$SERVERROOT.'/data';
$defaultLog = $datadir . '/nextcloud.log';
@@ -91,7 +91,7 @@ class LogFactoryTest extends TestCase {
* @dataProvider logFilePathProvider
* @throws \OCP\AppFramework\QueryException
*/
- public function testFileCustomPath($path, $expected) {
+ public function testFileCustomPath($path, $expected): void {
$datadir = \OC::$SERVERROOT.'/data';
$defaultLog = $datadir . '/nextcloud.log';
@@ -108,7 +108,7 @@ class LogFactoryTest extends TestCase {
/**
* @throws \OCP\AppFramework\QueryException
*/
- public function testErrorLog() {
+ public function testErrorLog(): void {
$log = $this->factory->get('errorlog');
$this->assertInstanceOf(Errorlog::class, $log);
}
@@ -116,7 +116,7 @@ class LogFactoryTest extends TestCase {
/**
* @throws \OCP\AppFramework\QueryException
*/
- public function testSystemLog() {
+ public function testSystemLog(): void {
$this->c->expects($this->once())
->method('resolve')
->with(Syslog::class)
@@ -129,7 +129,7 @@ class LogFactoryTest extends TestCase {
/**
* @throws \OCP\AppFramework\QueryException
*/
- public function testSystemdLog() {
+ public function testSystemdLog(): void {
$this->c->expects($this->once())
->method('resolve')
->with(Systemdlog::class)
diff --git a/tests/lib/Log/PsrLoggerAdapterTest.php b/tests/lib/Log/PsrLoggerAdapterTest.php
new file mode 100644
index 00000000000..cc9ddea378a
--- /dev/null
+++ b/tests/lib/Log/PsrLoggerAdapterTest.php
@@ -0,0 +1,88 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Log;
+
+use OC\Log;
+use OC\Log\PsrLoggerAdapter;
+use OCP\ILogger;
+use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\InvalidArgumentException;
+use Psr\Log\LogLevel;
+use Test\TestCase;
+
+class PsrLoggerAdapterTest extends TestCase {
+ protected Log&MockObject $logger;
+ protected PsrLoggerAdapter $loggerAdapter;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->logger = $this->createMock(Log::class);
+ $this->loggerAdapter = new PsrLoggerAdapter($this->logger);
+ }
+
+ /**
+ * @dataProvider dataPsrLoggingLevels
+ */
+ public function testLoggingWithPsrLogLevels(string $level, int $expectedLevel): void {
+ $this->logger->expects(self::once())
+ ->method('log')
+ ->with($expectedLevel, 'test message', ['app' => 'test']);
+ $this->loggerAdapter->log($level, 'test message', ['app' => 'test']);
+ }
+
+ /**
+ * @dataProvider dataPsrLoggingLevels
+ */
+ public function testLogLevelToInt(string $level, int $expectedLevel): void {
+ $this->assertEquals($expectedLevel, PsrLoggerAdapter::logLevelToInt($level));
+ }
+
+ public function dataPsrLoggingLevels(): array {
+ return [
+ [LogLevel::ALERT, ILogger::ERROR],
+ [LogLevel::CRITICAL, ILogger::ERROR],
+ [LogLevel::DEBUG, ILogger::DEBUG],
+ [LogLevel::EMERGENCY, ILogger::FATAL],
+ [LogLevel::ERROR, ILogger::ERROR],
+ [LogLevel::INFO, ILogger::INFO],
+ [LogLevel::NOTICE, ILogger::INFO],
+ [LogLevel::WARNING, ILogger::WARN],
+ ];
+ }
+
+ /**
+ * @dataProvider dataInvalidLoggingLevel
+ */
+ public function testInvalidLoggingLevel($level): void {
+ $this->logger->expects(self::never())
+ ->method('log');
+ $this->expectException(InvalidArgumentException::class);
+
+ $this->loggerAdapter->log($level, 'valid message');
+ }
+
+ public function dataInvalidLoggingLevel(): array {
+ return [
+ // invalid string
+ ['this is not a level'],
+ // int out of range
+ [ILogger::DEBUG - 1],
+ [ILogger::FATAL + 1],
+ // float is not allowed
+ [1.2345],
+ // boolean is not a level
+ [true],
+ [false],
+ //
+ [null],
+ ];
+ }
+}
diff --git a/tests/lib/LoggerTest.php b/tests/lib/LoggerTest.php
index e3a51d93804..c7c60e892aa 100644
--- a/tests/lib/LoggerTest.php
+++ b/tests/lib/LoggerTest.php
@@ -10,19 +10,18 @@ namespace Test;
use OC\Log;
use OC\SystemConfig;
use OCP\ILogger;
+use OCP\IUser;
+use OCP\IUserSession;
use OCP\Log\IWriter;
use OCP\Support\CrashReport\IRegistry;
use PHPUnit\Framework\MockObject\MockObject;
class LoggerTest extends TestCase implements IWriter {
- /** @var SystemConfig|MockObject */
- private $config;
+ private SystemConfig&MockObject $config;
- /** @var IRegistry|MockObject */
- private $registry;
+ private IRegistry&MockObject $registry;
- /** @var ILogger */
- private $logger;
+ private Log $logger;
/** @var array */
private array $logs = [];
@@ -33,7 +32,7 @@ class LoggerTest extends TestCase implements IWriter {
$this->logs = [];
$this->config = $this->createMock(SystemConfig::class);
$this->registry = $this->createMock(IRegistry::class);
- $this->logger = new Log($this, $this->config, null, $this->registry);
+ $this->logger = new Log($this, $this->config, crashReporters: $this->registry);
}
private function mockDefaultLogLevel(): void {
@@ -44,7 +43,7 @@ class LoggerTest extends TestCase implements IWriter {
])));
}
- public function testInterpolation() {
+ public function testInterpolation(): void {
$this->mockDefaultLogLevel();
$logger = $this->logger;
$logger->warning('{Message {nothing} {user} {foo.bar} a}', ['user' => 'Bob', 'foo.bar' => 'Bar']);
@@ -53,7 +52,7 @@ class LoggerTest extends TestCase implements IWriter {
$this->assertEquals($expected, $this->getLogs());
}
- public function testAppCondition() {
+ public function testAppCondition(): void {
$this->config->expects($this->any())
->method('getValue')
->will(($this->returnValueMap([
@@ -73,8 +72,97 @@ class LoggerTest extends TestCase implements IWriter {
$this->assertEquals($expected, $this->getLogs());
}
+ public function dataMatchesCondition(): array {
+ return [
+ [
+ 'user0',
+ [
+ 'apps' => ['app2'],
+ ],
+ [
+ '1 Info of app2',
+ ],
+ ],
+ [
+ 'user2',
+ [
+ 'users' => ['user1', 'user2'],
+ 'apps' => ['app1'],
+ ],
+ [
+ '1 Info of app1',
+ ],
+ ],
+ [
+ 'user3',
+ [
+ 'users' => ['user3'],
+ ],
+ [
+ '1 Info without app',
+ '1 Info of app1',
+ '1 Info of app2',
+ '0 Debug of app3',
+ ],
+ ],
+ [
+ 'user4',
+ [
+ 'users' => ['user4'],
+ 'apps' => ['app3'],
+ 'loglevel' => 0,
+ ],
+ [
+ '0 Debug of app3',
+ ],
+ ],
+ [
+ 'user4',
+ [
+ 'message' => ' of ',
+ ],
+ [
+ '1 Info of app1',
+ '1 Info of app2',
+ '0 Debug of app3',
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider dataMatchesCondition
+ */
+ public function testMatchesCondition(string $userId, array $conditions, array $expectedLogs): void {
+ $this->config->expects($this->any())
+ ->method('getValue')
+ ->willReturnMap([
+ ['loglevel', ILogger::WARN, ILogger::WARN],
+ ['log.condition', [], ['matches' => [
+ $conditions,
+ ]]],
+ ]);
+ $logger = $this->logger;
+
+ $user = $this->createMock(IUser::class);
+ $user->method('getUID')
+ ->willReturn($userId);
+ $userSession = $this->createMock(IUserSession::class);
+ $userSession->method('getUser')
+ ->willReturn($user);
+ $this->overwriteService(IUserSession::class, $userSession);
+
+ $logger->info('Info without app');
+ $logger->info('Info of app1', ['app' => 'app1']);
+ $logger->info('Info of app2', ['app' => 'app2']);
+ $logger->debug('Debug of app3', ['app' => 'app3']);
+
+ $this->assertEquals($expectedLogs, $this->getLogs());
+ }
+
public function testLoggingWithDataArray(): void {
$this->mockDefaultLogLevel();
+ /** @var IWriter&MockObject */
$writerMock = $this->createMock(IWriter::class);
$logFile = new Log($writerMock, $this->config);
$writerMock->expects($this->once())->method('write')->with('no app in context', ['something' => 'extra', 'message' => 'Testing logging with john']);
@@ -90,7 +178,7 @@ class LoggerTest extends TestCase implements IWriter {
if (is_array($message)) {
$textMessage = $message['message'];
}
- $this->logs[] = $level . " " . $textMessage;
+ $this->logs[] = $level . ' ' . $textMessage;
}
public function userAndPasswordData(): array {
diff --git a/tests/lib/Mail/EMailTemplateTest.php b/tests/lib/Mail/EMailTemplateTest.php
index a12cf82ab50..76b37d48ff3 100644
--- a/tests/lib/Mail/EMailTemplateTest.php
+++ b/tests/lib/Mail/EMailTemplateTest.php
@@ -38,12 +38,14 @@ class EMailTemplateTest extends TestCase {
$this->defaults,
$this->urlGenerator,
$this->l10n,
+ 252,
+ 120,
'test.TestTemplate',
[]
);
}
- public function testEMailTemplateCustomFooter() {
+ public function testEMailTemplateCustomFooter(): void {
$this->defaults
->expects($this->any())
->method('getDefaultColorPrimary')
@@ -84,7 +86,7 @@ class EMailTemplateTest extends TestCase {
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}
- public function testEMailTemplateDefaultFooter() {
+ public function testEMailTemplateDefaultFooter(): void {
$this->defaults
->expects($this->any())
->method('getDefaultColorPrimary')
@@ -127,7 +129,7 @@ class EMailTemplateTest extends TestCase {
$this->assertSame($expectedTXT, $this->emailTemplate->renderText());
}
- public function testEMailTemplateSingleButton() {
+ public function testEMailTemplateSingleButton(): void {
$this->defaults
->expects($this->any())
->method('getDefaultColorPrimary')
@@ -172,7 +174,7 @@ class EMailTemplateTest extends TestCase {
- public function testEMailTemplateAlternativePlainTexts() {
+ public function testEMailTemplateAlternativePlainTexts(): void {
$this->defaults
->expects($this->any())
->method('getDefaultColorPrimary')
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 91006a8331a..9f37b776f17 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -77,7 +77,7 @@ class MailerTest extends TestCase {
* @param $sendmailMode
* @param $binaryParam
*/
- public function testGetSendmailInstanceSendMail($sendmailMode, $binaryParam) {
+ public function testGetSendmailInstanceSendMail($sendmailMode, $binaryParam): void {
$this->config
->expects($this->exactly(2))
->method('getSystemValueString')
@@ -100,7 +100,7 @@ class MailerTest extends TestCase {
* @param $sendmailMode
* @param $binaryParam
*/
- public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam) {
+ public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam): void {
$this->config
->expects($this->exactly(2))
->method('getSystemValueString')
@@ -113,7 +113,7 @@ class MailerTest extends TestCase {
$this->assertEquals($sendmail, self::invokePrivate($this->mailer, 'getSendMailInstance'));
}
- public function testGetInstanceDefault() {
+ public function testGetInstanceDefault(): void {
$this->config
->method('getSystemValue')
->willReturnMap([
@@ -127,7 +127,7 @@ class MailerTest extends TestCase {
$this->assertInstanceOf(EsmtpTransport::class, $transport);
}
- public function testGetInstanceSendmail() {
+ public function testGetInstanceSendmail(): void {
$this->config
->method('getSystemValueString')
->willReturnMap([
@@ -141,7 +141,7 @@ class MailerTest extends TestCase {
$this->assertInstanceOf(SendmailTransport::class, $transport);
}
- public function testEvents() {
+ public function testEvents(): void {
$this->config
->method('getSystemValue')
->willReturnMap([
@@ -173,7 +173,7 @@ class MailerTest extends TestCase {
$this->mailer->send($message);
}
- public function testCreateMessage() {
+ public function testCreateMessage(): void {
$this->config
->expects($this->any())
->method('getSystemValueBool')
@@ -183,7 +183,7 @@ class MailerTest extends TestCase {
}
- public function testSendInvalidMailException() {
+ public function testSendInvalidMailException(): void {
$this->config
->method('getSystemValue')
->willReturnMap([
@@ -223,7 +223,7 @@ class MailerTest extends TestCase {
/**
* @dataProvider mailAddressProvider
*/
- public function testValidateMailAddress($email, $expected, $strict) {
+ public function testValidateMailAddress($email, $expected, $strict): void {
$this->config
->expects($this->atMost(1))
->method('getAppValue')
@@ -232,15 +232,18 @@ class MailerTest extends TestCase {
$this->assertSame($expected, $this->mailer->validateMailAddress($email));
}
- public function testCreateEMailTemplate() {
+ public function testCreateEMailTemplate(): void {
$this->config->method('getSystemValueString')
->with('mail_template_class', '')
->willReturnArgument(1);
+ $this->config->method('getAppValue')
+ ->with('theming', 'logoDimensions', Mailer::DEFAULT_DIMENSIONS)
+ ->willReturn(Mailer::DEFAULT_DIMENSIONS);
$this->assertSame(EMailTemplate::class, get_class($this->mailer->createEMailTemplate('tests.MailerTest')));
}
- public function testStreamingOptions() {
+ public function testStreamingOptions(): void {
$this->config->method('getSystemValue')
->willReturnMap([
['mail_smtpstreamoptions', [], ['foo' => 1]],
@@ -264,7 +267,7 @@ class MailerTest extends TestCase {
$this->assertTrue(isset($transport->getStream()->getStreamOptions()['foo']));
}
- public function testStreamingOptionsWrongType() {
+ public function testStreamingOptionsWrongType(): void {
$this->config->method('getSystemValue')
->willReturnMap([
['mail_smtpstreamoptions', [], 'bar'],
diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php
index 84c30a962fa..681ec033380 100644
--- a/tests/lib/Mail/MessageTest.php
+++ b/tests/lib/Mail/MessageTest.php
@@ -77,7 +77,7 @@ class MessageTest extends TestCase {
* @param string $unconverted
* @param string $expected
*/
- public function testConvertAddresses($unconverted, $expected) {
+ public function testConvertAddresses($unconverted, $expected): void {
$this->assertEquals($expected, self::invokePrivate($this->message, 'convertAddresses', [$unconverted]));
}
@@ -112,7 +112,7 @@ class MessageTest extends TestCase {
$this->message->setRecipients();
}
- public function testSetTo() {
+ public function testSetTo(): void {
$expected = ['pierres-general-store@stardewvalley.com' => 'Pierres General Store'];
$message = $this->message->setTo(['pierres-general-store@stardewvalley.com' => 'Pierres General Store']);
@@ -141,7 +141,7 @@ class MessageTest extends TestCase {
$message->setRecipients();
}
- public function testSetGetFrom() {
+ public function testSetGetFrom(): void {
$expected = ['pierres-general-store@stardewvalley.com' => 'Pierres General Store'];
$message = $this->message->setFrom(['pierres-general-store@stardewvalley.com' => 'Pierres General Store']);
@@ -149,7 +149,7 @@ class MessageTest extends TestCase {
$this->assertEquals($expected, $message->getFrom());
}
- public function testSetGetTo() {
+ public function testSetGetTo(): void {
$expected = ['lewis-tent@stardewvalley.com' => "Lewis' Tent Life"];
$message = $this->message->setTo(['lewis-tent@stardewvalley.com' => "Lewis' Tent Life"]);
@@ -157,7 +157,7 @@ class MessageTest extends TestCase {
$this->assertEquals($expected, $message->getTo());
}
- public function testSetGetReplyTo() {
+ public function testSetGetReplyTo(): void {
$expected = ['penny@stardewvalley-library.co.edu' => 'Penny'];
$message = $this->message->setReplyTo(['penny@stardewvalley-library.co.edu' => 'Penny']);
@@ -165,7 +165,7 @@ class MessageTest extends TestCase {
$this->assertEquals($expected, $message->getReplyTo());
}
- public function testSetGetCC() {
+ public function testSetGetCC(): void {
$expected = ['gunther@stardewvalley-library.co.edu' => 'Gunther'];
$message = $this->message->setCc(['gunther@stardewvalley-library.co.edu' => 'Gunther']);
@@ -173,7 +173,7 @@ class MessageTest extends TestCase {
$this->assertEquals($expected, $message->getCc());
}
- public function testSetGetBCC() {
+ public function testSetGetBCC(): void {
$expected = ['pam@stardewvalley-bus.com' => 'Pam'];
$message = $this->message->setBcc(['pam@stardewvalley-bus.com' => 'Pam']);
@@ -181,7 +181,7 @@ class MessageTest extends TestCase {
$this->assertEquals($expected, $message->getBcc());
}
- public function testSetPlainBody() {
+ public function testSetPlainBody(): void {
$this->symfonyEmail
->expects($this->once())
->method('text')
@@ -190,7 +190,7 @@ class MessageTest extends TestCase {
$this->message->setPlainBody('Fancy Body');
}
- public function testGetPlainBody() {
+ public function testGetPlainBody(): void {
$this->symfonyEmail
->expects($this->once())
->method('getTextBody')
@@ -199,7 +199,7 @@ class MessageTest extends TestCase {
$this->assertSame('Fancy Body', $this->message->getPlainBody());
}
- public function testSetHtmlBody() {
+ public function testSetHtmlBody(): void {
$this->symfonyEmail
->expects($this->once())
->method('html')
@@ -208,7 +208,7 @@ class MessageTest extends TestCase {
$this->message->setHtmlBody('<blink>Fancy Body</blink>');
}
- public function testPlainTextRenderOption() {
+ public function testPlainTextRenderOption(): void {
/** @var MockObject|Email $symfonyEmail */
$symfonyEmail = $this->getMockBuilder(Email::class)
->disableOriginalConstructor()->getMock();
@@ -231,7 +231,7 @@ class MessageTest extends TestCase {
$message->useTemplate($template);
}
- public function testBothRenderingOptions() {
+ public function testBothRenderingOptions(): void {
/** @var MockObject|Email $symfonyEmail */
$symfonyEmail = $this->getMockBuilder(Email::class)
->disableOriginalConstructor()->getMock();
@@ -254,9 +254,9 @@ class MessageTest extends TestCase {
$message->useTemplate($template);
}
- public function testSetAutoSubmitted1() {
+ public function testSetAutoSubmitted1(): void {
$headers = new Headers($this->createMock(HeaderInterface::class));
- $headers->addTextHeader(AutoSubmitted::HEADER, "yes");
+ $headers->addTextHeader(AutoSubmitted::HEADER, 'yes');
$symfonyEmail = $this->createMock(Email::class);
$symfonyEmail->method('getHeaders')
@@ -267,7 +267,7 @@ class MessageTest extends TestCase {
$this->assertNotSame('no', $message->getAutoSubmitted());
}
- public function testSetAutoSubmitted2() {
+ public function testSetAutoSubmitted2(): void {
$headers = new Headers($this->createMock(HeaderInterface::class));
$headers->addTextHeader(AutoSubmitted::HEADER, 'no');
$symfonyEmail = $this->createMock(Email::class);
@@ -280,7 +280,7 @@ class MessageTest extends TestCase {
$this->assertSame('auto-generated', $message->getAutoSubmitted());
}
- public function testGetAutoSubmitted() {
+ public function testGetAutoSubmitted(): void {
$headers = new Headers($this->createMock(HeaderInterface::class));
$headers->addTextHeader(AutoSubmitted::HEADER, 'no');
$symfonyEmail = $this->createMock(Email::class);
@@ -289,6 +289,6 @@ class MessageTest extends TestCase {
->willReturn($headers);
$message = new Message($symfonyEmail, false);
- $this->assertSame("no", $message->getAutoSubmitted());
+ $this->assertSame('no', $message->getAutoSubmitted());
}
}
diff --git a/tests/lib/Mail/Provider/AddressTest.php b/tests/lib/Mail/Provider/AddressTest.php
new file mode 100644
index 00000000000..ee03f6f1e83
--- /dev/null
+++ b/tests/lib/Mail/Provider/AddressTest.php
@@ -0,0 +1,46 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace Test\Mail\Provider;
+
+use OCP\Mail\Provider\Address;
+use Test\TestCase;
+
+class AddressTest extends TestCase {
+
+ /** @var Address&MockObject */
+ private Address $address;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->address = new Address('user1@testing.com', 'User One');
+
+ }
+
+ public function testAddress(): void {
+
+ // test set by constructor
+ $this->assertEquals('user1@testing.com', $this->address->getAddress());
+ // test set by setter
+ $this->address->setAddress('user2@testing.com');
+ $this->assertEquals('user2@testing.com', $this->address->getAddress());
+
+ }
+
+ public function testLabel(): void {
+
+ // test set by constructor
+ $this->assertEquals('User One', $this->address->getLabel());
+ // test set by setter
+ $this->address->setLabel('User Two');
+ $this->assertEquals('User Two', $this->address->getLabel());
+
+ }
+
+}
diff --git a/tests/lib/Mail/Provider/AttachmentTest.php b/tests/lib/Mail/Provider/AttachmentTest.php
new file mode 100644
index 00000000000..283391650b5
--- /dev/null
+++ b/tests/lib/Mail/Provider/AttachmentTest.php
@@ -0,0 +1,71 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace Test\Mail\Provider;
+
+use OCP\Mail\Provider\Attachment;
+use Test\TestCase;
+
+class AttachmentTest extends TestCase {
+
+ /** @var Attachment&MockObject */
+ private Attachment $attachment;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->attachment = new Attachment(
+ 'This is the contents of a file',
+ 'example1.txt',
+ 'text/plain',
+ false
+ );
+
+ }
+
+ public function testName(): void {
+
+ // test set by constructor
+ $this->assertEquals('example1.txt', $this->attachment->getName());
+ // test set by setter
+ $this->attachment->setName('example2.txt');
+ $this->assertEquals('example2.txt', $this->attachment->getName());
+
+ }
+
+ public function testType(): void {
+
+ // test set by constructor
+ $this->assertEquals('text/plain', $this->attachment->getType());
+ // test set by setter
+ $this->attachment->setType('text/html');
+ $this->assertEquals('text/html', $this->attachment->getType());
+
+ }
+
+ public function testContents(): void {
+
+ // test set by constructor
+ $this->assertEquals('This is the contents of a file', $this->attachment->getContents());
+ // test set by setter
+ $this->attachment->setContents('This is the modified contents of a file');
+ $this->assertEquals('This is the modified contents of a file', $this->attachment->getContents());
+
+ }
+
+ public function testEmbedded(): void {
+
+ // test set by constructor
+ $this->assertEquals(false, $this->attachment->getEmbedded());
+ // test set by setter
+ $this->attachment->setEmbedded(true);
+ $this->assertEquals(true, $this->attachment->getEmbedded());
+
+ }
+
+}
diff --git a/tests/lib/Mail/Provider/ManagerTest.php b/tests/lib/Mail/Provider/ManagerTest.php
new file mode 100644
index 00000000000..d3dabc0ea75
--- /dev/null
+++ b/tests/lib/Mail/Provider/ManagerTest.php
@@ -0,0 +1,189 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace Test\Mail\Provider;
+
+use OC\AppFramework\Bootstrap\Coordinator;
+use OC\AppFramework\Bootstrap\RegistrationContext;
+use OC\AppFramework\Bootstrap\ServiceRegistration;
+use OC\Mail\Provider\Manager;
+use OCP\Mail\Provider\Address;
+use OCP\Mail\Provider\IProvider;
+use OCP\Mail\Provider\IService;
+use Psr\Container\ContainerInterface;
+use Psr\Log\LoggerInterface;
+use Test\TestCase;
+
+class ManagerTest extends TestCase {
+
+ /** @var Coordinator&MockObject */
+ private Coordinator $coordinator;
+ /** @var ContainerInterface&MockObject */
+ private ContainerInterface $container;
+ /** @var LoggerInterface&MockObject */
+ private LoggerInterface $logger;
+ /** @var IProvider&MockObject */
+ private IProvider $provider;
+ /** @var IService&MockObject */
+ private IService $service;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->logger = $this->createMock(LoggerInterface::class);
+
+ // construct service registration
+ $registration = $this->createMock(ServiceRegistration::class);
+ $registration
+ ->method('getService')
+ ->willReturn('Mock\Provider\MailProvider');
+ // construct registration context
+ $context = $this->createMock(RegistrationContext::class);
+ $context
+ ->method('getMailProviders')
+ ->willReturn([$registration]);
+ // construct coordinator
+ $this->coordinator = $this->createMock(Coordinator::class);
+ $this->coordinator
+ ->method('getRegistrationContext')
+ ->willReturn($context);
+
+ // construct mail service
+ $this->service = $this->createMock(IService::class);
+ $this->service
+ ->method('id')
+ ->willReturn('100');
+ $this->service
+ ->method('getLabel')
+ ->willReturn('Mock Mail Service');
+ $this->service
+ ->method('getPrimaryAddress')
+ ->willReturn((new Address('user1@testing.com', 'User One')));
+ // construct mail provider
+ $this->provider = $this->createMock(IProvider::class);
+ $this->provider
+ ->method('id')
+ ->willReturn('mock-provider');
+ $this->provider
+ ->method('label')
+ ->willReturn('Mock Provider');
+ $this->provider
+ ->method('listServices')
+ ->willReturnMap([
+ ['user0', []],
+ ['user1', [$this->service->id() => $this->service]]
+ ]);
+ $this->provider
+ ->method('findServiceById')
+ ->willReturnMap([
+ ['user0', '100', null],
+ ['user1', '100', $this->service]
+ ]);
+ $this->provider
+ ->method('findServiceByAddress')
+ ->willReturnMap([
+ ['user0', 'user0@testing.com', null],
+ ['user1', 'user1@testing.com', $this->service]
+ ]);
+ // construct container interface
+ $this->container = $this->createMock(ContainerInterface::class);
+ $this->container
+ ->method('get')
+ ->willReturnMap([
+ ['Mock\Provider\MailProvider', $this->provider]
+ ]);
+
+ }
+
+ public function testHas(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with providers found
+ $this->assertTrue($manager->has());
+
+ }
+
+ public function testCount(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with providers found
+ $this->assertGreaterThan(0, $manager->count());
+
+ }
+
+ public function testTypes(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with providers found
+ $this->assertEquals(['mock-provider' => 'Mock Provider'], $manager->types());
+
+ }
+
+ public function testProviders(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with providers found
+ $this->assertEquals([$this->provider->id() => $this->provider], $manager->providers());
+
+ }
+
+ public function testFindProviderById(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with providers found
+ $this->assertEquals($this->provider, $manager->findProviderById($this->provider->id()));
+
+ }
+
+ public function testServices(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with no services found
+ $this->assertEquals([], $manager->services('user0'));
+ // test result with services found
+ $this->assertEquals([$this->provider->id() => [$this->service->id() => $this->service]], $manager->services('user1'));
+
+ }
+
+ public function testFindServiceById(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with no services found and not provider specified
+ $this->assertEquals(null, $manager->findServiceById('user0', '100'));
+ // test result with no services found and provider specified
+ $this->assertEquals(null, $manager->findServiceById('user0', '100', $this->provider->id()));
+ // test result with services found and not provider specified
+ $this->assertEquals($this->service, $manager->findServiceById('user1', '100'));
+ // test result with services found and provider specified
+ $this->assertEquals($this->service, $manager->findServiceById('user1', '100', $this->provider->id()));
+
+ }
+
+ public function testFindServiceByAddress(): void {
+
+ // construct mail manager
+ $manager = new Manager($this->coordinator, $this->container, $this->logger);
+ // test result with no services found and not provider specified
+ $this->assertEquals(null, $manager->findServiceByAddress('user0', 'user0@testing.com'));
+ // test result with no services found and provider specified
+ $this->assertEquals(null, $manager->findServiceByAddress('user0', 'user0@testing.com', $this->provider->id()));
+ // test result with services found and not provider specified
+ $this->assertEquals($this->service, $manager->findServiceByAddress('user1', 'user1@testing.com'));
+ // test result with services found and provider specified
+ $this->assertEquals($this->service, $manager->findServiceByAddress('user1', 'user1@testing.com', $this->provider->id()));
+
+ }
+
+}
diff --git a/tests/lib/Mail/Provider/MessageTest.php b/tests/lib/Mail/Provider/MessageTest.php
new file mode 100644
index 00000000000..1791a03421c
--- /dev/null
+++ b/tests/lib/Mail/Provider/MessageTest.php
@@ -0,0 +1,163 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace Test\Mail\Provider;
+
+use OCP\Mail\Provider\Address;
+use OCP\Mail\Provider\Attachment;
+use OCP\Mail\Provider\Message;
+use Test\TestCase;
+
+class MessageTest extends TestCase {
+
+ /** @var Message&MockObject */
+ private Message $message;
+ /** @var Address&MockObject */
+ private Address $address1;
+ /** @var Address&MockObject */
+ private Address $address2;
+ /** @var Attachment&MockObject */
+ private Attachment $attachment1;
+ /** @var Attachment&MockObject */
+ private Attachment $attachment2;
+
+ protected function setUp(): void {
+ parent::setUp();
+
+ $this->message = new Message(
+ ['id' => 'cd02ea42-feac-4863-b9d8-484d16a587ea']
+ );
+ $this->address1 = new Address(
+ 'user1@testing.com',
+ 'User One'
+ );
+ $this->address2 = new Address(
+ 'user2@testing.com',
+ 'User Two'
+ );
+ $this->attachment1 = new Attachment(
+ 'This is the contents of the first attachment',
+ 'example1.txt',
+ 'text/plain',
+ false
+ );
+ $this->attachment2 = new Attachment(
+ 'This is the contents of the second attachment',
+ 'example1.txt',
+ 'text/plain',
+ false
+ );
+
+ }
+
+ public function testId(): void {
+
+ // test set by constructor
+ $this->assertEquals('cd02ea42-feac-4863-b9d8-484d16a587ea', $this->message->id());
+
+ }
+
+ public function testFrom(): void {
+
+ // test not set
+ $this->assertNull($this->message->getFrom());
+ // test set by setter
+ $this->message->setFrom($this->address1);
+ $this->assertEquals($this->address1, $this->message->getFrom());
+
+ }
+
+ public function testReplyTo(): void {
+
+ // test not set
+ $this->assertNull($this->message->getReplyTo());
+ // test set by setter
+ $this->message->setReplyTo($this->address1);
+ $this->assertEquals($this->address1, $this->message->getReplyTo());
+
+ }
+
+ public function testTo(): void {
+
+ // test not set
+ $this->assertEquals([], $this->message->getTo());
+ // test set by setter single
+ $this->message->setTo($this->address1);
+ $this->assertEquals([$this->address1], $this->message->getTo());
+ // test set by setter multiple
+ $this->message->setTo($this->address1, $this->address2);
+ $this->assertEquals([$this->address1, $this->address2], $this->message->getTo());
+
+ }
+
+ public function testCc(): void {
+
+ // test not set
+ $this->assertEquals([], $this->message->getCc());
+ // test set by setter single
+ $this->message->setCc($this->address1);
+ $this->assertEquals([$this->address1], $this->message->getCc());
+ // test set by setter multiple
+ $this->message->setCc($this->address1, $this->address2);
+ $this->assertEquals([$this->address1, $this->address2], $this->message->getCc());
+
+ }
+
+ public function testBcc(): void {
+
+ // test not set
+ $this->assertEquals([], $this->message->getBcc());
+ // test set by setter single
+ $this->message->setBcc($this->address1);
+ $this->assertEquals([$this->address1], $this->message->getBcc());
+ // test set by setter multiple
+ $this->message->setBcc($this->address1, $this->address2);
+ $this->assertEquals([$this->address1, $this->address2], $this->message->getBcc());
+
+ }
+
+ public function testSubject(): void {
+
+ // test not set
+ $this->assertNull($this->message->getSubject());
+ // test set by setter
+ $this->message->setSubject('Testing Mail Subject');
+ $this->assertEquals('Testing Mail Subject', $this->message->getSubject());
+
+ }
+
+ public function testBody(): void {
+
+ // test not set
+ $this->assertNull($this->message->getBody());
+ // test set by setter - text body
+ $this->message->setBody('Testing Text Body', false);
+ $this->assertEquals('Testing Text Body', $this->message->getBody());
+ $this->message->setBodyPlain('Testing Text Body Again', false);
+ $this->assertEquals('Testing Text Body Again', $this->message->getBodyPlain());
+ // test set by setter - html body
+ $this->message->setBody('Testing HTML Body', true);
+ $this->assertEquals('Testing HTML Body', $this->message->getBody());
+ $this->message->setBodyHtml('Testing HTML Body Again', false);
+ $this->assertEquals('Testing HTML Body Again', $this->message->getBodyHtml());
+
+ }
+
+ public function testAttachments(): void {
+
+ // test not set
+ $this->assertEquals([], $this->message->getAttachments());
+ // test set by setter single
+ $this->message->setAttachments($this->attachment1);
+ $this->assertEquals([$this->attachment1], $this->message->getAttachments());
+ // test set by setter multiple
+ $this->message->setAttachments($this->attachment1, $this->attachment2);
+ $this->assertEquals([$this->attachment1, $this->attachment2], $this->message->getAttachments());
+
+ }
+}
diff --git a/tests/lib/Memcache/APCuTest.php b/tests/lib/Memcache/APCuTest.php
index c13d30da136..cb465d1f07a 100644
--- a/tests/lib/Memcache/APCuTest.php
+++ b/tests/lib/Memcache/APCuTest.php
@@ -23,13 +23,13 @@ class APCuTest extends Cache {
$this->instance = new \OC\Memcache\APCu($this->getUniqueID());
}
- public function testCasIntChanged() {
+ public function testCasIntChanged(): void {
$this->instance->set('foo', 1);
$this->assertTrue($this->instance->cas('foo', 1, 2));
$this->assertEquals(2, $this->instance->get('foo'));
}
- public function testCasIntNotChanged() {
+ public function testCasIntNotChanged(): void {
$this->instance->set('foo', 1);
$this->assertFalse($this->instance->cas('foo', 2, 3));
$this->assertEquals(1, $this->instance->get('foo'));
diff --git a/tests/lib/Memcache/Cache.php b/tests/lib/Memcache/Cache.php
index efdaffc94eb..5845d426311 100644
--- a/tests/lib/Memcache/Cache.php
+++ b/tests/lib/Memcache/Cache.php
@@ -14,65 +14,65 @@ abstract class Cache extends \Test\Cache\TestCache {
*/
protected $instance;
- public function testExistsAfterSet() {
+ public function testExistsAfterSet(): void {
$this->assertFalse($this->instance->hasKey('foo'));
$this->instance->set('foo', 'bar');
$this->assertTrue($this->instance->hasKey('foo'));
}
- public function testGetAfterSet() {
+ public function testGetAfterSet(): void {
$this->assertNull($this->instance->get('foo'));
$this->instance->set('foo', 'bar');
$this->assertEquals('bar', $this->instance->get('foo'));
}
- public function testGetArrayAfterSet() {
+ public function testGetArrayAfterSet(): void {
$this->assertNull($this->instance->get('foo'));
$this->instance->set('foo', ['bar']);
$this->assertEquals(['bar'], $this->instance->get('foo'));
}
- public function testDoesNotExistAfterRemove() {
+ public function testDoesNotExistAfterRemove(): void {
$this->instance->set('foo', 'bar');
$this->instance->remove('foo');
$this->assertFalse($this->instance->hasKey('foo'));
}
- public function testRemoveNonExisting() {
+ public function testRemoveNonExisting(): void {
$this->instance->remove('foo');
$this->assertFalse($this->instance->hasKey('foo'));
}
- public function testArrayAccessSet() {
+ public function testArrayAccessSet(): void {
$this->instance['foo'] = 'bar';
$this->assertEquals('bar', $this->instance->get('foo'));
}
- public function testArrayAccessGet() {
+ public function testArrayAccessGet(): void {
$this->instance->set('foo', 'bar');
$this->assertEquals('bar', $this->instance['foo']);
}
- public function testArrayAccessExists() {
+ public function testArrayAccessExists(): void {
$this->assertFalse(isset($this->instance['foo']));
$this->instance->set('foo', 'bar');
$this->assertTrue(isset($this->instance['foo']));
}
- public function testArrayAccessUnset() {
+ public function testArrayAccessUnset(): void {
$this->instance->set('foo', 'bar');
unset($this->instance['foo']);
$this->assertFalse($this->instance->hasKey('foo'));
}
- public function testAdd() {
+ public function testAdd(): void {
$this->assertTrue($this->instance->add('foo', 'bar'));
$this->assertEquals('bar', $this->instance->get('foo'));
$this->assertFalse($this->instance->add('foo', 'asd'));
$this->assertEquals('bar', $this->instance->get('foo'));
}
- public function testInc() {
+ public function testInc(): void {
$this->assertEquals(1, $this->instance->inc('foo'));
$this->assertEquals(1, $this->instance->get('foo'));
$this->assertEquals(2, $this->instance->inc('foo'));
@@ -85,7 +85,7 @@ abstract class Cache extends \Test\Cache\TestCache {
$this->assertEquals('bar', $this->instance->get('foo'));
}
- public function testDec() {
+ public function testDec(): void {
$this->assertFalse($this->instance->dec('foo'));
$this->instance->set('foo', 20);
$this->assertEquals(19, $this->instance->dec('foo'));
@@ -97,30 +97,53 @@ abstract class Cache extends \Test\Cache\TestCache {
$this->assertEquals('bar', $this->instance->get('foo'));
}
- public function testCasNotChanged() {
+ public function testCasNotChanged(): void {
$this->instance->set('foo', 'bar');
$this->assertTrue($this->instance->cas('foo', 'bar', 'asd'));
$this->assertEquals('asd', $this->instance->get('foo'));
}
- public function testCasChanged() {
+ public function testCasChanged(): void {
$this->instance->set('foo', 'bar1');
$this->assertFalse($this->instance->cas('foo', 'bar', 'asd'));
$this->assertEquals('bar1', $this->instance->get('foo'));
}
- public function testCadNotChanged() {
+ public function testCasNotSet(): void {
+ $this->assertFalse($this->instance->cas('foo', 'bar', 'asd'));
+ }
+
+ public function testCadNotChanged(): void {
$this->instance->set('foo', 'bar');
$this->assertTrue($this->instance->cad('foo', 'bar'));
$this->assertFalse($this->instance->hasKey('foo'));
}
- public function testCadChanged() {
+ public function testCadChanged(): void {
$this->instance->set('foo', 'bar1');
$this->assertFalse($this->instance->cad('foo', 'bar'));
$this->assertTrue($this->instance->hasKey('foo'));
}
+ public function testCadNotSet(): void {
+ $this->assertFalse($this->instance->cad('foo', 'bar'));
+ }
+
+ public function testNcadNotChanged(): void {
+ $this->instance->set('foo', 'bar');
+ $this->assertFalse($this->instance->ncad('foo', 'bar'));
+ $this->assertTrue($this->instance->hasKey('foo'));
+ }
+
+ public function testNcadChanged(): void {
+ $this->instance->set('foo', 'bar1');
+ $this->assertTrue($this->instance->ncad('foo', 'bar'));
+ $this->assertFalse($this->instance->hasKey('foo'));
+ }
+
+ public function testNcadNotSet(): void {
+ $this->assertFalse($this->instance->ncad('foo', 'bar'));
+ }
protected function tearDown(): void {
if ($this->instance) {
diff --git a/tests/lib/Memcache/CasTraitTest.php b/tests/lib/Memcache/CasTraitTest.php
index 1c09a0e08f8..129819045f2 100644
--- a/tests/lib/Memcache/CasTraitTest.php
+++ b/tests/lib/Memcache/CasTraitTest.php
@@ -46,14 +46,14 @@ class CasTraitTest extends TestCase {
return $mock;
}
- public function testCasNotChanged() {
+ public function testCasNotChanged(): void {
$cache = $this->getCache();
$cache->set('foo', 'bar');
$this->assertTrue($cache->cas('foo', 'bar', 'asd'));
$this->assertEquals('asd', $cache->get('foo'));
}
- public function testCasChanged() {
+ public function testCasChanged(): void {
$cache = $this->getCache();
$cache->set('foo', 'bar1');
$this->assertFalse($cache->cas('foo', 'bar', 'asd'));
diff --git a/tests/lib/Memcache/FactoryTest.php b/tests/lib/Memcache/FactoryTest.php
index 5a1509eb3d9..fa0d80c5153 100644
--- a/tests/lib/Memcache/FactoryTest.php
+++ b/tests/lib/Memcache/FactoryTest.php
@@ -107,10 +107,10 @@ class FactoryTest extends \Test\TestCase {
* @dataProvider cacheAvailabilityProvider
*/
public function testCacheAvailability($localCache, $distributedCache, $lockingCache,
- $expectedLocalCache, $expectedDistributedCache, $expectedLockingCache) {
+ $expectedLocalCache, $expectedDistributedCache, $expectedLockingCache): void {
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$profiler = $this->getMockBuilder(IProfiler::class)->getMock();
- $factory = new \OC\Memcache\Factory('abc', $logger, $profiler, $localCache, $distributedCache, $lockingCache);
+ $factory = new \OC\Memcache\Factory(fn () => 'abc', $logger, $profiler, $localCache, $distributedCache, $lockingCache);
$this->assertTrue(is_a($factory->createLocal(), $expectedLocalCache));
$this->assertTrue(is_a($factory->createDistributed(), $expectedDistributedCache));
$this->assertTrue(is_a($factory->createLocking(), $expectedLockingCache));
@@ -119,18 +119,18 @@ class FactoryTest extends \Test\TestCase {
/**
* @dataProvider cacheUnavailableProvider
*/
- public function testCacheNotAvailableException($localCache, $distributedCache) {
+ public function testCacheNotAvailableException($localCache, $distributedCache): void {
$this->expectException(\OCP\HintException::class);
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$profiler = $this->getMockBuilder(IProfiler::class)->getMock();
- new \OC\Memcache\Factory('abc', $logger, $profiler, $localCache, $distributedCache);
+ new \OC\Memcache\Factory(fn () => 'abc', $logger, $profiler, $localCache, $distributedCache);
}
public function testCreateInMemory(): void {
$logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$profiler = $this->getMockBuilder(IProfiler::class)->getMock();
- $factory = new \OC\Memcache\Factory('abc', $logger, $profiler, null, null, null);
+ $factory = new \OC\Memcache\Factory(fn () => 'abc', $logger, $profiler, null, null, null);
$cache = $factory->createInMemory();
$cache->set('test', 48);
diff --git a/tests/lib/Memcache/MemcachedTest.php b/tests/lib/Memcache/MemcachedTest.php
index 48f93a45ed9..346530e191d 100644
--- a/tests/lib/Memcache/MemcachedTest.php
+++ b/tests/lib/Memcache/MemcachedTest.php
@@ -30,7 +30,7 @@ class MemcachedTest extends Cache {
$this->instance = new \OC\Memcache\Memcached($this->getUniqueID());
}
- public function testClear() {
+ public function testClear(): void {
// Memcached is sometimes broken with clear(), so we don't test it thoroughly
$value = 'ipsum lorum';
$this->instance->set('1_value1', $value);
diff --git a/tests/lib/Memcache/RedisTest.php b/tests/lib/Memcache/RedisTest.php
index 8df286b2f93..d76da03eb85 100644
--- a/tests/lib/Memcache/RedisTest.php
+++ b/tests/lib/Memcache/RedisTest.php
@@ -63,20 +63,20 @@ class RedisTest extends Cache {
$this->instance = new \OC\Memcache\Redis($this->getUniqueID());
}
- public function testScriptHashes() {
+ public function testScriptHashes(): void {
foreach (\OC\Memcache\Redis::LUA_SCRIPTS as $script) {
$this->assertEquals(sha1($script[0]), $script[1]);
}
}
- public function testCasTtlNotChanged() {
+ public function testCasTtlNotChanged(): void {
$this->instance->set('foo', 'bar', 50);
$this->assertTrue($this->instance->compareSetTTL('foo', 'bar', 100));
// allow for 1s of inaccuracy due to time moving forward
$this->assertLessThan(1, 100 - $this->instance->getTTL('foo'));
}
- public function testCasTtlChanged() {
+ public function testCasTtlChanged(): void {
$this->instance->set('foo', 'bar1', 50);
$this->assertFalse($this->instance->compareSetTTL('foo', 'bar', 100));
// allow for 1s of inaccuracy due to time moving forward
diff --git a/tests/lib/MemoryInfoTest.php b/tests/lib/MemoryInfoTest.php
index fb9c9ac7bd4..2477de2d799 100644
--- a/tests/lib/MemoryInfoTest.php
+++ b/tests/lib/MemoryInfoTest.php
@@ -59,7 +59,7 @@ class MemoryInfoTest extends TestCase {
* @param int|float $expected The expected detected memory limit.
* @dataProvider getMemoryLimitTestData
*/
- public function testMemoryLimit(string $iniValue, int|float $expected) {
+ public function testMemoryLimit(string $iniValue, int|float $expected): void {
ini_set('memory_limit', $iniValue);
$memoryInfo = new MemoryInfo();
self::assertEquals($expected, $memoryInfo->getMemoryLimit());
@@ -87,7 +87,7 @@ class MemoryInfoTest extends TestCase {
* @dataProvider getSufficientMemoryTestData
* @return void
*/
- public function testIsMemoryLimitSufficient(int $memoryLimit, bool $expected) {
+ public function testIsMemoryLimitSufficient(int $memoryLimit, bool $expected): void {
/* @var MemoryInfo|MockObject $memoryInfo */
$memoryInfo = $this->getMockBuilder(MemoryInfo::class)
->setMethods(['getMemoryLimit',])
diff --git a/tests/lib/Migration/BackgroundRepairTest.php b/tests/lib/Migration/BackgroundRepairTest.php
index 2744ac5cefb..585ebc420ad 100644
--- a/tests/lib/Migration/BackgroundRepairTest.php
+++ b/tests/lib/Migration/BackgroundRepairTest.php
@@ -70,12 +70,12 @@ class BackgroundRepairTest extends TestCase {
->getMock();
}
- public function testNoArguments() {
+ public function testNoArguments(): void {
$this->jobList->expects($this->once())->method('remove');
$this->job->start($this->jobList);
}
- public function testAppUpgrading() {
+ public function testAppUpgrading(): void {
$this->jobList->expects($this->never())->method('remove');
$this->job->expects($this->once())->method('loadApp')->with('test')->willThrowException(new NeedsUpdateException());
$this->job->setArgument([
@@ -85,7 +85,7 @@ class BackgroundRepairTest extends TestCase {
$this->job->start($this->jobList);
}
- public function testUnknownStep() {
+ public function testUnknownStep(): void {
$this->dispatcher->expects($this->never())->method('dispatchTyped');
$this->jobList->expects($this->once())->method('remove');
@@ -98,7 +98,7 @@ class BackgroundRepairTest extends TestCase {
$this->job->start($this->jobList);
}
- public function testWorkingStep() {
+ public function testWorkingStep(): void {
$this->dispatcher->expects($this->once())->method('dispatchTyped')
->with($this->equalTo(new RepairStepEvent('A test repair step')));
diff --git a/tests/lib/NaturalSortTest.php b/tests/lib/NaturalSortTest.php
index a053687eaf9..3a07c5ceb66 100644
--- a/tests/lib/NaturalSortTest.php
+++ b/tests/lib/NaturalSortTest.php
@@ -11,7 +11,7 @@ class NaturalSortTest extends \Test\TestCase {
/**
* @dataProvider naturalSortDataProvider
*/
- public function testNaturalSortCompare($array, $sorted) {
+ public function testNaturalSortCompare($array, $sorted): void {
if (!class_exists('Collator')) {
$this->markTestSkipped('The intl module is not available, natural sorting might not work as expected.');
return;
@@ -24,7 +24,7 @@ class NaturalSortTest extends \Test\TestCase {
/**
* @dataProvider defaultCollatorDataProvider
*/
- public function testDefaultCollatorCompare($array, $sorted) {
+ public function testDefaultCollatorCompare($array, $sorted): void {
$comparator = new \OC\NaturalSort(new \OC\NaturalSort_DefaultCollator());
usort($array, [$comparator, 'compare']);
$this->assertEquals($sorted, $array);
diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php
index 1899fdd9443..1297bfdf669 100644
--- a/tests/lib/NavigationManagerTest.php
+++ b/tests/lib/NavigationManagerTest.php
@@ -18,6 +18,7 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\L10N\IFactory;
+use Psr\Log\LoggerInterface;
class NavigationManagerTest extends TestCase {
/** @var AppManager|\PHPUnit\Framework\MockObject\MockObject */
@@ -35,6 +36,7 @@ class NavigationManagerTest extends TestCase {
/** @var \OC\NavigationManager */
protected $navigationManager;
+ protected LoggerInterface $logger;
protected function setUp(): void {
parent::setUp();
@@ -45,13 +47,15 @@ class NavigationManagerTest extends TestCase {
$this->userSession = $this->createMock(IUserSession::class);
$this->groupManager = $this->createMock(Manager::class);
$this->config = $this->createMock(IConfig::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
$this->navigationManager = new NavigationManager(
$this->appManager,
$this->urlGenerator,
$this->l10nFac,
$this->userSession,
$this->groupManager,
- $this->config
+ $this->config,
+ $this->logger,
);
$this->navigationManager->clear(false);
@@ -114,7 +118,7 @@ class NavigationManagerTest extends TestCase {
* @param array $entry
* @param array $expectedEntry
*/
- public function testAddArray(array $entry, array $expectedEntry) {
+ public function testAddArray(array $entry, array $expectedEntry): void {
$this->assertEmpty($this->navigationManager->getAll('all'), 'Expected no navigation entry exists');
$this->navigationManager->add($entry);
@@ -132,7 +136,7 @@ class NavigationManagerTest extends TestCase {
* @param array $entry
* @param array $expectedEntry
*/
- public function testAddClosure(array $entry, array $expectedEntry) {
+ public function testAddClosure(array $entry, array $expectedEntry): void {
global $testAddClosureNumberOfCalls;
$testAddClosureNumberOfCalls = 0;
@@ -159,7 +163,7 @@ class NavigationManagerTest extends TestCase {
$this->assertEmpty($this->navigationManager->getAll('all'), 'Expected no navigation entry exists after clear()');
}
- public function testAddArrayClearGetAll() {
+ public function testAddArrayClearGetAll(): void {
$entry = [
'id' => 'entry id',
'name' => 'link text',
@@ -174,7 +178,7 @@ class NavigationManagerTest extends TestCase {
$this->assertEmpty($this->navigationManager->getAll(), 'Expected no navigation entry exists after clear()');
}
- public function testAddClosureClearGetAll() {
+ public function testAddClosureClearGetAll(): void {
$this->assertEmpty($this->navigationManager->getAll(), 'Expected no navigation entry exists');
$entry = [
@@ -205,7 +209,7 @@ class NavigationManagerTest extends TestCase {
/**
* @dataProvider providesNavigationConfig
*/
- public function testWithAppManager($expected, $navigation, $isAdmin = false) {
+ public function testWithAppManager($expected, $navigation, $isAdmin = false): void {
$l = $this->createMock(IL10N::class);
$l->expects($this->any())->method('t')->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
@@ -216,9 +220,9 @@ class NavigationManagerTest extends TestCase {
->willReturnArgument(3);
$this->appManager->expects($this->any())
- ->method('isEnabledForUser')
- ->with('theming')
- ->willReturn(true);
+ ->method('isEnabledForUser')
+ ->with('theming')
+ ->willReturn(true);
$this->appManager->expects($this->once())
->method('getAppInfo')
->with('test')
@@ -243,9 +247,9 @@ class NavigationManagerTest extends TestCase {
$this->userSession->expects($this->any())->method('getUser')->willReturn($user);
$this->userSession->expects($this->any())->method('isLoggedIn')->willReturn(true);
$this->appManager->expects($this->any())
- ->method('getEnabledAppsForUser')
- ->with($user)
- ->willReturn(['test']);
+ ->method('getEnabledAppsForUser')
+ ->with($user)
+ ->willReturn(['test']);
$this->groupManager->expects($this->any())->method('isAdmin')->willReturn($isAdmin);
$subadmin = $this->createMock(SubAdmin::class);
$subadmin->expects($this->any())->method('isSubAdmin')->with($user)->willReturn(false);
@@ -485,7 +489,7 @@ class NavigationManagerTest extends TestCase {
];
}
- public function testWithAppManagerAndApporder() {
+ public function testWithAppManagerAndApporder(): void {
$l = $this->createMock(IL10N::class);
$l->expects($this->any())->method('t')->willReturnCallback(function ($text, $parameters = []) {
return vsprintf($text, $parameters);
@@ -525,9 +529,9 @@ class NavigationManagerTest extends TestCase {
);
$this->appManager->expects($this->any())
- ->method('isEnabledForUser')
- ->with('theming')
- ->willReturn(true);
+ ->method('isEnabledForUser')
+ ->with('theming')
+ ->willReturn(true);
$this->appManager->expects($this->once())->method('getAppInfo')->with('test')->willReturn($navigation);
$this->appManager->expects($this->once())->method('getAppIcon')->with('test')->willReturn('/apps/test/img/app.svg');
$this->l10nFac->expects($this->any())->method('get')->willReturn($l);
@@ -545,9 +549,9 @@ class NavigationManagerTest extends TestCase {
$this->userSession->expects($this->any())->method('getUser')->willReturn($user);
$this->userSession->expects($this->any())->method('isLoggedIn')->willReturn(true);
$this->appManager->expects($this->any())
- ->method('getEnabledAppsForUser')
- ->with($user)
- ->willReturn(['test']);
+ ->method('getEnabledAppsForUser')
+ ->with($user)
+ ->willReturn(['test']);
$this->groupManager->expects($this->any())->method('isAdmin')->willReturn(false);
$subadmin = $this->createMock(SubAdmin::class);
$subadmin->expects($this->any())->method('isSubAdmin')->with($user)->willReturn(false);
@@ -557,4 +561,224 @@ class NavigationManagerTest extends TestCase {
$entries = $this->navigationManager->getAll();
$this->assertEquals($expected, $entries);
}
+
+ public static function provideDefaultEntries(): array {
+ return [
+ // none specified, default to files
+ [
+ '',
+ '',
+ '{}',
+ true,
+ 'files',
+ ],
+ // none specified, without fallback
+ [
+ '',
+ '',
+ '{}',
+ false,
+ '',
+ ],
+ // unexisting or inaccessible app specified, default to files
+ [
+ 'unexist',
+ '',
+ '{}',
+ true,
+ 'files',
+ ],
+ // unexisting or inaccessible app specified, without fallbacks
+ [
+ 'unexist',
+ '',
+ '{}',
+ false,
+ '',
+ ],
+ // non-standard app
+ [
+ 'settings',
+ '',
+ '{}',
+ true,
+ 'settings',
+ ],
+ // non-standard app, without fallback
+ [
+ 'settings',
+ '',
+ '{}',
+ false,
+ 'settings',
+ ],
+ // non-standard app with fallback
+ [
+ 'unexist,settings',
+ '',
+ '{}',
+ true,
+ 'settings',
+ ],
+ // system default app and user apporder
+ [
+ // system default is settings
+ 'unexist,settings',
+ '',
+ // apporder says default app is files (order is lower)
+ '{"files_id":{"app":"files","order":1},"settings_id":{"app":"settings","order":2}}',
+ true,
+ // system default should override apporder
+ 'settings'
+ ],
+ // user-customized defaultapp
+ [
+ '',
+ 'files',
+ '',
+ true,
+ 'files',
+ ],
+ // user-customized defaultapp with systemwide
+ [
+ 'unexist,settings',
+ 'files',
+ '',
+ true,
+ 'files',
+ ],
+ // user-customized defaultapp with system wide and apporder
+ [
+ 'unexist,settings',
+ 'files',
+ '{"settings_id":{"app":"settings","order":1},"files_id":{"app":"files","order":2}}',
+ true,
+ 'files',
+ ],
+ // user-customized apporder fallback
+ [
+ '',
+ '',
+ '{"settings_id":{"app":"settings","order":1},"files":{"app":"files","order":2}}',
+ true,
+ 'settings',
+ ],
+ // user-customized apporder fallback with missing app key (entries added by closures does not always have an app key set (Nextcloud 27 spreed app for example))
+ [
+ '',
+ '',
+ '{"spreed":{"order":1},"files":{"app":"files","order":2}}',
+ true,
+ 'files',
+ ],
+ // user-customized apporder, but called without fallback
+ [
+ '',
+ '',
+ '{"settings":{"app":"settings","order":1},"files":{"app":"files","order":2}}',
+ false,
+ '',
+ ],
+ // user-customized apporder with an app that has multiple routes
+ [
+ '',
+ '',
+ '{"settings_id":{"app":"settings","order":1},"settings_id_2":{"app":"settings","order":3},"id_files":{"app":"files","order":2}}',
+ true,
+ 'settings',
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider provideDefaultEntries
+ */
+ public function testGetDefaultEntryIdForUser($defaultApps, $userDefaultApps, $userApporder, $withFallbacks, $expectedApp): void {
+ $this->navigationManager->add([
+ 'id' => 'files',
+ ]);
+ $this->navigationManager->add([
+ 'id' => 'settings',
+ ]);
+
+ $this->appManager->method('getInstalledApps')->willReturn([]);
+
+ $user = $this->createMock(IUser::class);
+ $user->method('getUID')->willReturn('user1');
+
+ $this->userSession->expects($this->once())
+ ->method('getUser')
+ ->willReturn($user);
+
+ $this->config->expects($this->once())
+ ->method('getSystemValueString')
+ ->with('defaultapp', $this->anything())
+ ->willReturn($defaultApps);
+
+ $this->config->expects($this->atLeastOnce())
+ ->method('getUserValue')
+ ->willReturnMap([
+ ['user1', 'core', 'defaultapp', '', $userDefaultApps],
+ ['user1', 'core', 'apporder', '[]', $userApporder],
+ ]);
+
+ $this->assertEquals($expectedApp, $this->navigationManager->getDefaultEntryIdForUser(null, $withFallbacks));
+ }
+
+ public function testDefaultEntryUpdated(): void {
+ $this->appManager->method('getInstalledApps')->willReturn([]);
+
+ $user = $this->createMock(IUser::class);
+ $user->method('getUID')->willReturn('user1');
+
+ $this->userSession
+ ->method('getUser')
+ ->willReturn($user);
+
+ $this->config
+ ->method('getSystemValueString')
+ ->with('defaultapp', $this->anything())
+ ->willReturn('app4,app3,app2,app1');
+
+ $this->config
+ ->method('getUserValue')
+ ->willReturnMap([
+ ['user1', 'core', 'defaultapp', '', ''],
+ ['user1', 'core', 'apporder', '[]', ''],
+ ]);
+
+ $this->navigationManager->add([
+ 'id' => 'app1',
+ ]);
+
+ $this->assertEquals('app1', $this->navigationManager->getDefaultEntryIdForUser(null, false));
+ $this->assertEquals(true, $this->navigationManager->get('app1')['default']);
+
+ $this->navigationManager->add([
+ 'id' => 'app3',
+ ]);
+
+ $this->assertEquals('app3', $this->navigationManager->getDefaultEntryIdForUser(null, false));
+ $this->assertEquals(false, $this->navigationManager->get('app1')['default']);
+ $this->assertEquals(true, $this->navigationManager->get('app3')['default']);
+
+ $this->navigationManager->add([
+ 'id' => 'app2',
+ ]);
+
+ $this->assertEquals('app3', $this->navigationManager->getDefaultEntryIdForUser(null, false));
+ $this->assertEquals(false, $this->navigationManager->get('app1')['default']);
+ $this->assertEquals(false, $this->navigationManager->get('app2')['default']);
+ $this->assertEquals(true, $this->navigationManager->get('app3')['default']);
+
+ $this->navigationManager->add([
+ 'id' => 'app4',
+ ]);
+
+ $this->assertEquals('app4', $this->navigationManager->getDefaultEntryIdForUser(null, false));
+ $this->assertEquals(false, $this->navigationManager->get('app1')['default']);
+ $this->assertEquals(false, $this->navigationManager->get('app2')['default']);
+ $this->assertEquals(false, $this->navigationManager->get('app3')['default']);
+ $this->assertEquals(true, $this->navigationManager->get('app4')['default']);
+ }
}
diff --git a/tests/lib/Notification/ActionTest.php b/tests/lib/Notification/ActionTest.php
index bfcfbbe75db..3ae4b1db7e7 100644
--- a/tests/lib/Notification/ActionTest.php
+++ b/tests/lib/Notification/ActionTest.php
@@ -32,7 +32,7 @@ class ActionTest extends TestCase {
* @dataProvider dataSetLabel
* @param string $label
*/
- public function testSetLabel($label) {
+ public function testSetLabel($label): void {
$this->assertSame('', $this->action->getLabel());
$this->assertSame($this->action, $this->action->setLabel($label));
$this->assertSame($label, $this->action->getLabel());
@@ -50,7 +50,7 @@ class ActionTest extends TestCase {
* @param mixed $label
*
*/
- public function testSetLabelInvalid($label) {
+ public function testSetLabelInvalid($label): void {
$this->expectException(\InvalidArgumentException::class);
$this->action->setLabel($label);
@@ -68,7 +68,7 @@ class ActionTest extends TestCase {
* @dataProvider dataSetParsedLabel
* @param string $label
*/
- public function testSetParsedLabel($label) {
+ public function testSetParsedLabel($label): void {
$this->assertSame('', $this->action->getParsedLabel());
$this->assertSame($this->action, $this->action->setParsedLabel($label));
$this->assertSame($label, $this->action->getParsedLabel());
@@ -85,7 +85,7 @@ class ActionTest extends TestCase {
* @param mixed $label
*
*/
- public function testSetParsedLabelInvalid($label) {
+ public function testSetParsedLabelInvalid($label): void {
$this->expectException(\InvalidArgumentException::class);
$this->action->setParsedLabel($label);
@@ -105,7 +105,7 @@ class ActionTest extends TestCase {
* @param string $link
* @param string $type
*/
- public function testSetLink($link, $type) {
+ public function testSetLink($link, $type): void {
$this->assertSame('', $this->action->getLink());
$this->assertSame($this->action, $this->action->setLink($link, $type));
$this->assertSame($link, $this->action->getLink());
@@ -129,7 +129,7 @@ class ActionTest extends TestCase {
* @param mixed $type
*
*/
- public function testSetLinkInvalid($link, $type) {
+ public function testSetLinkInvalid($link, $type): void {
$this->expectException(\InvalidArgumentException::class);
$this->action->setLink($link, $type);
@@ -146,13 +146,13 @@ class ActionTest extends TestCase {
* @dataProvider dataSetPrimary
* @param bool $primary
*/
- public function testSetPrimary($primary) {
+ public function testSetPrimary($primary): void {
$this->assertSame(false, $this->action->isPrimary());
$this->assertSame($this->action, $this->action->setPrimary($primary));
$this->assertSame($primary, $this->action->isPrimary());
}
- public function testIsValid() {
+ public function testIsValid(): void {
$this->assertFalse($this->action->isValid());
$this->assertFalse($this->action->isValidParsed());
$this->action->setLabel('label');
@@ -163,7 +163,7 @@ class ActionTest extends TestCase {
$this->assertFalse($this->action->isValidParsed());
}
- public function testIsValidParsed() {
+ public function testIsValidParsed(): void {
$this->assertFalse($this->action->isValid());
$this->assertFalse($this->action->isValidParsed());
$this->action->setParsedLabel('label');
diff --git a/tests/lib/Notification/NotificationTest.php b/tests/lib/Notification/NotificationTest.php
index 9afc74db495..48a78bd0fe7 100644
--- a/tests/lib/Notification/NotificationTest.php
+++ b/tests/lib/Notification/NotificationTest.php
@@ -57,7 +57,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetApp
* @param string $app
*/
- public function testSetApp($app) {
+ public function testSetApp($app): void {
$this->assertSame('', $this->notification->getApp());
$this->assertSame($this->notification, $this->notification->setApp($app));
$this->assertSame($app, $this->notification->getApp());
@@ -72,7 +72,7 @@ class NotificationTest extends TestCase {
* @param mixed $app
*
*/
- public function testSetAppInvalid($app) {
+ public function testSetAppInvalid($app): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setApp($app);
@@ -87,7 +87,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetUser
* @param string $user
*/
- public function testSetUser($user) {
+ public function testSetUser($user): void {
$this->assertSame('', $this->notification->getUser());
$this->assertSame($this->notification, $this->notification->setUser($user));
$this->assertSame($user, $this->notification->getUser());
@@ -102,7 +102,7 @@ class NotificationTest extends TestCase {
* @param mixed $user
*
*/
- public function testSetUserInvalid($user) {
+ public function testSetUserInvalid($user): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setUser($user);
@@ -126,7 +126,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetDateTime
* @param \DateTime $dateTime
*/
- public function testSetDateTime(\DateTime $dateTime) {
+ public function testSetDateTime(\DateTime $dateTime): void {
$this->assertSame(0, $this->notification->getDateTime()->getTimestamp());
$this->assertSame($this->notification, $this->notification->setDateTime($dateTime));
$this->assertSame($dateTime, $this->notification->getDateTime());
@@ -146,7 +146,7 @@ class NotificationTest extends TestCase {
*
* @expectedMessage 'The given date time is invalid'
*/
- public function testSetDateTimeZero($dateTime) {
+ public function testSetDateTimeZero($dateTime): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setDateTime($dateTime);
@@ -164,7 +164,7 @@ class NotificationTest extends TestCase {
* @param string $type
* @param string $id
*/
- public function testSetObject($type, $id) {
+ public function testSetObject($type, $id): void {
$this->assertSame('', $this->notification->getObjectType());
$this->assertSame('', $this->notification->getObjectId());
$this->assertSame($this->notification, $this->notification->setObject($type, $id));
@@ -189,7 +189,7 @@ class NotificationTest extends TestCase {
*
* @expectedMessage 'The given object id is invalid'
*/
- public function testSetObjectIdInvalid($id) {
+ public function testSetObjectIdInvalid($id): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setObject('object', $id);
@@ -208,7 +208,7 @@ class NotificationTest extends TestCase {
* @param string $subject
* @param array $parameters
*/
- public function testSetSubject($subject, $parameters) {
+ public function testSetSubject($subject, $parameters): void {
$this->assertSame('', $this->notification->getSubject());
$this->assertSame([], $this->notification->getSubjectParameters());
$this->assertSame($this->notification, $this->notification->setSubject($subject, $parameters));
@@ -225,7 +225,7 @@ class NotificationTest extends TestCase {
* @param mixed $subject
*
*/
- public function testSetSubjectInvalidSubject($subject) {
+ public function testSetSubjectInvalidSubject($subject): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setSubject($subject, []);
@@ -239,7 +239,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetParsedSubject
* @param string $subject
*/
- public function testSetParsedSubject($subject) {
+ public function testSetParsedSubject($subject): void {
$this->assertSame('', $this->notification->getParsedSubject());
$this->assertSame($this->notification, $this->notification->setParsedSubject($subject));
$this->assertSame($subject, $this->notification->getParsedSubject());
@@ -254,7 +254,7 @@ class NotificationTest extends TestCase {
* @param mixed $subject
*
*/
- public function testSetParsedSubjectInvalid($subject) {
+ public function testSetParsedSubjectInvalid($subject): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setParsedSubject($subject);
@@ -273,7 +273,7 @@ class NotificationTest extends TestCase {
* @param string $message
* @param array $parameters
*/
- public function testSetMessage($message, $parameters) {
+ public function testSetMessage($message, $parameters): void {
$this->assertSame('', $this->notification->getMessage());
$this->assertSame([], $this->notification->getMessageParameters());
$this->assertSame($this->notification, $this->notification->setMessage($message, $parameters));
@@ -290,7 +290,7 @@ class NotificationTest extends TestCase {
* @param mixed $message
*
*/
- public function testSetMessageInvalidMessage($message) {
+ public function testSetMessageInvalidMessage($message): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setMessage($message, []);
@@ -304,7 +304,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetParsedMessage
* @param string $message
*/
- public function testSetParsedMessage($message) {
+ public function testSetParsedMessage($message): void {
$this->assertSame('', $this->notification->getParsedMessage());
$this->assertSame($this->notification, $this->notification->setParsedMessage($message));
$this->assertSame($message, $this->notification->getParsedMessage());
@@ -319,7 +319,7 @@ class NotificationTest extends TestCase {
* @param mixed $message
*
*/
- public function testSetParsedMessageInvalid($message) {
+ public function testSetParsedMessageInvalid($message): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setParsedMessage($message);
@@ -333,7 +333,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetLink
* @param string $link
*/
- public function testSetLink($link) {
+ public function testSetLink($link): void {
$this->assertSame('', $this->notification->getLink());
$this->assertSame($this->notification, $this->notification->setLink($link));
$this->assertSame($link, $this->notification->getLink());
@@ -348,7 +348,7 @@ class NotificationTest extends TestCase {
* @param mixed $link
*
*/
- public function testSetLinkInvalid($link) {
+ public function testSetLinkInvalid($link): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setLink($link);
@@ -362,7 +362,7 @@ class NotificationTest extends TestCase {
* @dataProvider dataSetIcon
* @param string $icon
*/
- public function testSetIcon($icon) {
+ public function testSetIcon($icon): void {
$this->assertSame('', $this->notification->getIcon());
$this->assertSame($this->notification, $this->notification->setIcon($icon));
$this->assertSame($icon, $this->notification->getIcon());
@@ -377,18 +377,18 @@ class NotificationTest extends TestCase {
* @param mixed $icon
*
*/
- public function testSetIconInvalid($icon) {
+ public function testSetIconInvalid($icon): void {
$this->expectException(\InvalidArgumentException::class);
$this->notification->setIcon($icon);
}
- public function testCreateAction() {
+ public function testCreateAction(): void {
$action = $this->notification->createAction();
$this->assertInstanceOf(IAction::class, $action);
}
- public function testAddAction() {
+ public function testAddAction(): void {
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
@@ -404,7 +404,7 @@ class NotificationTest extends TestCase {
}
- public function testAddActionInvalid() {
+ public function testAddActionInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
@@ -418,7 +418,7 @@ class NotificationTest extends TestCase {
$this->notification->addAction($action);
}
- public function testAddActionSecondPrimary() {
+ public function testAddActionSecondPrimary(): void {
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
@@ -434,7 +434,7 @@ class NotificationTest extends TestCase {
$this->notification->addAction($action);
}
- public function testAddParsedAction() {
+ public function testAddParsedAction(): void {
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->once())
@@ -450,7 +450,7 @@ class NotificationTest extends TestCase {
}
- public function testAddParsedActionInvalid() {
+ public function testAddParsedActionInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
@@ -464,7 +464,7 @@ class NotificationTest extends TestCase {
$this->notification->addParsedAction($action);
}
- public function testAddActionSecondParsedPrimary() {
+ public function testAddActionSecondParsedPrimary(): void {
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action = $this->createMock(IAction::class);
$action->expects($this->exactly(2))
@@ -480,7 +480,7 @@ class NotificationTest extends TestCase {
$this->notification->addParsedAction($action);
}
- public function testAddActionParsedPrimaryEnd() {
+ public function testAddActionParsedPrimaryEnd(): void {
/** @var \OCP\Notification\IAction|\PHPUnit\Framework\MockObject\MockObject $action */
$action1 = $this->createMock(IAction::class);
$action1->expects($this->exactly(2))
@@ -521,7 +521,7 @@ class NotificationTest extends TestCase {
* @param string $subject
* @param bool $expected
*/
- public function testIsValid($isValidCommon, $subject, $expected) {
+ public function testIsValid($isValidCommon, $subject, $expected): void {
/** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->setMethods([
@@ -554,7 +554,7 @@ class NotificationTest extends TestCase {
* @param string $subject
* @param bool $expected
*/
- public function testIsParsedValid($isValidCommon, $subject, $expected) {
+ public function testIsParsedValid($isValidCommon, $subject, $expected): void {
/** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->setMethods([
@@ -601,7 +601,7 @@ class NotificationTest extends TestCase {
* @param string $objectId
* @param bool $expected
*/
- public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected) {
+ public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected): void {
/** @var \OCP\Notification\INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->getMockBuilder(Notification::class)
->setMethods([
diff --git a/tests/lib/OCS/ApiHelperTest.php b/tests/lib/OCS/ApiHelperTest.php
new file mode 100644
index 00000000000..fdbc1f4c538
--- /dev/null
+++ b/tests/lib/OCS/ApiHelperTest.php
@@ -0,0 +1,54 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\OCS;
+
+use OC\OCS\ApiHelper;
+use OCP\IRequest;
+
+class ApiHelperTest extends \Test\TestCase {
+ /**
+ * @return array
+ */
+ public function versionDataScriptNameProvider(): array {
+ return [
+ // Valid script name
+ [
+ '/master/ocs/v2.php', true,
+ ],
+
+ // Invalid script names
+ [
+ '/master/ocs/v2.php/someInvalidPathName', false,
+ ],
+ [
+ '/master/ocs/v1.php', false,
+ ],
+ [
+ '', false,
+ ],
+ ];
+ }
+
+ /**
+ * @dataProvider versionDataScriptNameProvider
+ */
+ public function testIsV2(string $scriptName, bool $expected): void {
+ $request = $this->getMockBuilder(IRequest::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $request
+ ->expects($this->once())
+ ->method('getScriptName')
+ ->willReturn($scriptName);
+
+ $this->assertEquals($expected, $this->invokePrivate(new ApiHelper, 'isV2', [$request]));
+ }
+}
diff --git a/tests/lib/OCS/DiscoveryServiceTest.php b/tests/lib/OCS/DiscoveryServiceTest.php
index 1c71ee4c7a5..3db3163e11d 100644
--- a/tests/lib/OCS/DiscoveryServiceTest.php
+++ b/tests/lib/OCS/DiscoveryServiceTest.php
@@ -13,13 +13,13 @@ use OCP\OCS\IDiscoveryService;
use Test\TestCase;
class DiscoveryServiceTest extends TestCase {
- /** @var \PHPUnit\Framework\MockObject\MockObject | ICacheFactory */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | ICacheFactory */
private $cacheFactory;
- /** @var \PHPUnit\Framework\MockObject\MockObject | IClientService */
+ /** @var \PHPUnit\Framework\MockObject\MockObject | IClientService */
private $clientService;
- /** @var IDiscoveryService */
+ /** @var IDiscoveryService */
private $discoveryService;
protected function setUp(): void {
@@ -40,7 +40,7 @@ class DiscoveryServiceTest extends TestCase {
* @param string $url
* @param bool $expected
*/
- public function testIsSafeUrl($url, $expected) {
+ public function testIsSafeUrl($url, $expected): void {
$result = $this->invokePrivate($this->discoveryService, 'isSafeUrl', [$url]);
$this->assertSame($expected, $result);
}
@@ -64,7 +64,7 @@ class DiscoveryServiceTest extends TestCase {
* @param string $service
* @param array $expected
*/
- public function testGetEndpoints($decodedServices, $service, $expected) {
+ public function testGetEndpoints($decodedServices, $service, $expected): void {
$result = $this->invokePrivate($this->discoveryService, 'getEndpoints', [$decodedServices, $service]);
$this->assertSame($expected, $result);
}
diff --git a/tests/lib/OCS/MapStatusCodeTest.php b/tests/lib/OCS/MapStatusCodeTest.php
deleted file mode 100644
index c6d6d5edd06..00000000000
--- a/tests/lib/OCS/MapStatusCodeTest.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
- * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-
-namespace Test\OCS;
-
-use OCP\AppFramework\Http;
-
-class MapStatusCodeTest extends \Test\TestCase {
- /**
- * @dataProvider providesStatusCodes
- */
- public function testStatusCodeMapper($expected, $sc) {
- $result = \OC_API::mapStatusCodes($sc);
- $this->assertEquals($expected, $result);
- }
-
- public function providesStatusCodes() {
- return [
- [Http::STATUS_OK, 100],
- [Http::STATUS_BAD_REQUEST, 104],
- [Http::STATUS_BAD_REQUEST, 1000],
- [201, 201],
- ];
- }
-}
diff --git a/tests/lib/OCS/ProviderTest.php b/tests/lib/OCS/ProviderTest.php
index c1efa7d873e..3834c1d613e 100644
--- a/tests/lib/OCS/ProviderTest.php
+++ b/tests/lib/OCS/ProviderTest.php
@@ -25,7 +25,7 @@ class ProviderTest extends \Test\TestCase {
$this->ocsProvider = new Provider('ocs_provider', $this->request, $this->appManager);
}
- public function testBuildProviderListWithoutAnythingEnabled() {
+ public function testBuildProviderListWithoutAnythingEnabled(): void {
$this->appManager
->expects($this->exactly(4))
->method('isEnabledForUser')
@@ -56,7 +56,7 @@ class ProviderTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
}
- public function testBuildProviderListWithSharingEnabled() {
+ public function testBuildProviderListWithSharingEnabled(): void {
$this->appManager
->expects($this->exactly(4))
->method('isEnabledForUser')
@@ -105,7 +105,7 @@ class ProviderTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
}
- public function testBuildProviderListWithFederationEnabled() {
+ public function testBuildProviderListWithFederationEnabled(): void {
$this->appManager
->expects($this->exactly(4))
->method('isEnabledForUser')
@@ -149,7 +149,7 @@ class ProviderTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocsProvider->buildProviderList());
}
- public function testBuildProviderListWithEverythingEnabled() {
+ public function testBuildProviderListWithEverythingEnabled(): void {
$this->appManager
->expects($this->any())
->method('isEnabledForUser')
diff --git a/tests/lib/Preview/BackgroundCleanupJobTest.php b/tests/lib/Preview/BackgroundCleanupJobTest.php
index a221829b712..d9ea1718491 100644
--- a/tests/lib/Preview/BackgroundCleanupJobTest.php
+++ b/tests/lib/Preview/BackgroundCleanupJobTest.php
@@ -121,7 +121,7 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
return $i;
}
- public function testCleanupSystemCron() {
+ public function testCleanupSystemCron(): void {
$files = $this->setup11Previews();
$fileIds = array_map(function (File $f) {
return $f->getId();
@@ -145,7 +145,11 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$this->assertSame(0, $this->countPreviews($root, $fileIds));
}
- public function testCleanupAjax() {
+ public function testCleanupAjax(): void {
+ if ($this->connection->getShardDefinition('filecache')) {
+ $this->markTestSkipped('ajax cron is not supported for sharded setups');
+ return;
+ }
$files = $this->setup11Previews();
$fileIds = array_map(function (File $f) {
return $f->getId();
@@ -173,16 +177,22 @@ class BackgroundCleanupJobTest extends \Test\TestCase {
$this->assertSame(0, $this->countPreviews($root, $fileIds));
}
- public function testOldPreviews() {
+ public function testOldPreviews(): void {
+ if ($this->connection->getShardDefinition('filecache')) {
+ $this->markTestSkipped('old previews are not supported for sharded setups');
+ return;
+ }
$appdata = \OC::$server->getAppDataDir('preview');
$f1 = $appdata->newFolder('123456781');
$f1->newFile('foo.jpg', 'foo');
$f2 = $appdata->newFolder('123456782');
$f2->newFile('foo.jpg', 'foo');
+ $f2 = $appdata->newFolder((string)PHP_INT_MAX - 1);
+ $f2->newFile('foo.jpg', 'foo');
$appdata = \OC::$server->getAppDataDir('preview');
- $this->assertSame(2, count($appdata->getDirectoryListing()));
+ $this->assertSame(3, count($appdata->getDirectoryListing()));
$job = new BackgroundCleanupJob($this->timeFactory, $this->connection, $this->getRoot(), $this->mimeTypeLoader, true);
$job->run([]);
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index 9116fee7e2f..7bd121250fb 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -15,6 +15,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IConfig;
+use OCP\IImage;
use OCP\IPreview;
use OCP\Preview\BeforePreviewFetchedEvent;
use OCP\Preview\IProviderV2;
@@ -56,7 +57,7 @@ class GeneratorTest extends \Test\TestCase {
);
}
- public function testGetCachedPreview() {
+ public function testGetCachedPreview(): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
->willReturn(true);
@@ -90,13 +91,13 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL));
+ ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL, null));
$result = $this->generator->getPreview($file, 100, 100);
$this->assertSame($previewFile, $result);
}
- public function testGetNewPreview() {
+ public function testGetNewPreview(): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
->willReturn(true);
@@ -161,7 +162,7 @@ class GeneratorTest extends \Test\TestCase {
$this->fail('Unexpected provider requested');
});
- $image = $this->createMock(\OC_Image::class);
+ $image = $this->createMock(IImage::class);
$image->method('width')->willReturn(2048);
$image->method('height')->willReturn(2048);
$image->method('valid')->willReturn(true);
@@ -218,13 +219,13 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL));
+ ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL, null));
$result = $this->generator->getPreview($file, 100, 100);
$this->assertSame($previewFile, $result);
}
- public function testInvalidMimeType() {
+ public function testInvalidMimeType(): void {
$this->expectException(NotFoundException::class);
$file = $this->createMock(File::class);
@@ -257,12 +258,12 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file, 1024, 512, true, IPreview::MODE_COVER));
+ ->with(new BeforePreviewFetchedEvent($file, 1024, 512, true, IPreview::MODE_COVER, 'invalidType'));
$this->generator->getPreview($file, 1024, 512, true, IPreview::MODE_COVER, 'invalidType');
}
- public function testReturnCachedPreviewsWithoutCheckingSupportedMimetype() {
+ public function testReturnCachedPreviewsWithoutCheckingSupportedMimetype(): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
->willReturn(true);
@@ -294,13 +295,13 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file, 1024, 512, true, IPreview::MODE_COVER));
+ ->with(new BeforePreviewFetchedEvent($file, 1024, 512, true, IPreview::MODE_COVER, 'invalidType'));
$result = $this->generator->getPreview($file, 1024, 512, true, IPreview::MODE_COVER, 'invalidType');
$this->assertSame($preview, $result);
}
- public function testNoProvider() {
+ public function testNoProvider(): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
->willReturn(true);
@@ -322,14 +323,14 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL));
+ ->with(new BeforePreviewFetchedEvent($file, 100, 100, false, IPreview::MODE_FILL, null));
$this->expectException(NotFoundException::class);
$this->generator->getPreview($file, 100, 100);
}
private function getMockImage($width, $height, $data = null) {
- $image = $this->createMock(\OC_Image::class);
+ $image = $this->createMock(IImage::class);
$image->method('height')->willReturn($width);
$image->method('width')->willReturn($height);
$image->method('valid')->willReturn(true);
@@ -397,7 +398,7 @@ class GeneratorTest extends \Test\TestCase {
* @param int $expectedX
* @param int $expectedY
*/
- public function testCorrectSize($maxX, $maxY, $reqX, $reqY, $crop, $mode, $expectedX, $expectedY) {
+ public function testCorrectSize($maxX, $maxY, $reqX, $reqY, $crop, $mode, $expectedX, $expectedY): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
->willReturn(true);
@@ -447,7 +448,7 @@ class GeneratorTest extends \Test\TestCase {
$this->eventDispatcher->expects($this->once())
->method('dispatchTyped')
- ->with(new BeforePreviewFetchedEvent($file, $reqX, $reqY, $crop, $mode));
+ ->with(new BeforePreviewFetchedEvent($file, $reqX, $reqY, $crop, $mode, null));
$result = $this->generator->getPreview($file, $reqX, $reqY, $crop, $mode);
if ($expectedX === $maxX && $expectedY === $maxY) {
@@ -457,7 +458,7 @@ class GeneratorTest extends \Test\TestCase {
}
}
- public function testUnreadbleFile() {
+ public function testUnreadbleFile(): void {
$file = $this->createMock(File::class);
$file->method('isReadable')
->willReturn(false);
diff --git a/tests/lib/Preview/HEICTest.php b/tests/lib/Preview/HEICTest.php
index cfd2adac912..5df7b63dd03 100644
--- a/tests/lib/Preview/HEICTest.php
+++ b/tests/lib/Preview/HEICTest.php
@@ -15,7 +15,7 @@ namespace Test\Preview;
*/
class HEICTest extends Provider {
protected function setUp(): void {
- if (!in_array("HEIC", \Imagick::queryFormats("HEI*"))) {
+ if (!in_array('HEIC', \Imagick::queryFormats('HEI*'))) {
$this->markTestSkipped('ImageMagick is not HEIC aware. Skipping tests');
} else {
parent::setUp();
diff --git a/tests/lib/Preview/Provider.php b/tests/lib/Preview/Provider.php
index 6cecd8a0762..41a2a4ca3c4 100644
--- a/tests/lib/Preview/Provider.php
+++ b/tests/lib/Preview/Provider.php
@@ -78,7 +78,7 @@ abstract class Provider extends \Test\TestCase {
* @param int $widthAdjustment
* @param int $heightAdjustment
*/
- public function testGetThumbnail($widthAdjustment, $heightAdjustment) {
+ public function testGetThumbnail($widthAdjustment, $heightAdjustment): void {
$ratio = round($this->width / $this->height, 2);
$this->maxWidth = $this->width - $widthAdjustment;
$this->maxHeight = $this->height - $heightAdjustment;
diff --git a/tests/lib/PublicNamespace/UtilTest.php b/tests/lib/PublicNamespace/UtilTest.php
index 6931b191a4d..4fa31bd902a 100644
--- a/tests/lib/PublicNamespace/UtilTest.php
+++ b/tests/lib/PublicNamespace/UtilTest.php
@@ -13,7 +13,7 @@ class UtilTest extends \Test\TestCase {
*
* @param string $channel
*/
- public function testOverrideChannel($channel) {
+ public function testOverrideChannel($channel): void {
\OCP\Util::setChannel($channel);
$actual = \OCP\Util::getChannel($channel);
$this->assertEquals($channel, $actual);
diff --git a/tests/lib/Remote/Api/OCSTest.php b/tests/lib/Remote/Api/OCSTest.php
index d47bb50cc35..3fcc486f246 100644
--- a/tests/lib/Remote/Api/OCSTest.php
+++ b/tests/lib/Remote/Api/OCSTest.php
@@ -40,7 +40,7 @@ class OCSTest extends TestCase {
return 'https://example.com/ocs/v2.php/' . $url;
}
- public function testGetUser() {
+ public function testGetUser(): void {
$client = $this->getOCSClient();
$this->expectGetRequest($this->getOCSUrl('cloud/users/user'),
@@ -53,7 +53,7 @@ class OCSTest extends TestCase {
}
- public function testGetUserInvalidResponse() {
+ public function testGetUserInvalidResponse(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid user response, expected field email not found');
@@ -67,7 +67,7 @@ class OCSTest extends TestCase {
}
- public function testInvalidPassword() {
+ public function testInvalidPassword(): void {
$this->expectException(\OC\ForbiddenException::class);
$client = $this->getOCSClient();
diff --git a/tests/lib/Remote/InstanceTest.php b/tests/lib/Remote/InstanceTest.php
index 3e4ffda15b7..027a67010be 100644
--- a/tests/lib/Remote/InstanceTest.php
+++ b/tests/lib/Remote/InstanceTest.php
@@ -24,7 +24,7 @@ class InstanceTest extends TestCase {
$this->cache = new ArrayCache();
}
- public function testBasicStatus() {
+ public function testBasicStatus(): void {
$instance = new Instance('example.com', $this->cache, $this->getClientService());
$this->expectGetRequest('https://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
@@ -34,7 +34,7 @@ class InstanceTest extends TestCase {
$this->assertEquals('https://example.com', $instance->getFullUrl());
}
- public function testHttpFallback() {
+ public function testHttpFallback(): void {
$instance = new Instance('example.com', $this->cache, $this->getClientService());
$this->expectGetRequest('https://example.com/status.php', new \Exception());
$this->expectGetRequest('http://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
@@ -43,7 +43,7 @@ class InstanceTest extends TestCase {
$this->assertEquals('http://example.com', $instance->getFullUrl());
}
- public function testRerequestHttps() {
+ public function testRerequestHttps(): void {
$instance = new Instance('example.com', $this->cache, $this->getClientService());
$this->expectGetRequest('https://example.com/status.php', '{"installed":true,"maintenance":false,"needsDbUpgrade":false,"version":"13.0.0.5","versionstring":"13.0.0 alpha","edition":"","productname":"Nextcloud"}');
@@ -58,7 +58,7 @@ class InstanceTest extends TestCase {
}
- public function testPreventDowngradeAttach() {
+ public function testPreventDowngradeAttach(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('refusing to connect to remote instance(example.com) over http that was previously accessible over https');
diff --git a/tests/lib/Repair/CleanTagsTest.php b/tests/lib/Repair/CleanTagsTest.php
index 586ae24a0aa..13aca706a5a 100644
--- a/tests/lib/Repair/CleanTagsTest.php
+++ b/tests/lib/Repair/CleanTagsTest.php
@@ -65,10 +65,11 @@ class CleanTagsTest extends \Test\TestCase {
->execute();
$qb->delete('filecache')
+ ->runAcrossAllShards()
->execute();
}
- public function testRun() {
+ public function testRun(): void {
$cat1 = $this->addTagCategory('TestRepairCleanTags', 'files'); // Retained
$cat2 = $this->addTagCategory('TestRepairCleanTags2', 'files'); // Deleted: Category will be empty
$this->addTagCategory('TestRepairCleanTags3', 'files'); // Deleted: Category is empty
@@ -141,7 +142,7 @@ class CleanTagsTest extends \Test\TestCase {
])
->execute();
- return (int) $this->getLastInsertID('vcategory', 'id');
+ return $qb->getLastInsertId();
}
/**
@@ -176,6 +177,7 @@ class CleanTagsTest extends \Test\TestCase {
$fileName = $this->getUniqueID('TestRepairCleanTags', 12);
$qb->insert('filecache')
->values([
+ 'storage' => $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT),
'path' => $qb->createNamedParameter($fileName),
'path_hash' => $qb->createNamedParameter(md5($fileName)),
])
@@ -183,21 +185,13 @@ class CleanTagsTest extends \Test\TestCase {
$fileName = $this->getUniqueID('TestRepairCleanTags', 12);
$qb->insert('filecache')
->values([
+ 'storage' => $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT),
'path' => $qb->createNamedParameter($fileName),
'path_hash' => $qb->createNamedParameter(md5($fileName)),
])
->execute();
- $this->createdFile = (int) $this->getLastInsertID('filecache', 'fileid');
+ $this->createdFile = $qb->getLastInsertId();
return $this->createdFile;
}
-
- /**
- * @param $tableName
- * @param $idName
- * @return int
- */
- protected function getLastInsertID($tableName, $idName) {
- return $this->connection->lastInsertId("*PREFIX*$tableName");
- }
}
diff --git a/tests/lib/Repair/ClearFrontendCachesTest.php b/tests/lib/Repair/ClearFrontendCachesTest.php
index 640e272f3b7..e48db295d45 100644
--- a/tests/lib/Repair/ClearFrontendCachesTest.php
+++ b/tests/lib/Repair/ClearFrontendCachesTest.php
@@ -36,7 +36,7 @@ class ClearFrontendCachesTest extends \Test\TestCase {
}
- public function testRun() {
+ public function testRun(): void {
$imagePathCache = $this->createMock(ICache::class);
$imagePathCache->expects($this->once())
->method('clear')
diff --git a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
index 1545085f977..c03b9082446 100644
--- a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
+++ b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
@@ -57,11 +57,11 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase {
* @param string $from
* @param boolean $expected
*/
- public function testShouldRun($from, $expected) {
+ public function testShouldRun($from, $expected): void {
$this->config->expects($this->any())
- ->method('getSystemValueString')
- ->with('version', '0.0.0.0')
- ->willReturn($from);
+ ->method('getSystemValueString')
+ ->with('version', '0.0.0.0')
+ ->willReturn($from);
$this->assertEquals($expected, $this->invokePrivate($this->repair, 'shouldRun'));
}
diff --git a/tests/lib/Repair/NC11/FixMountStoragesTest.php b/tests/lib/Repair/NC11/FixMountStoragesTest.php
deleted file mode 100644
index 6fdcc07d24e..00000000000
--- a/tests/lib/Repair/NC11/FixMountStoragesTest.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-/**
- * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-namespace Test\Repair\NC11;
-
-use OC\Repair\NC11\FixMountStorages;
-use OCP\DB\QueryBuilder\IQueryBuilder;
-use OCP\IDBConnection;
-use OCP\Migration\IOutput;
-use Test\TestCase;
-
-/**
- * Class FixMountStoragesTest
- *
- * @package Test\Repair\NC11
- * @group DB
- */
-class FixMountStoragesTest extends TestCase {
- /** @var IDBConnection */
- private $db;
-
- /** @var FixMountStorages */
- private $repair;
-
- protected function setUp(): void {
- parent::setUp();
-
- $this->db = \OC::$server->getDatabaseConnection();
-
- $this->repair = new FixMountStorages(
- $this->db
- );
- }
-
- public function testGetName() {
- $this->assertSame('Fix potential broken mount points', $this->repair->getName());
- }
-
- public function testRun() {
- // Valid mount
- $file1 = $this->createFile(42);
- $mount1 = $this->createMount($file1, 42);
- $this->assertStorage($mount1, 42);
-
- // Broken mount
- $file2 = $this->createFile(23);
- $mount2 = $this->createMount($file2, 1337);
- $this->assertStorage($mount2, 1337);
-
- /** @var IOutput|\PHPUnit\Framework\MockObject\MockObject $output */
- $output = $this->createMock(IOutput::class);
- $output->expects($this->exactly(2))
- ->method('info')
- ->withConsecutive(
- ['1 mounts updated'],
- ['No mounts updated']
- );
-
- $this->repair->run($output);
- $this->assertStorage($mount1, 42);
- $this->assertStorage($mount2, 23);
-
- $this->repair->run($output);
- $this->assertStorage($mount1, 42);
- $this->assertStorage($mount2, 23);
- }
-
-
- protected function createFile($storage) {
- $query = $this->db->getQueryBuilder();
-
- $query->insert('filecache')
- ->values([
- 'storage' => $query->createNamedParameter($storage, IQueryBuilder::PARAM_INT),
- 'path_hash' => $query->createNamedParameter(static::getUniqueID(), IQueryBuilder::PARAM_STR),
- 'encrypted' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
- 'size' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
- 'unencrypted_size' => $query->createNamedParameter(0, IQueryBuilder::PARAM_INT),
- ]);
- $query->execute();
-
- return $query->getLastInsertId();
- }
-
- protected function createMount($fileId, $storage) {
- $query = $this->db->getQueryBuilder();
-
- $query->insert('mounts')
- ->values([
- 'storage_id' => $query->createNamedParameter($storage, IQueryBuilder::PARAM_INT),
- 'root_id' => $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT),
- 'user_id' => $query->createNamedParameter(static::getUniqueID(), IQueryBuilder::PARAM_STR),
- 'mount_point' => $query->createNamedParameter(static::getUniqueID(), IQueryBuilder::PARAM_STR),
- ]);
- $query->execute();
-
- return $query->getLastInsertId();
- }
-
- protected function assertStorage($mount, $storage) {
- $query = $this->db->getQueryBuilder();
- $query->select('storage_id')
- ->from('mounts')
- ->where($query->expr()->eq('id', $query->createNamedParameter($mount, IQueryBuilder::PARAM_INT)));
- $result = $query->execute();
- $row = $result->fetch();
- $result->closeCursor();
-
- $this->assertEquals($storage, $row['storage_id']);
- }
-}
diff --git a/tests/lib/Repair/OldGroupMembershipSharesTest.php b/tests/lib/Repair/OldGroupMembershipSharesTest.php
index 4678bd174eb..5d3590499e6 100644
--- a/tests/lib/Repair/OldGroupMembershipSharesTest.php
+++ b/tests/lib/Repair/OldGroupMembershipSharesTest.php
@@ -51,7 +51,7 @@ class OldGroupMembershipSharesTest extends \Test\TestCase {
$qb->delete('share')->execute();
}
- public function testRun() {
+ public function testRun(): void {
$repair = new OldGroupMembershipShares(
$this->connection,
$this->groupManager
diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php
index 55bda8337c9..2b5091ad927 100644
--- a/tests/lib/Repair/RepairCollationTest.php
+++ b/tests/lib/Repair/RepairCollationTest.php
@@ -7,7 +7,6 @@
namespace Test\Repair;
-use Doctrine\DBAL\Platforms\MySqlPlatform;
use OC\Repair\Collation;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
@@ -61,23 +60,23 @@ class RepairCollationTest extends TestCase {
$this->connection = \OC::$server->get(IDBConnection::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->config = \OC::$server->getConfig();
- if (!$this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
- $this->markTestSkipped("Test only relevant on MySql");
+ if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_MYSQL) {
+ $this->markTestSkipped('Test only relevant on MySql');
}
- $dbPrefix = $this->config->getSystemValueString("dbtableprefix");
- $this->tableName = $this->getUniqueID($dbPrefix . "_collation_test");
+ $dbPrefix = $this->config->getSystemValueString('dbtableprefix');
+ $this->tableName = $this->getUniqueID($dbPrefix . '_collation_test');
$this->connection->prepare("CREATE TABLE $this->tableName(text VARCHAR(16)) COLLATE utf8_unicode_ci")->execute();
$this->repair = new TestCollationRepair($this->config, $this->logger, $this->connection, false);
}
protected function tearDown(): void {
- $this->connection->getInner()->getSchemaManager()->dropTable($this->tableName);
+ $this->connection->getInner()->createSchemaManager()->dropTable($this->tableName);
parent::tearDown();
}
- public function testCollationConvert() {
+ public function testCollationConvert(): void {
$tables = $this->repair->getAllNonUTF8BinTables($this->connection);
$this->assertGreaterThanOrEqual(1, count($tables));
diff --git a/tests/lib/Repair/RepairDavSharesTest.php b/tests/lib/Repair/RepairDavSharesTest.php
index 9831365e974..3a97de4d25d 100644
--- a/tests/lib/Repair/RepairDavSharesTest.php
+++ b/tests/lib/Repair/RepairDavSharesTest.php
@@ -52,7 +52,7 @@ class RepairDavSharesTest extends TestCase {
);
}
- public function testRun() {
+ public function testRun(): void {
$this->config->expects($this->any())
->method('getSystemValueString')
->with('version', '0.0.0')
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index eb0e46c61db..d728e0c7ecd 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -60,7 +60,7 @@ class RepairInvalidSharesTest extends TestCase {
/**
* Test remove shares where the parent share does not exist anymore
*/
- public function testSharesNonExistingParent() {
+ public function testSharesNonExistingParent(): void {
$qb = $this->connection->getQueryBuilder();
$shareValues = [
'share_type' => $qb->expr()->literal(IShare::TYPE_USER),
@@ -153,7 +153,7 @@ class RepairInvalidSharesTest extends TestCase {
*
* @dataProvider fileSharePermissionsProvider
*/
- public function testFileSharePermissions($itemType, $testPerms, $expectedPerms) {
+ public function testFileSharePermissions($itemType, $testPerms, $expectedPerms): void {
$qb = $this->connection->getQueryBuilder();
$qb->insert('share')
->values([
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index fbccd393fd0..0f1a945bd8d 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -113,7 +113,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
/**
* Test renaming the additional image mime types
*/
- public function testRenameImageTypes() {
+ public function testRenameImageTypes(): void {
$currentMimeTypes = [
['test.jp2', 'application/octet-stream'],
['test.webp', 'application/octet-stream'],
@@ -130,7 +130,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
/**
* Test renaming the richdocuments additional office mime types
*/
- public function testRenameWindowsProgramTypes() {
+ public function testRenameWindowsProgramTypes(): void {
$currentMimeTypes = [
['test.htaccess', 'application/octet-stream'],
['.htaccess', 'application/octet-stream'],
@@ -152,7 +152,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
* Test that nothing happens and no error happens when all mimetypes are
* already correct and no old ones exist..
*/
- public function testDoNothingWhenOnlyNewFiles() {
+ public function testDoNothingWhenOnlyNewFiles(): void {
$currentMimeTypes = [
['test.doc', 'application/msword'],
['test.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
@@ -267,7 +267,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
/**
* Test that mime type renaming does not affect folders
*/
- public function testDoNotChangeFolderMimeType() {
+ public function testDoNotChangeFolderMimeType(): void {
$currentMimeTypes = [
['test.conf', 'httpd/unix-directory'],
['test.cnf', 'httpd/unix-directory'],
diff --git a/tests/lib/RepairTest.php b/tests/lib/RepairTest.php
index ab60b14d47e..97c278a1d10 100644
--- a/tests/lib/RepairTest.php
+++ b/tests/lib/RepairTest.php
@@ -61,7 +61,7 @@ class RepairTest extends TestCase {
});
}
- public function testRunRepairStep() {
+ public function testRunRepairStep(): void {
$this->repair->addStep(new TestRepairStep(false));
$this->repair->run();
@@ -74,7 +74,7 @@ class RepairTest extends TestCase {
);
}
- public function testRunRepairStepThatFail() {
+ public function testRunRepairStepThatFail(): void {
$this->repair->addStep(new TestRepairStep(true));
$this->repair->run();
@@ -87,7 +87,7 @@ class RepairTest extends TestCase {
);
}
- public function testRunRepairStepsWithException() {
+ public function testRunRepairStepsWithException(): void {
$mock = $this->createMock(TestRepairStep::class);
$mock->expects($this->any())
->method('run')
@@ -119,7 +119,7 @@ class RepairTest extends TestCase {
);
}
- public function testRunRepairStepsContinueAfterWarning() {
+ public function testRunRepairStepsContinueAfterWarning(): void {
$this->repair->addStep(new TestRepairStep(true));
$this->repair->addStep(new TestRepairStep(false));
$this->repair->run();
diff --git a/tests/lib/RichObjectStrings/DefinitionsTest.php b/tests/lib/RichObjectStrings/DefinitionsTest.php
index efe372a25e8..9299a556972 100644
--- a/tests/lib/RichObjectStrings/DefinitionsTest.php
+++ b/tests/lib/RichObjectStrings/DefinitionsTest.php
@@ -20,7 +20,7 @@ class DefinitionsTest extends TestCase {
}
- public function testGetDefinitionNotExisting() {
+ public function testGetDefinitionNotExisting(): void {
$this->expectException(\OCP\RichObjectStrings\InvalidObjectExeption::class);
$this->expectExceptionMessage('Object type is undefined');
@@ -33,7 +33,7 @@ class DefinitionsTest extends TestCase {
* @param string $type
* @param array $expected
*/
- public function testGetDefinition($type, array $expected) {
+ public function testGetDefinition($type, array $expected): void {
$definitions = new Definitions();
$definition = $definitions->getDefinition($type);
diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php
index 3604dcba4f7..e5230efe462 100644
--- a/tests/lib/RichObjectStrings/ValidatorTest.php
+++ b/tests/lib/RichObjectStrings/ValidatorTest.php
@@ -8,10 +8,11 @@ namespace Test\RichObjectStrings;
use OC\RichObjectStrings\Validator;
use OCP\RichObjectStrings\Definitions;
+use OCP\RichObjectStrings\InvalidObjectExeption;
use Test\TestCase;
class ValidatorTest extends TestCase {
- public function test() {
+ public function test(): void {
$v = new Validator(new Definitions());
$v->validate('test', []);
$v->validate('test {string1} test {foo} test {bar}.', [
@@ -33,5 +34,27 @@ class ValidatorTest extends TestCase {
],
]);
$this->addToAssertionCount(2);
+
+ $this->expectException(InvalidObjectExeption::class);
+
+ $this->expectExceptionMessage('Object is invalid, value 123 is not a string');
+ $v->validate('test {string1} test.', [
+ 'string1' => [
+ 'type' => 'user',
+ 'id' => 'johndoe',
+ 'name' => 'John Doe',
+ 'key' => 123,
+ ],
+ ]);
+
+ $this->expectExceptionMessage('Object is invalid, key 456 is not a string');
+ $v->validate('test {string1} test.', [
+ 'string1' => [
+ 'type' => 'user',
+ 'id' => 'johndoe',
+ 'name' => 'John Doe',
+ 456 => 'value',
+ ],
+ ]);
}
}
diff --git a/tests/lib/Route/RouterTest.php b/tests/lib/Route/RouterTest.php
index 713d90d3c20..8647bb0f2f6 100644
--- a/tests/lib/Route/RouterTest.php
+++ b/tests/lib/Route/RouterTest.php
@@ -13,6 +13,7 @@ use OCP\App\IAppManager;
use OCP\Diagnostics\IEventLogger;
use OCP\IConfig;
use OCP\IRequest;
+use PHPUnit\Framework\MockObject\MockObject;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Test\TestCase;
@@ -26,6 +27,8 @@ use Test\TestCase;
*/
class RouterTest extends TestCase {
private Router $router;
+ private IAppManager&MockObject $appManager;
+
protected function setUp(): void {
parent::setUp();
/** @var LoggerInterface $logger */
@@ -36,13 +39,16 @@ class RouterTest extends TestCase {
$this->fail('Unexpected info log: '.(string)($data['exception'] ?? $message));
}
);
+
+ $this->appManager = $this->createMock(IAppManager::class);
+
$this->router = new Router(
$logger,
$this->createMock(IRequest::class),
$this->createMock(IConfig::class),
$this->createMock(IEventLogger::class),
$this->createMock(ContainerInterface::class),
- $this->createMock(IAppManager::class),
+ $this->appManager,
);
}
@@ -51,6 +57,12 @@ class RouterTest extends TestCase {
}
public function testGenerateConsecutively(): void {
+ $this->appManager->expects(self::atLeastOnce())
+ ->method('cleanAppId')
+ ->willReturnArgument(0);
+ $this->appManager->expects(self::atLeastOnce())
+ ->method('getAppPath')
+ ->willReturnCallback(fn (string $appid): string => \OC::$SERVERROOT . '/apps/' . $appid);
$this->assertEquals('/index.php/apps/files/', $this->router->generate('files.view.index'));
diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php
index 69d20cccd3a..a94f1849c8a 100644
--- a/tests/lib/Security/Bruteforce/ThrottlerTest.php
+++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php
@@ -183,7 +183,7 @@ class ThrottlerTest extends TestCase {
*/
public function testIsIpWhiteListedWithEnabledProtection($ip,
$whitelists,
- $isWhiteListed) {
+ $isWhiteListed): void {
$this->isIpWhiteListedHelper(
$ip,
$whitelists,
@@ -201,7 +201,7 @@ class ThrottlerTest extends TestCase {
*/
public function testIsIpWhiteListedWithDisabledProtection($ip,
$whitelists,
- $isWhiteListed) {
+ $isWhiteListed): void {
$this->isIpWhiteListedHelper(
$ip,
$whitelists,
diff --git a/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php b/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
index edc0c613655..39dd7a95890 100644
--- a/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
+++ b/tests/lib/Security/CSP/AddContentSecurityPolicyEventTest.php
@@ -15,7 +15,7 @@ use OCP\Security\CSP\AddContentSecurityPolicyEvent;
use Test\TestCase;
class AddContentSecurityPolicyEventTest extends TestCase {
- public function testAddEvent() {
+ public function testAddEvent(): void {
$cspManager = $this->createMock(ContentSecurityPolicyManager::class);
$policy = $this->createMock(ContentSecurityPolicy::class);
$event = new AddContentSecurityPolicyEvent($cspManager);
diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php
index dc0fe7c8340..63a5565e7fa 100644
--- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php
+++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php
@@ -28,12 +28,12 @@ class ContentSecurityPolicyManagerTest extends TestCase {
$this->contentSecurityPolicyManager = new ContentSecurityPolicyManager($this->dispatcher);
}
- public function testAddDefaultPolicy() {
+ public function testAddDefaultPolicy(): void {
$this->contentSecurityPolicyManager->addDefaultPolicy(new \OCP\AppFramework\Http\ContentSecurityPolicy());
$this->addToAssertionCount(1);
}
- public function testGetDefaultPolicyWithPolicies() {
+ public function testGetDefaultPolicyWithPolicies(): void {
$policy = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$policy->addAllowedFontDomain('mydomain.com');
$policy->addAllowedImageDomain('anotherdomain.de');
@@ -64,7 +64,7 @@ class ContentSecurityPolicyManagerTest extends TestCase {
$this->assertSame($expectedStringPolicy, $this->contentSecurityPolicyManager->getDefaultPolicy()->buildPolicy());
}
- public function testGetDefaultPolicyWithPoliciesViaEvent() {
+ public function testGetDefaultPolicyWithPoliciesViaEvent(): void {
$this->dispatcher->addListener(AddContentSecurityPolicyEvent::class, function (AddContentSecurityPolicyEvent $e) {
$policy = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$policy->addAllowedFontDomain('mydomain.com');
diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php
index f4281bd2b22..3765311155a 100644
--- a/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php
+++ b/tests/lib/Security/CSP/ContentSecurityPolicyNonceManagerTest.php
@@ -13,42 +13,46 @@ use OC\AppFramework\Http\Request;
use OC\Security\CSP\ContentSecurityPolicyNonceManager;
use OC\Security\CSRF\CsrfToken;
use OC\Security\CSRF\CsrfTokenManager;
+use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;
class ContentSecurityPolicyNonceManagerTest extends TestCase {
- /** @var CsrfTokenManager */
- private $csrfTokenManager;
- /** @var Request */
+ /** @var CsrfTokenManager&MockObject */
+ private $CSRFTokenManager;
+ /** @var Request&MockObject */
private $request;
/** @var ContentSecurityPolicyNonceManager */
private $nonceManager;
protected function setUp(): void {
- $this->csrfTokenManager = $this->createMock(CsrfTokenManager::class);
+ $this->CSRFTokenManager = $this->createMock(CsrfTokenManager::class);
$this->request = $this->createMock(Request::class);
$this->nonceManager = new ContentSecurityPolicyNonceManager(
- $this->csrfTokenManager,
+ $this->CSRFTokenManager,
$this->request
);
}
- public function testGetNonce() {
+ public function testGetNonce(): void {
+ $secret = base64_encode('secret');
+ $tokenValue = base64_encode('secret' ^ 'value_') . ':' . $secret;
$token = $this->createMock(CsrfToken::class);
$token
->expects($this->once())
->method('getEncryptedValue')
- ->willReturn('MyToken');
+ ->willReturn($tokenValue);
- $this->csrfTokenManager
+ $this->CSRFTokenManager
->expects($this->once())
->method('getToken')
->willReturn($token);
- $this->assertSame('TXlUb2tlbg==', $this->nonceManager->getNonce());
- $this->assertSame('TXlUb2tlbg==', $this->nonceManager->getNonce());
+ $this->assertSame($secret, $this->nonceManager->getNonce());
+ // call it twice but `getEncryptedValue` is expected to be called only once
+ $this->assertSame($secret, $this->nonceManager->getNonce());
}
- public function testGetNonceServerVar() {
+ public function testGetNonceServerVar(): void {
$token = 'SERVERNONCE';
$this->request
->method('__isset')
@@ -61,6 +65,7 @@ class ContentSecurityPolicyNonceManagerTest extends TestCase {
->willReturn(['CSP_NONCE' => $token]);
$this->assertSame($token, $this->nonceManager->getNonce());
+ // call it twice but `CSP_NONCE` variable is expected to be loaded only once
$this->assertSame($token, $this->nonceManager->getNonce());
}
}
diff --git a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
index 8b92848341c..98eddf602ee 100644
--- a/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenGeneratorTest.php
@@ -23,7 +23,7 @@ class CsrfTokenGeneratorTest extends \Test\TestCase {
$this->csrfTokenGenerator = new \OC\Security\CSRF\CsrfTokenGenerator($this->random);
}
- public function testGenerateTokenWithCustomNumber() {
+ public function testGenerateTokenWithCustomNumber(): void {
$this->random
->expects($this->once())
->method('generate')
@@ -32,7 +32,7 @@ class CsrfTokenGeneratorTest extends \Test\TestCase {
$this->assertSame('abc', $this->csrfTokenGenerator->generateToken(3));
}
- public function testGenerateTokenWithDefault() {
+ public function testGenerateTokenWithDefault(): void {
$this->random
->expects($this->once())
->method('generate')
diff --git a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php
index c4fd480654d..47f873bfe13 100644
--- a/tests/lib/Security/CSRF/CsrfTokenManagerTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenManagerTest.php
@@ -31,7 +31,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
);
}
- public function testGetTokenWithExistingToken() {
+ public function testGetTokenWithExistingToken(): void {
$this->storageInterface
->expects($this->once())
->method('hasToken')
@@ -45,7 +45,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $this->csrfTokenManager->getToken());
}
- public function testGetTokenWithExistingTokenKeepsOnSecondRequest() {
+ public function testGetTokenWithExistingTokenKeepsOnSecondRequest(): void {
$this->storageInterface
->expects($this->once())
->method('hasToken')
@@ -61,7 +61,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->assertSame($token, $this->csrfTokenManager->getToken());
}
- public function testGetTokenWithoutExistingToken() {
+ public function testGetTokenWithoutExistingToken(): void {
$this->storageInterface
->expects($this->once())
->method('hasToken')
@@ -79,7 +79,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $this->csrfTokenManager->getToken());
}
- public function testRefreshToken() {
+ public function testRefreshToken(): void {
$this->tokenGenerator
->expects($this->once())
->method('generateToken')
@@ -93,7 +93,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $this->csrfTokenManager->refreshToken());
}
- public function testRemoveToken() {
+ public function testRemoveToken(): void {
$this->storageInterface
->expects($this->once())
->method('removeToken');
@@ -101,7 +101,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->csrfTokenManager->removeToken();
}
- public function testIsTokenValidWithoutToken() {
+ public function testIsTokenValidWithoutToken(): void {
$this->storageInterface
->expects($this->once())
->method('hasToken')
@@ -111,7 +111,7 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->assertSame(false, $this->csrfTokenManager->isTokenValid($token));
}
- public function testIsTokenValidWithWrongToken() {
+ public function testIsTokenValidWithWrongToken(): void {
$this->storageInterface
->expects($this->once())
->method('hasToken')
@@ -125,20 +125,20 @@ class CsrfTokenManagerTest extends \Test\TestCase {
$this->assertSame(false, $this->csrfTokenManager->isTokenValid($token));
}
- public function testIsTokenValidWithValidToken() {
+ public function testIsTokenValidWithValidToken(): void {
$a = 'abc';
$b = 'def';
$xorB64 = 'BQcF';
$tokenVal = sprintf('%s:%s', $xorB64, base64_encode($a));
$this->storageInterface
- ->expects($this->once())
- ->method('hasToken')
- ->willReturn(true);
+ ->expects($this->once())
+ ->method('hasToken')
+ ->willReturn(true);
$token = new \OC\Security\CSRF\CsrfToken($tokenVal);
$this->storageInterface
- ->expects($this->once())
- ->method('getToken')
- ->willReturn($b);
+ ->expects($this->once())
+ ->method('getToken')
+ ->willReturn($b);
$this->assertSame(true, $this->csrfTokenManager->isTokenValid($token));
}
diff --git a/tests/lib/Security/CSRF/CsrfTokenTest.php b/tests/lib/Security/CSRF/CsrfTokenTest.php
index c6f9aaa5be7..9ecbbe9f23a 100644
--- a/tests/lib/Security/CSRF/CsrfTokenTest.php
+++ b/tests/lib/Security/CSRF/CsrfTokenTest.php
@@ -11,20 +11,20 @@ declare(strict_types=1);
namespace Test\Security\CSRF;
class CsrfTokenTest extends \Test\TestCase {
- public function testGetEncryptedValue() {
+ public function testGetEncryptedValue(): void {
$csrfToken = new \OC\Security\CSRF\CsrfToken('MyCsrfToken');
$this->assertSame(33, strlen($csrfToken->getEncryptedValue()));
$this->assertSame(':', $csrfToken->getEncryptedValue()[16]);
}
- public function testGetEncryptedValueStaysSameOnSecondRequest() {
+ public function testGetEncryptedValueStaysSameOnSecondRequest(): void {
$csrfToken = new \OC\Security\CSRF\CsrfToken('MyCsrfToken');
$tokenValue = $csrfToken->getEncryptedValue();
$this->assertSame($tokenValue, $csrfToken->getEncryptedValue());
$this->assertSame($tokenValue, $csrfToken->getEncryptedValue());
}
- public function testGetDecryptedValue() {
+ public function testGetDecryptedValue(): void {
$a = 'abc';
$b = 'def';
$xorB64 = 'BQcF';
diff --git a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
index 8e5c8b8e481..f8386124626 100644
--- a/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
+++ b/tests/lib/Security/CSRF/TokenStorage/SessionStorageTest.php
@@ -44,7 +44,7 @@ class SessionStorageTest extends \Test\TestCase {
* @dataProvider getTokenDataProvider
*
*/
- public function testGetTokenWithEmptyToken($token) {
+ public function testGetTokenWithEmptyToken($token): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Session does not contain a requesttoken');
@@ -56,7 +56,7 @@ class SessionStorageTest extends \Test\TestCase {
$this->sessionStorage->getToken();
}
- public function testGetTokenWithValidToken() {
+ public function testGetTokenWithValidToken(): void {
$this->session
->expects($this->once())
->method('get')
@@ -65,7 +65,7 @@ class SessionStorageTest extends \Test\TestCase {
$this->assertSame('MyFancyCsrfToken', $this->sessionStorage->getToken());
}
- public function testSetToken() {
+ public function testSetToken(): void {
$this->session
->expects($this->once())
->method('set')
@@ -73,7 +73,7 @@ class SessionStorageTest extends \Test\TestCase {
$this->sessionStorage->setToken('TokenToSet');
}
- public function testRemoveToken() {
+ public function testRemoveToken(): void {
$this->session
->expects($this->once())
->method('remove')
@@ -81,7 +81,7 @@ class SessionStorageTest extends \Test\TestCase {
$this->sessionStorage->removeToken();
}
- public function testHasTokenWithExistingToken() {
+ public function testHasTokenWithExistingToken(): void {
$this->session
->expects($this->once())
->method('exists')
@@ -90,7 +90,7 @@ class SessionStorageTest extends \Test\TestCase {
$this->assertSame(true, $this->sessionStorage->hasToken());
}
- public function testHasTokenWithoutExistingToken() {
+ public function testHasTokenWithoutExistingToken(): void {
$this->session
->expects($this->once())
->method('exists')
@@ -99,7 +99,7 @@ class SessionStorageTest extends \Test\TestCase {
$this->assertSame(false, $this->sessionStorage->hasToken());
}
- public function testSetSession() {
+ public function testSetSession(): void {
$session = $this->createMock(ISession::class);
$session
->expects($this->once())
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php
index fc5ae1f03f2..14036b3dd3b 100644
--- a/tests/lib/Security/CertificateManagerTest.php
+++ b/tests/lib/Security/CertificateManagerTest.php
@@ -12,8 +12,10 @@ namespace Test\Security;
use OC\Files\View;
use OC\Security\CertificateManager;
+use OCP\Files\InvalidPathException;
use OCP\IConfig;
use OCP\Security\ISecureRandom;
+use PHPUnit\Framework\MockObject\MockObject;
use Psr\Log\LoggerInterface;
/**
@@ -25,12 +27,9 @@ class CertificateManagerTest extends \Test\TestCase {
use \Test\Traits\UserTrait;
use \Test\Traits\MountProviderTrait;
- /** @var CertificateManager */
- private $certificateManager;
- /** @var String */
- private $username;
- /** @var ISecureRandom */
- private $random;
+ private CertificateManager $certificateManager;
+ private string $username;
+ private ISecureRandom&MockObject $random;
protected function setUp(): void {
parent::setUp();
@@ -77,7 +76,7 @@ class CertificateManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $actual);
}
- public function testListCertificates() {
+ public function testListCertificates(): void {
// Test empty certificate bundle
$this->assertSame([], $this->certificateManager->listCertificates());
@@ -94,7 +93,7 @@ class CertificateManagerTest extends \Test\TestCase {
}
- public function testAddInvalidCertificate() {
+ public function testAddInvalidCertificate(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate could not get parsed.');
@@ -116,23 +115,21 @@ class CertificateManagerTest extends \Test\TestCase {
* @dataProvider dangerousFileProvider
* @param string $filename
*/
- public function testAddDangerousFile($filename) {
- $this->expectException(\Exception::class);
- $this->expectExceptionMessage('Filename is not valid');
-
+ public function testAddDangerousFile($filename): void {
+ $this->expectException(InvalidPathException::class);
$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), $filename);
}
- public function testRemoveDangerousFile() {
+ public function testRemoveDangerousFile(): void {
$this->assertFalse($this->certificateManager->removeCertificate('../../foo.txt'));
}
- public function testRemoveExistingFile() {
+ public function testRemoveExistingFile(): void {
$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
$this->assertTrue($this->certificateManager->removeCertificate('GoodCertificate'));
}
- public function testGetCertificateBundle() {
+ public function testGetCertificateBundle(): void {
$this->assertSame('/files_external/rootcerts.crt', $this->certificateManager->getCertificateBundle());
}
@@ -148,7 +145,7 @@ class CertificateManagerTest extends \Test\TestCase {
$targetBundleMtime,
$targetBundleExists,
$expected
- ) {
+ ): void {
$view = $this->getMockBuilder(View::class)
->disableOriginalConstructor()->getMock();
$config = $this->createMock(IConfig::class);
diff --git a/tests/lib/Security/CertificateTest.php b/tests/lib/Security/CertificateTest.php
index 6f4e736263b..8b084ca41b3 100644
--- a/tests/lib/Security/CertificateTest.php
+++ b/tests/lib/Security/CertificateTest.php
@@ -32,7 +32,7 @@ class CertificateTest extends \Test\TestCase {
}
- public function testBogusData() {
+ public function testBogusData(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate could not get parsed.');
@@ -41,36 +41,36 @@ class CertificateTest extends \Test\TestCase {
}
- public function testCertificateStartingWithFileReference() {
+ public function testCertificateStartingWithFileReference(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Certificate could not get parsed.');
new Certificate('file://'.__DIR__ . '/../../data/certificates/goodCertificate.crt', 'bar');
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame('GoodCertificate', $this->goodCertificate->getName());
$this->assertSame('BadCertificate', $this->invalidCertificate->getName());
}
- public function testGetCommonName() {
+ public function testGetCommonName(): void {
$this->assertSame('security.owncloud.com', $this->goodCertificate->getCommonName());
$this->assertSame(null, $this->invalidCertificate->getCommonName());
}
- public function testGetOrganization() {
+ public function testGetOrganization(): void {
$this->assertSame('ownCloud Security', $this->goodCertificate->getOrganization());
$this->assertSame('Internet Widgits Pty Ltd', $this->invalidCertificate->getOrganization());
}
- public function testGetIssueDate() {
+ public function testGetIssueDate(): void {
$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');
$this->assertEquals($expected->getTimestamp(), $this->invalidCertificate->getIssueDate()->getTimestamp());
}
- public function testGetExpireDate() {
+ public function testGetExpireDate(): void {
$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');
@@ -79,19 +79,19 @@ class CertificateTest extends \Test\TestCase {
$this->assertEquals($expected->getTimestamp(), $this->expiredCertificate->getExpireDate()->getTimestamp());
}
- public function testIsExpired() {
+ public function testIsExpired(): void {
$this->assertSame(false, $this->goodCertificate->isExpired());
$this->assertSame(false, $this->invalidCertificate->isExpired());
$this->assertSame(true, $this->expiredCertificate->isExpired());
}
- public function testGetIssuerName() {
+ public function testGetIssuerName(): void {
$this->assertSame('security.owncloud.com', $this->goodCertificate->getIssuerName());
$this->assertSame(null, $this->invalidCertificate->getIssuerName());
$this->assertSame(null, $this->expiredCertificate->getIssuerName());
}
- public function testGetIssuerOrganization() {
+ public function testGetIssuerOrganization(): void {
$this->assertSame('ownCloud Security', $this->goodCertificate->getIssuerOrganization());
$this->assertSame('Internet Widgits Pty Ltd', $this->invalidCertificate->getIssuerOrganization());
$this->assertSame('Internet Widgits Pty Ltd', $this->expiredCertificate->getIssuerOrganization());
diff --git a/tests/lib/Security/CredentialsManagerTest.php b/tests/lib/Security/CredentialsManagerTest.php
index d9272627e5b..ce60a2f62a2 100644
--- a/tests/lib/Security/CredentialsManagerTest.php
+++ b/tests/lib/Security/CredentialsManagerTest.php
@@ -20,7 +20,7 @@ class CredentialsManagerTest extends \Test\TestCase {
/**
* @dataProvider credentialsProvider
*/
- public function testWithDB($userId, $identifier) {
+ public function testWithDB($userId, $identifier): void {
$credentialsManager = Server::get(ICredentialsManager::class);
$secrets = 'Open Sesame';
diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php
index b65a9a36985..ef96f8d5ddb 100644
--- a/tests/lib/Security/CryptoTest.php
+++ b/tests/lib/Security/CryptoTest.php
@@ -32,13 +32,13 @@ class CryptoTest extends \Test\TestCase {
/**
* @dataProvider defaultEncryptionProvider
*/
- public function testDefaultEncrypt($stringToEncrypt) {
+ public function testDefaultEncrypt($stringToEncrypt): void {
$ciphertext = $this->crypto->encrypt($stringToEncrypt);
$this->assertEquals($stringToEncrypt, $this->crypto->decrypt($ciphertext));
}
- public function testWrongPassword() {
+ public function testWrongPassword(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('HMAC does not match.');
@@ -47,14 +47,14 @@ class CryptoTest extends \Test\TestCase {
$this->crypto->decrypt($ciphertext, 'A wrong password!');
}
- public function testLaterDecryption() {
+ public function testLaterDecryption(): void {
$stringToEncrypt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.';
$encryptedString = '44a35023cca2e7a6125e06c29fc4b2ad9d8a33d0873a8b45b0de4ef9284f260c6c46bf25dc62120644c59b8bafe4281ddc47a70c35ae6c29ef7a63d79eefacc297e60b13042ac582733598d0a6b4de37311556bb5c480fd2633de4e6ebafa868c2d1e2d80a5d24f9660360dba4d6e0c8|lhrFgK0zd9U160Wo|a75e57ab701f9124e1113543fd1dc596f21e20d456a0d1e813d5a8aaec9adcb11213788e96598b67fe9486a9f0b99642c18296d0175db44b1ae426e4e91080ee';
$this->assertEquals($stringToEncrypt, $this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd'));
}
- public function testWrongIV() {
+ public function testWrongIV(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('HMAC does not match.');
@@ -63,7 +63,7 @@ class CryptoTest extends \Test\TestCase {
}
- public function testWrongParameters() {
+ public function testWrongParameters(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Authenticated ciphertext could not be decoded.');
@@ -71,14 +71,14 @@ class CryptoTest extends \Test\TestCase {
$this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd');
}
- public function testLegacy() {
+ public function testLegacy(): void {
$cipherText = 'e16599188e3d212f5c7f17fdc2abca46|M1WfLAxbcAmITeD6|509457885d6ca5e6c3bfd3741852687a7f2bffce197f8d5ae97b65818b15a1b7f616b68326ff312371540f4ca8ac55f8e2de4aa13aab3474bd3431e51214e3ee';
$password = 'mypass';
$this->assertSame('legacy test', $this->crypto->decrypt($cipherText, $password));
}
- public function testVersion2CiphertextDecryptsToCorrectPlaintext() {
+ public function testVersion2CiphertextDecryptsToCorrectPlaintext(): void {
$this->assertSame(
'This is a plaintext value that will be encrypted with version 2. Which addresses the reduced permutations on the IV.',
$this->crypto->decrypt(
@@ -88,7 +88,7 @@ class CryptoTest extends \Test\TestCase {
);
}
- public function testVersion3CiphertextDecryptsToCorrectPlaintext() {
+ public function testVersion3CiphertextDecryptsToCorrectPlaintext(): void {
$this->assertSame(
'Another plaintext value that will be encrypted with version 3. It addresses the related key issue. Old ciphertexts should be decrypted properly, but only use the better version for encryption.',
$this->crypto->decrypt(
diff --git a/tests/lib/Security/Events/GenerateSecurePasswordEventTest.php b/tests/lib/Security/Events/GenerateSecurePasswordEventTest.php
new file mode 100644
index 00000000000..e589f20f62c
--- /dev/null
+++ b/tests/lib/Security/Events/GenerateSecurePasswordEventTest.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Security\Events;
+
+use OCP\Security\Events\GenerateSecurePasswordEvent;
+use OCP\Security\PasswordContext;
+
+class GenerateSecurePasswordEventTest extends \Test\TestCase {
+
+ public function testDefaultProperties(): void {
+ $event = new GenerateSecurePasswordEvent();
+ $this->assertNull($event->getPassword());
+ $this->assertEquals(PasswordContext::ACCOUNT, $event->getContext());
+ }
+
+ public function testSettingPassword(): void {
+ $event = new GenerateSecurePasswordEvent();
+ $event->setPassword('example');
+ $this->assertEquals('example', $event->getPassword());
+ }
+
+ public function testSettingContext(): void {
+ $event = new GenerateSecurePasswordEvent(PasswordContext::SHARING);
+ $this->assertEquals(PasswordContext::SHARING, $event->getContext());
+ }
+}
diff --git a/tests/lib/Security/Events/ValidatePasswordPolicyEventTest.php b/tests/lib/Security/Events/ValidatePasswordPolicyEventTest.php
new file mode 100644
index 00000000000..272f34e31aa
--- /dev/null
+++ b/tests/lib/Security/Events/ValidatePasswordPolicyEventTest.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Security\Events;
+
+use OCP\Security\Events\ValidatePasswordPolicyEvent;
+use OCP\Security\PasswordContext;
+
+class ValidatePasswordPolicyEventTest extends \Test\TestCase {
+
+ public function testDefaultProperties(): void {
+ $password = 'example';
+ $event = new ValidatePasswordPolicyEvent($password);
+ $this->assertEquals($password, $event->getPassword());
+ $this->assertEquals(PasswordContext::ACCOUNT, $event->getContext());
+ }
+
+ public function testSettingContext(): void {
+ $event = new ValidatePasswordPolicyEvent('example', PasswordContext::SHARING);
+ $this->assertEquals(PasswordContext::SHARING, $event->getContext());
+ }
+}
diff --git a/tests/lib/Security/FeaturePolicy/AddFeaturePolicyEventTest.php b/tests/lib/Security/FeaturePolicy/AddFeaturePolicyEventTest.php
index 3c964972238..1fe01e26280 100644
--- a/tests/lib/Security/FeaturePolicy/AddFeaturePolicyEventTest.php
+++ b/tests/lib/Security/FeaturePolicy/AddFeaturePolicyEventTest.php
@@ -14,7 +14,7 @@ use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent;
use Test\TestCase;
class AddFeaturePolicyEventTest extends TestCase {
- public function testAddEvent() {
+ public function testAddEvent(): void {
$manager = $this->createMock(FeaturePolicyManager::class);
$policy = $this->createMock(FeaturePolicy::class);
$event = new AddFeaturePolicyEvent($manager);
diff --git a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
index 7110effb261..7386aa023a9 100644
--- a/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
+++ b/tests/lib/Security/FeaturePolicy/FeaturePolicyManagerTest.php
@@ -27,12 +27,12 @@ class FeaturePolicyManagerTest extends TestCase {
$this->manager = new FeaturePolicyManager($this->dispatcher);
}
- public function testAddDefaultPolicy() {
+ public function testAddDefaultPolicy(): void {
$this->manager->addDefaultPolicy(new FeaturePolicy());
$this->addToAssertionCount(1);
}
- public function testGetDefaultPolicyWithPoliciesViaEvent() {
+ public function testGetDefaultPolicyWithPoliciesViaEvent(): void {
$this->dispatcher->addListener(AddFeaturePolicyEvent::class, function (AddFeaturePolicyEvent $e) {
$policy = new FeaturePolicy();
$policy->addAllowedMicrophoneDomain('mydomain.com');
diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php
index f51b4ee39db..41cad7f323f 100644
--- a/tests/lib/Security/HasherTest.php
+++ b/tests/lib/Security/HasherTest.php
@@ -122,7 +122,7 @@ class HasherTest extends \Test\TestCase {
$this->hasher = new Hasher($this->config);
}
- public function testHash() {
+ public function testHash(): void {
$hash = $this->hasher->hash('String To Hash');
$this->assertNotNull($hash);
}
@@ -130,7 +130,7 @@ class HasherTest extends \Test\TestCase {
/**
* @dataProvider versionHashProvider
*/
- public function testSplitHash($hash, $expected) {
+ public function testSplitHash($hash, $expected): void {
$relativePath = self::invokePrivate($this->hasher, 'splitHash', [$hash]);
$this->assertSame($expected, $relativePath);
}
@@ -139,7 +139,7 @@ class HasherTest extends \Test\TestCase {
/**
* @dataProvider hashProviders70_71
*/
- public function testVerify($password, $hash, $expected) {
+ public function testVerify($password, $hash, $expected): void {
$this->config
->expects($this->any())
->method('getSystemValue')
@@ -157,7 +157,7 @@ class HasherTest extends \Test\TestCase {
/**
* @dataProvider hashProviders72
*/
- public function testVerifyArgon2i($password, $hash, $expected) {
+ public function testVerifyArgon2i($password, $hash, $expected): void {
if (!\defined('PASSWORD_ARGON2I')) {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
}
@@ -169,7 +169,7 @@ class HasherTest extends \Test\TestCase {
/**
* @dataProvider hashProviders73
*/
- public function testVerifyArgon2id(string $password, string $hash, bool $expected) {
+ public function testVerifyArgon2id(string $password, string $hash, bool $expected): void {
if (!\defined('PASSWORD_ARGON2ID')) {
$this->markTestSkipped('Need ARGON2ID support to test ARGON2ID hashes');
}
@@ -178,7 +178,7 @@ class HasherTest extends \Test\TestCase {
$this->assertSame($expected, $result);
}
- public function testUpgradeHashBlowFishToArgon2() {
+ public function testUpgradeHashBlowFishToArgon2(): void {
if (!\defined('PASSWORD_ARGON2I')) {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
}
@@ -203,7 +203,7 @@ class HasherTest extends \Test\TestCase {
$this->assertFalse(password_needs_rehash($relativePath['hash'], $newAlg, []));
}
- public function testUsePasswordDefaultArgon2iVerify() {
+ public function testUsePasswordDefaultArgon2iVerify(): void {
if (!\defined('PASSWORD_ARGON2I')) {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
}
@@ -227,7 +227,7 @@ class HasherTest extends \Test\TestCase {
$this->assertTrue(password_verify($message, $relativePath['hash']));
}
- public function testDoNotUsePasswordDefaultArgon2idVerify() {
+ public function testDoNotUsePasswordDefaultArgon2idVerify(): void {
if (!\defined('PASSWORD_ARGON2ID')) {
$this->markTestSkipped('Need ARGON2ID support to test ARGON2ID hashes');
}
@@ -245,7 +245,7 @@ class HasherTest extends \Test\TestCase {
$this->assertNull($newHash);
}
- public function testHashUsePasswordDefault() {
+ public function testHashUsePasswordDefault(): void {
if (!\defined('PASSWORD_ARGON2I')) {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
}
@@ -265,7 +265,7 @@ class HasherTest extends \Test\TestCase {
$this->assertEquals(PASSWORD_BCRYPT, $info['algo']);
}
- public function testValidHash() {
+ public function testValidHash(): void {
$hash = '3|$argon2id$v=19$m=65536,t=4,p=1$czFCSjk3LklVdXppZ2VCWA$li0NgdXe2/jwSRxgteGQPWlzJU0E0xdtfHbCbrpych0';
$isValid = $this->hasher->validate($hash);
@@ -273,7 +273,7 @@ class HasherTest extends \Test\TestCase {
$this->assertTrue($isValid);
}
- public function testValidGeneratedHash() {
+ public function testValidGeneratedHash(): void {
$message = 'secret';
$hash = $this->hasher->hash($message);
@@ -282,7 +282,7 @@ class HasherTest extends \Test\TestCase {
$this->assertTrue($isValid);
}
- public function testInvalidHash() {
+ public function testInvalidHash(): void {
$invalidHash = 'someInvalidHash';
$isValid = $this->hasher->validate($invalidHash);
diff --git a/tests/lib/Security/IdentityProof/KeyTest.php b/tests/lib/Security/IdentityProof/KeyTest.php
index 19dc02e2ad1..572bfbea619 100644
--- a/tests/lib/Security/IdentityProof/KeyTest.php
+++ b/tests/lib/Security/IdentityProof/KeyTest.php
@@ -22,11 +22,11 @@ class KeyTest extends TestCase {
$this->key = new Key('public', 'private');
}
- public function testGetPrivate() {
+ public function testGetPrivate(): void {
$this->assertSame('private', $this->key->getPrivate());
}
- public function testGetPublic() {
+ public function testGetPublic(): void {
$this->assertSame('public', $this->key->getPublic());
}
}
diff --git a/tests/lib/Security/IdentityProof/ManagerTest.php b/tests/lib/Security/IdentityProof/ManagerTest.php
index bb5b01d563c..722555efe01 100644
--- a/tests/lib/Security/IdentityProof/ManagerTest.php
+++ b/tests/lib/Security/IdentityProof/ManagerTest.php
@@ -79,7 +79,7 @@ class ManagerTest extends TestCase {
}
}
- public function testGetKeyWithExistingKey() {
+ public function testGetKeyWithExistingKey(): void {
$user = $this->createMock(IUser::class);
$user
->expects($this->once())
@@ -122,7 +122,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $this->manager->getKey($user));
}
- public function testGetKeyWithNotExistingKey() {
+ public function testGetKeyWithNotExistingKey(): void {
$user = $this->createMock(IUser::class);
$user
->expects($this->once())
@@ -177,7 +177,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $this->manager->getKey($user));
}
- public function testGenerateKeyPair() {
+ public function testGenerateKeyPair(): void {
$manager = $this->getManager();
$data = 'MyTestData';
@@ -189,7 +189,7 @@ class ManagerTest extends TestCase {
$this->assertSame(2048, $details['bits']);
}
- public function testGetSystemKey() {
+ public function testGetSystemKey(): void {
$manager = $this->getManager(['retrieveKey']);
/** @var Key|\PHPUnit\Framework\MockObject\MockObject $key */
@@ -206,7 +206,7 @@ class ManagerTest extends TestCase {
- public function testGetSystemKeyFailure() {
+ public function testGetSystemKeyFailure(): void {
$this->expectException(\RuntimeException::class);
$manager = $this->getManager(['retrieveKey']);
diff --git a/tests/lib/Security/IdentityProof/SignerTest.php b/tests/lib/Security/IdentityProof/SignerTest.php
index 8b8d93e6b9a..6dc73c072e4 100644
--- a/tests/lib/Security/IdentityProof/SignerTest.php
+++ b/tests/lib/Security/IdentityProof/SignerTest.php
@@ -90,7 +90,7 @@ gQIDAQAB
);
}
- public function testSign() {
+ public function testSign(): void {
$user = $this->createMock(IUser::class);
$user->method('getCloudId')
->willReturn('foo@example.com');
@@ -123,7 +123,7 @@ gQIDAQAB
$this->assertEquals($expects, $result);
}
- public function testVerifyValid() {
+ public function testVerifyValid(): void {
$data = [
'message' => [
'data' => [
@@ -151,7 +151,7 @@ gQIDAQAB
$this->assertTrue($this->signer->verify($data));
}
- public function testVerifyInvalid() {
+ public function testVerifyInvalid(): void {
$data = [
'message' => [
'data' => [
@@ -179,7 +179,7 @@ gQIDAQAB
$this->assertFalse($this->signer->verify($data));
}
- public function testVerifyInvalidData() {
+ public function testVerifyInvalidData(): void {
$data = [
];
diff --git a/tests/lib/Security/Ip/RemoteAddressTest.php b/tests/lib/Security/Ip/RemoteAddressTest.php
new file mode 100644
index 00000000000..d780c3bc198
--- /dev/null
+++ b/tests/lib/Security/Ip/RemoteAddressTest.php
@@ -0,0 +1,77 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace Test\Security\Ip;
+
+use OC\Security\Ip\RemoteAddress;
+use OCP\IConfig;
+use OCP\IRequest;
+
+class RemoteAddressTest extends \Test\TestCase {
+ private IConfig $config;
+ private IRequest $request;
+
+ protected function setUp(): void {
+ parent::setUp();
+ $this->config = $this->createMock(IConfig::class);
+ $this->request = $this->createMock(IRequest::class);
+ }
+
+ /**
+ * @param mixed $allowedRanges
+ * @dataProvider dataProvider
+ */
+ public function testAllowedIps(string $remoteIp, $allowedRanges, bool $expected): void {
+ $this->request
+ ->method('getRemoteAddress')
+ ->willReturn($remoteIp);
+ $this->config
+ ->method('getSystemValue')
+ ->with('allowed_admin_ranges', false)
+ ->willReturn($allowedRanges);
+
+ $remoteAddress = new RemoteAddress($this->config, $this->request);
+
+ $this->assertEquals($expected, $remoteAddress->allowsAdminActions());
+ }
+
+ /**
+ * @return array<string, mixed, bool>
+ */
+ public function dataProvider(): array {
+ return [
+ // No IP (ie. CLI)
+ ['', ['192.168.1.2/24'], true],
+ ['', ['fe80/8'], true],
+ // No configuration
+ ['1.2.3.4', false, true],
+ ['1234:4567:8910::', false, true],
+ // Empty configuration
+ ['1.2.3.4', [], true],
+ ['1234:4567:8910::', [], true],
+ // Invalid configuration
+ ['1.2.3.4', 'hello', true],
+ ['1234:4567:8910::', 'world', true],
+ // Mixed configuration
+ ['192.168.1.5', ['1.2.3.*', '1234::/8'], false],
+ ['::1', ['127.0.0.1', '1234::/8'], false],
+ ['192.168.1.5', ['192.168.1.0/24', '1234::/8'], true],
+ // Allowed IP
+ ['1.2.3.4', ['1.2.3.*'], true],
+ ['fc00:1:2:3::1', ['fc00::/7'], true],
+ ['1.2.3.4', ['192.168.1.2/24', '1.2.3.0/24'], true],
+ ['1234:4567:8910::1', ['fe80::/8','1234:4567::/16'], true],
+ // Blocked IP
+ ['192.168.1.5', ['1.2.3.*'], false],
+ ['9234:4567:8910::', ['1234:4567::1'], false],
+ ['192.168.2.1', ['192.168.1.2/24', '1.2.3.0/24'], false],
+ ['9234:4567:8910::', ['fe80::/8','1234:4567::/16'], false],
+ ];
+ }
+}
diff --git a/tests/lib/Security/Normalizer/IpAddressTest.php b/tests/lib/Security/Normalizer/IpAddressTest.php
index ae6b5cbc9ca..55cb149309a 100644
--- a/tests/lib/Security/Normalizer/IpAddressTest.php
+++ b/tests/lib/Security/Normalizer/IpAddressTest.php
@@ -60,11 +60,11 @@ class IpAddressTest extends TestCase {
* @param string $input
* @param string $expected
*/
- public function testGetSubnet($input, $expected) {
+ public function testGetSubnet($input, $expected): void {
$this->assertSame($expected, (new IpAddress($input))->getSubnet());
}
- public function testToString() {
+ public function testToString(): void {
$this->assertSame('127.0.0.1', (string)(new IpAddress('127.0.0.1')));
}
}
diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php
index 27799ce4af5..24e3ab1a209 100644
--- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php
+++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php
@@ -53,7 +53,7 @@ class MemoryCacheBackendTest extends TestCase {
);
}
- public function testGetAttemptsWithNoAttemptsBefore() {
+ public function testGetAttemptsWithNoAttemptsBefore(): void {
$this->cache
->expects($this->once())
->method('get')
@@ -63,7 +63,7 @@ class MemoryCacheBackendTest extends TestCase {
$this->assertSame(0, $this->memoryCache->getAttempts('Method', 'User'));
}
- public function testGetAttempts() {
+ public function testGetAttempts(): void {
$this->timeFactory
->expects($this->once())
->method('getTime')
@@ -84,7 +84,7 @@ class MemoryCacheBackendTest extends TestCase {
$this->assertSame(3, $this->memoryCache->getAttempts('Method', 'User'));
}
- public function testRegisterAttemptWithNoAttemptsBefore() {
+ public function testRegisterAttemptWithNoAttemptsBefore(): void {
$this->timeFactory
->expects($this->once())
->method('getTime')
@@ -106,7 +106,7 @@ class MemoryCacheBackendTest extends TestCase {
$this->memoryCache->registerAttempt('Method', 'User', 100);
}
- public function testRegisterAttempt() {
+ public function testRegisterAttempt(): void {
$this->timeFactory
->expects($this->once())
->method('getTime')
diff --git a/tests/lib/Security/RateLimiting/LimiterTest.php b/tests/lib/Security/RateLimiting/LimiterTest.php
index 332f26b81d0..92600e22de8 100644
--- a/tests/lib/Security/RateLimiting/LimiterTest.php
+++ b/tests/lib/Security/RateLimiting/LimiterTest.php
@@ -31,7 +31,7 @@ class LimiterTest extends TestCase {
}
- public function testRegisterAnonRequestExceeded() {
+ public function testRegisterAnonRequestExceeded(): void {
$this->expectException(\OC\Security\RateLimiting\Exception\RateLimitExceededException::class);
$this->expectExceptionMessage('Rate limit exceeded');
@@ -47,7 +47,7 @@ class LimiterTest extends TestCase {
$this->limiter->registerAnonRequest('MyIdentifier', 100, 100, '127.0.0.1');
}
- public function testRegisterAnonRequestSuccess() {
+ public function testRegisterAnonRequestSuccess(): void {
$this->backend
->expects($this->once())
->method('getAttempts')
@@ -69,7 +69,7 @@ class LimiterTest extends TestCase {
}
- public function testRegisterUserRequestExceeded() {
+ public function testRegisterUserRequestExceeded(): void {
$this->expectException(\OC\Security\RateLimiting\Exception\RateLimitExceededException::class);
$this->expectExceptionMessage('Rate limit exceeded');
@@ -91,7 +91,7 @@ class LimiterTest extends TestCase {
$this->limiter->registerUserRequest('MyIdentifier', 100, 100, $user);
}
- public function testRegisterUserRequestSuccess() {
+ public function testRegisterUserRequestSuccess(): void {
/** @var IUser|\PHPUnit\Framework\MockObject\MockObject $user */
$user = $this->createMock(IUser::class);
$user
diff --git a/tests/lib/Security/SecureRandomTest.php b/tests/lib/Security/SecureRandomTest.php
index 6e5f3587630..08d33d4a1b3 100644
--- a/tests/lib/Security/SecureRandomTest.php
+++ b/tests/lib/Security/SecureRandomTest.php
@@ -43,7 +43,7 @@ class SecureRandomTest extends \Test\TestCase {
/**
* @dataProvider stringGenerationProvider
*/
- public function testGetLowStrengthGeneratorLength($length, $expectedLength) {
+ public function testGetLowStrengthGeneratorLength($length, $expectedLength): void {
$generator = $this->rng;
$this->assertEquals($expectedLength, strlen($generator->generate($length)));
@@ -52,7 +52,7 @@ class SecureRandomTest extends \Test\TestCase {
/**
* @dataProvider stringGenerationProvider
*/
- public function testMediumLowStrengthGeneratorLength($length, $expectedLength) {
+ public function testMediumLowStrengthGeneratorLength($length, $expectedLength): void {
$generator = $this->rng;
$this->assertEquals($expectedLength, strlen($generator->generate($length)));
@@ -61,14 +61,14 @@ class SecureRandomTest extends \Test\TestCase {
/**
* @dataProvider stringGenerationProvider
*/
- public function testUninitializedGenerate($length, $expectedLength) {
+ public function testUninitializedGenerate($length, $expectedLength): void {
$this->assertEquals($expectedLength, strlen($this->rng->generate($length)));
}
/**
* @dataProvider charCombinations
*/
- public function testScheme($charName, $chars) {
+ public function testScheme($charName, $chars): void {
$generator = $this->rng;
$scheme = constant('OCP\Security\ISecureRandom::' . $charName);
$randomString = $generator->generate(100, $scheme);
@@ -86,7 +86,7 @@ class SecureRandomTest extends \Test\TestCase {
/**
* @dataProvider invalidLengths
*/
- public function testInvalidLengths($length) {
+ public function testInvalidLengths($length): void {
$this->expectException(\LengthException::class);
$generator = $this->rng;
$generator->generate($length);
diff --git a/tests/lib/Security/TrustedDomainHelperTest.php b/tests/lib/Security/TrustedDomainHelperTest.php
index 3dbaf376b52..656b7a77206 100644
--- a/tests/lib/Security/TrustedDomainHelperTest.php
+++ b/tests/lib/Security/TrustedDomainHelperTest.php
@@ -32,7 +32,7 @@ class TrustedDomainHelperTest extends \Test\TestCase {
* @param string $testDomain
* @param bool $result
*/
- public function testIsTrustedUrl($trustedDomains, $testDomain, $result) {
+ public function testIsTrustedUrl($trustedDomains, $testDomain, $result): void {
$this->config->method('getSystemValue')
->willReturnMap([
['overwritehost', '', ''],
@@ -49,7 +49,7 @@ class TrustedDomainHelperTest extends \Test\TestCase {
* @param string $testDomain
* @param bool $result
*/
- public function testIsTrustedDomain($trustedDomains, $testDomain, $result) {
+ public function testIsTrustedDomain($trustedDomains, $testDomain, $result): void {
$this->config->method('getSystemValue')
->willReturnMap([
['overwritehost', '', ''],
@@ -134,7 +134,7 @@ class TrustedDomainHelperTest extends \Test\TestCase {
];
}
- public function testIsTrustedDomainOverwriteHost() {
+ public function testIsTrustedDomainOverwriteHost(): void {
$this->config->method('getSystemValue')
->with('overwritehost')
->willReturn('myproxyhost');
diff --git a/tests/lib/Security/VerificationToken/VerificationTokenTest.php b/tests/lib/Security/VerificationToken/VerificationTokenTest.php
index f8573478fa5..7123cc8b013 100644
--- a/tests/lib/Security/VerificationToken/VerificationTokenTest.php
+++ b/tests/lib/Security/VerificationToken/VerificationTokenTest.php
@@ -52,13 +52,13 @@ class VerificationTokenTest extends TestCase {
);
}
- public function testTokenUserUnknown() {
+ public function testTokenUserUnknown(): void {
$this->expectException(InvalidTokenException::class);
$this->expectExceptionCode(InvalidTokenException::USER_UNKNOWN);
$this->token->check('encryptedToken', null, 'fingerprintToken', 'foobar');
}
- public function testTokenUserUnknown2() {
+ public function testTokenUserUnknown2(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -69,7 +69,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar');
}
- public function testTokenNotFound() {
+ public function testTokenNotFound(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -85,7 +85,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar');
}
- public function testTokenDecryptionError() {
+ public function testTokenDecryptionError(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -112,7 +112,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar');
}
- public function testTokenInvalidFormat() {
+ public function testTokenInvalidFormat(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -139,7 +139,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar');
}
- public function testTokenExpired() {
+ public function testTokenExpired(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -173,7 +173,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar');
}
- public function testTokenExpiredByLogin() {
+ public function testTokenExpiredByLogin(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -207,7 +207,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar', true);
}
- public function testTokenMismatch() {
+ public function testTokenMismatch(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -241,7 +241,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('encryptedToken', $user, 'fingerprintToken', 'foobar');
}
- public function testTokenSuccess() {
+ public function testTokenSuccess(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->atLeastOnce())
->method('isEnabled')
@@ -273,7 +273,7 @@ class VerificationTokenTest extends TestCase {
$this->token->check('barfoo', $user, 'fingerprintToken', 'foobar');
}
- public function testCreate() {
+ public function testCreate(): void {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUID')
diff --git a/tests/lib/ServerTest.php b/tests/lib/ServerTest.php
index d9ff8ea41c2..7f7d3125fdd 100644
--- a/tests/lib/ServerTest.php
+++ b/tests/lib/ServerTest.php
@@ -119,8 +119,6 @@ class ServerTest extends \Test\TestCase {
['RootFolder', '\OCP\Files\Folder'],
['Router', '\OCP\Route\IRouter'],
- ['Search', '\OC\Search'],
- ['Search', '\OCP\ISearch'],
['SecureRandom', '\OC\Security\SecureRandom'],
['SecureRandom', '\OCP\Security\ISecureRandom'],
['ShareManager', '\OC\Share20\Manager'],
@@ -154,16 +152,16 @@ class ServerTest extends \Test\TestCase {
* @param string $serviceName
* @param string $instanceOf
*/
- public function testQuery($serviceName, $instanceOf) {
+ public function testQuery($serviceName, $instanceOf): void {
$this->assertInstanceOf($instanceOf, $this->server->query($serviceName), 'Service "' . $serviceName . '"" did not return the right class');
}
- public function testGetCertificateManager() {
+ public function testGetCertificateManager(): void {
$this->assertInstanceOf('\OC\Security\CertificateManager', $this->server->getCertificateManager(), 'service returned by "getCertificateManager" did not return the right class');
$this->assertInstanceOf('\OCP\ICertificateManager', $this->server->getCertificateManager(), 'service returned by "getCertificateManager" did not return the right class');
}
- public function testOverwriteDefaultCommentsManager() {
+ public function testOverwriteDefaultCommentsManager(): void {
$config = $this->server->getConfig();
$defaultManagerFactory = $config->getSystemValue('comments.managerFactory', '\OC\Comments\ManagerFactory');
diff --git a/tests/lib/Session/CryptoSessionDataTest.php b/tests/lib/Session/CryptoSessionDataTest.php
index 83768ef49aa..6c1536f4769 100644
--- a/tests/lib/Session/CryptoSessionDataTest.php
+++ b/tests/lib/Session/CryptoSessionDataTest.php
@@ -20,7 +20,7 @@ class CryptoSessionDataTest extends Session {
protected function setUp(): void {
parent::setUp();
- $this->wrappedSession = new \OC\Session\Memory($this->getUniqueID());
+ $this->wrappedSession = new \OC\Session\Memory();
$this->crypto = $this->createMock(ICrypto::class);
$this->crypto->expects($this->any())
->method('encrypt')
diff --git a/tests/lib/Session/CryptoWrappingTest.php b/tests/lib/Session/CryptoWrappingTest.php
index 093f2214929..8afbf61bddc 100644
--- a/tests/lib/Session/CryptoWrappingTest.php
+++ b/tests/lib/Session/CryptoWrappingTest.php
@@ -47,7 +47,7 @@ class CryptoWrappingTest extends TestCase {
$this->instance = new CryptoSessionData($this->wrappedSession, $this->crypto, 'PASS');
}
- public function testUnwrappingGet() {
+ public function testUnwrappingGet(): void {
$unencryptedValue = 'foobar';
$encryptedValue = $this->crypto->encrypt($unencryptedValue);
diff --git a/tests/lib/Session/MemoryTest.php b/tests/lib/Session/MemoryTest.php
index ae4a1b64dc0..24bfc06b274 100644
--- a/tests/lib/Session/MemoryTest.php
+++ b/tests/lib/Session/MemoryTest.php
@@ -11,11 +11,11 @@ namespace Test\Session;
class MemoryTest extends Session {
protected function setUp(): void {
parent::setUp();
- $this->instance = new \OC\Session\Memory($this->getUniqueID());
+ $this->instance = new \OC\Session\Memory();
}
-
- public function testThrowsExceptionOnGetId() {
+
+ public function testThrowsExceptionOnGetId(): void {
$this->expectException(\OCP\Session\Exceptions\SessionNotAvailableException::class);
$this->instance->getId();
diff --git a/tests/lib/Session/Session.php b/tests/lib/Session/Session.php
index 63fa4554477..1e2e9370825 100644
--- a/tests/lib/Session/Session.php
+++ b/tests/lib/Session/Session.php
@@ -19,43 +19,43 @@ abstract class Session extends \Test\TestCase {
parent::tearDown();
}
- public function testNotExistsEmpty() {
+ public function testNotExistsEmpty(): void {
$this->assertFalse($this->instance->exists('foo'));
}
- public function testExistsAfterSet() {
+ public function testExistsAfterSet(): void {
$this->instance->set('foo', 1);
$this->assertTrue($this->instance->exists('foo'));
}
- public function testNotExistsAfterRemove() {
+ public function testNotExistsAfterRemove(): void {
$this->instance->set('foo', 1);
$this->instance->remove('foo');
$this->assertFalse($this->instance->exists('foo'));
}
- public function testGetNonExisting() {
+ public function testGetNonExisting(): void {
$this->assertNull($this->instance->get('foo'));
}
- public function testGetAfterSet() {
+ public function testGetAfterSet(): void {
$this->instance->set('foo', 'bar');
$this->assertEquals('bar', $this->instance->get(('foo')));
}
- public function testRemoveNonExisting() {
+ public function testRemoveNonExisting(): void {
$this->assertFalse($this->instance->exists('foo'));
$this->instance->remove('foo');
$this->assertFalse($this->instance->exists('foo'));
}
- public function testNotExistsAfterClear() {
+ public function testNotExistsAfterClear(): void {
$this->instance->set('foo', 1);
$this->instance->clear();
$this->assertFalse($this->instance->exists('foo'));
}
- public function testArrayInterface() {
+ public function testArrayInterface(): void {
$this->assertFalse(isset($this->instance['foo']));
$this->instance['foo'] = 'bar';
$this->assertTrue(isset($this->instance['foo']));
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 6ed8ed74359..90c195e6bd0 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -64,7 +64,7 @@ class ManagerTest extends TestCase {
);
}
- public function testGetAdminSections() {
+ public function testGetAdminSections(): void {
$this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class);
$section = \OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class);
@@ -77,7 +77,7 @@ class ManagerTest extends TestCase {
], $this->manager->getAdminSections());
}
- public function testGetPersonalSections() {
+ public function testGetPersonalSections(): void {
$this->manager->registerSection('personal', \OCA\WorkflowEngine\Settings\Section::class);
$section = \OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class);
@@ -90,11 +90,11 @@ class ManagerTest extends TestCase {
], $this->manager->getPersonalSections());
}
- public function testGetAdminSectionsEmptySection() {
+ public function testGetAdminSectionsEmptySection(): void {
$this->assertEquals([], $this->manager->getAdminSections());
}
- public function testGetPersonalSectionsEmptySection() {
+ public function testGetPersonalSectionsEmptySection(): void {
$this->l10nFactory
->expects($this->once())
->method('get')
@@ -108,7 +108,7 @@ class ManagerTest extends TestCase {
$this->assertEquals([], $this->manager->getPersonalSections());
}
- public function testGetAdminSettings() {
+ public function testGetAdminSettings(): void {
$section = $this->createMock(ISettings::class);
$section->method('getPriority')
->willReturn(13);
@@ -126,7 +126,7 @@ class ManagerTest extends TestCase {
], $settings);
}
- public function testGetAdminSettingsAsSubAdmin() {
+ public function testGetAdminSettingsAsSubAdmin(): void {
$section = $this->createMock(ISettings::class);
$section->method('getPriority')
->willReturn(13);
@@ -142,7 +142,7 @@ class ManagerTest extends TestCase {
$this->assertEquals([], $settings);
}
- public function testGetSubAdminSettingsAsSubAdmin() {
+ public function testGetSubAdminSettingsAsSubAdmin(): void {
$section = $this->createMock(ISubAdminSettings::class);
$section->method('getPriority')
->willReturn(13);
@@ -161,7 +161,7 @@ class ManagerTest extends TestCase {
], $settings);
}
- public function testGetPersonalSettings() {
+ public function testGetPersonalSettings(): void {
$section = $this->createMock(ISettings::class);
$section->method('getPriority')
->willReturn(16);
@@ -195,7 +195,7 @@ class ManagerTest extends TestCase {
], $settings);
}
- public function testSameSectionAsPersonalAndAdmin() {
+ public function testSameSectionAsPersonalAndAdmin(): void {
$this->l10nFactory
->expects($this->once())
->method('get')
diff --git a/tests/lib/Settings/SectionTest.php b/tests/lib/Settings/SectionTest.php
index 964256f303c..dd69f8ae110 100644
--- a/tests/lib/Settings/SectionTest.php
+++ b/tests/lib/Settings/SectionTest.php
@@ -10,13 +10,13 @@ use OC\Settings\Section;
use Test\TestCase;
class SectionTest extends TestCase {
- public function testGetID() {
+ public function testGetID(): void {
$this->assertSame('ldap', (new Section('ldap', 'name', 1))->getID());
}
- public function testGetName() {
+ public function testGetName(): void {
$this->assertSame('name', (new Section('ldap', 'name', 1))->getName());
}
- public function testGetPriority() {
+ public function testGetPriority(): void {
$this->assertSame(1, (new Section('ldap', 'name', 1))->getPriority());
}
}
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index 5216d2a730a..b5e1b7000c3 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -47,7 +47,7 @@ class SetupTest extends \Test\TestCase {
->getMock();
}
- public function testGetSupportedDatabasesWithOneWorking() {
+ public function testGetSupportedDatabasesWithOneWorking(): void {
$this->config
->expects($this->once())
->method('getValue')
@@ -70,7 +70,7 @@ class SetupTest extends \Test\TestCase {
$this->assertSame($expectedResult, $result);
}
- public function testGetSupportedDatabasesWithNoWorking() {
+ public function testGetSupportedDatabasesWithNoWorking(): void {
$this->config
->expects($this->once())
->method('getValue')
@@ -90,7 +90,7 @@ class SetupTest extends \Test\TestCase {
$this->assertSame([], $result);
}
- public function testGetSupportedDatabasesWithAllWorking() {
+ public function testGetSupportedDatabasesWithAllWorking(): void {
$this->config
->expects($this->once())
->method('getValue')
@@ -116,7 +116,7 @@ class SetupTest extends \Test\TestCase {
}
- public function testGetSupportedDatabaseException() {
+ public function testGetSupportedDatabaseException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Supported databases are not properly configured.');
@@ -132,7 +132,7 @@ class SetupTest extends \Test\TestCase {
* @param $url
* @param $expected
*/
- public function testFindWebRootCli($url, $expected) {
+ public function testFindWebRootCli($url, $expected): void {
$cliState = \OC::$CLI;
$this->config
diff --git a/tests/lib/Share/Backend.php b/tests/lib/Share/Backend.php
index 91493d599dc..42269d7e275 100644
--- a/tests/lib/Share/Backend.php
+++ b/tests/lib/Share/Backend.php
@@ -30,7 +30,7 @@ class Backend implements \OCP\Share_Backend {
// Always make target be test.txt to cause conflicts
if (substr($itemSource, 0, strlen('test')) !== 'test') {
- $target = "test.txt";
+ $target = 'test.txt';
} else {
$target = $itemSource;
}
diff --git a/tests/lib/Share/HelperTest.php b/tests/lib/Share/HelperTest.php
index f92effebd5d..c923bb0480a 100644
--- a/tests/lib/Share/HelperTest.php
+++ b/tests/lib/Share/HelperTest.php
@@ -36,7 +36,7 @@ class HelperTest extends \Test\TestCase {
/**
* @dataProvider expireDateProvider
*/
- public function testCalculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate, $expected) {
+ public function testCalculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate, $expected): void {
$result = \OC\Share\Helper::calculateExpireDate($defaultExpireSettings, $creationTime, $userExpireDate);
$this->assertSame($expected, $result);
}
@@ -48,7 +48,7 @@ class HelperTest extends \Test\TestCase {
* @param string $server2
* @param bool $expected
*/
- public function testIsSameUserOnSameServer($user1, $server1, $user2, $server2, $expected) {
+ public function testIsSameUserOnSameServer($user1, $server1, $user2, $server2, $expected): void {
$this->assertSame($expected,
\OC\Share\Helper::isSameUserOnSameServer($user1, $server1, $user2, $server2)
);
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index d6ed54f06da..60891e10ca2 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -126,7 +126,7 @@ class ShareTest extends \Test\TestCase {
* @param string $url
* @param string $expectedResult
*/
- public function testRemoveProtocolFromUrl($url, $expectedResult) {
+ public function testRemoveProtocolFromUrl($url, $expectedResult): void {
$share = new Share();
$result = self::invokePrivate($share, 'removeProtocolFromUrl', [$url]);
$this->assertSame($expectedResult, $result);
@@ -145,7 +145,7 @@ class ShareTest extends \Test\TestCase {
* @param array $ungrouped
* @param array $grouped
*/
- public function testGroupItems($ungrouped, $grouped) {
+ public function testGroupItems($ungrouped, $grouped): void {
$result = DummyShareClass::groupItemsTest($ungrouped);
$this->compareArrays($grouped, $result);
diff --git a/tests/lib/Share20/DefaultShareProviderTest.php b/tests/lib/Share20/DefaultShareProviderTest.php
index e138f2f576b..36f070d7c99 100644
--- a/tests/lib/Share20/DefaultShareProviderTest.php
+++ b/tests/lib/Share20/DefaultShareProviderTest.php
@@ -27,6 +27,7 @@ use OCP\Mail\IMailer;
use OCP\Share\IManager as IShareManager;
use OCP\Share\IShare;
use PHPUnit\Framework\MockObject\MockObject;
+use Psr\Log\LoggerInterface;
/**
* Class DefaultShareProviderTest
@@ -68,6 +69,11 @@ class DefaultShareProviderTest extends \Test\TestCase {
/** @var ITimeFactory|MockObject */
protected $timeFactory;
+ /** @var LoggerInterface|MockObject */
+ protected $logger;
+
+ protected IShareManager&MockObject $shareManager;
+
protected function setUp(): void {
$this->dbConn = \OC::$server->getDatabaseConnection();
$this->userManager = $this->createMock(IUserManager::class);
@@ -79,9 +85,11 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults = $this->getMockBuilder(Defaults::class)->disableOriginalConstructor()->getMock();
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
+ $this->shareManager = $this->createMock(IShareManager::class);
$this->userManager->expects($this->any())->method('userExists')->willReturn(true);
- $this->timeFactory->expects($this->any())->method('now')->willReturn(new \DateTimeImmutable("2023-05-04 00:00 Europe/Berlin"));
+ $this->timeFactory->expects($this->any())->method('now')->willReturn(new \DateTimeImmutable('2023-05-04 00:00 Europe/Berlin'));
//Empty share table
$this->dbConn->getQueryBuilder()->delete('share')->execute();
@@ -95,13 +103,15 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
- $this->timeFactory
+ $this->timeFactory,
+ $this->logger,
+ $this->shareManager,
);
}
protected function tearDown(): void {
$this->dbConn->getQueryBuilder()->delete('share')->execute();
- $this->dbConn->getQueryBuilder()->delete('filecache')->execute();
+ $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->execute();
$this->dbConn->getQueryBuilder()->delete('storages')->execute();
}
@@ -165,13 +175,13 @@ class DefaultShareProviderTest extends \Test\TestCase {
- public function testGetShareByIdNotExist() {
+ public function testGetShareByIdNotExist(): void {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$this->provider->getShareById(1);
}
- public function testGetShareByIdUserShare() {
+ public function testGetShareByIdUserShare(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -218,7 +228,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testGetShareByIdLazy() {
+ public function testGetShareByIdLazy(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -253,7 +263,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testGetShareByIdLazy2() {
+ public function testGetShareByIdLazy2(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -297,7 +307,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testGetShareByIdGroupShare() {
+ public function testGetShareByIdGroupShare(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -321,10 +331,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$shareOwnerFolder->method('getFirstNodeById')->with(42)->willReturn($ownerPath);
$this->rootFolder
- ->method('getUserFolder')
- ->willReturnMap([
- ['shareOwner', $shareOwnerFolder],
- ]);
+ ->method('getUserFolder')
+ ->willReturnMap([
+ ['shareOwner', $shareOwnerFolder],
+ ]);
$share = $this->provider->getShareById($id);
@@ -340,7 +350,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testGetShareByIdUserGroupShare() {
+ public function testGetShareByIdUserGroupShare(): void {
$id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user0', 'user0', 'file', 42, 'myTarget', 31, null, null);
$this->addShareToDB(2, 'user1', 'user0', 'user0', 'file', 42, 'userTarget', 0, null, null, $id);
@@ -355,6 +365,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$node = $this->createMock(Folder::class);
$node->method('getId')->willReturn(42);
+ $node->method('getName')->willReturn('myTarget');
$this->rootFolder->method('getUserFolder')->with('user0')->willReturnSelf();
$this->rootFolder->method('getFirstNodeById')->willReturn($node);
@@ -379,7 +390,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('userTarget', $share->getTarget());
}
- public function testGetShareByIdLinkShare() {
+ public function testGetShareByIdLinkShare(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -405,10 +416,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$shareOwnerFolder->method('getFirstNodeById')->with(42)->willReturn($ownerPath);
$this->rootFolder
- ->method('getUserFolder')
- ->willReturnMap([
- ['shareOwner', $shareOwnerFolder],
- ]);
+ ->method('getUserFolder')
+ ->willReturnMap([
+ ['shareOwner', $shareOwnerFolder],
+ ]);
$share = $this->provider->getShareById($id);
@@ -426,7 +437,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testDeleteSingleShare() {
+ public function testDeleteSingleShare(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -456,7 +467,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
- $this->timeFactory
+ $this->timeFactory,
+ $this->logger,
+ $this->shareManager,
])
->setMethods(['getShareById'])
->getMock();
@@ -474,7 +487,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEmpty($result);
}
- public function testDeleteSingleShareLazy() {
+ public function testDeleteSingleShareLazy(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -507,7 +520,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEmpty($result);
}
- public function testDeleteGroupShareWithUserGroupShares() {
+ public function testDeleteGroupShareWithUserGroupShares(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -551,7 +564,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
- $this->timeFactory
+ $this->timeFactory,
+ $this->logger,
+ $this->shareManager,
])
->setMethods(['getShareById'])
->getMock();
@@ -569,7 +584,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEmpty($result);
}
- public function testGetChildren() {
+ public function testGetChildren(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -657,7 +672,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget2', $children[1]->getTarget());
}
- public function testCreateUserShare() {
+ public function testCreateUserShare(): void {
$share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
$shareOwner = $this->createMock(IUser::class);
@@ -722,14 +737,14 @@ class DefaultShareProviderTest extends \Test\TestCase {
[
'scope' => 'permissions',
'key' => 'download',
- 'enabled' => true
+ 'value' => true
]
],
$share->getAttributes()->toArray()
);
}
- public function testCreateGroupShare() {
+ public function testCreateGroupShare(): void {
$share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
$shareOwner = $this->createMock(IUser::class);
@@ -792,14 +807,14 @@ class DefaultShareProviderTest extends \Test\TestCase {
[
'scope' => 'permissions',
'key' => 'download',
- 'enabled' => true
+ 'value' => true
]
],
$share->getAttributes()->toArray()
);
}
- public function testCreateLinkShare() {
+ public function testCreateLinkShare(): void {
$share = new \OC\Share20\Share($this->rootFolder, $this->userManager);
$shareOwner = $this->createMock(IUser::class);
@@ -812,18 +827,18 @@ class DefaultShareProviderTest extends \Test\TestCase {
$ownerFolder = $this->createMock(Folder::class);
$userFolder = $this->createMock(Folder::class);
$this->rootFolder
- ->method('getUserFolder')
- ->willReturnMap([
- ['sharedBy', $userFolder],
- ['shareOwner', $ownerFolder],
- ]);
+ ->method('getUserFolder')
+ ->willReturnMap([
+ ['sharedBy', $userFolder],
+ ['shareOwner', $ownerFolder],
+ ]);
$userFolder->method('getFirstNodeById')
- ->with(100)
- ->willReturn($path);
+ ->with(100)
+ ->willReturn($path);
$ownerFolder->method('getFirstNodeById')
- ->with(100)
- ->willReturn($path);
+ ->with(100)
+ ->willReturn($path);
$share->setShareType(IShare::TYPE_LINK);
$share->setSharedBy('sharedBy');
@@ -854,7 +869,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals($expireDate->getTimestamp(), $share2->getExpirationDate()->getTimestamp());
}
- public function testGetShareByToken() {
+ public function testGetShareByToken(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
@@ -889,7 +904,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
- public function testGetShareByTokenNotFound() {
+ public function testGetShareByTokenNotFound(): void {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$this->provider->getShareByToken('invalidtoken');
@@ -909,10 +924,10 @@ class DefaultShareProviderTest extends \Test\TestCase {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('filecache')
->values([
- 'storage' => $qb->expr()->literal($storage),
- 'path' => $qb->expr()->literal($path),
- 'path_hash' => $qb->expr()->literal(md5($path)),
- 'name' => $qb->expr()->literal(basename($path)),
+ 'storage' => $qb->createNamedParameter($storage, IQueryBuilder::PARAM_INT),
+ 'path' => $qb->createNamedParameter($path),
+ 'path_hash' => $qb->createNamedParameter(md5($path)),
+ 'name' => $qb->createNamedParameter(basename($path)),
]);
$this->assertEquals(1, $qb->execute());
return $qb->getLastInsertId();
@@ -932,7 +947,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
/**
* @dataProvider storageAndFileNameProvider
*/
- public function testGetSharedWithUser($storageStringId, $fileName1, $fileName2) {
+ public function testGetSharedWithUser($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$fileId2 = $this->createTestFileEntry($fileName2, $storageId);
@@ -983,7 +998,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
/**
* @dataProvider storageAndFileNameProvider
*/
- public function testGetSharedWithGroup($storageStringId, $fileName1, $fileName2) {
+ public function testGetSharedWithGroup($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$fileId2 = $this->createTestFileEntry($fileName2, $storageId);
@@ -1057,7 +1072,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
/**
* @dataProvider storageAndFileNameProvider
*/
- public function testGetSharedWithGroupUserModified($storageStringId, $fileName1, $fileName2) {
+ public function testGetSharedWithGroupUserModified($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$qb = $this->dbConn->getQueryBuilder();
@@ -1149,7 +1164,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
/**
* @dataProvider storageAndFileNameProvider
*/
- public function testGetSharedWithUserWithNode($storageStringId, $fileName1, $fileName2) {
+ public function testGetSharedWithUserWithNode($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$fileId2 = $this->createTestFileEntry($fileName2, $storageId);
@@ -1191,7 +1206,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
/**
* @dataProvider storageAndFileNameProvider
*/
- public function testGetSharedWithGroupWithNode($storageStringId, $fileName1, $fileName2) {
+ public function testGetSharedWithGroupWithNode($storageStringId, $fileName1, $fileName2): void {
$storageId = $this->createTestStorageEntry($storageStringId);
$fileId = $this->createTestFileEntry($fileName1, $storageId);
$fileId2 = $this->createTestFileEntry($fileName2, $storageId);
@@ -1243,7 +1258,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
/**
* @dataProvider shareTypesProvider
*/
- public function testGetSharedWithWithDeletedFile($shareType, $trashed) {
+ public function testGetSharedWithWithDeletedFile($shareType, $trashed): void {
if ($trashed) {
// exists in database but is in trash
$storageId = $this->createTestStorageEntry('home::shareOwner');
@@ -1297,7 +1312,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertCount(0, $share);
}
- public function testGetSharesBy() {
+ public function testGetSharesBy(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -1346,7 +1361,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testGetSharesNode() {
+ public function testGetSharesNode(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -1396,7 +1411,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('myTarget', $share->getTarget());
}
- public function testGetSharesReshare() {
+ public function testGetSharesReshare(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->values([
@@ -1455,7 +1470,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('userTarget', $share->getTarget());
}
- public function testDeleteFromSelfGroupNoCustomShare() {
+ public function testDeleteFromSelfGroupNoCustomShare(): void {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
@@ -1512,7 +1527,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertEquals('user2', $share2['share_with']);
}
- public function testDeleteFromSelfGroupAlreadyCustomShare() {
+ public function testDeleteFromSelfGroupAlreadyCustomShare(): void {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
@@ -1585,7 +1600,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
- public function testDeleteFromSelfGroupUserNotInGroup() {
+ public function testDeleteFromSelfGroupUserNotInGroup(): void {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
@@ -1628,7 +1643,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
- public function testDeleteFromSelfGroupDoesNotExist() {
+ public function testDeleteFromSelfGroupDoesNotExist(): void {
$this->expectException(\OC\Share20\Exception\ProviderException::class);
$this->expectExceptionMessage('Group "group" does not exist');
@@ -1669,7 +1684,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->provider->deleteFromSelf($share, 'user2');
}
- public function testDeleteFromSelfUser() {
+ public function testDeleteFromSelfUser(): void {
$qb = $this->dbConn->getQueryBuilder();
$stmt = $qb->insert('share')
->values([
@@ -1719,7 +1734,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
- public function testDeleteFromSelfUserNotRecipient() {
+ public function testDeleteFromSelfUserNotRecipient(): void {
$this->expectException(\OC\Share20\Exception\ProviderException::class);
$this->expectExceptionMessage('Recipient does not match');
@@ -1762,7 +1777,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
}
- public function testDeleteFromSelfLink() {
+ public function testDeleteFromSelfLink(): void {
$this->expectException(\OC\Share20\Exception\ProviderException::class);
$this->expectExceptionMessage('Invalid shareType');
@@ -1798,7 +1813,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->provider->deleteFromSelf($share, $user1);
}
- public function testUpdateUser() {
+ public function testUpdateUser(): void {
$id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
@@ -1856,7 +1871,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame(1, $share2->getPermissions());
}
- public function testUpdateLink() {
+ public function testUpdateLink(): void {
$id = $this->addShareToDB(IShare::TYPE_LINK, null, 'user1', 'user2',
'file', 42, 'target', 31, null, null);
@@ -1916,7 +1931,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame(1, $share2->getPermissions());
}
- public function testUpdateLinkRemovePassword() {
+ public function testUpdateLinkRemovePassword(): void {
$id = $this->addShareToDB(IShare::TYPE_LINK, 'foo', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
@@ -1979,7 +1994,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame(1, $share2->getPermissions());
}
- public function testUpdateGroupNoSub() {
+ public function testUpdateGroupNoSub(): void {
$id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
@@ -2052,7 +2067,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame(1, $share2->getPermissions());
}
- public function testUpdateGroupSubShares() {
+ public function testUpdateGroupSubShares(): void {
$id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user2',
'file', 42, 'target', 31, null, null);
@@ -2153,7 +2168,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$stmt->closeCursor();
}
- public function testMoveUserShare() {
+ public function testMoveUserShare(): void {
$id = $this->addShareToDB(IShare::TYPE_USER, 'user0', 'user1', 'user1', 'file',
42, 'mytaret', 31, null, null);
@@ -2184,7 +2199,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertSame('/newTarget', $share->getTarget());
}
- public function testMoveGroupShare() {
+ public function testMoveGroupShare(): void {
$id = $this->addShareToDB(IShare::TYPE_GROUP, 'group0', 'user1', 'user1', 'file',
42, 'mytaret', 31, null, null);
@@ -2255,7 +2270,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @param string $deletedUser The user that is deleted
* @param bool $rowDeleted Is the row deleted in this setup
*/
- public function testDeleteUser($type, $owner, $initiator, $recipient, $deletedUser, $rowDeleted) {
+ public function testDeleteUser($type, $owner, $initiator, $recipient, $deletedUser, $rowDeleted): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter($type))
@@ -2303,7 +2318,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @param bool $groupShareDeleted
* @param bool $userGroupShareDeleted
*/
- public function testDeleteUserGroup($owner, $initiator, $recipient, $deletedUser, $groupShareDeleted, $userGroupShareDeleted) {
+ public function testDeleteUserGroup($owner, $initiator, $recipient, $deletedUser, $groupShareDeleted, $userGroupShareDeleted): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))
@@ -2406,7 +2421,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @param $groupToDelete
* @param $shouldBeDeleted
*/
- public function testGroupDeleted($shares, $groupToDelete, $shouldBeDeleted) {
+ public function testGroupDeleted($shares, $groupToDelete, $shouldBeDeleted): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter($shares['type']))
@@ -2466,7 +2481,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
* @param string $user
* @param bool $toDelete
*/
- public function testUserDeletedFromGroup($group, $user, $toDelete) {
+ public function testUserDeletedFromGroup($group, $user, $toDelete): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_GROUP))
@@ -2505,7 +2520,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->assertCount($toDelete ? 0 : 1, $data);
}
- public function testGetSharesInFolder() {
+ public function testGetSharesInFolder(): void {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
$rootFolder = \OC::$server->get(IRootFolder::class);
@@ -2519,7 +2534,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
- $this->timeFactory
+ $this->timeFactory,
+ $this->logger,
+ $this->shareManager,
);
$password = md5(time());
@@ -2603,7 +2620,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$g1->delete();
}
- public function testGetAccessListNoCurrentAccessRequired() {
+ public function testGetAccessListNoCurrentAccessRequired(): void {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
$rootFolder = \OC::$server->get(IRootFolder::class);
@@ -2617,7 +2634,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
- $this->timeFactory
+ $this->timeFactory,
+ $this->logger,
+ $this->shareManager,
);
$u1 = $userManager->createUser('testShare1', 'test');
@@ -2699,7 +2718,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$g1->delete();
}
- public function testGetAccessListCurrentAccessRequired() {
+ public function testGetAccessListCurrentAccessRequired(): void {
$userManager = \OC::$server->getUserManager();
$groupManager = \OC::$server->getGroupManager();
$rootFolder = \OC::$server->get(IRootFolder::class);
@@ -2713,7 +2732,9 @@ class DefaultShareProviderTest extends \Test\TestCase {
$this->defaults,
$this->l10nFactory,
$this->urlGenerator,
- $this->timeFactory
+ $this->timeFactory,
+ $this->logger,
+ $this->shareManager,
);
$u1 = $userManager->createUser('testShare1', 'test');
@@ -2794,7 +2815,7 @@ class DefaultShareProviderTest extends \Test\TestCase {
$g1->delete();
}
- public function testGetAllShares() {
+ public function testGetAllShares(): void {
$qb = $this->dbConn->getQueryBuilder();
$qb->insert('share')
diff --git a/tests/lib/Share20/LegacyHooksTest.php b/tests/lib/Share20/LegacyHooksTest.php
index 87643614f74..0761eed592b 100644
--- a/tests/lib/Share20/LegacyHooksTest.php
+++ b/tests/lib/Share20/LegacyHooksTest.php
@@ -43,7 +43,7 @@ class LegacyHooksTest extends TestCase {
$this->manager = \OC::$server->get(IShareManager::class);
}
- public function testPreUnshare() {
+ public function testPreUnshare(): void {
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(1);
@@ -84,7 +84,7 @@ class LegacyHooksTest extends TestCase {
$this->eventDispatcher->dispatchTyped($event);
}
- public function testPostUnshare() {
+ public function testPostUnshare(): void {
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(1);
@@ -138,7 +138,7 @@ class LegacyHooksTest extends TestCase {
$this->eventDispatcher->dispatchTyped($event);
}
- public function testPostUnshareFromSelf() {
+ public function testPostUnshareFromSelf(): void {
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(1);
@@ -194,7 +194,7 @@ class LegacyHooksTest extends TestCase {
$this->eventDispatcher->dispatchTyped($event);
}
- public function testPreShare() {
+ public function testPreShare(): void {
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(1);
@@ -242,7 +242,7 @@ class LegacyHooksTest extends TestCase {
$this->eventDispatcher->dispatchTyped($event);
}
- public function testPreShareError() {
+ public function testPreShareError(): void {
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(1);
@@ -297,7 +297,7 @@ class LegacyHooksTest extends TestCase {
$this->assertSame('I error', $event->getError());
}
- public function testPostShare() {
+ public function testPostShare(): void {
$path = $this->createMock(File::class);
$path->method('getId')->willReturn(1);
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 15ecc839451..2250e28bd13 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -74,9 +74,9 @@ class ManagerTest extends \Test\TestCase {
protected $hasher;
/** @var IShareProvider|MockObject */
protected $defaultProvider;
- /** @var IMountManager|MockObject */
+ /** @var IMountManager|MockObject */
protected $mountManager;
- /** @var IGroupManager|MockObject */
+ /** @var IGroupManager|MockObject */
protected $groupManager;
/** @var IL10N|MockObject */
protected $l;
@@ -90,20 +90,20 @@ class ManagerTest extends \Test\TestCase {
protected $rootFolder;
/** @var IEventDispatcher|MockObject */
protected $dispatcher;
- /** @var IMailer|MockObject */
+ /** @var IMailer|MockObject */
protected $mailer;
- /** @var IURLGenerator|MockObject */
+ /** @var IURLGenerator|MockObject */
protected $urlGenerator;
- /** @var \OC_Defaults|MockObject */
+ /** @var \OC_Defaults|MockObject */
protected $defaults;
- /** @var IUserSession|MockObject */
+ /** @var IUserSession|MockObject */
protected $userSession;
- /** @var KnownUserService|MockObject */
+ /** @var KnownUserService|MockObject */
protected $knownUserService;
- /** @var ShareDisableChecker|MockObject */
+ /** @var ShareDisableChecker|MockObject */
protected $shareDisabledChecker;
private DateTimeZone $timezone;
- /** @var IDateTimeZone|MockObject */
+ /** @var IDateTimeZone|MockObject */
protected $dateTimeZone;
protected function setUp(): void {
@@ -199,7 +199,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testDeleteNoShareId() {
+ public function testDeleteNoShareId(): void {
$this->expectException(\InvalidArgumentException::class);
$share = $this->manager->newShare();
@@ -225,7 +225,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider dataTestDelete
*/
- public function testDelete($shareType, $sharedWith) {
+ public function testDelete($shareType, $sharedWith): void {
$manager = $this->createManagerMock()
->setMethods(['getShareById', 'deleteChildren'])
->getMock();
@@ -267,7 +267,7 @@ class ManagerTest extends \Test\TestCase {
$manager->deleteShare($share);
}
- public function testDeleteLazyShare() {
+ public function testDeleteLazyShare(): void {
$manager = $this->createManagerMock()
->setMethods(['getShareById', 'deleteChildren'])
->getMock();
@@ -310,7 +310,7 @@ class ManagerTest extends \Test\TestCase {
$manager->deleteShare($share);
}
- public function testDeleteNested() {
+ public function testDeleteNested(): void {
$manager = $this->createManagerMock()
->setMethods(['getShareById'])
->getMock();
@@ -396,7 +396,7 @@ class ManagerTest extends \Test\TestCase {
$manager->deleteShare($share1);
}
- public function testDeleteFromSelf() {
+ public function testDeleteFromSelf(): void {
$manager = $this->createManagerMock()
->setMethods(['getShareById'])
->getMock();
@@ -429,7 +429,7 @@ class ManagerTest extends \Test\TestCase {
$manager->deleteFromSelf($share, $recipientId);
}
- public function testDeleteChildren() {
+ public function testDeleteChildren(): void {
$manager = $this->createManagerMock()
->setMethods(['deleteShare'])
->getMock();
@@ -469,7 +469,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($shares, $result);
}
- public function testGetShareById() {
+ public function testGetShareById(): void {
$share = $this->createMock(IShare::class);
$this->defaultProvider
@@ -482,7 +482,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGetExpiredShareById() {
+ public function testGetExpiredShareById(): void {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$manager = $this->createManagerMock()
@@ -509,7 +509,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testVerifyPasswordNullButEnforced() {
+ public function testVerifyPasswordNullButEnforced(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Passwords are enforced for link and mail shares');
@@ -521,7 +521,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'verifyPassword', [null]);
}
- public function testVerifyPasswordNotEnforcedGroup() {
+ public function testVerifyPasswordNotEnforcedGroup(): void {
$this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password_excluded_groups', '', '["admin"]'],
['core', 'shareapi_enforce_links_password', 'no', 'yes'],
@@ -536,7 +536,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($result);
}
- public function testVerifyPasswordNotEnforcedMultipleGroups() {
+ public function testVerifyPasswordNotEnforcedMultipleGroups(): void {
$this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password_excluded_groups', '', '["admin", "special"]'],
['core', 'shareapi_enforce_links_password', 'no', 'yes'],
@@ -551,7 +551,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($result);
}
- public function testVerifyPasswordNull() {
+ public function testVerifyPasswordNull(): void {
$this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
['core', 'shareapi_enforce_links_password', 'no', 'no'],
@@ -561,7 +561,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($result);
}
- public function testVerifyPasswordHook() {
+ public function testVerifyPasswordHook(): void {
$this->config->method('getAppValue')->willReturnMap([
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
['core', 'shareapi_enforce_links_password', 'no', 'no'],
@@ -580,7 +580,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testVerifyPasswordHookFails() {
+ public function testVerifyPasswordHookFails(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('password not accepted');
@@ -652,7 +652,7 @@ class ManagerTest extends \Test\TestCase {
[$this->createShare(null, IShare::TYPE_LINK, $file, $user2, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
[$this->createShare(null, IShare::TYPE_LINK, $file, $group0, $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
[$this->createShare(null, IShare::TYPE_LINK, $file, 'foo@bar.com', $user0, $user0, 31, null, null), 'SharedWith should be empty', true],
- [$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'unknown share type', true],
+ [$this->createShare(null, -1, $file, null, $user0, $user0, 31, null, null), 'Unknown share type', true],
[$this->createShare(null, IShare::TYPE_USER, $file, $user2, null, $user0, 31, null, null), 'SharedBy should be set', true],
[$this->createShare(null, IShare::TYPE_GROUP, $file, $group0, null, $user0, 31, null, null), 'SharedBy should be set', true],
@@ -778,7 +778,7 @@ class ManagerTest extends \Test\TestCase {
* @param $exceptionMessage
* @param $exception
*/
- public function testGeneralChecks($share, $exceptionMessage, $exception) {
+ public function testGeneralChecks($share, $exceptionMessage, $exception): void {
$thrown = null;
$this->userManager->method('userExists')->willReturnMap([
@@ -819,7 +819,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGeneralCheckShareRoot() {
+ public function testGeneralCheckShareRoot(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('You cannot share your root folder');
@@ -851,7 +851,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalInPast($shareType) {
+ public function testValidateExpirationDateInternalInPast($shareType): void {
$this->expectException(\OCP\Share\Exceptions\GenericShareException::class);
$this->expectExceptionMessage('Expiration date is in the past');
@@ -869,7 +869,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalEnforceButNotSet($shareType) {
+ public function testValidateExpirationDateInternalEnforceButNotSet($shareType): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expiration date is enforced');
@@ -896,7 +896,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalEnforceButNotEnabledAndNotSet($shareType) {
+ public function testValidateExpirationDateInternalEnforceButNotEnabledAndNotSet($shareType): void {
$share = $this->manager->newShare();
$share->setProviderId('foo')->setId('bar');
$share->setShareType($shareType);
@@ -921,7 +921,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shareType) {
+ public function testValidateExpirationDateInternalEnforceButNotSetNewShare($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -956,7 +956,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSetNewShare($shareType) {
+ public function testValidateExpirationDateInternalEnforceRelaxedDefaultButNotSetNewShare($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -991,7 +991,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalEnforceTooFarIntoFuture($shareType) {
+ public function testValidateExpirationDateInternalEnforceTooFarIntoFuture($shareType): void {
$this->expectException(\OCP\Share\Exceptions\GenericShareException::class);
$this->expectExceptionMessage('Cannot set expiration date more than 3 days in the future');
@@ -1024,7 +1024,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalEnforceValid($shareType) {
+ public function testValidateExpirationDateInternalEnforceValid($shareType): void {
$future = new \DateTime('now', $this->dateTimeZone->getTimeZone());
$future->add(new \DateInterval('P2D'));
$future->setTime(1, 2, 3);
@@ -1066,7 +1066,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalNoDefault($shareType) {
+ public function testValidateExpirationDateInternalNoDefault($shareType): void {
$date = new \DateTime('now', $this->dateTimeZone->getTimeZone());
$date->add(new \DateInterval('P5D'));
$date->setTime(1, 2, 3);
@@ -1092,7 +1092,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalNoDateNoDefault($shareType) {
+ public function testValidateExpirationDateInternalNoDateNoDefault($shareType): void {
$hookListener = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) {
@@ -1111,7 +1111,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalNoDateDefault($shareType) {
+ public function testValidateExpirationDateInternalNoDateDefault($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
@@ -1150,7 +1150,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalDefault($shareType) {
+ public function testValidateExpirationDateInternalDefault($shareType): void {
$future = new \DateTime('now', $this->timezone);
$future->add(new \DateInterval('P5D'));
$future->setTime(1, 2, 3);
@@ -1192,7 +1192,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalHookModification($shareType) {
+ public function testValidateExpirationDateInternalHookModification($shareType): void {
$nextWeek = new \DateTime('now', $this->timezone);
$nextWeek->add(new \DateInterval('P7D'));
$nextWeek->setTime(0, 0, 0);
@@ -1218,7 +1218,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalHookException($shareType) {
+ public function testValidateExpirationDateInternalHookException($shareType): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid date!');
@@ -1243,7 +1243,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider validateExpirationDateInternalProvider
*/
- public function testValidateExpirationDateInternalExistingShareNoDefault($shareType) {
+ public function testValidateExpirationDateInternalExistingShareNoDefault($shareType): void {
$share = $this->manager->newShare();
$share->setShareType($shareType);
$share->setId('42')->setProviderId('foo');
@@ -1267,7 +1267,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals(null, $share->getExpirationDate());
}
- public function testValidateExpirationDateInPast() {
+ public function testValidateExpirationDateInPast(): void {
$this->expectException(\OCP\Share\Exceptions\GenericShareException::class);
$this->expectExceptionMessage('Expiration date is in the past');
@@ -1281,7 +1281,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]);
}
- public function testValidateExpirationDateEnforceButNotSet() {
+ public function testValidateExpirationDateEnforceButNotSet(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Expiration date is enforced');
@@ -1297,7 +1297,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]);
}
- public function testValidateExpirationDateEnforceButNotEnabledAndNotSet() {
+ public function testValidateExpirationDateEnforceButNotEnabledAndNotSet(): void {
$share = $this->manager->newShare();
$share->setProviderId('foo')->setId('bar');
@@ -1311,7 +1311,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($share->getExpirationDate());
}
- public function testValidateExpirationDateEnforceButNotSetNewShare() {
+ public function testValidateExpirationDateEnforceButNotSetNewShare(): void {
$share = $this->manager->newShare();
$this->config->method('getAppValue')
@@ -1332,7 +1332,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare() {
+ public function testValidateExpirationDateEnforceRelaxedDefaultButNotSetNewShare(): void {
$share = $this->manager->newShare();
$this->config->method('getAppValue')
@@ -1353,7 +1353,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationDateEnforceTooFarIntoFuture() {
+ public function testValidateExpirationDateEnforceTooFarIntoFuture(): void {
$this->expectException(\OCP\Share\Exceptions\GenericShareException::class);
$this->expectExceptionMessage('Cannot set expiration date more than 3 days in the future');
@@ -1373,7 +1373,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]);
}
- public function testValidateExpirationDateEnforceValid() {
+ public function testValidateExpirationDateEnforceValid(): void {
$future = new \DateTime('now', $this->timezone);
$future->add(new \DateInterval('P2D'));
$future->setTime(1, 2, 3);
@@ -1402,7 +1402,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationDateNoDefault() {
+ public function testValidateExpirationDateNoDefault(): void {
$date = new \DateTime('now', $this->timezone);
$date->add(new \DateInterval('P5D'));
$date->setTime(1, 2, 3);
@@ -1425,7 +1425,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationDateNoDateNoDefault() {
+ public function testValidateExpirationDateNoDateNoDefault(): void {
$hookListener = $this->getMockBuilder('Dummy')->setMethods(['listener'])->getMock();
\OCP\Util::connectHook('\OC\Share', 'verifyExpirationDate', $hookListener, 'listener');
$hookListener->expects($this->once())->method('listener')->with($this->callback(function ($data) {
@@ -1440,7 +1440,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($share->getExpirationDate());
}
- public function testValidateExpirationDateNoDateDefault() {
+ public function testValidateExpirationDateNoDateDefault(): void {
$share = $this->manager->newShare();
$expected = new \DateTime('now', $this->timezone);
@@ -1466,7 +1466,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationDateDefault() {
+ public function testValidateExpirationDateDefault(): void {
$future = new \DateTime('now', $this->timezone);
$future->add(new \DateInterval('P5D'));
$future->setTime(1, 2, 3);
@@ -1496,7 +1496,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationNegativeOffsetTimezone() {
+ public function testValidateExpirationNegativeOffsetTimezone(): void {
$this->timezone = new \DateTimeZone('Pacific/Tahiti');
$future = new \DateTime();
$future->add(new \DateInterval('P5D'));
@@ -1527,7 +1527,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, $share->getExpirationDate());
}
- public function testValidateExpirationDateHookModification() {
+ public function testValidateExpirationDateHookModification(): void {
$nextWeek = new \DateTime('now', $this->timezone);
$nextWeek->add(new \DateInterval('P7D'));
@@ -1550,7 +1550,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($save, $share->getExpirationDate());
}
- public function testValidateExpirationDateHookException() {
+ public function testValidateExpirationDateHookException(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Invalid date!');
@@ -1571,7 +1571,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'validateExpirationDateLink', [$share]);
}
- public function testValidateExpirationDateExistingShareNoDefault() {
+ public function testValidateExpirationDateExistingShareNoDefault(): void {
$share = $this->manager->newShare();
$share->setId('42')->setProviderId('foo');
@@ -1587,7 +1587,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals(null, $share->getExpirationDate());
}
- public function testUserCreateChecksShareWithGroupMembersOnlyDifferentGroups() {
+ public function testUserCreateChecksShareWithGroupMembersOnlyDifferentGroups(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Sharing is only allowed with group members');
@@ -1621,7 +1621,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'userCreateChecks', [$share]);
}
- public function testUserCreateChecksShareWithGroupMembersOnlySharedGroup() {
+ public function testUserCreateChecksShareWithGroupMembersOnlySharedGroup(): void {
$share = $this->manager->newShare();
$sharedBy = $this->createMock(IUser::class);
@@ -1662,7 +1662,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUserCreateChecksIdenticalShareExists() {
+ public function testUserCreateChecksIdenticalShareExists(): void {
$this->expectException(AlreadySharedException::class);
$this->expectExceptionMessage('Sharing name.txt failed, because this item is already shared with the account user');
@@ -1691,7 +1691,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUserCreateChecksIdenticalPathSharedViaGroup() {
+ public function testUserCreateChecksIdenticalPathSharedViaGroup(): void {
$this->expectException(AlreadySharedException::class);
$this->expectExceptionMessage('Sharing name2.txt failed, because this item is already shared with the account userName');
@@ -1736,7 +1736,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'userCreateChecks', [$share]);
}
- public function testUserCreateChecksIdenticalPathSharedViaDeletedGroup() {
+ public function testUserCreateChecksIdenticalPathSharedViaDeletedGroup(): void {
$share = $this->manager->newShare();
$sharedWith = $this->createMock(IUser::class);
@@ -1769,7 +1769,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($this->invokePrivate($this->manager, 'userCreateChecks', [$share]));
}
- public function testUserCreateChecksIdenticalPathNotSharedWithUser() {
+ public function testUserCreateChecksIdenticalPathNotSharedWithUser(): void {
$share = $this->manager->newShare();
$sharedWith = $this->createMock(IUser::class);
$path = $this->createMock(Node::class);
@@ -1806,7 +1806,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGroupCreateChecksShareWithGroupMembersGroupSharingNotAllowed() {
+ public function testGroupCreateChecksShareWithGroupMembersGroupSharingNotAllowed(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Group sharing is now allowed');
@@ -1822,7 +1822,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGroupCreateChecksShareWithGroupMembersOnlyNotInGroup() {
+ public function testGroupCreateChecksShareWithGroupMembersOnlyNotInGroup(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Sharing is only allowed within your own groups');
@@ -1849,7 +1849,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGroupCreateChecksShareWithGroupMembersOnlyNullGroup() {
+ public function testGroupCreateChecksShareWithGroupMembersOnlyNullGroup(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Sharing is only allowed within your own groups');
@@ -1872,7 +1872,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertNull($this->invokePrivate($this->manager, 'groupCreateChecks', [$share]));
}
- public function testGroupCreateChecksShareWithGroupMembersOnlyInGroup() {
+ public function testGroupCreateChecksShareWithGroupMembersOnlyInGroup(): void {
$share = $this->manager->newShare();
$user = $this->createMock(IUser::class);
@@ -1904,7 +1904,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGroupCreateChecksPathAlreadySharedWithSameGroup() {
+ public function testGroupCreateChecksPathAlreadySharedWithSameGroup(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Path is already shared with this group');
@@ -1934,7 +1934,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'groupCreateChecks', [$share]);
}
- public function testGroupCreateChecksPathAlreadySharedWithDifferentGroup() {
+ public function testGroupCreateChecksPathAlreadySharedWithDifferentGroup(): void {
$share = $this->manager->newShare();
$share->setSharedWith('sharedWith');
@@ -1960,7 +1960,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testLinkCreateChecksNoLinkSharesAllowed() {
+ public function testLinkCreateChecksNoLinkSharesAllowed(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Link sharing is not allowed');
@@ -1976,7 +1976,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testFileLinkCreateChecksNoPublicUpload() {
+ public function testFileLinkCreateChecksNoPublicUpload(): void {
$share = $this->manager->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
@@ -1993,7 +1993,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testFolderLinkCreateChecksNoPublicUpload() {
+ public function testFolderLinkCreateChecksNoPublicUpload(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Public upload is not allowed');
@@ -2012,7 +2012,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'linkCreateChecks', [$share]);
}
- public function testLinkCreateChecksPublicUpload() {
+ public function testLinkCreateChecksPublicUpload(): void {
$share = $this->manager->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_CREATE | \OCP\Constants::PERMISSION_UPDATE);
@@ -2031,7 +2031,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testLinkCreateChecksReadOnly() {
+ public function testLinkCreateChecksReadOnly(): void {
$share = $this->manager->newShare();
$share->setPermissions(\OCP\Constants::PERMISSION_READ);
@@ -2051,7 +2051,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testPathCreateChecksContainsSharedMount() {
+ public function testPathCreateChecksContainsSharedMount(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Path contains files shared with you');
@@ -2068,7 +2068,7 @@ class ManagerTest extends \Test\TestCase {
self::invokePrivate($this->manager, 'pathCreateChecks', [$path]);
}
- public function testPathCreateChecksContainsNoSharedMount() {
+ public function testPathCreateChecksContainsNoSharedMount(): void {
$path = $this->createMock(Folder::class);
$path->method('getPath')->willReturn('path');
@@ -2083,7 +2083,7 @@ class ManagerTest extends \Test\TestCase {
$this->addToAssertionCount(1);
}
- public function testPathCreateChecksContainsNoFolder() {
+ public function testPathCreateChecksContainsNoFolder(): void {
$path = $this->createMock(File::class);
self::invokePrivate($this->manager, 'pathCreateChecks', [$path]);
@@ -2136,7 +2136,7 @@ class ManagerTest extends \Test\TestCase {
* @param string[] $groupIds
* @param bool $expected
*/
- public function testIsSharingDisabledForUser($excludeGroups, $groupList, $setList, $groupIds, $expected) {
+ public function testIsSharingDisabledForUser($excludeGroups, $groupList, $setList, $groupIds, $expected): void {
$user = $this->createMock(IUser::class);
$this->config->method('getAppValue')
@@ -2186,7 +2186,7 @@ class ManagerTest extends \Test\TestCase {
* @param string $sharingEnabled
* @param bool $disabledForUser
*/
- public function testCanShare($expected, $sharingEnabled, $disabledForUser) {
+ public function testCanShare($expected, $sharingEnabled, $disabledForUser): void {
$this->config->method('getAppValue')
->willReturnMap([
['core', 'shareapi_enabled', 'yes', $sharingEnabled],
@@ -2213,7 +2213,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals($expected, !$exception);
}
- public function testCreateShareUser() {
+ public function testCreateShareUser(): void {
$manager = $this->createManagerMock()
->setMethods(['canShare', 'generalCreateChecks', 'userCreateChecks', 'pathCreateChecks'])
->getMock();
@@ -2268,7 +2268,7 @@ class ManagerTest extends \Test\TestCase {
$manager->createShare($share);
}
- public function testCreateShareGroup() {
+ public function testCreateShareGroup(): void {
$manager = $this->createManagerMock()
->setMethods(['canShare', 'generalCreateChecks', 'groupCreateChecks', 'pathCreateChecks'])
->getMock();
@@ -2323,7 +2323,7 @@ class ManagerTest extends \Test\TestCase {
$manager->createShare($share);
}
- public function testCreateShareLink() {
+ public function testCreateShareLink(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -2443,7 +2443,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertEquals('hashed', $share->getPassword());
}
- public function testCreateShareMail() {
+ public function testCreateShareMail(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -2547,7 +2547,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testCreateShareHookError() {
+ public function testCreateShareHookError(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('I won\'t let you share');
@@ -2615,7 +2615,7 @@ class ManagerTest extends \Test\TestCase {
$manager->createShare($share);
}
- public function testCreateShareOfIncomingFederatedShare() {
+ public function testCreateShareOfIncomingFederatedShare(): void {
$manager = $this->createManagerMock()
->setMethods(['canShare', 'generalCreateChecks', 'userCreateChecks', 'pathCreateChecks'])
->getMock();
@@ -2689,7 +2689,7 @@ class ManagerTest extends \Test\TestCase {
$manager->createShare($share);
}
- public function testGetSharesBy() {
+ public function testGetSharesBy(): void {
$share = $this->manager->newShare();
$node = $this->createMock(Folder::class);
@@ -2719,7 +2719,7 @@ class ManagerTest extends \Test\TestCase {
* have received share 1,2 and 7. And from the manager. Share 3-6 should be
* deleted (as they are evaluated). but share 8 should still be there.
*/
- public function testGetSharesByExpiredLinkShares() {
+ public function testGetSharesByExpiredLinkShares(): void {
$manager = $this->createManagerMock()
->setMethods(['deleteShare'])
->getMock();
@@ -2792,7 +2792,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($today, $shares[3]->getExpirationDate());
}
- public function testGetShareByToken() {
+ public function testGetShareByToken(): void {
$this->config
->expects($this->exactly(2))
->method('getAppValue')
@@ -2821,7 +2821,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($share, $ret);
}
- public function testGetShareByTokenRoom() {
+ public function testGetShareByTokenRoom(): void {
$this->config
->expects($this->exactly(2))
->method('getAppValue')
@@ -2857,7 +2857,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($share, $ret);
}
- public function testGetShareByTokenWithException() {
+ public function testGetShareByTokenWithException(): void {
$this->config
->expects($this->exactly(2))
->method('getAppValue')
@@ -2893,7 +2893,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGetShareByTokenHideDisabledUser() {
+ public function testGetShareByTokenHideDisabledUser(): void {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$this->expectExceptionMessage('The requested share comes from a disabled user');
@@ -2948,7 +2948,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGetShareByTokenExpired() {
+ public function testGetShareByTokenExpired(): void {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$this->expectExceptionMessage('The requested share does not exist anymore');
@@ -2983,7 +2983,7 @@ class ManagerTest extends \Test\TestCase {
$manager->getShareByToken('expiredToken');
}
- public function testGetShareByTokenNotExpired() {
+ public function testGetShareByTokenNotExpired(): void {
$this->config
->expects($this->exactly(2))
->method('getAppValue')
@@ -3009,7 +3009,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testGetShareByTokenWithPublicLinksDisabled() {
+ public function testGetShareByTokenWithPublicLinksDisabled(): void {
$this->expectException(\OCP\Share\Exceptions\ShareNotFound::class);
$this->config
@@ -3020,7 +3020,7 @@ class ManagerTest extends \Test\TestCase {
$this->manager->getShareByToken('validToken');
}
- public function testGetShareByTokenPublicUploadDisabled() {
+ public function testGetShareByTokenPublicUploadDisabled(): void {
$this->config
->expects($this->exactly(3))
->method('getAppValue')
@@ -3047,13 +3047,13 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame(\OCP\Constants::PERMISSION_READ, $res->getPermissions());
}
- public function testCheckPasswordNoLinkShare() {
+ public function testCheckPasswordNoLinkShare(): void {
$share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(IShare::TYPE_USER);
$this->assertFalse($this->manager->checkPassword($share, 'password'));
}
- public function testCheckPasswordNoPassword() {
+ public function testCheckPasswordNoPassword(): void {
$share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(IShare::TYPE_LINK);
$this->assertFalse($this->manager->checkPassword($share, 'password'));
@@ -3062,7 +3062,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertFalse($this->manager->checkPassword($share, null));
}
- public function testCheckPasswordInvalidPassword() {
+ public function testCheckPasswordInvalidPassword(): void {
$share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(IShare::TYPE_LINK);
$share->method('getPassword')->willReturn('password');
@@ -3072,7 +3072,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertFalse($this->manager->checkPassword($share, 'invalidpassword'));
}
- public function testCheckPasswordValidPassword() {
+ public function testCheckPasswordValidPassword(): void {
$share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(IShare::TYPE_LINK);
$share->method('getPassword')->willReturn('passwordHash');
@@ -3082,7 +3082,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertTrue($this->manager->checkPassword($share, 'password'));
}
- public function testCheckPasswordUpdateShare() {
+ public function testCheckPasswordUpdateShare(): void {
$share = $this->manager->newShare();
$share->setShareType(IShare::TYPE_LINK)
->setPassword('passwordHash');
@@ -3104,7 +3104,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUpdateShareCantChangeShareType() {
+ public function testUpdateShareCantChangeShareType(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Cannot change share type');
@@ -3132,7 +3132,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUpdateShareCantChangeRecipientForGroupShare() {
+ public function testUpdateShareCantChangeRecipientForGroupShare(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Can only update recipient on user shares');
@@ -3160,7 +3160,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUpdateShareCantShareWithOwner() {
+ public function testUpdateShareCantShareWithOwner(): void {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Cannot share with the share owner');
@@ -3188,7 +3188,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareUser() {
+ public function testUpdateShareUser(): void {
$this->userManager->expects($this->any())->method('userExists')->willReturn(true);
$manager = $this->createManagerMock()
@@ -3254,7 +3254,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareGroup() {
+ public function testUpdateShareGroup(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -3300,7 +3300,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareLink() {
+ public function testUpdateShareLink(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -3378,7 +3378,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareLinkEnableSendPasswordByTalkWithNoPassword() {
+ public function testUpdateShareLinkEnableSendPasswordByTalkWithNoPassword(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot enable sending the password by Talk with an empty password');
@@ -3447,7 +3447,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareMail() {
+ public function testUpdateShareMail(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -3527,7 +3527,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareMailEnableSendPasswordByTalk() {
+ public function testUpdateShareMailEnableSendPasswordByTalk(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -3610,7 +3610,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareMailEnableSendPasswordByTalkWithDifferentPassword() {
+ public function testUpdateShareMailEnableSendPasswordByTalkWithDifferentPassword(): void {
$manager = $this->createManagerMock()
->setMethods([
'canShare',
@@ -3698,7 +3698,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareMailEnableSendPasswordByTalkWithNoPassword() {
+ public function testUpdateShareMailEnableSendPasswordByTalkWithNoPassword(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot enable sending the password by Talk with an empty password');
@@ -3771,7 +3771,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUpdateShareMailEnableSendPasswordByTalkRemovingPassword() {
+ public function testUpdateShareMailEnableSendPasswordByTalkRemovingPassword(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot enable sending the password by Talk with an empty password');
@@ -3844,7 +3844,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUpdateShareMailEnableSendPasswordByTalkRemovingPasswordWithEmptyString() {
+ public function testUpdateShareMailEnableSendPasswordByTalkRemovingPasswordWithEmptyString(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot enable sending the password by Talk with an empty password');
@@ -3917,7 +3917,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testUpdateShareMailEnableSendPasswordByTalkWithPreviousPassword() {
+ public function testUpdateShareMailEnableSendPasswordByTalkWithPreviousPassword(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot enable sending the password by Talk without setting a new password');
@@ -3991,7 +3991,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareMailDisableSendPasswordByTalkWithPreviousPassword() {
+ public function testUpdateShareMailDisableSendPasswordByTalkWithPreviousPassword(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot disable sending the password by Talk without setting a new password');
@@ -4065,7 +4065,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testUpdateShareMailDisableSendPasswordByTalkWithoutChangingPassword() {
+ public function testUpdateShareMailDisableSendPasswordByTalkWithoutChangingPassword(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot disable sending the password by Talk without setting a new password');
@@ -4139,7 +4139,7 @@ class ManagerTest extends \Test\TestCase {
$manager->updateShare($share);
}
- public function testMoveShareLink() {
+ public function testMoveShareLink(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot change target of link share');
@@ -4152,7 +4152,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testMoveShareUserNotRecipient() {
+ public function testMoveShareUserNotRecipient(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid recipient');
@@ -4164,7 +4164,7 @@ class ManagerTest extends \Test\TestCase {
$this->manager->moveShare($share, 'recipient');
}
- public function testMoveShareUser() {
+ public function testMoveShareUser(): void {
$share = $this->manager->newShare();
$share->setShareType(IShare::TYPE_USER)
->setId('42')
@@ -4179,7 +4179,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testMoveShareGroupNotRecipient() {
+ public function testMoveShareGroupNotRecipient(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid recipient');
@@ -4199,7 +4199,7 @@ class ManagerTest extends \Test\TestCase {
}
- public function testMoveShareGroupNull() {
+ public function testMoveShareGroupNull(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Group "shareWith" does not exist');
@@ -4215,7 +4215,7 @@ class ManagerTest extends \Test\TestCase {
$this->manager->moveShare($share, 'recipient');
}
- public function testMoveShareGroup() {
+ public function testMoveShareGroup(): void {
$share = $this->manager->newShare();
$share->setShareType(IShare::TYPE_GROUP)
->setId('42')
@@ -4239,7 +4239,7 @@ class ManagerTest extends \Test\TestCase {
/**
* @dataProvider dataTestShareProviderExists
*/
- public function testShareProviderExists($shareType, $expected) {
+ public function testShareProviderExists($shareType, $expected): void {
$factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock();
$factory->expects($this->any())->method('getProviderForType')
->willReturnCallback(function ($id) {
@@ -4262,7 +4262,7 @@ class ManagerTest extends \Test\TestCase {
];
}
- public function testGetSharesInFolder() {
+ public function testGetSharesInFolder(): void {
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
$manager = $this->createManager($factory);
@@ -4309,7 +4309,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($expects, $result);
}
- public function testGetAccessList() {
+ public function testGetAccessList(): void {
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
$manager = $this->createManager($factory);
@@ -4408,7 +4408,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($expected['users'], $result['users']);
}
- public function testGetAccessListWithCurrentAccess() {
+ public function testGetAccessListWithCurrentAccess(): void {
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
$manager = $this->createManager($factory);
@@ -4516,7 +4516,7 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($expected['users'], $result['users']);
}
- public function testGetAllShares() {
+ public function testGetAllShares(): void {
$factory = new DummyFactory2($this->createMock(IServerContainer::class));
$manager = $this->createManager($factory);
@@ -4586,7 +4586,7 @@ class ManagerTest extends \Test\TestCase {
'limitEnumerationToPhone',
'limitEnumerationToGroups',
])
- ->getMock();
+ ->getMock();
$manager->method('allowEnumerationFullMatch')
->willReturn($allowEnumerationFullMatch);
diff --git a/tests/lib/Share20/ShareByMailProviderTest.php b/tests/lib/Share20/ShareByMailProviderTest.php
index c3fe0dab790..01029e421e0 100644
--- a/tests/lib/Share20/ShareByMailProviderTest.php
+++ b/tests/lib/Share20/ShareByMailProviderTest.php
@@ -125,7 +125,7 @@ class ShareByMailProviderTest extends TestCase {
protected function tearDown(): void {
$this->dbConn->getQueryBuilder()->delete('share')->execute();
- $this->dbConn->getQueryBuilder()->delete('filecache')->execute();
+ $this->dbConn->getQueryBuilder()->delete('filecache')->runAcrossAllShards()->execute();
$this->dbConn->getQueryBuilder()->delete('storages')->execute();
}
@@ -189,7 +189,7 @@ class ShareByMailProviderTest extends TestCase {
return $qb->getLastInsertId();
}
- public function testGetSharesByWithResharesAndNoNode() {
+ public function testGetSharesByWithResharesAndNoNode(): void {
$this->addShareToDB(
IShare::TYPE_EMAIL,
'external.one@domain.tld',
@@ -236,7 +236,7 @@ class ShareByMailProviderTest extends TestCase {
$this->assertEquals('external.one@domain.tld', $actual[0]->getSharedWith());
}
- public function testGetSharesByWithResharesAndNode() {
+ public function testGetSharesByWithResharesAndNode(): void {
$this->addShareToDB(
IShare::TYPE_EMAIL,
'external.one@domain.tld',
diff --git a/tests/lib/Share20/ShareHelperTest.php b/tests/lib/Share20/ShareHelperTest.php
index 04a079db0e9..8aaa8350ea9 100644
--- a/tests/lib/Share20/ShareHelperTest.php
+++ b/tests/lib/Share20/ShareHelperTest.php
@@ -51,7 +51,7 @@ class ShareHelperTest extends TestCase {
/**
* @dataProvider dataGetPathsForAccessList
*/
- public function testGetPathsForAccessList(array $userList, array $userMap, $resolveUsers, array $remoteList, array $remoteMap, $resolveRemotes, array $expected) {
+ public function testGetPathsForAccessList(array $userList, array $userMap, $resolveUsers, array $remoteList, array $remoteMap, $resolveRemotes, array $expected): void {
$this->manager->expects($this->once())
->method('getAccessList')
->willReturn([
@@ -107,7 +107,7 @@ class ShareHelperTest extends TestCase {
* @param array $nodes
* @param array $expected
*/
- public function testGetPathsForUsers(array $users, array $nodes, array $expected) {
+ public function testGetPathsForUsers(array $users, array $nodes, array $expected): void {
$lastNode = null;
foreach ($nodes as $nodeId => $nodeName) {
/** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
@@ -164,7 +164,7 @@ class ShareHelperTest extends TestCase {
* @param array $nodes
* @param array $expected
*/
- public function testGetPathsForRemotes(array $remotes, array $nodes, array $expected) {
+ public function testGetPathsForRemotes(array $remotes, array $nodes, array $expected): void {
$lastNode = null;
foreach ($nodes as $nodeId => $nodePath) {
/** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
@@ -202,7 +202,7 @@ class ShareHelperTest extends TestCase {
* @param string $path
* @param string $expected
*/
- public function testGetMountedPath($path, $expected) {
+ public function testGetMountedPath($path, $expected): void {
/** @var Node|\PHPUnit\Framework\MockObject\MockObject $node */
$node = $this->createMock(Node::class);
$node->expects($this->once())
diff --git a/tests/lib/Share20/ShareTest.php b/tests/lib/Share20/ShareTest.php
index 6769683aafe..72f3b46190c 100644
--- a/tests/lib/Share20/ShareTest.php
+++ b/tests/lib/Share20/ShareTest.php
@@ -31,26 +31,26 @@ class ShareTest extends \Test\TestCase {
}
- public function testSetIdInvalid() {
+ public function testSetIdInvalid(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('String expected.');
$this->share->setId(1.2);
}
- public function testSetIdInt() {
+ public function testSetIdInt(): void {
$this->share->setId(42);
$this->assertEquals('42', $this->share->getId());
}
- public function testSetIdString() {
+ public function testSetIdString(): void {
$this->share->setId('foo');
$this->assertEquals('foo', $this->share->getId());
}
- public function testSetIdOnce() {
+ public function testSetIdOnce(): void {
$this->expectException(\OCP\Share\Exceptions\IllegalIDChangeException::class);
$this->expectExceptionMessage('Not allowed to assign a new internal id to a share');
@@ -59,7 +59,7 @@ class ShareTest extends \Test\TestCase {
}
- public function testSetProviderIdInt() {
+ public function testSetProviderIdInt(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('String expected.');
@@ -67,14 +67,14 @@ class ShareTest extends \Test\TestCase {
}
- public function testSetProviderIdString() {
+ public function testSetProviderIdString(): void {
$this->share->setProviderId('foo');
$this->share->setId('bar');
$this->assertEquals('foo:bar', $this->share->getFullId());
}
- public function testSetProviderIdOnce() {
+ public function testSetProviderIdOnce(): void {
$this->expectException(\OCP\Share\Exceptions\IllegalIDChangeException::class);
$this->expectExceptionMessage('Not allowed to assign a new provider id to a share');
diff --git a/tests/lib/SubAdminTest.php b/tests/lib/SubAdminTest.php
index a4138fa922b..2827fe84d78 100644
--- a/tests/lib/SubAdminTest.php
+++ b/tests/lib/SubAdminTest.php
@@ -94,7 +94,7 @@ class SubAdminTest extends \Test\TestCase {
->execute();
}
- public function testCreateSubAdmin() {
+ public function testCreateSubAdmin(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
@@ -119,7 +119,7 @@ class SubAdminTest extends \Test\TestCase {
->execute();
}
- public function testDeleteSubAdmin() {
+ public function testDeleteSubAdmin(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
$subAdmin->deleteSubAdmin($this->users[0], $this->groups[0]);
@@ -135,7 +135,7 @@ class SubAdminTest extends \Test\TestCase {
$this->assertEmpty($result);
}
- public function testGetSubAdminsGroups() {
+ public function testGetSubAdminsGroups(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
$subAdmin->createSubAdmin($this->users[0], $this->groups[1]);
@@ -151,7 +151,7 @@ class SubAdminTest extends \Test\TestCase {
$subAdmin->deleteSubAdmin($this->users[0], $this->groups[1]);
}
- public function testGetGroupsSubAdmins() {
+ public function testGetGroupsSubAdmins(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
$subAdmin->createSubAdmin($this->users[1], $this->groups[0]);
@@ -167,7 +167,7 @@ class SubAdminTest extends \Test\TestCase {
$subAdmin->deleteSubAdmin($this->users[1], $this->groups[0]);
}
- public function testGetAllSubAdmin() {
+ public function testGetAllSubAdmin(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
@@ -182,7 +182,7 @@ class SubAdminTest extends \Test\TestCase {
$this->assertNotContains(['user' => null, 'group' => null], $result);
}
- public function testIsSubAdminofGroup() {
+ public function testIsSubAdminofGroup(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
@@ -193,7 +193,7 @@ class SubAdminTest extends \Test\TestCase {
$subAdmin->deleteSubAdmin($this->users[0], $this->groups[0]);
}
- public function testIsSubAdmin() {
+ public function testIsSubAdmin(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
@@ -203,14 +203,14 @@ class SubAdminTest extends \Test\TestCase {
$subAdmin->deleteSubAdmin($this->users[0], $this->groups[0]);
}
- public function testIsSubAdminAsAdmin() {
+ public function testIsSubAdminAsAdmin(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$this->groupManager->get('admin')->addUser($this->users[0]);
$this->assertTrue($subAdmin->isSubAdmin($this->users[0]));
}
- public function testIsUserAccessible() {
+ public function testIsUserAccessible(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$this->groups[0]->addUser($this->users[1]);
$this->groups[1]->addUser($this->users[1]);
@@ -226,12 +226,12 @@ class SubAdminTest extends \Test\TestCase {
$subAdmin->deleteSubAdmin($this->users[2], $this->groups[2]);
}
- public function testIsUserAccessibleAsUser() {
+ public function testIsUserAccessibleAsUser(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$this->assertFalse($subAdmin->isUserAccessible($this->users[0], $this->users[1]));
}
- public function testIsUserAccessibleAdmin() {
+ public function testIsUserAccessibleAdmin(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$subAdmin->createSubAdmin($this->users[0], $this->groups[0]);
$this->groupManager->get('admin')->addUser($this->users[1]);
@@ -239,7 +239,7 @@ class SubAdminTest extends \Test\TestCase {
$this->assertFalse($subAdmin->isUserAccessible($this->users[0], $this->users[1]));
}
- public function testPostDeleteUser() {
+ public function testPostDeleteUser(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$user = array_shift($this->users);
@@ -251,7 +251,7 @@ class SubAdminTest extends \Test\TestCase {
$this->assertEmpty($subAdmin->getAllSubAdmins());
}
- public function testPostDeleteGroup() {
+ public function testPostDeleteGroup(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$group = array_shift($this->groups);
@@ -263,7 +263,7 @@ class SubAdminTest extends \Test\TestCase {
$this->assertEmpty($subAdmin->getAllSubAdmins());
}
- public function testHooks() {
+ public function testHooks(): void {
$subAdmin = new \OC\SubAdmin($this->userManager, $this->groupManager, $this->dbConn, $this->eventDispatcher);
$test = $this;
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php
index de7f7600496..869c1498c41 100644
--- a/tests/lib/Support/Subscription/RegistryTest.php
+++ b/tests/lib/Support/Subscription/RegistryTest.php
@@ -66,13 +66,13 @@ class RegistryTest extends TestCase {
/**
* Doesn't assert anything, just checks whether anything "explodes"
*/
- public function testDelegateToNone() {
+ public function testDelegateToNone(): void {
$this->registry->delegateHasValidSubscription();
$this->addToAssertionCount(1);
}
- public function testDoubleRegistration() {
+ public function testDoubleRegistration(): void {
$this->expectException(\OCP\Support\Subscription\Exception\AlreadyRegisteredException::class);
/* @var ISubscription $subscription1 */
@@ -83,12 +83,12 @@ class RegistryTest extends TestCase {
$this->registry->register($subscription2);
}
- public function testNoSupportApp() {
+ public function testNoSupportApp(): void {
$this->assertSame([], $this->registry->delegateGetSupportedApps());
$this->assertSame(false, $this->registry->delegateHasValidSubscription());
}
- public function testDelegateHasValidSubscription() {
+ public function testDelegateHasValidSubscription(): void {
/* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISubscription::class);
$subscription->expects($this->once())
@@ -99,7 +99,7 @@ class RegistryTest extends TestCase {
$this->assertSame(true, $this->registry->delegateHasValidSubscription());
}
- public function testDelegateHasValidSubscriptionConfig() {
+ public function testDelegateHasValidSubscriptionConfig(): void {
/* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$this->config->expects($this->once())
->method('getSystemValueBool')
@@ -109,7 +109,7 @@ class RegistryTest extends TestCase {
$this->assertSame(true, $this->registry->delegateHasValidSubscription());
}
- public function testDelegateHasExtendedSupport() {
+ public function testDelegateHasExtendedSupport(): void {
/* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISubscription::class);
$subscription->expects($this->once())
@@ -121,7 +121,7 @@ class RegistryTest extends TestCase {
}
- public function testDelegateGetSupportedApps() {
+ public function testDelegateGetSupportedApps(): void {
/* @var ISupportedApps|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISupportedApps::class);
$subscription->expects($this->once())
@@ -132,7 +132,7 @@ class RegistryTest extends TestCase {
$this->assertSame(['abc'], $this->registry->delegateGetSupportedApps());
}
- public function testSubscriptionService() {
+ public function testSubscriptionService(): void {
$this->serverContainer->method('query')
->with(DummySubscription::class)
->willReturn(new DummySubscription(true, false, false));
@@ -142,7 +142,7 @@ class RegistryTest extends TestCase {
$this->assertFalse($this->registry->delegateHasExtendedSupport());
}
- public function testDelegateIsHardUserLimitReached() {
+ public function testDelegateIsHardUserLimitReached(): void {
/* @var ISubscription|\PHPUnit\Framework\MockObject\MockObject $subscription */
$subscription = $this->createMock(ISubscription::class);
$subscription->expects($this->once())
@@ -163,7 +163,7 @@ class RegistryTest extends TestCase {
$this->assertSame(true, $this->registry->delegateIsHardUserLimitReached($this->notificationManager));
}
- public function testDelegateIsHardUserLimitReachedWithoutSupportApp() {
+ public function testDelegateIsHardUserLimitReachedWithoutSupportApp(): void {
$this->config->expects($this->once())
->method('getSystemValueBool')
->with('one-click-instance')
@@ -185,7 +185,7 @@ class RegistryTest extends TestCase {
/**
* @dataProvider dataForUserLimitCheck
*/
- public function testDelegateIsHardUserLimitReachedWithoutSupportAppAndUserCount($userLimit, $userCount, $disabledUsers, $expectedResult) {
+ public function testDelegateIsHardUserLimitReachedWithoutSupportAppAndUserCount($userLimit, $userCount, $disabledUsers, $expectedResult): void {
$this->config->expects($this->once())
->method('getSystemValueBool')
->with('one-click-instance')
diff --git a/tests/lib/SystemTag/SystemTagManagerTest.php b/tests/lib/SystemTag/SystemTagManagerTest.php
index 5029eaa7df6..7b93d900bee 100644
--- a/tests/lib/SystemTag/SystemTagManagerTest.php
+++ b/tests/lib/SystemTag/SystemTagManagerTest.php
@@ -102,7 +102,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider getAllTagsDataProvider
*/
- public function testGetAllTags($testTags) {
+ public function testGetAllTags($testTags): void {
$testTagsById = [];
foreach ($testTags as $testTag) {
$tag = $this->tagManager->createTag($testTag[0], $testTag[1], $testTag[2]);
@@ -211,7 +211,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider getAllTagsFilteredDataProvider
*/
- public function testGetAllTagsFiltered($testTags, $visibilityFilter, $nameSearch, $expectedResults) {
+ public function testGetAllTagsFiltered($testTags, $visibilityFilter, $nameSearch, $expectedResults): void {
foreach ($testTags as $testTag) {
$this->tagManager->createTag($testTag[0], $testTag[1], $testTag[2]);
}
@@ -244,7 +244,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider oneTagMultipleFlagsProvider
*/
- public function testCreateDuplicate($name, $userVisible, $userAssignable) {
+ public function testCreateDuplicate($name, $userVisible, $userAssignable): void {
$this->expectException(\OCP\SystemTag\TagAlreadyExistsException::class);
try {
@@ -255,7 +255,7 @@ class SystemTagManagerTest extends TestCase {
$this->tagManager->createTag($name, $userVisible, $userAssignable);
}
- public function testCreateOverlongName() {
+ public function testCreateOverlongName(): void {
$tag = $this->tagManager->createTag('Zona circundante do Palácio Nacional da Ajuda (Jardim das Damas, Salão de Física, Torre Sineira, Paço Velho e Jardim Botânico)', true, true);
$this->assertSame('Zona circundante do Palácio Nacional da Ajuda (Jardim das Damas', $tag->getName()); // 63 characters but 64 bytes due to "á"
}
@@ -263,14 +263,14 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider oneTagMultipleFlagsProvider
*/
- public function testGetExistingTag($name, $userVisible, $userAssignable) {
+ public function testGetExistingTag($name, $userVisible, $userAssignable): void {
$tag1 = $this->tagManager->createTag($name, $userVisible, $userAssignable);
$tag2 = $this->tagManager->getTag($name, $userVisible, $userAssignable);
$this->assertSameTag($tag1, $tag2);
}
- public function testGetExistingTagById() {
+ public function testGetExistingTagById(): void {
$tag1 = $this->tagManager->createTag('one', true, false);
$tag2 = $this->tagManager->createTag('two', false, true);
@@ -283,14 +283,14 @@ class SystemTagManagerTest extends TestCase {
}
- public function testGetNonExistingTag() {
+ public function testGetNonExistingTag(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->tagManager->getTag('nonexist', false, false);
}
- public function testGetNonExistingTagsById() {
+ public function testGetNonExistingTagsById(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$tag1 = $this->tagManager->createTag('one', true, false);
@@ -298,7 +298,7 @@ class SystemTagManagerTest extends TestCase {
}
- public function testGetInvalidTagIdFormat() {
+ public function testGetInvalidTagIdFormat(): void {
$this->expectException(\InvalidArgumentException::class);
$tag1 = $this->tagManager->createTag('one', true, false);
@@ -333,7 +333,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider updateTagProvider
*/
- public function testUpdateTag($tagCreate, $tagUpdated) {
+ public function testUpdateTag($tagCreate, $tagUpdated): void {
$tag1 = $this->tagManager->createTag(
$tagCreate[0],
$tagCreate[1],
@@ -360,7 +360,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider updateTagProvider
*/
- public function testUpdateTagDuplicate($tagCreate, $tagUpdated) {
+ public function testUpdateTagDuplicate($tagCreate, $tagUpdated): void {
$this->expectException(\OCP\SystemTag\TagAlreadyExistsException::class);
$this->tagManager->createTag(
@@ -383,7 +383,7 @@ class SystemTagManagerTest extends TestCase {
);
}
- public function testDeleteTags() {
+ public function testDeleteTags(): void {
$tag1 = $this->tagManager->createTag('one', true, false);
$tag2 = $this->tagManager->createTag('two', false, true);
@@ -393,13 +393,13 @@ class SystemTagManagerTest extends TestCase {
}
- public function testDeleteNonExistingTag() {
+ public function testDeleteNonExistingTag(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->tagManager->deleteTags([100]);
}
- public function testDeleteTagRemovesRelations() {
+ public function testDeleteTagRemovesRelations(): void {
$tag1 = $this->tagManager->createTag('one', true, false);
$tag2 = $this->tagManager->createTag('two', true, true);
@@ -434,7 +434,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider visibilityCheckProvider
*/
- public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult) {
+ public function testVisibilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
@@ -481,7 +481,7 @@ class SystemTagManagerTest extends TestCase {
/**
* @dataProvider assignabilityCheckProvider
*/
- public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult, $userGroupIds = [], $tagGroupIds = []) {
+ public function testAssignabilityCheck($userVisible, $userAssignable, $isAdmin, $expectedResult, $userGroupIds = [], $tagGroupIds = []): void {
$user = $this->getMockBuilder(IUser::class)->getMock();
$user->expects($this->any())
->method('getUID')
@@ -501,7 +501,7 @@ class SystemTagManagerTest extends TestCase {
$this->assertEquals($expectedResult, $this->tagManager->canUserAssignTag($tag1, $user));
}
- public function testTagGroups() {
+ public function testTagGroups(): void {
$tag1 = $this->tagManager->createTag('tag1', true, false);
$tag2 = $this->tagManager->createTag('tag2', true, false);
$this->tagManager->setTagGroups($tag1, ['group1', 'group2']);
@@ -521,7 +521,7 @@ class SystemTagManagerTest extends TestCase {
/**
* empty groupIds should be ignored
*/
- public function testEmptyTagGroup() {
+ public function testEmptyTagGroup(): void {
$tag1 = $this->tagManager->createTag('tag1', true, false);
$this->tagManager->setTagGroups($tag1, ['']);
$this->assertEquals([], $this->tagManager->getTagGroups($tag1));
diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
index c9aff9f5183..3569c98b5bc 100644
--- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php
+++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php
@@ -113,7 +113,7 @@ class SystemTagObjectMapperTest extends TestCase {
$query->delete(SystemTagManager::TAG_TABLE)->execute();
}
- public function testGetTagIdsForObjects() {
+ public function testGetTagIdsForObjects(): void {
$tagIdMapping = $this->tagMapper->getTagIdsForObjects(
['1', '2', '3', '4'],
'testtype'
@@ -127,7 +127,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $tagIdMapping);
}
- public function testGetTagIdsForNoObjects() {
+ public function testGetTagIdsForNoObjects(): void {
$tagIdMapping = $this->tagMapper->getTagIdsForObjects(
[],
'testtype'
@@ -136,7 +136,7 @@ class SystemTagObjectMapperTest extends TestCase {
$this->assertEquals([], $tagIdMapping);
}
- public function testGetTagIdsForALotOfObjects() {
+ public function testGetTagIdsForALotOfObjects(): void {
$ids = range(1, 10500);
$tagIdMapping = $this->tagMapper->getTagIdsForObjects(
$ids,
@@ -147,11 +147,12 @@ class SystemTagObjectMapperTest extends TestCase {
$this->assertEquals([$this->tag1->getId(), $this->tag2->getId()], $tagIdMapping[1]);
}
- public function testGetObjectsForTags() {
+ public function testGetObjectsForTags(): void {
$objectIds = $this->tagMapper->getObjectIdsForTags(
[$this->tag1->getId(), $this->tag2->getId(), $this->tag3->getId()],
'testtype'
);
+ sort($objectIds);
$this->assertEquals([
'1',
@@ -159,7 +160,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $objectIds);
}
- public function testGetObjectsForTagsLimit() {
+ public function testGetObjectsForTagsLimit(): void {
$objectIds = $this->tagMapper->getObjectIdsForTags(
[$this->tag1->getId()],
'testtype',
@@ -172,7 +173,7 @@ class SystemTagObjectMapperTest extends TestCase {
}
- public function testGetObjectsForTagsLimitWithMultipleTags() {
+ public function testGetObjectsForTagsLimitWithMultipleTags(): void {
$this->expectException(\InvalidArgumentException::class);
$this->tagMapper->getObjectIdsForTags(
@@ -182,7 +183,7 @@ class SystemTagObjectMapperTest extends TestCase {
);
}
- public function testGetObjectsForTagsLimitOffset() {
+ public function testGetObjectsForTagsLimitOffset(): void {
$objectIds = $this->tagMapper->getObjectIdsForTags(
[$this->tag1->getId()],
'testtype',
@@ -196,7 +197,7 @@ class SystemTagObjectMapperTest extends TestCase {
}
- public function testGetObjectsForNonExistingTag() {
+ public function testGetObjectsForNonExistingTag(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->tagMapper->getObjectIdsForTags(
@@ -205,7 +206,7 @@ class SystemTagObjectMapperTest extends TestCase {
);
}
- public function testAssignUnassignTags() {
+ public function testAssignUnassignTags(): void {
$this->tagMapper->unassignTags('1', 'testtype', [$this->tag1->getId()]);
$tagIdMapping = $this->tagMapper->getTagIdsForObjects('1', 'testtype');
@@ -223,7 +224,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $tagIdMapping);
}
- public function testReAssignUnassignTags() {
+ public function testReAssignUnassignTags(): void {
// reassign tag1
$this->tagMapper->assignTags('1', 'testtype', [$this->tag1->getId()]);
@@ -234,13 +235,13 @@ class SystemTagObjectMapperTest extends TestCase {
}
- public function testAssignNonExistingTags() {
+ public function testAssignNonExistingTags(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->tagMapper->assignTags('1', 'testtype', [100]);
}
- public function testAssignNonExistingTagInArray() {
+ public function testAssignNonExistingTagInArray(): void {
$caught = false;
try {
$this->tagMapper->assignTags('1', 'testtype', [100, $this->tag3->getId()]);
@@ -261,13 +262,13 @@ class SystemTagObjectMapperTest extends TestCase {
}
- public function testUnassignNonExistingTags() {
+ public function testUnassignNonExistingTags(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->tagMapper->unassignTags('1', 'testtype', [100]);
}
- public function testUnassignNonExistingTagsInArray() {
+ public function testUnassignNonExistingTagsInArray(): void {
$caught = false;
try {
$this->tagMapper->unassignTags('1', 'testtype', [100, $this->tag1->getId()]);
@@ -287,7 +288,7 @@ class SystemTagObjectMapperTest extends TestCase {
], $tagIdMapping, 'None of the tags got unassigned');
}
- public function testHaveTagAllMatches() {
+ public function testHaveTagAllMatches(): void {
$this->assertTrue(
$this->tagMapper->haveTag(
['1'],
@@ -339,7 +340,7 @@ class SystemTagObjectMapperTest extends TestCase {
);
}
- public function testHaveTagAtLeastOneMatch() {
+ public function testHaveTagAtLeastOneMatch(): void {
$this->assertTrue(
$this->tagMapper->haveTag(
['1'],
@@ -392,7 +393,7 @@ class SystemTagObjectMapperTest extends TestCase {
}
- public function testHaveTagNonExisting() {
+ public function testHaveTagNonExisting(): void {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->tagMapper->haveTag(
diff --git a/tests/lib/TagsTest.php b/tests/lib/TagsTest.php
index a3e0c8f750f..18768970954 100644
--- a/tests/lib/TagsTest.php
+++ b/tests/lib/TagsTest.php
@@ -59,7 +59,7 @@ class TagsTest extends \Test\TestCase {
parent::tearDown();
}
- public function testTagManagerWithoutUserReturnsNull() {
+ public function testTagManagerWithoutUserReturnsNull(): void {
$this->userSession = $this->createMock(IUserSession::class);
$this->userSession
->expects($this->any())
@@ -69,7 +69,7 @@ class TagsTest extends \Test\TestCase {
$this->assertNull($this->tagMgr->load($this->objectType));
}
- public function testInstantiateWithDefaults() {
+ public function testInstantiateWithDefaults(): void {
$defaultTags = ['Friends', 'Family', 'Work', 'Other'];
$tagger = $this->tagMgr->load($this->objectType, $defaultTags);
@@ -77,7 +77,7 @@ class TagsTest extends \Test\TestCase {
$this->assertEquals(4, count($tagger->getTags()));
}
- public function testAddTags() {
+ public function testAddTags(): void {
$tags = ['Friends', 'Family', 'Work', 'Other'];
$tagger = $this->tagMgr->load($this->objectType);
@@ -94,7 +94,7 @@ class TagsTest extends \Test\TestCase {
$this->assertCount(4, $tagger->getTags(), 'Wrong number of added tags');
}
- public function testAddMultiple() {
+ public function testAddMultiple(): void {
$tags = ['Friends', 'Family', 'Work', 'Other'];
$tagger = $this->tagMgr->load($this->objectType);
@@ -142,7 +142,7 @@ class TagsTest extends \Test\TestCase {
$this->assertCount(4, $tagger->getTags(), 'Not all previously saved tags found');
}
- public function testIsEmpty() {
+ public function testIsEmpty(): void {
$tagger = $this->tagMgr->load($this->objectType);
$this->assertEquals(0, count($tagger->getTags()));
@@ -154,7 +154,7 @@ class TagsTest extends \Test\TestCase {
$this->assertFalse($tagger->isEmpty());
}
- public function testGetTagsForObjects() {
+ public function testGetTagsForObjects(): void {
$defaultTags = ['Friends', 'Family', 'Work', 'Other'];
$tagger = $this->tagMgr->load($this->objectType, $defaultTags);
@@ -184,7 +184,7 @@ class TagsTest extends \Test\TestCase {
);
}
- public function testGetTagsForObjectsMassiveResults() {
+ public function testGetTagsForObjectsMassiveResults(): void {
$defaultTags = ['tag1'];
$tagger = $this->tagMgr->load($this->objectType, $defaultTags);
$tagData = $tagger->getTags();
@@ -209,7 +209,7 @@ class TagsTest extends \Test\TestCase {
$this->assertEquals(1500, count($tags));
}
- public function testDeleteTags() {
+ public function testDeleteTags(): void {
$defaultTags = ['Friends', 'Family', 'Work', 'Other'];
$tagger = $this->tagMgr->load($this->objectType, $defaultTags);
@@ -222,7 +222,7 @@ class TagsTest extends \Test\TestCase {
$this->assertEquals(0, count($tagger->getTags()));
}
- public function testRenameTag() {
+ public function testRenameTag(): void {
$defaultTags = ['Friends', 'Family', 'Wrok', 'Other'];
$tagger = $this->tagMgr->load($this->objectType, $defaultTags);
@@ -233,7 +233,7 @@ class TagsTest extends \Test\TestCase {
$this->assertFalse($tagger->rename('Work', 'Family')); // Collide with existing tag.
}
- public function testTagAs() {
+ public function testTagAs(): void {
$objids = [1, 2, 3, 4, 5, 6, 7, 8, 9];
$tagger = $this->tagMgr->load($this->objectType);
@@ -249,7 +249,7 @@ class TagsTest extends \Test\TestCase {
/**
* @depends testTagAs
*/
- public function testUnTag() {
+ public function testUnTag(): void {
$objIds = [1, 2, 3, 4, 5, 6, 7, 8, 9];
// Is this "legal"?
@@ -266,7 +266,7 @@ class TagsTest extends \Test\TestCase {
$this->assertEquals(0, count($tagger->getIdsForTag('Family')));
}
- public function testFavorite() {
+ public function testFavorite(): void {
$tagger = $this->tagMgr->load($this->objectType);
$this->assertTrue($tagger->addToFavorites(1));
$this->assertEquals([1], $tagger->getFavorites());
diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php
index fe679ebbd2d..38675e826bf 100644
--- a/tests/lib/TaskProcessing/TaskProcessingTest.php
+++ b/tests/lib/TaskProcessing/TaskProcessingTest.php
@@ -3,7 +3,7 @@
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-namespace Test\TextProcessing;
+namespace Test\TaskProcessing;
use OC\AppFramework\Bootstrap\Coordinator;
use OC\AppFramework\Bootstrap\RegistrationContext;
@@ -12,17 +12,20 @@ use OC\EventDispatcher\EventDispatcher;
use OC\TaskProcessing\Db\TaskMapper;
use OC\TaskProcessing\Manager;
use OC\TaskProcessing\RemoveOldTasksBackgroundJob;
+use OCP\App\IAppManager;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\AppData\IAppDataFactory;
-use OCP\Files\IAppData;
+use OCP\Files\Config\ICachedMountInfo;
+use OCP\Files\Config\IUserMountCache;
use OCP\Files\IRootFolder;
+use OCP\Http\Client\IClientService;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IServerContainer;
+use OCP\IUser;
use OCP\IUserManager;
-use OCP\SpeechToText\ISpeechToTextManager;
use OCP\TaskProcessing\EShapeType;
use OCP\TaskProcessing\Events\TaskFailedEvent;
use OCP\TaskProcessing\Events\TaskSuccessfulEvent;
@@ -100,6 +103,30 @@ class AsyncProvider implements IProvider {
'optionalKey' => new ShapeDescriptor('optional Key', 'AN optional key', EShapeType::Text),
];
}
+
+ public function getInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOutputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalOutputShapeEnumValues(): array {
+ return [];
+ }
}
class SuccessfulSyncProvider implements IProvider, ISynchronousProvider {
@@ -134,6 +161,30 @@ class SuccessfulSyncProvider implements IProvider, ISynchronousProvider {
public function process(?string $userId, array $input, callable $reportProgress): array {
return ['output' => $input['input']];
}
+
+ public function getInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOutputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalOutputShapeEnumValues(): array {
+ return [];
+ }
}
class FailingSyncProvider implements IProvider, ISynchronousProvider {
@@ -169,6 +220,30 @@ class FailingSyncProvider implements IProvider, ISynchronousProvider {
public function process(?string $userId, array $input, callable $reportProgress): array {
throw new ProcessingException(self::ERROR_MESSAGE);
}
+
+ public function getInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOutputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalOutputShapeEnumValues(): array {
+ return [];
+ }
}
class BrokenSyncProvider implements IProvider, ISynchronousProvider {
@@ -203,6 +278,30 @@ class BrokenSyncProvider implements IProvider, ISynchronousProvider {
public function process(?string $userId, array $input, callable $reportProgress): array {
return [];
}
+
+ public function getInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalInputShapeDefaults(): array {
+ return [];
+ }
+
+ public function getOutputShapeEnumValues(): array {
+ return [];
+ }
+
+ public function getOptionalOutputShapeEnumValues(): array {
+ return [];
+ }
}
class SuccessfulTextProcessingSummaryProvider implements \OCP\TextProcessing\IProvider {
@@ -252,7 +351,7 @@ class SuccessfulTextToImageProvider implements \OCP\TextToImage\IProvider {
public function generate(string $prompt, array $resources): void {
$this->ran = true;
- foreach($resources as $resource) {
+ foreach ($resources as $resource) {
fwrite($resource, 'test');
}
}
@@ -295,8 +394,7 @@ class TaskProcessingTest extends \Test\TestCase {
private RegistrationContext $registrationContext;
private TaskMapper $taskMapper;
private IJobList $jobList;
- private IAppData $appData;
- private \OCP\Share\IManager $shareManager;
+ private IUserMountCache $userMountCache;
private IRootFolder $rootFolder;
public const TEST_USER = 'testuser';
@@ -351,15 +449,6 @@ class TaskProcessingTest extends \Test\TestCase {
$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
- $textProcessingManager = new \OC\TextProcessing\Manager(
- $this->serverContainer,
- $this->coordinator,
- \OC::$server->get(LoggerInterface::class),
- $this->jobList,
- \OC::$server->get(\OC\TextProcessing\Db\TaskMapper::class),
- \OC::$server->get(IConfig::class),
- );
-
$text2imageManager = new \OC\TextToImage\Manager(
$this->serverContainer,
$this->coordinator,
@@ -370,9 +459,10 @@ class TaskProcessingTest extends \Test\TestCase {
\OC::$server->get(IAppDataFactory::class),
);
- $this->shareManager = $this->createMock(\OCP\Share\IManager::class);
+ $this->userMountCache = $this->createMock(IUserMountCache::class);
$this->manager = new Manager(
+ \OC::$server->get(IConfig::class),
$this->coordinator,
$this->serverContainer,
\OC::$server->get(LoggerInterface::class),
@@ -381,10 +471,10 @@ class TaskProcessingTest extends \Test\TestCase {
$this->eventDispatcher,
\OC::$server->get(IAppDataFactory::class),
\OC::$server->get(IRootFolder::class),
- $textProcessingManager,
$text2imageManager,
- \OC::$server->get(ISpeechToTextManager::class),
- $this->shareManager,
+ $this->userMountCache,
+ \OC::$server->get(IClientService::class),
+ \OC::$server->get(IAppManager::class),
);
}
@@ -394,7 +484,7 @@ class TaskProcessingTest extends \Test\TestCase {
return $file;
}
- public function testShouldNotHaveAnyProviders() {
+ public function testShouldNotHaveAnyProviders(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([]);
self::assertCount(0, $this->manager->getAvailableTaskTypes());
self::assertFalse($this->manager->hasProviders());
@@ -402,7 +492,7 @@ class TaskProcessingTest extends \Test\TestCase {
$this->manager->scheduleTask(new Task(TextToText::ID, ['input' => 'Hello'], 'test', null));
}
- public function testProviderShouldBeRegisteredAndTaskFailValidation() {
+ public function testProviderShouldBeRegisteredAndTaskFailValidation(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', BrokenSyncProvider::class)
]);
@@ -414,18 +504,22 @@ class TaskProcessingTest extends \Test\TestCase {
$this->manager->scheduleTask($task);
}
- public function testProviderShouldBeRegisteredAndTaskWithFilesFailValidation() {
- $this->shareManager->expects($this->any())->method('getAccessList')->willReturn(['users' => []]);
+ public function testProviderShouldBeRegisteredAndTaskWithFilesFailValidation(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingTaskTypes')->willReturn([
new ServiceRegistration('test', AudioToImage::class)
]);
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', AsyncProvider::class)
]);
- $this->shareManager->expects($this->any())->method('getAccessList')->willReturn(['users' => [null]]);
- self::assertCount(1, $this->manager->getAvailableTaskTypes());
+ $user = $this->createMock(IUser::class);
+ $user->expects($this->any())->method('getUID')->willReturn(null);
+ $mount = $this->createMock(ICachedMountInfo::class);
+ $mount->expects($this->any())->method('getUser')->willReturn($user);
+ $this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]);
+ self::assertCount(1, $this->manager->getAvailableTaskTypes());
self::assertTrue($this->manager->hasProviders());
+
$audioId = $this->getFile('audioInput', 'Hello')->getId();
$task = new Task(AudioToImage::ID, ['audio' => $audioId], 'test', null);
self::assertNull($task->getId());
@@ -434,7 +528,7 @@ class TaskProcessingTest extends \Test\TestCase {
$this->manager->scheduleTask($task);
}
- public function testProviderShouldBeRegisteredAndFail() {
+ public function testProviderShouldBeRegisteredAndFail(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', FailingSyncProvider::class)
]);
@@ -462,7 +556,7 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertEquals(FailingSyncProvider::ERROR_MESSAGE, $task->getErrorMessage());
}
- public function testProviderShouldBeRegisteredAndFailOutputValidation() {
+ public function testProviderShouldBeRegisteredAndFailOutputValidation(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', BrokenSyncProvider::class)
]);
@@ -490,7 +584,7 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertEquals('The task was processed successfully but the provider\'s output doesn\'t pass validation against the task type\'s outputShape spec and/or the provider\'s own optionalOutputShape spec', $task->getErrorMessage());
}
- public function testProviderShouldBeRegisteredAndRun() {
+ public function testProviderShouldBeRegisteredAndRun(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulSyncProvider::class)
]);
@@ -536,14 +630,20 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertEquals(1, $task->getProgress());
}
- public function testAsyncProviderWithFilesShouldBeRegisteredAndRun() {
+ public function testAsyncProviderWithFilesShouldBeRegisteredAndRunReturningRawFileData(): void {
$this->registrationContext->expects($this->any())->method('getTaskProcessingTaskTypes')->willReturn([
new ServiceRegistration('test', AudioToImage::class)
]);
$this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
new ServiceRegistration('test', AsyncProvider::class)
]);
- $this->shareManager->expects($this->any())->method('getAccessList')->willReturn(['users' => ['testuser' => 1]]);
+
+ $user = $this->createMock(IUser::class);
+ $user->expects($this->any())->method('getUID')->willReturn('testuser');
+ $mount = $this->createMock(ICachedMountInfo::class);
+ $mount->expects($this->any())->method('getUser')->willReturn($user);
+ $this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]);
+
self::assertCount(1, $this->manager->getAvailableTaskTypes());
self::assertTrue($this->manager->hasProviders());
@@ -582,12 +682,64 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertEquals('World', $node->getContent());
}
- public function testNonexistentTask() {
+ public function testAsyncProviderWithFilesShouldBeRegisteredAndRunReturningFileIds(): void {
+ $this->registrationContext->expects($this->any())->method('getTaskProcessingTaskTypes')->willReturn([
+ new ServiceRegistration('test', AudioToImage::class)
+ ]);
+ $this->registrationContext->expects($this->any())->method('getTaskProcessingProviders')->willReturn([
+ new ServiceRegistration('test', AsyncProvider::class)
+ ]);
+ $user = $this->createMock(IUser::class);
+ $user->expects($this->any())->method('getUID')->willReturn('testuser');
+ $mount = $this->createMock(ICachedMountInfo::class);
+ $mount->expects($this->any())->method('getUser')->willReturn($user);
+ $this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]);
+ self::assertCount(1, $this->manager->getAvailableTaskTypes());
+
+ self::assertTrue($this->manager->hasProviders());
+ $audioId = $this->getFile('audioInput', 'Hello')->getId();
+ $task = new Task(AudioToImage::ID, ['audio' => $audioId], 'test', 'testuser');
+ self::assertNull($task->getId());
+ self::assertEquals(Task::STATUS_UNKNOWN, $task->getStatus());
+ $this->manager->scheduleTask($task);
+ self::assertNotNull($task->getId());
+ self::assertEquals(Task::STATUS_SCHEDULED, $task->getStatus());
+
+ // Task object retrieved from db is up-to-date
+ $task2 = $this->manager->getTask($task->getId());
+ self::assertEquals($task->getId(), $task2->getId());
+ self::assertEquals(['audio' => $audioId], $task2->getInput());
+ self::assertNull($task2->getOutput());
+ self::assertEquals(Task::STATUS_SCHEDULED, $task2->getStatus());
+
+ $this->eventDispatcher->expects($this->once())->method('dispatchTyped')->with(new IsInstanceOf(TaskSuccessfulEvent::class));
+
+ $this->manager->setTaskProgress($task2->getId(), 0.1);
+ $input = $this->manager->prepareInputData($task2);
+ self::assertTrue(isset($input['audio']));
+ self::assertInstanceOf(\OCP\Files\File::class, $input['audio']);
+ self::assertEquals($audioId, $input['audio']->getId());
+
+ $outputFileId = $this->getFile('audioOutput', 'World')->getId();
+
+ $this->manager->setTaskResult($task2->getId(), null, ['spectrogram' => $outputFileId], true);
+
+ $task = $this->manager->getTask($task->getId());
+ self::assertEquals(Task::STATUS_SUCCESSFUL, $task->getStatus());
+ self::assertEquals(1, $task->getProgress());
+ self::assertTrue(isset($task->getOutput()['spectrogram']));
+ $node = $this->rootFolder->getFirstNodeById($task->getOutput()['spectrogram']);
+ self::assertNotNull($node, 'fileId:' . $task->getOutput()['spectrogram']);
+ self::assertInstanceOf(\OCP\Files\File::class, $node);
+ self::assertEquals('World', $node->getContent());
+ }
+
+ public function testNonexistentTask(): void {
$this->expectException(\OCP\TaskProcessing\Exception\NotFoundException::class);
$this->manager->getTask(2147483646);
}
- public function testOldTasksShouldBeCleanedUp() {
+ public function testOldTasksShouldBeCleanedUp(): void {
$currentTime = new \DateTime('now');
$timeFactory = $this->createMock(ITimeFactory::class);
$timeFactory->expects($this->any())->method('getDateTime')->willReturnCallback(fn () => $currentTime);
@@ -633,7 +785,7 @@ class TaskProcessingTest extends \Test\TestCase {
$this->manager->getTask($task->getId());
}
- public function testShouldTransparentlyHandleTextProcessingProviders() {
+ public function testShouldTransparentlyHandleTextProcessingProviders(): void {
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulTextProcessingSummaryProvider::class)
]);
@@ -664,7 +816,7 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertTrue($this->providers[SuccessfulTextProcessingSummaryProvider::class]->ran);
}
- public function testShouldTransparentlyHandleFailingTextProcessingProviders() {
+ public function testShouldTransparentlyHandleFailingTextProcessingProviders(): void {
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', FailingTextProcessingSummaryProvider::class)
]);
@@ -694,7 +846,7 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertTrue($this->providers[FailingTextProcessingSummaryProvider::class]->ran);
}
- public function testShouldTransparentlyHandleText2ImageProviders() {
+ public function testShouldTransparentlyHandleText2ImageProviders(): void {
$this->registrationContext->expects($this->any())->method('getTextToImageProviders')->willReturn([
new ServiceRegistration('test', SuccessfulTextToImageProvider::class)
]);
@@ -730,7 +882,7 @@ class TaskProcessingTest extends \Test\TestCase {
self::assertEquals('test', $node->getContent());
}
- public function testShouldTransparentlyHandleFailingText2ImageProviders() {
+ public function testShouldTransparentlyHandleFailingText2ImageProviders(): void {
$this->registrationContext->expects($this->any())->method('getTextToImageProviders')->willReturn([
new ServiceRegistration('test', FailingTextToImageProvider::class)
]);
diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php
index 89b66654570..a981338f42a 100644
--- a/tests/lib/TempManagerTest.php
+++ b/tests/lib/TempManagerTest.php
@@ -33,8 +33,8 @@ class TempManagerTest extends \Test\TestCase {
}
/**
- * @param ?LoggerInterface $logger
- * @param ?IConfig $config
+ * @param ?LoggerInterface $logger
+ * @param ?IConfig $config
* @return \OC\TempManager
*/
protected function getManager($logger = null, $config = null) {
@@ -55,7 +55,7 @@ class TempManagerTest extends \Test\TestCase {
return $manager;
}
- public function testGetFile() {
+ public function testGetFile(): void {
$manager = $this->getManager();
$file = $manager->getTemporaryFile('txt');
$this->assertStringEndsWith('.txt', $file);
@@ -66,7 +66,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertEquals('bar', file_get_contents($file));
}
- public function testGetFolder() {
+ public function testGetFolder(): void {
$manager = $this->getManager();
$folder = $manager->getTemporaryFolder();
$this->assertStringEndsWith('/', $folder);
@@ -77,7 +77,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertEquals('bar', file_get_contents($folder . 'foo.txt'));
}
- public function testCleanFiles() {
+ public function testCleanFiles(): void {
$manager = $this->getManager();
$file1 = $manager->getTemporaryFile('txt');
$file2 = $manager->getTemporaryFile('txt');
@@ -90,7 +90,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertFalse(file_exists($file2));
}
- public function testCleanFolder() {
+ public function testCleanFolder(): void {
$manager = $this->getManager();
$folder1 = $manager->getTemporaryFolder();
$folder2 = $manager->getTemporaryFolder();
@@ -109,7 +109,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertFalse(file_exists($folder1 . 'bar.txt'));
}
- public function testCleanOld() {
+ public function testCleanOld(): void {
$manager = $this->getManager();
$oldFile = $manager->getTemporaryFile('txt');
$newFile = $manager->getTemporaryFile('txt');
@@ -130,7 +130,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertTrue(file_exists($newFile));
}
- public function testLogCantCreateFile() {
+ public function testLogCantCreateFile(): void {
$this->markTestSkipped('TODO: Disable because fails on drone');
$logger = $this->createMock(LoggerInterface::class);
@@ -142,7 +142,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertFalse($manager->getTemporaryFile('txt'));
}
- public function testLogCantCreateFolder() {
+ public function testLogCantCreateFolder(): void {
$this->markTestSkipped('TODO: Disable because fails on drone');
$logger = $this->createMock(LoggerInterface::class);
@@ -154,7 +154,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertFalse($manager->getTemporaryFolder());
}
- public function testBuildFileNameWithPostfix() {
+ public function testBuildFileNameWithPostfix(): void {
$logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
@@ -165,7 +165,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertEquals('/tmp/myTemporaryFile-.postfix', $tmpManager);
}
- public function testBuildFileNameWithoutPostfix() {
+ public function testBuildFileNameWithoutPostfix(): void {
$logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
@@ -176,7 +176,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertEquals('/tmp/myTemporaryFile', $tmpManager);
}
- public function testBuildFileNameWithSuffixPathTraversal() {
+ public function testBuildFileNameWithSuffixPathTraversal(): void {
$logger = $this->createMock(LoggerInterface::class);
$tmpManager = self::invokePrivate(
$this->getManager($logger),
@@ -188,7 +188,7 @@ class TempManagerTest extends \Test\TestCase {
$this->assertStringEndsWith('.Traversal..FileName', $tmpManager);
}
- public function testGetTempBaseDirFromConfig() {
+ public function testGetTempBaseDirFromConfig(): void {
$dir = $this->getManager()->getTemporaryFolder();
$config = $this->createMock(IConfig::class);
diff --git a/tests/lib/Template/CSSResourceLocatorTest.php b/tests/lib/Template/CSSResourceLocatorTest.php
index 64c31d9c94c..ed02358a8c9 100644
--- a/tests/lib/Template/CSSResourceLocatorTest.php
+++ b/tests/lib/Template/CSSResourceLocatorTest.php
@@ -77,7 +77,7 @@ class CSSResourceLocatorTest extends \Test\TestCase {
return sha1(uniqid(mt_rand(), true));
}
- public function testFindWithAppPathSymlink() {
+ public function testFindWithAppPathSymlink(): void {
// First create new apps path, and a symlink to it
$apps_dirname = $this->randomString();
$new_apps_path = sys_get_temp_dir() . '/' . $apps_dirname;
diff --git a/tests/lib/Template/JSCombinerTest.php b/tests/lib/Template/JSCombinerTest.php
index d9de4b088d1..63a52f34047 100644
--- a/tests/lib/Template/JSCombinerTest.php
+++ b/tests/lib/Template/JSCombinerTest.php
@@ -55,7 +55,7 @@ class JSCombinerTest extends \Test\TestCase {
);
}
- public function testProcessDebugMode() {
+ public function testProcessDebugMode(): void {
$this->config
->expects($this->once())
->method('getValue')
@@ -66,7 +66,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testProcessNotInstalled() {
+ public function testProcessNotInstalled(): void {
$this->config
->expects($this->exactly(2))
->method('getValue')
@@ -83,7 +83,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testProcessUncachedFileNoAppDataFolder() {
+ public function testProcessUncachedFileNoAppDataFolder(): void {
$this->config
->expects($this->exactly(2))
->method('getValue')
@@ -123,7 +123,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertTrue($actual);
}
- public function testProcessUncachedFile() {
+ public function testProcessUncachedFile(): void {
$this->config
->expects($this->exactly(2))
->method('getValue')
@@ -161,7 +161,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertTrue($actual);
}
- public function testProcessCachedFile() {
+ public function testProcessCachedFile(): void {
$this->config
->expects($this->exactly(2))
->method('getValue')
@@ -202,7 +202,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertTrue($actual);
}
- public function testProcessCachedFileMemcache() {
+ public function testProcessCachedFileMemcache(): void {
$this->config
->expects($this->exactly(2))
->method('getValue')
@@ -243,7 +243,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertTrue($actual);
}
- public function testIsCachedNoDepsFile() {
+ public function testIsCachedNoDepsFile(): void {
$fileName = 'combine.json';
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -263,7 +263,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testIsCachedWithNotExistingFile() {
+ public function testIsCachedWithNotExistingFile(): void {
$fileName = 'combine.json';
$folder = $this->createMock(ISimpleFolder::class);
$folder->method('fileExists')
@@ -281,7 +281,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testIsCachedWithOlderMtime() {
+ public function testIsCachedWithOlderMtime(): void {
$fileName = 'combine.json';
$folder = $this->createMock(ISimpleFolder::class);
$folder->method('fileExists')
@@ -299,7 +299,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testIsCachedWithoutContent() {
+ public function testIsCachedWithoutContent(): void {
$fileName = 'combine.json';
$folder = $this->createMock(ISimpleFolder::class);
$folder->method('fileExists')
@@ -319,7 +319,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertFalse($actual);
}
- public function testCacheNoFile() {
+ public function testCacheNoFile(): void {
$fileName = 'combine.js';
$folder = $this->createMock(ISimpleFolder::class);
@@ -352,7 +352,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertTrue($actual);
}
- public function testCache() {
+ public function testCache(): void {
$fileName = 'combine.js';
$folder = $this->createMock(ISimpleFolder::class);
@@ -383,7 +383,7 @@ class JSCombinerTest extends \Test\TestCase {
$this->assertTrue($actual);
}
- public function testCacheNotPermittedException() {
+ public function testCacheNotPermittedException(): void {
$fileName = 'combine.js';
$folder = $this->createMock(ISimpleFolder::class);
@@ -429,7 +429,7 @@ var b = \'world\';
$this->assertFalse($actual);
}
- public function testCacheSuccess() {
+ public function testCacheSuccess(): void {
$fileName = 'combine.js';
$folder = $this->createMock(ISimpleFolder::class);
@@ -497,7 +497,7 @@ var b = \'world\';
* @param $result
* @dataProvider dataGetCachedSCSS
*/
- public function testGetCachedSCSS($appName, $fileName, $result) {
+ public function testGetCachedSCSS($appName, $fileName, $result): void {
$this->urlGenerator->expects($this->once())
->method('linkToRoute')
->with('core.Js.getJs', [
@@ -510,7 +510,7 @@ var b = \'world\';
$this->assertEquals(substr($result, 1), $actual);
}
- public function testGetContent() {
+ public function testGetContent(): void {
// Create temporary file with some content
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('JSCombinerTest');
$pathInfo = pathinfo($tmpFile);
@@ -525,7 +525,7 @@ var b = \'world\';
$this->assertEquals($expected, $this->jsCombiner->getContent($pathInfo['dirname'], $pathInfo['basename']));
}
- public function testGetContentInvalidJson() {
+ public function testGetContentInvalidJson(): void {
// Create temporary file with some content
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('JSCombinerTest');
$pathInfo = pathinfo($tmpFile);
@@ -534,7 +534,7 @@ var b = \'world\';
$this->assertEquals($expected, $this->jsCombiner->getContent($pathInfo['dirname'], $pathInfo['basename']));
}
- public function testResetCache() {
+ public function testResetCache(): void {
$file = $this->createMock(ISimpleFile::class);
$file->expects($this->once())
->method('delete');
diff --git a/tests/lib/Template/JSResourceLocatorTest.php b/tests/lib/Template/JSResourceLocatorTest.php
index 354f23fac19..bb2c2bec6c4 100644
--- a/tests/lib/Template/JSResourceLocatorTest.php
+++ b/tests/lib/Template/JSResourceLocatorTest.php
@@ -72,7 +72,7 @@ class JSResourceLocatorTest extends \Test\TestCase {
return sha1(uniqid(mt_rand(), true));
}
- public function testFindWithAppPathSymlink() {
+ public function testFindWithAppPathSymlink(): void {
$appName = 'test-js-app';
// First create new apps path, and a symlink to it
@@ -123,7 +123,7 @@ class JSResourceLocatorTest extends \Test\TestCase {
$this->rrmdir($new_apps_path);
}
- public function testNotExistingTranslationHandledSilent() {
+ public function testNotExistingTranslationHandledSilent(): void {
$this->appManager->expects($this->once())
->method('getAppPath')
->with('core')
@@ -138,13 +138,13 @@ class JSResourceLocatorTest extends \Test\TestCase {
// Run the tests
$locator = $this->jsResourceLocator();
- $locator->find(["core/l10n/en.js"]);
+ $locator->find(['core/l10n/en.js']);
$resources = $locator->getResources();
$this->assertCount(0, $resources);
}
- public function testFindModuleJSWithFallback() {
+ public function testFindModuleJSWithFallback(): void {
// First create new apps path, and a symlink to it
$apps_dirname = $this->randomString();
$new_apps_path = sys_get_temp_dir() . '/' . $apps_dirname;
diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php
index e74e72014c5..65d4c7938f9 100644
--- a/tests/lib/Template/ResourceLocatorTest.php
+++ b/tests/lib/Template/ResourceLocatorTest.php
@@ -37,7 +37,7 @@ class ResourceLocatorTest extends \Test\TestCase {
'', true, true, true, []);
}
- public function testFind() {
+ public function testFind(): void {
$locator = $this->getResourceLocator('theme');
$locator->expects($this->once())
->method('doFind')
@@ -49,7 +49,7 @@ class ResourceLocatorTest extends \Test\TestCase {
$locator->find(['foo']);
}
- public function testFindNotFound() {
+ public function testFindNotFound(): void {
$systemConfig = $this->createMock(SystemConfig::class);
$systemConfig->method('getValue')
->with('theme', '')
@@ -72,7 +72,7 @@ class ResourceLocatorTest extends \Test\TestCase {
$locator->find(['foo']);
}
- public function testAppendIfExist() {
+ public function testAppendIfExist(): void {
$locator = $this->getResourceLocator('theme');
/** @var \OC\Template\ResourceLocator $locator */
$method = new \ReflectionMethod($locator, 'appendIfExist');
diff --git a/tests/lib/TemplateFunctionsTest.php b/tests/lib/TemplateFunctionsTest.php
index 754551a415b..a693a39c580 100644
--- a/tests/lib/TemplateFunctionsTest.php
+++ b/tests/lib/TemplateFunctionsTest.php
@@ -14,50 +14,50 @@ class TemplateFunctionsTest extends \Test\TestCase {
require_once \OC::$SERVERROOT . '/lib/private/legacy/OC_Template.php';
}
- public function testPJavaScript() {
+ public function testPJavaScript(): void {
$this->expectOutputString('&lt;img onload=&quot;alert(1)&quot; /&gt;');
p('<img onload="alert(1)" />');
}
- public function testPJavaScriptWithScriptTags() {
+ public function testPJavaScriptWithScriptTags(): void {
$this->expectOutputString('&lt;script&gt;alert(&#039;Hacked!&#039;);&lt;/script&gt;');
p("<script>alert('Hacked!');</script>");
}
- public function testPNormalString() {
+ public function testPNormalString(): void {
$string = 'This is a good string without HTML.';
$this->expectOutputString($string);
p($string);
}
- public function testPrintUnescaped() {
+ public function testPrintUnescaped(): void {
$htmlString = "<script>alert('xss');</script>";
$this->expectOutputString($htmlString);
print_unescaped($htmlString);
}
- public function testPrintUnescapedNormalString() {
+ public function testPrintUnescapedNormalString(): void {
$string = 'This is a good string!';
$this->expectOutputString($string);
print_unescaped($string);
}
- public function testEmitScriptTagWithContent() {
+ public function testEmitScriptTagWithContent(): void {
$this->expectOutputRegex('/<script nonce="[^"]+">\nalert\(\)\n<\/script>\n?/');
emit_script_tag('', 'alert()');
}
- public function testEmitScriptTagWithSource() {
+ public function testEmitScriptTagWithSource(): void {
$this->expectOutputRegex('/<script nonce=".*" defer src="some.js"><\/script>/');
emit_script_tag('some.js');
}
- public function testEmitScriptTagWithModuleSource() {
+ public function testEmitScriptTagWithModuleSource(): void {
$this->expectOutputRegex('/<script nonce=".*" defer src="some.mjs" type="module"><\/script>/');
emit_script_tag('some.mjs', '', 'module');
}
- public function testEmitScriptLoadingTags() {
+ public function testEmitScriptLoadingTags(): void {
// Test mjs js and inline content
$pattern = '/src="some\.mjs"[^>]+type="module"[^>]*>.+\n'; // some.mjs with type = module
$pattern .= '<script[^>]+src="other\.js"[^>]*>.+\n'; // other.js as plain javascript
@@ -71,7 +71,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
]);
}
- public function testEmitScriptLoadingTagsWithVersion() {
+ public function testEmitScriptLoadingTagsWithVersion(): void {
// Test mjs js and inline content
$pattern = '/src="some\.mjs\?v=ab123cd"[^>]+type="module"[^>]*>.+\n'; // some.mjs with type = module
$pattern .= '<script[^>]+src="other\.js\?v=12abc34"[^>]*>.+\n'; // other.js as plain javascript
@@ -86,7 +86,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
// ---------------------------------------------------------------------------
// Test relative_modified_date with dates only
// ---------------------------------------------------------------------------
- public function testRelativeDateToday() {
+ public function testRelativeDateToday(): void {
$currentTime = 1380703592;
$elementTime = $currentTime;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -100,7 +100,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('today', $result);
}
- public function testRelativeDateYesterday() {
+ public function testRelativeDateYesterday(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 24 * 3600;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -114,7 +114,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('yesterday', $result);
}
- public function testRelativeDate2DaysAgo() {
+ public function testRelativeDate2DaysAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 48 * 3600;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -128,7 +128,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('2 days ago', $result);
}
- public function testRelativeDateLastMonth() {
+ public function testRelativeDateLastMonth(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 31;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -141,7 +141,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('last month', $result);
}
- public function testRelativeDateMonthsAgo() {
+ public function testRelativeDateMonthsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 65;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -154,7 +154,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('4 months ago', $result);
}
- public function testRelativeDateLastYear() {
+ public function testRelativeDateLastYear(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 365;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -167,7 +167,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('last year', $result);
}
- public function testRelativeDateYearsAgo() {
+ public function testRelativeDateYearsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 365.25 * 2;
$result = (string)relative_modified_date($elementTime, $currentTime, true);
@@ -184,7 +184,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
// Test relative_modified_date with timestamps only (date + time value)
// ---------------------------------------------------------------------------
- public function testRelativeTimeSecondsAgo() {
+ public function testRelativeTimeSecondsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 5;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -192,7 +192,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('seconds ago', $result);
}
- public function testRelativeTimeMinutesAgo() {
+ public function testRelativeTimeMinutesAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 190;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -200,7 +200,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('3 minutes ago', $result);
}
- public function testRelativeTimeHoursAgo() {
+ public function testRelativeTimeHoursAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 7500;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -208,7 +208,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('2 hours ago', $result);
}
- public function testRelativeTime2DaysAgo() {
+ public function testRelativeTime2DaysAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 48 * 3600;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -222,7 +222,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('2 days ago', $result);
}
- public function testRelativeTimeLastMonth() {
+ public function testRelativeTimeLastMonth(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 31;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -235,7 +235,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('last month', $result);
}
- public function testRelativeTimeMonthsAgo() {
+ public function testRelativeTimeMonthsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 65;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -248,7 +248,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('4 months ago', $result);
}
- public function testRelativeTimeLastYear() {
+ public function testRelativeTimeLastYear(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 365;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
@@ -261,7 +261,7 @@ class TemplateFunctionsTest extends \Test\TestCase {
$this->assertEquals('last year', $result);
}
- public function testRelativeTimeYearsAgo() {
+ public function testRelativeTimeYearsAgo(): void {
$currentTime = 1380703592;
$elementTime = $currentTime - 86400 * 365.25 * 2;
$result = (string)relative_modified_date($elementTime, $currentTime, false);
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index 8c97c184c6f..9369a20eb81 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -192,7 +192,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
$errors = libxml_get_errors();
libxml_clear_errors();
if (!empty($errors)) {
- self::assertEquals([], $errors, "There have been xml parsing errors");
+ self::assertEquals([], $errors, 'There have been xml parsing errors');
}
if ($this->IsDatabaseAccessAllowed()) {
@@ -342,6 +342,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
*/
protected static function tearDownAfterClassCleanFileCache(IQueryBuilder $queryBuilder) {
$queryBuilder->delete('filecache')
+ ->runAcrossAllShards()
->execute();
}
@@ -465,10 +466,10 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
* @param string $path path to check
* @param int $type lock type
* @param bool $onMountPoint true to check the mount point instead of the
- * mounted storage
+ * mounted storage
*
* @return boolean true if the file is locked with the
- * given type, false otherwise
+ * given type, false otherwise
*/
protected function isFileLocked($view, $path, $type, $onMountPoint = false) {
// Note: this seems convoluted but is necessary because
diff --git a/tests/lib/TextProcessing/TextProcessingTest.php b/tests/lib/TextProcessing/TextProcessingTest.php
index db479a7a7b6..84c5492a4a2 100644
--- a/tests/lib/TextProcessing/TextProcessingTest.php
+++ b/tests/lib/TextProcessing/TextProcessingTest.php
@@ -86,6 +86,9 @@ class FreePromptProvider implements IProvider {
}
}
+/**
+ * @group DB
+ */
class TextProcessingTest extends \Test\TestCase {
private IManager $manager;
private Coordinator $coordinator;
@@ -176,11 +179,12 @@ class TextProcessingTest extends \Test\TestCase {
\OC::$server->get(LoggerInterface::class),
$this->jobList,
$this->taskMapper,
- $config
+ $config,
+ \OC::$server->get(\OCP\TaskProcessing\IManager::class),
);
}
- public function testShouldNotHaveAnyProviders() {
+ public function testShouldNotHaveAnyProviders(): void {
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([]);
$this->assertCount(0, $this->manager->getAvailableTaskTypes());
$this->assertFalse($this->manager->hasProviders());
@@ -188,7 +192,7 @@ class TextProcessingTest extends \Test\TestCase {
$this->manager->runTask(new \OCP\TextProcessing\Task(FreePromptTaskType::class, 'Hello', 'test', null));
}
- public function testProviderShouldBeRegisteredAndRun() {
+ public function testProviderShouldBeRegisteredAndRun(): void {
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulSummaryProvider::class)
]);
@@ -201,7 +205,7 @@ class TextProcessingTest extends \Test\TestCase {
$this->manager->runTask(new Task(FreePromptTaskType::class, 'Hello', 'test', null));
}
- public function testProviderShouldBeRegisteredAndScheduled() {
+ public function testProviderShouldBeRegisteredAndScheduled(): void {
// register provider
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulSummaryProvider::class)
@@ -252,7 +256,7 @@ class TextProcessingTest extends \Test\TestCase {
$this->assertEquals(Task::STATUS_SUCCESSFUL, $task3->getStatus());
}
- public function testMultipleProvidersShouldBeRegisteredAndRunCorrectly() {
+ public function testMultipleProvidersShouldBeRegisteredAndRunCorrectly(): void {
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulSummaryProvider::class),
new ServiceRegistration('test', FreePromptProvider::class),
@@ -271,12 +275,12 @@ class TextProcessingTest extends \Test\TestCase {
$this->manager->runTask(new Task(TopicsTaskType::class, 'Hello', 'test', null));
}
- public function testNonexistentTask() {
+ public function testNonexistentTask(): void {
$this->expectException(NotFoundException::class);
$this->manager->getTask(2147483646);
}
- public function testTaskFailure() {
+ public function testTaskFailure(): void {
// register provider
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', FailingSummaryProvider::class),
@@ -327,7 +331,7 @@ class TextProcessingTest extends \Test\TestCase {
$this->assertEquals(Task::STATUS_FAILED, $task3->getStatus());
}
- public function testOldTasksShouldBeCleanedUp() {
+ public function testOldTasksShouldBeCleanedUp(): void {
$this->registrationContext->expects($this->any())->method('getTextProcessingProviders')->willReturn([
new ServiceRegistration('test', SuccessfulSummaryProvider::class)
]);
diff --git a/tests/lib/Updater/ChangesCheckTest.php b/tests/lib/Updater/ChangesCheckTest.php
index 26da6579d33..81eaa95d1fe 100644
--- a/tests/lib/Updater/ChangesCheckTest.php
+++ b/tests/lib/Updater/ChangesCheckTest.php
@@ -54,7 +54,7 @@ class ChangesCheckTest extends TestCase {
/**
* @dataProvider statusCodeProvider
*/
- public function testEvaluateResponse(int $statusCode, int $expected) {
+ public function testEvaluateResponse(int $statusCode, int $expected): void {
$response = $this->createMock(IResponse::class);
$response->expects($this->atLeastOnce())
->method('getStatusCode')
@@ -69,7 +69,7 @@ class ChangesCheckTest extends TestCase {
$this->assertSame($expected, $evaluation);
}
- public function testCacheResultInsert() {
+ public function testCacheResultInsert(): void {
$version = '13.0.4';
$entry = $this->createMock(Changes::class);
$entry->expects($this->exactly(2))
@@ -85,7 +85,7 @@ class ChangesCheckTest extends TestCase {
$this->invokePrivate($this->checker, 'cacheResult', [$entry, $version]);
}
- public function testCacheResultUpdate() {
+ public function testCacheResultUpdate(): void {
$version = '13.0.4';
$entry = $this->createMock(Changes::class);
$entry->expects($this->once())
@@ -272,7 +272,7 @@ class ChangesCheckTest extends TestCase {
/**
* @dataProvider changesXMLProvider
*/
- public function testExtractData(string $body, array $expected) {
+ public function testExtractData(string $body, array $expected): void {
$actual = $this->invokePrivate($this->checker, 'extractData', [$body]);
$this->assertSame($expected, $actual);
}
@@ -287,7 +287,7 @@ class ChangesCheckTest extends TestCase {
/**
* @dataProvider etagProvider
*/
- public function testQueryChangesServer(string $etag) {
+ public function testQueryChangesServer(string $etag): void {
$uri = 'https://changes.nextcloud.server/?13.0.5';
$entry = $this->createMock(Changes::class);
$entry->expects($this->any())
@@ -324,7 +324,7 @@ class ChangesCheckTest extends TestCase {
/**
* @dataProvider versionProvider
*/
- public function testNormalizeVersion(string $input, string $expected) {
+ public function testNormalizeVersion(string $input, string $expected): void {
$normalized = $this->checker->normalizeVersion($input);
$this->assertSame($expected, $normalized);
}
@@ -344,7 +344,7 @@ class ChangesCheckTest extends TestCase {
* @dataProvider changeDataProvider
*
*/
- public function testGetChangesForVersion(string $inputVersion, string $normalizedVersion, bool $isFound) {
+ public function testGetChangesForVersion(string $inputVersion, string $normalizedVersion, bool $isFound): void {
$mocker = $this->mapper->expects($this->once())
->method('getChanges')
->with($normalizedVersion);
@@ -368,7 +368,7 @@ class ChangesCheckTest extends TestCase {
$this->assertTrue(isset($data['changelogURL']));
}
- public function testGetChangesForVersionEmptyData() {
+ public function testGetChangesForVersionEmptyData(): void {
$entry = $this->createMock(Changes::class);
$entry->expects($this->once())
->method('__call')
diff --git a/tests/lib/Updater/ReleaseMetadataTest.php b/tests/lib/Updater/ReleaseMetadataTest.php
new file mode 100644
index 00000000000..72c6da5064d
--- /dev/null
+++ b/tests/lib/Updater/ReleaseMetadataTest.php
@@ -0,0 +1,209 @@
+<?php
+
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+namespace Test\Updater;
+
+use OC\Updater\ReleaseMetadata;
+use OCP\Http\Client\IClient;
+use OCP\Http\Client\IClientService;
+use OCP\Http\Client\IResponse;
+use PHPUnit\Framework\MockObject\MockObject;
+
+class ReleaseMetadataTest extends \Test\TestCase {
+ private IClientService|MockObject $clientService;
+
+ protected function setUp(): void {
+ parent::setUp();
+ $this->clientService = $this->getMockBuilder(IClientService::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
+ public function testDownloadMetadata(): void {
+ $client = $this->createMock(IClient::class);
+ $response = $this->createMock(IResponse::class);
+ $this->clientService->expects($this->once())
+ ->method('newClient')
+ ->with()
+ ->willReturn($client);
+ $client->expects($this->once())
+ ->method('get')
+ ->willReturn($response);
+ $response->expects($this->once())
+ ->method('getBody')
+ ->with()
+ ->willReturn($this->resultRequest());
+
+
+ $releaseMetadata = new ReleaseMetadata($this->clientService);
+ $this->assertSame($this->resultRequestArray(), $releaseMetadata->downloadMetadata('ouila'));
+ }
+
+ /**
+ * @dataProvider getMetadataUrlProvider
+ *
+ * @param string $version
+ * @param string $url
+ */
+ public function testGetMetadata(string $version, string $url): void {
+ $client = $this->createMock(IClient::class);
+ $response = $this->createMock(IResponse::class);
+ $this->clientService->expects($this->once())
+ ->method('newClient')
+ ->with()
+ ->willReturn($client);
+ $client->expects($this->once())
+ ->method('get')
+ ->with($url)
+ ->willReturn($response);
+
+ $response->expects($this->once())
+ ->method('getBody')
+ ->with()
+ ->willReturn('{}');
+
+ $releaseMetadata = new ReleaseMetadata($this->clientService);
+ $releaseMetadata->getMetadata($version);
+ }
+
+ /**
+ * @return array
+ */
+ public function getMetadataUrlProvider(): array {
+ return [
+ [
+ '30.0.0',
+ 'https://download.nextcloud.com/server/releases/nextcloud-30.0.0.metadata'
+ ],
+ [
+ '30.0.0-beta1',
+ 'https://download.nextcloud.com/server/prereleases/nextcloud-30.0.0-beta1.metadata'
+ ],
+ [
+ '30',
+ 'https://download.nextcloud.com/server/releases/latest-30.metadata'
+ ]
+ ];
+ }
+
+ private function resultRequest(): string {
+ return json_encode($this->resultRequestArray());
+ }
+
+ private function resultRequestArray(): array {
+ return [
+ 'migrations' => [
+ 'core' => [],
+ 'apps' => [
+ 'testing' => [
+ '30000Date20240102030405' => [
+ 'class' => 'OCP\\Migration\\Attributes\\DropTable',
+ 'table' => 'old_table',
+ 'description' => '',
+ 'notes' => [],
+ 'columns' => []
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\CreateTable',
+ 'table' => 'new_table',
+ 'description' => 'Table is used to store things, but also to get more things',
+ 'notes' => [
+ 'this is a notice',
+ 'and another one, if really needed'
+ ],
+ 'columns' => []
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddColumn',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => '',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddColumn',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'another_field',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'last_one',
+ 'type' => 'date'
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddIndex',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\AddIndex',
+ 'table' => 'my_table',
+ 'description' => '',
+ 'notes' => [],
+ 'type' => 'primary'
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => '',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropColumn',
+ 'table' => 'other_table',
+ 'description' => 'field is not used anymore and replaced by \'last_one\'',
+ 'notes' => [],
+ 'name' => 'old_column',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\DropIndex',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\ModifyColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => '',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\ModifyColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'this_field',
+ 'type' => ''
+ ],
+ [
+ 'class' => 'OCP\\Migration\\Attributes\\ModifyColumn',
+ 'table' => 'other_table',
+ 'description' => '',
+ 'notes' => [],
+ 'name' => 'this_field',
+ 'type' => 'bigint'
+ ]
+ ]
+ ]
+ ]
+ ];
+ }
+}
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index 7aa04ad2ab6..b33829a2155 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -21,11 +21,11 @@ class VersionCheckTest extends \Test\TestCase {
private $config;
/** @var IAppConfig| \PHPUnit\Framework\MockObject\MockObject */
private $appConfig;
- /** @var VersionCheck | \PHPUnit\Framework\MockObject\MockObject*/
+ /** @var VersionCheck | \PHPUnit\Framework\MockObject\MockObject */
private $updater;
- /** @var IRegistry | \PHPUnit\Framework\Mo2ckObject\MockObject*/
+ /** @var IRegistry | \PHPUnit\Framework\Mo2ckObject\MockObject */
private $registry;
- /** @var LoggerInterface | \PHPUnit\Framework\Mo2ckObject\MockObject*/
+ /** @var LoggerInterface | \PHPUnit\Framework\Mo2ckObject\MockObject */
private $logger;
protected function setUp(): void {
@@ -66,7 +66,7 @@ class VersionCheckTest extends \Test\TestCase {
return $baseUrl . '?version='.implode('x', Util::getVersion()).'xinstalledatx' . time() . 'x'.\OC_Util::getChannel().'xxx'.PHP_MAJOR_VERSION.'x'.PHP_MINOR_VERSION.'x'.PHP_RELEASE_VERSION.'x0x0';
}
- public function testCheckInCache() {
+ public function testCheckInCache(): void {
$expectedResult = [
'version' => '8.0.4.2',
'versionstring' => 'ownCloud 8.0.4',
@@ -94,7 +94,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
- public function testCheckWithoutUpdateUrl() {
+ public function testCheckWithoutUpdateUrl(): void {
$expectedResult = [
'version' => '8.0.4.2',
'versionstring' => 'ownCloud 8.0.4',
@@ -155,7 +155,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
- public function testCheckWithInvalidXml() {
+ public function testCheckWithInvalidXml(): void {
$this->config
->expects($this->once())
->method('getSystemValueBool')
@@ -198,7 +198,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame([], $this->updater->check());
}
- public function testCheckWithEmptyValidXmlResponse() {
+ public function testCheckWithEmptyValidXmlResponse(): void {
$expectedResult = [
'version' => '',
'versionstring' => '',
@@ -258,7 +258,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
- public function testCheckWithEmptyInvalidXmlResponse() {
+ public function testCheckWithEmptyInvalidXmlResponse(): void {
$expectedResult = [];
$this->config
@@ -303,7 +303,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
- public function testCheckWithMissingAttributeXmlResponse() {
+ public function testCheckWithMissingAttributeXmlResponse(): void {
$expectedResult = [
'version' => '',
'versionstring' => '',
@@ -363,7 +363,7 @@ class VersionCheckTest extends \Test\TestCase {
$this->assertSame($expectedResult, $this->updater->check());
}
- public function testNoInternet() {
+ public function testNoInternet(): void {
$this->config
->expects($this->once())
->method('getSystemValueBool')
diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php
index 118cb1b6d41..da48e581fbc 100644
--- a/tests/lib/UpdaterTest.php
+++ b/tests/lib/UpdaterTest.php
@@ -95,7 +95,7 @@ class UpdaterTest extends TestCase {
* @param bool $debug
* @param string $vendor
*/
- public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud') {
+ public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud'): void {
$this->config->expects($this->any())
->method('getSystemValueBool')
->with('debug', false)
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index d54698b7a0a..0f5e2984ce9 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -71,7 +71,7 @@ class UrlGeneratorTest extends \Test\TestCase {
* test linkTo URL construction
* @dataProvider provideDocRootAppUrlParts
*/
- public function testLinkToDocRoot($app, $file, $args, $expectedResult) {
+ public function testLinkToDocRoot($app, $file, $args, $expectedResult): void {
\OC::$WEBROOT = '';
$result = $this->urlGenerator->linkTo($app, $file, $args);
$this->assertEquals($expectedResult, $result);
@@ -82,7 +82,7 @@ class UrlGeneratorTest extends \Test\TestCase {
* test linkTo URL construction in sub directory
* @dataProvider provideSubDirAppUrlParts
*/
- public function testLinkToSubDir($app, $file, $args, $expectedResult) {
+ public function testLinkToSubDir($app, $file, $args, $expectedResult): void {
\OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->linkTo($app, $file, $args);
$this->assertEquals($expectedResult, $result);
@@ -91,7 +91,7 @@ class UrlGeneratorTest extends \Test\TestCase {
/**
* @dataProvider provideRoutes
*/
- public function testLinkToRouteAbsolute($route, $expected) {
+ public function testLinkToRouteAbsolute($route, $expected): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
$this->router->expects($this->once())
@@ -135,7 +135,7 @@ class UrlGeneratorTest extends \Test\TestCase {
* test absolute URL construction
* @dataProvider provideDocRootURLs
*/
- public function testGetAbsoluteURLDocRoot($url, $expectedResult) {
+ public function testGetAbsoluteURLDocRoot($url, $expectedResult): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '';
$result = $this->urlGenerator->getAbsoluteURL($url);
@@ -147,7 +147,7 @@ class UrlGeneratorTest extends \Test\TestCase {
* test absolute URL construction
* @dataProvider provideSubDirURLs
*/
- public function testGetAbsoluteURLSubDir($url, $expectedResult) {
+ public function testGetAbsoluteURLSubDir($url, $expectedResult): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
$result = $this->urlGenerator->getAbsoluteURL($url);
@@ -174,7 +174,7 @@ class UrlGeneratorTest extends \Test\TestCase {
];
}
- public function testGetBaseUrl() {
+ public function testGetBaseUrl(): void {
$this->mockBaseUrl();
\OC::$WEBROOT = '/nextcloud';
$actual = $this->urlGenerator->getBaseUrl();
@@ -182,7 +182,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->assertEquals($expected, $actual);
}
- public function testGetWebroot() {
+ public function testGetWebroot(): void {
\OC::$WEBROOT = '/nextcloud';
$actual = $this->urlGenerator->getWebroot();
$this->assertEquals(\OC::$WEBROOT, $actual);
@@ -234,14 +234,14 @@ class UrlGeneratorTest extends \Test\TestCase {
->willReturn($ignoreFrontControllerConfig);
}
- public function testLinkToDefaultPageUrlWithRedirectUrlWithoutFrontController() {
+ public function testLinkToDefaultPageUrlWithRedirectUrlWithoutFrontController(): void {
$this->mockBaseUrl();
$_REQUEST['redirect_url'] = 'myRedirectUrl.com';
$this->assertSame('http://localhost' . \OC::$WEBROOT . '/myRedirectUrl.com', $this->urlGenerator->linkToDefaultPageUrl());
}
- public function testLinkToDefaultPageUrlWithRedirectUrlRedirectBypassWithoutFrontController() {
+ public function testLinkToDefaultPageUrlWithRedirectUrlRedirectBypassWithoutFrontController(): void {
$this->mockBaseUrl();
$this->mockLinkToDefaultPageUrl();
putenv('front_controller_active=false');
@@ -250,7 +250,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->assertSame('http://localhost' . \OC::$WEBROOT . '/index.php/apps/dashboard/', $this->urlGenerator->linkToDefaultPageUrl());
}
- public function testLinkToDefaultPageUrlWithRedirectUrlRedirectBypassWithFrontController() {
+ public function testLinkToDefaultPageUrlWithRedirectUrlRedirectBypassWithFrontController(): void {
$this->mockBaseUrl();
$this->mockLinkToDefaultPageUrl();
putenv('front_controller_active=true');
@@ -259,7 +259,7 @@ class UrlGeneratorTest extends \Test\TestCase {
$this->assertSame('http://localhost' . \OC::$WEBROOT . '/apps/dashboard/', $this->urlGenerator->linkToDefaultPageUrl());
}
- public function testLinkToDefaultPageUrlWithRedirectUrlWithIgnoreFrontController() {
+ public function testLinkToDefaultPageUrlWithRedirectUrlWithIgnoreFrontController(): void {
$this->mockBaseUrl();
$this->mockLinkToDefaultPageUrl(true);
putenv('front_controller_active=false');
diff --git a/tests/lib/User/Backend.php b/tests/lib/User/Backend.php
index 7efba2eaeb6..ed17776476a 100644
--- a/tests/lib/User/Backend.php
+++ b/tests/lib/User/Backend.php
@@ -32,7 +32,7 @@ abstract class Backend extends \Test\TestCase {
return $this->getUniqueID('test_');
}
- public function testAddRemove() {
+ public function testAddRemove(): void {
//get the number of groups we start with, in case there are exising groups
$startCount = count($this->backend->getUsers());
@@ -56,7 +56,7 @@ abstract class Backend extends \Test\TestCase {
$this->assertFalse((array_search($name2, $this->backend->getUsers()) !== false));
}
- public function testLogin() {
+ public function testLogin(): void {
$name1 = $this->getUser();
$name2 = $this->getUser();
@@ -84,7 +84,7 @@ abstract class Backend extends \Test\TestCase {
$this->assertFalse($this->backend->checkPassword($name2, 'newpass1'));
}
- public function testSearch() {
+ public function testSearch(): void {
$name1 = 'foobarbaz';
$name2 = 'bazbarfoo';
$name3 = 'notme';
diff --git a/tests/lib/User/DatabaseTest.php b/tests/lib/User/DatabaseTest.php
index 16b223aaaba..bd74ab333fb 100644
--- a/tests/lib/User/DatabaseTest.php
+++ b/tests/lib/User/DatabaseTest.php
@@ -49,7 +49,7 @@ class DatabaseTest extends Backend {
parent::tearDown();
}
- public function testVerifyPasswordEvent() {
+ public function testVerifyPasswordEvent(): void {
$user = $this->getUser();
$this->backend->createUser($user, 'pass1');
@@ -67,7 +67,7 @@ class DatabaseTest extends Backend {
}
- public function testVerifyPasswordEventFail() {
+ public function testVerifyPasswordEventFail(): void {
$this->expectException(\OCP\HintException::class);
$this->expectExceptionMessage('password change failed');
@@ -88,14 +88,14 @@ class DatabaseTest extends Backend {
$this->assertSame($user, $this->backend->checkPassword($user, 'newpass'));
}
- public function testCreateUserInvalidatesCache() {
+ public function testCreateUserInvalidatesCache(): void {
$user1 = $this->getUniqueID('test_');
$this->assertFalse($this->backend->userExists($user1));
$this->backend->createUser($user1, 'pw');
$this->assertTrue($this->backend->userExists($user1));
}
- public function testDeleteUserInvalidatesCache() {
+ public function testDeleteUserInvalidatesCache(): void {
$user1 = $this->getUniqueID('test_');
$this->backend->createUser($user1, 'pw');
$this->assertTrue($this->backend->userExists($user1));
@@ -105,7 +105,7 @@ class DatabaseTest extends Backend {
$this->assertTrue($this->backend->userExists($user1));
}
- public function testSearch() {
+ public function testSearch(): void {
parent::testSearch();
$user1 = $this->getUser();
diff --git a/tests/lib/User/ManagerTest.php b/tests/lib/User/ManagerTest.php
index c516b1de945..302cba4ea2b 100644
--- a/tests/lib/User/ManagerTest.php
+++ b/tests/lib/User/ManagerTest.php
@@ -47,7 +47,7 @@ class ManagerTest extends TestCase {
->willReturn($this->cache);
}
- public function testGetBackends() {
+ public function testGetBackends(): void {
$userDummyBackend = $this->createMock(\Test\Util\User\Dummy::class);
$manager = new \OC\User\Manager($this->config, $this->cacheFactory, $this->eventDispatcher);
$manager->registerBackend($userDummyBackend);
@@ -58,7 +58,7 @@ class ManagerTest extends TestCase {
}
- public function testUserExistsSingleBackendExists() {
+ public function testUserExistsSingleBackendExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -74,7 +74,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($manager->userExists('foo'));
}
- public function testUserExistsSingleBackendNotExists() {
+ public function testUserExistsSingleBackendNotExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -90,13 +90,13 @@ class ManagerTest extends TestCase {
$this->assertFalse($manager->userExists('foo'));
}
- public function testUserExistsNoBackends() {
+ public function testUserExistsNoBackends(): void {
$manager = new \OC\User\Manager($this->config, $this->cacheFactory, $this->eventDispatcher);
$this->assertFalse($manager->userExists('foo'));
}
- public function testUserExistsTwoBackendsSecondExists() {
+ public function testUserExistsTwoBackendsSecondExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
@@ -122,7 +122,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($manager->userExists('foo'));
}
- public function testUserExistsTwoBackendsFirstExists() {
+ public function testUserExistsTwoBackendsFirstExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
@@ -146,7 +146,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($manager->userExists('foo'));
}
- public function testCheckPassword() {
+ public function testCheckPassword(): void {
/**
* @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -173,7 +173,7 @@ class ManagerTest extends TestCase {
$this->assertTrue($user instanceof \OC\User\User);
}
- public function testCheckPasswordNotSupported() {
+ public function testCheckPasswordNotSupported(): void {
/**
* @var \OC\User\Backend | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -191,7 +191,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($manager->checkPassword('foo', 'bar'));
}
- public function testGetOneBackendExists() {
+ public function testGetOneBackendExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -209,7 +209,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('foo', $manager->get('foo')->getUID());
}
- public function testGetOneBackendNotExists() {
+ public function testGetOneBackendNotExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -225,7 +225,7 @@ class ManagerTest extends TestCase {
$this->assertEquals(null, $manager->get('foo'));
}
- public function testGetOneBackendDoNotTranslateLoginNames() {
+ public function testGetOneBackendDoNotTranslateLoginNames(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -243,7 +243,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('bLeNdEr', $manager->get('bLeNdEr')->getUID());
}
- public function testSearchOneBackend() {
+ public function testSearchOneBackend(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -266,7 +266,7 @@ class ManagerTest extends TestCase {
$this->assertEquals('foo', array_shift($result)->getUID());
}
- public function testSearchTwoBackendLimitOffset() {
+ public function testSearchTwoBackendLimitOffset(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend1
*/
@@ -334,7 +334,7 @@ class ManagerTest extends TestCase {
/**
* @dataProvider dataCreateUserInvalid
*/
- public function testCreateUserInvalid($uid, $password, $exception) {
+ public function testCreateUserInvalid($uid, $password, $exception): void {
/** @var \Test\Util\User\Dummy|\PHPUnit\Framework\MockObject\MockObject $backend */
$backend = $this->createMock(\Test\Util\User\Dummy::class);
$backend->expects($this->once())
@@ -350,7 +350,7 @@ class ManagerTest extends TestCase {
$manager->createUser($uid, $password);
}
- public function testCreateUserSingleBackendNotExists() {
+ public function testCreateUserSingleBackendNotExists(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -378,7 +378,7 @@ class ManagerTest extends TestCase {
}
- public function testCreateUserSingleBackendExists() {
+ public function testCreateUserSingleBackendExists(): void {
$this->expectException(\Exception::class);
/**
@@ -403,7 +403,7 @@ class ManagerTest extends TestCase {
$manager->createUser('foo', 'bar');
}
- public function testCreateUserSingleBackendNotSupported() {
+ public function testCreateUserSingleBackendNotSupported(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -424,14 +424,14 @@ class ManagerTest extends TestCase {
$this->assertFalse($manager->createUser('foo', 'bar'));
}
- public function testCreateUserNoBackends() {
+ public function testCreateUserNoBackends(): void {
$manager = new \OC\User\Manager($this->config, $this->cacheFactory, $this->eventDispatcher);
$this->assertFalse($manager->createUser('foo', 'bar'));
}
- public function testCreateUserFromBackendWithBackendError() {
+ public function testCreateUserFromBackendWithBackendError(): void {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Could not create account');
@@ -450,7 +450,7 @@ class ManagerTest extends TestCase {
}
- public function testCreateUserTwoBackendExists() {
+ public function testCreateUserTwoBackendExists(): void {
$this->expectException(\Exception::class);
/**
@@ -492,7 +492,7 @@ class ManagerTest extends TestCase {
$manager->createUser('foo', 'bar');
}
- public function testCountUsersNoBackend() {
+ public function testCountUsersNoBackend(): void {
$manager = new \OC\User\Manager($this->config, $this->cacheFactory, $this->eventDispatcher);
$result = $manager->countUsers();
@@ -500,7 +500,7 @@ class ManagerTest extends TestCase {
$this->assertTrue(empty($result));
}
- public function testCountUsersOneBackend() {
+ public function testCountUsersOneBackend(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -529,7 +529,7 @@ class ManagerTest extends TestCase {
$this->assertEquals(7, $users);
}
- public function testCountUsersTwoBackends() {
+ public function testCountUsersTwoBackends(): void {
/**
* @var \Test\Util\User\Dummy | \PHPUnit\Framework\MockObject\MockObject $backend
*/
@@ -574,7 +574,7 @@ class ManagerTest extends TestCase {
$this->assertEquals(7 + 16, $users);
}
- public function testCountUsersOnlyDisabled() {
+ public function testCountUsersOnlyDisabled(): void {
$manager = \OC::$server->getUserManager();
// count other users in the db before adding our own
$countBefore = $manager->countDisabledUsers();
@@ -599,7 +599,7 @@ class ManagerTest extends TestCase {
$user4->delete();
}
- public function testCountUsersOnlySeen() {
+ public function testCountUsersOnlySeen(): void {
$manager = \OC::$server->getUserManager();
// count other users in the db before adding our own
$countBefore = $manager->countSeenUsers();
@@ -625,7 +625,7 @@ class ManagerTest extends TestCase {
$user4->delete();
}
- public function testCallForSeenUsers() {
+ public function testCallForSeenUsers(): void {
$manager = \OC::$server->getUserManager();
// count other users in the db before adding our own
$count = 0;
@@ -659,7 +659,7 @@ class ManagerTest extends TestCase {
$user4->delete();
}
- public function testDeleteUser() {
+ public function testDeleteUser(): void {
$config = $this->getMockBuilder(AllConfig::class)
->disableOriginalConstructor()
->getMock();
@@ -682,7 +682,7 @@ class ManagerTest extends TestCase {
$this->assertFalse($manager->userExists('foo'));
}
- public function testGetByEmail() {
+ public function testGetByEmail(): void {
$config = $this->getMockBuilder(AllConfig::class)
->disableOriginalConstructor()
->getMock();
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index 236da2a1dcc..fad5d11565c 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -113,8 +113,8 @@ class SessionTest extends \Test\TestCase {
/**
* @dataProvider isLoggedInData
*/
- public function testIsLoggedIn($isLoggedIn) {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testIsLoggedIn($isLoggedIn): void {
+ $session = $this->createMock(Memory::class);
$manager = $this->createMock(Manager::class);
@@ -131,8 +131,8 @@ class SessionTest extends \Test\TestCase {
$this->assertEquals($isLoggedIn, $userSession->isLoggedIn());
}
- public function testSetUser() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testSetUser(): void {
+ $session = $this->createMock(Memory::class);
$session->expects($this->once())
->method('set')
->with('user_id', 'foo');
@@ -150,8 +150,8 @@ class SessionTest extends \Test\TestCase {
$userSession->setUser($user);
}
- public function testLoginValidPasswordEnabled() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testLoginValidPasswordEnabled(): void {
+ $session = $this->createMock(Memory::class);
$session->expects($this->once())
->method('regenerateId');
$this->tokenProvider->expects($this->once())
@@ -225,10 +225,10 @@ class SessionTest extends \Test\TestCase {
}
- public function testLoginValidPasswordDisabled() {
+ public function testLoginValidPasswordDisabled(): void {
$this->expectException(LoginException::class);
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ $session = $this->createMock(Memory::class);
$session->expects($this->never())
->method('set');
$session->expects($this->once())
@@ -269,8 +269,8 @@ class SessionTest extends \Test\TestCase {
$userSession->login('foo', 'bar');
}
- public function testLoginInvalidPassword() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testLoginInvalidPassword(): void {
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
//keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -313,7 +313,7 @@ class SessionTest extends \Test\TestCase {
}
public function testPasswordlessLoginNoLastCheckUpdate(): void {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
// Keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -350,7 +350,7 @@ class SessionTest extends \Test\TestCase {
}
public function testLoginLastCheckUpdate(): void {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
// Keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -386,8 +386,8 @@ class SessionTest extends \Test\TestCase {
$userSession->login('foo', 'app-password');
}
- public function testLoginNonExisting() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testLoginNonExisting(): void {
+ $session = $this->createMock(Memory::class);
$manager = $this->createMock(Manager::class);
$userSession = new Session($manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher);
@@ -408,7 +408,7 @@ class SessionTest extends \Test\TestCase {
$userSession->login('foo', 'bar');
}
- public function testLogClientInNoTokenPasswordWith2fa() {
+ public function testLogClientInNoTokenPasswordWith2fa(): void {
$this->expectException(PasswordLoginForbiddenException::class);
$manager = $this->createMock(Manager::class);
@@ -446,7 +446,7 @@ class SessionTest extends \Test\TestCase {
$userSession->logClientIn('john', 'doe', $request, $this->throttler);
}
- public function testLogClientInUnexist() {
+ public function testLogClientInUnexist(): void {
$manager = $this->createMock(Manager::class);
$session = $this->createMock(ISession::class);
$request = $this->createMock(IRequest::class);
@@ -472,7 +472,7 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($userSession->logClientIn('unexist', 'doe', $request, $this->throttler));
}
- public function testLogClientInWithTokenPassword() {
+ public function testLogClientInWithTokenPassword(): void {
$manager = $this->createMock(Manager::class);
$session = $this->createMock(ISession::class);
$request = $this->createMock(IRequest::class);
@@ -512,7 +512,7 @@ class SessionTest extends \Test\TestCase {
}
- public function testLogClientInNoTokenPasswordNo2fa() {
+ public function testLogClientInNoTokenPasswordNo2fa(): void {
$this->expectException(PasswordLoginForbiddenException::class);
$manager = $this->createMock(Manager::class);
@@ -606,8 +606,8 @@ class SessionTest extends \Test\TestCase {
self::assertFalse($loginResult);
}
- public function testRememberLoginValidToken() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testRememberLoginValidToken(): void {
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
//keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -695,8 +695,8 @@ class SessionTest extends \Test\TestCase {
$this->assertTrue($granted);
}
- public function testRememberLoginInvalidSessionToken() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testRememberLoginInvalidSessionToken(): void {
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
//keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -759,8 +759,8 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($granted);
}
- public function testRememberLoginInvalidToken() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testRememberLoginInvalidToken(): void {
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
//keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -811,8 +811,8 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($granted);
}
- public function testRememberLoginInvalidUser() {
- $session = $this->getMockBuilder(Memory::class)->setConstructorArgs([''])->getMock();
+ public function testRememberLoginInvalidUser(): void {
+ $session = $this->createMock(Memory::class);
$managerMethods = get_class_methods(Manager::class);
//keep following methods intact in order to ensure hooks are working
$mockedManagerMethods = array_diff($managerMethods, ['__construct', 'emit', 'listen']);
@@ -856,7 +856,7 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($granted);
}
- public function testActiveUserAfterSetSession() {
+ public function testActiveUserAfterSetSession(): void {
$users = [
'foo' => new User('foo', null, $this->createMock(IEventDispatcher::class)),
'bar' => new User('bar', null, $this->createMock(IEventDispatcher::class))
@@ -872,7 +872,7 @@ class SessionTest extends \Test\TestCase {
return $users[$uid];
});
- $session = new Memory('');
+ $session = new Memory();
$session->set('user_id', 'foo');
$userSession = $this->getMockBuilder(Session::class)
->setConstructorArgs([$manager, $session, $this->timeFactory, $this->tokenProvider, $this->config, $this->random, $this->lockdownManager, $this->logger, $this->dispatcher])
@@ -885,13 +885,13 @@ class SessionTest extends \Test\TestCase {
$this->assertEquals($users['foo'], $userSession->getUser());
- $session2 = new Memory('');
+ $session2 = new Memory();
$session2->set('user_id', 'bar');
$userSession->setSession($session2);
$this->assertEquals($users['bar'], $userSession->getUser());
}
- public function testCreateSessionToken() {
+ public function testCreateSessionToken(): void {
$manager = $this->createMock(Manager::class);
$session = $this->createMock(ISession::class);
$user = $this->createMock(IUser::class);
@@ -932,7 +932,7 @@ class SessionTest extends \Test\TestCase {
$this->assertTrue($userSession->createSessionToken($request, $uid, $loginName, $password));
}
- public function testCreateRememberedSessionToken() {
+ public function testCreateRememberedSessionToken(): void {
$manager = $this->createMock(Manager::class);
$session = $this->createMock(ISession::class);
$user = $this->createMock(IUser::class);
@@ -973,7 +973,7 @@ class SessionTest extends \Test\TestCase {
$this->assertTrue($userSession->createSessionToken($request, $uid, $loginName, $password, true));
}
- public function testCreateSessionTokenWithTokenPassword() {
+ public function testCreateSessionTokenWithTokenPassword(): void {
$manager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()
->getMock();
@@ -1022,7 +1022,7 @@ class SessionTest extends \Test\TestCase {
$this->assertTrue($userSession->createSessionToken($request, $uid, $loginName, $password));
}
- public function testCreateSessionTokenWithNonExistentUser() {
+ public function testCreateSessionTokenWithNonExistentUser(): void {
$manager = $this->getMockBuilder(Manager::class)
->disableOriginalConstructor()
->getMock();
@@ -1042,7 +1042,7 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($userSession->createSessionToken($request, $uid, $loginName, $password));
}
- public function testCreateRememberMeToken() {
+ public function testCreateRememberMeToken(): void {
$user = $this->createMock(IUser::class);
$user
->expects($this->exactly(2))
@@ -1065,7 +1065,7 @@ class SessionTest extends \Test\TestCase {
$this->userSession->createRememberMeToken($user);
}
- public function testTryBasicAuthLoginValid() {
+ public function testTryBasicAuthLoginValid(): void {
$request = $this->createMock(Request::class);
$request->method('__get')
->willReturn([
@@ -1135,7 +1135,7 @@ class SessionTest extends \Test\TestCase {
$this->assertSame(1000, $lastPasswordConfirmSet);
}
- public function testTryBasicAuthLoginNoLogin() {
+ public function testTryBasicAuthLoginNoLogin(): void {
$request = $this->createMock(Request::class);
$request->method('__get')
->willReturn([]);
@@ -1170,7 +1170,7 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($userSession->tryBasicAuthLogin($request, $this->throttler));
}
- public function testUpdateTokens() {
+ public function testUpdateTokens(): void {
$this->tokenProvider->expects($this->once())
->method('updatePasswords')
->with('uid', 'pass');
@@ -1178,7 +1178,7 @@ class SessionTest extends \Test\TestCase {
$this->userSession->updateTokens('uid', 'pass');
}
- public function testLogClientInThrottlerUsername() {
+ public function testLogClientInThrottlerUsername(): void {
$manager = $this->createMock(Manager::class);
$session = $this->createMock(ISession::class);
$request = $this->createMock(IRequest::class);
@@ -1224,7 +1224,7 @@ class SessionTest extends \Test\TestCase {
$this->assertFalse($userSession->logClientIn('john', 'I-AM-AN-PASSWORD', $request, $this->throttler));
}
- public function testLogClientInThrottlerEmail() {
+ public function testLogClientInThrottlerEmail(): void {
$manager = $this->createMock(Manager::class);
$session = $this->createMock(ISession::class);
$request = $this->createMock(IRequest::class);
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index 8e62c06e1ba..55230b83667 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -41,7 +41,7 @@ class UserTest extends TestCase {
$this->dispatcher = Server::get(IEventDispatcher::class);
}
- public function testDisplayName() {
+ public function testDisplayName(): void {
/**
* @var \OC\User\Backend | MockObject $backend
*/
@@ -63,7 +63,7 @@ class UserTest extends TestCase {
/**
* if the display name contain whitespaces only, we expect the uid as result
*/
- public function testDisplayNameEmpty() {
+ public function testDisplayNameEmpty(): void {
/**
* @var \OC\User\Backend | MockObject $backend
*/
@@ -82,7 +82,7 @@ class UserTest extends TestCase {
$this->assertEquals('foo', $user->getDisplayName());
}
- public function testDisplayNameNotSupported() {
+ public function testDisplayNameNotSupported(): void {
/**
* @var \OC\User\Backend | MockObject $backend
*/
@@ -99,7 +99,7 @@ class UserTest extends TestCase {
$this->assertEquals('foo', $user->getDisplayName());
}
- public function testSetPassword() {
+ public function testSetPassword(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -122,7 +122,7 @@ class UserTest extends TestCase {
$this->assertTrue($user->setPassword('bar', ''));
}
- public function testSetPasswordNotSupported() {
+ public function testSetPasswordNotSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -138,7 +138,7 @@ class UserTest extends TestCase {
$this->assertFalse($user->setPassword('bar', ''));
}
- public function testChangeAvatarSupportedYes() {
+ public function testChangeAvatarSupportedYes(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -162,7 +162,7 @@ class UserTest extends TestCase {
$this->assertTrue($user->canChangeAvatar());
}
- public function testChangeAvatarSupportedNo() {
+ public function testChangeAvatarSupportedNo(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -186,7 +186,7 @@ class UserTest extends TestCase {
$this->assertFalse($user->canChangeAvatar());
}
- public function testChangeAvatarNotSupported() {
+ public function testChangeAvatarNotSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -202,7 +202,7 @@ class UserTest extends TestCase {
$this->assertTrue($user->canChangeAvatar());
}
- public function testDelete() {
+ public function testDelete(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -215,14 +215,14 @@ class UserTest extends TestCase {
$this->assertTrue($user->delete());
}
- public function testDeleteWithDifferentHome() {
+ public function testDeleteWithDifferentHome(): void {
/** @var ObjectHomeMountProvider $homeProvider */
$homeProvider = \OC::$server->get(ObjectHomeMountProvider::class);
$user = $this->createMock(IUser::class);
$user->method('getUID')
->willReturn('foo');
if ($homeProvider->getHomeMountForUser($user, $this->createMock(IStorageFactory::class)) !== null) {
- $this->markTestSkipped("Skipping test for non local home storage");
+ $this->markTestSkipped('Skipping test for non local home storage');
}
/**
@@ -256,7 +256,7 @@ class UserTest extends TestCase {
$this->assertTrue($user->delete());
}
- public function testGetHome() {
+ public function testGetHome(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -280,14 +280,14 @@ class UserTest extends TestCase {
$this->assertEquals('/home/foo', $user->getHome());
}
- public function testGetBackendClassName() {
+ public function testGetBackendClassName(): void {
$user = new User('foo', new \Test\Util\User\Dummy(), $this->dispatcher);
$this->assertEquals('Dummy', $user->getBackendClassName());
$user = new User('foo', new \OC\User\Database(), $this->dispatcher);
$this->assertEquals('Database', $user->getBackendClassName());
}
- public function testGetHomeNotSupported() {
+ public function testGetHomeNotSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -314,7 +314,7 @@ class UserTest extends TestCase {
$this->assertEquals('arbitrary/path/foo', $user->getHome());
}
- public function testCanChangePassword() {
+ public function testCanChangePassword(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -334,7 +334,7 @@ class UserTest extends TestCase {
$this->assertTrue($user->canChangePassword());
}
- public function testCanChangePasswordNotSupported() {
+ public function testCanChangePasswordNotSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -348,7 +348,7 @@ class UserTest extends TestCase {
$this->assertFalse($user->canChangePassword());
}
- public function testCanChangeDisplayName() {
+ public function testCanChangeDisplayName(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -373,7 +373,7 @@ class UserTest extends TestCase {
$this->assertTrue($user->canChangeDisplayName());
}
- public function testCanChangeDisplayNameNotSupported() {
+ public function testCanChangeDisplayNameNotSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -387,7 +387,7 @@ class UserTest extends TestCase {
$this->assertFalse($user->canChangeDisplayName());
}
- public function testSetDisplayNameSupported() {
+ public function testSetDisplayNameSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -416,7 +416,7 @@ class UserTest extends TestCase {
/**
* don't allow display names containing whitespaces only
*/
- public function testSetDisplayNameEmpty() {
+ public function testSetDisplayNameEmpty(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -437,7 +437,7 @@ class UserTest extends TestCase {
$this->assertEquals('foo', $user->getDisplayName());
}
- public function testSetDisplayNameNotSupported() {
+ public function testSetDisplayNameNotSupported(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -455,7 +455,7 @@ class UserTest extends TestCase {
$this->assertEquals('foo', $user->getDisplayName());
}
- public function testSetPasswordHooks() {
+ public function testSetPasswordHooks(): void {
$hooksCalled = 0;
$test = $this;
@@ -508,7 +508,7 @@ class UserTest extends TestCase {
* @param bool $result
* @param int $expectedHooks
*/
- public function testDeleteHooks($result, $expectedHooks) {
+ public function testDeleteHooks($result, $expectedHooks): void {
$hooksCalled = 0;
$test = $this;
@@ -618,7 +618,7 @@ class UserTest extends TestCase {
$this->assertEquals($cloudId, $user->getCloudId());
}
- public function testSetEMailAddressEmpty() {
+ public function testSetEMailAddressEmpty(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -654,7 +654,7 @@ class UserTest extends TestCase {
$user->setEMailAddress('');
}
- public function testSetEMailAddress() {
+ public function testSetEMailAddress(): void {
/**
* @var UserInterface | MockObject $backend
*/
@@ -691,7 +691,7 @@ class UserTest extends TestCase {
$user->setEMailAddress('foo@bar.com');
}
- public function testSetEMailAddressNoChange() {
+ public function testSetEMailAddressNoChange(): void {
/**
* @var UserInterface | MockObject $backend
*/
@@ -717,7 +717,7 @@ class UserTest extends TestCase {
$user->setEMailAddress('foo@bar.com');
}
- public function testSetQuota() {
+ public function testSetQuota(): void {
/**
* @var UserInterface | MockObject $backend
*/
@@ -754,7 +754,7 @@ class UserTest extends TestCase {
$user->setQuota('23 TB');
}
- public function testGetDefaultUnlimitedQuota() {
+ public function testGetDefaultUnlimitedQuota(): void {
/**
* @var UserInterface | MockObject $backend
*/
@@ -785,7 +785,7 @@ class UserTest extends TestCase {
$this->assertEquals('none', $quota);
}
- public function testGetDefaultUnlimitedQuotaForbidden() {
+ public function testGetDefaultUnlimitedQuotaForbidden(): void {
/**
* @var UserInterface | MockObject $backend
*/
@@ -819,7 +819,7 @@ class UserTest extends TestCase {
$this->assertEquals('1 GB', $quota);
}
- public function testSetQuotaAddressNoChange() {
+ public function testSetQuotaAddressNoChange(): void {
/**
* @var UserInterface | MockObject $backend
*/
@@ -841,7 +841,7 @@ class UserTest extends TestCase {
$user->setQuota('23 TB');
}
- public function testGetLastLogin() {
+ public function testGetLastLogin(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -861,7 +861,7 @@ class UserTest extends TestCase {
$this->assertSame(42, $user->getLastLogin());
}
- public function testSetEnabled() {
+ public function testSetEnabled(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -881,7 +881,7 @@ class UserTest extends TestCase {
$user->setEnabled(true);
}
- public function testSetDisabled() {
+ public function testSetDisabled(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -921,7 +921,7 @@ class UserTest extends TestCase {
$user->setEnabled(false);
}
- public function testSetDisabledAlreadyDisabled() {
+ public function testSetDisabledAlreadyDisabled(): void {
/**
* @var Backend | MockObject $backend
*/
@@ -951,7 +951,7 @@ class UserTest extends TestCase {
$user->setEnabled(false);
}
- public function testGetEMailAddress() {
+ public function testGetEMailAddress(): void {
/**
* @var Backend | MockObject $backend
*/
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php
index f0cc8a57e6f..ca4cd7d108f 100644
--- a/tests/lib/UtilCheckServerTest.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -39,20 +39,20 @@ class UtilCheckServerTest extends \Test\TestCase {
$this->datadir = \OC::$server->getTempManager()->getTemporaryFolder();
- file_put_contents($this->datadir . '/.ocdata', '');
+ file_put_contents($this->datadir . '/.ncdata', '# Nextcloud data directory');
\OC::$server->getSession()->set('checkServer_succeeded', false);
}
protected function tearDown(): void {
// clean up
- @unlink($this->datadir . '/.ocdata');
+ @unlink($this->datadir . '/.ncdata');
parent::tearDown();
}
/**
* Test that checkServer() returns no errors in the regular case.
*/
- public function testCheckServer() {
+ public function testCheckServer(): void {
$result = \OC_Util::checkServer($this->getConfig([
'installed' => true
]));
@@ -64,11 +64,11 @@ class UtilCheckServerTest extends \Test\TestCase {
* when the server is not installed yet (else the setup cannot
* be run...)
*/
- public function testCheckServerSkipDataDirValidityOnSetup() {
+ public function testCheckServerSkipDataDirValidityOnSetup(): void {
// simulate old version that didn't have it
- unlink($this->datadir . '/.ocdata');
+ unlink($this->datadir . '/.ncdata');
- // even though ".ocdata" is missing, the error isn't
+ // even though ".ncdata" is missing, the error isn't
// triggered to allow setup to run
$result = \OC_Util::checkServer($this->getConfig([
'installed' => false
@@ -81,9 +81,9 @@ class UtilCheckServerTest extends \Test\TestCase {
* when an upgrade is required (else the upgrade cannot be
* performed...)
*/
- public function testCheckServerSkipDataDirValidityOnUpgrade() {
+ public function testCheckServerSkipDataDirValidityOnUpgrade(): void {
// simulate old version that didn't have it
- unlink($this->datadir . '/.ocdata');
+ unlink($this->datadir . '/.ncdata');
$session = \OC::$server->getSession();
$oldCurrentVersion = $session->get('OC_Version');
@@ -91,7 +91,7 @@ class UtilCheckServerTest extends \Test\TestCase {
// upgrade condition to simulate needUpgrade() === true
$session->set('OC_Version', [6, 0, 0, 2]);
- // even though ".ocdata" is missing, the error isn't
+ // even though ".ncdata" is missing, the error isn't
// triggered to allow for upgrade
$result = \OC_Util::checkServer($this->getConfig([
'installed' => true,
@@ -105,19 +105,19 @@ class UtilCheckServerTest extends \Test\TestCase {
/**
* Test that checkDataDirectoryValidity returns no error
- * when ".ocdata" is present.
+ * when ".ncdata" is present.
*/
- public function testCheckDataDirValidity() {
+ public function testCheckDataDirValidity(): void {
$result = \OC_Util::checkDataDirectoryValidity($this->datadir);
$this->assertEmpty($result);
}
/**
* Test that checkDataDirectoryValidity and checkServer
- * both return an error when ".ocdata" is missing.
+ * both return an error when ".ncdata" is missing.
*/
- public function testCheckDataDirValidityWhenFileMissing() {
- unlink($this->datadir . '/.ocdata');
+ public function testCheckDataDirValidityWhenFileMissing(): void {
+ unlink($this->datadir . '/.ncdata');
$result = \OC_Util::checkDataDirectoryValidity($this->datadir);
$this->assertEquals(1, count($result));
@@ -131,7 +131,7 @@ class UtilCheckServerTest extends \Test\TestCase {
/**
* Tests that no error is given when the datadir is writable
*/
- public function testDataDirWritable() {
+ public function testDataDirWritable(): void {
$result = \OC_Util::checkServer($this->getConfig([
'installed' => true,
'version' => implode('.', \OCP\Util::getVersion())
@@ -142,7 +142,7 @@ class UtilCheckServerTest extends \Test\TestCase {
/**
* Tests an error is given when the datadir is not writable
*/
- public function testDataDirNotWritable() {
+ public function testDataDirNotWritable(): void {
$this->markTestSkipped('TODO: Disable because fails on drone');
chmod($this->datadir, 0300);
@@ -156,7 +156,7 @@ class UtilCheckServerTest extends \Test\TestCase {
/**
* Tests no error is given when the datadir is not writable during setup
*/
- public function testDataDirNotWritableSetup() {
+ public function testDataDirNotWritableSetup(): void {
chmod($this->datadir, 0300);
$result = \OC_Util::checkServer($this->getConfig([
'installed' => false,
diff --git a/tests/lib/UtilTest.php b/tests/lib/UtilTest.php
index 82897cbca29..064b73d0b7e 100644
--- a/tests/lib/UtilTest.php
+++ b/tests/lib/UtilTest.php
@@ -16,7 +16,7 @@ use OC_Util;
* @group DB
*/
class UtilTest extends \Test\TestCase {
- public function testGetVersion() {
+ public function testGetVersion(): void {
$version = \OCP\Util::getVersion();
$this->assertTrue(is_array($version));
foreach ($version as $num) {
@@ -24,17 +24,17 @@ class UtilTest extends \Test\TestCase {
}
}
- public function testGetVersionString() {
+ public function testGetVersionString(): void {
$version = \OC_Util::getVersionString();
$this->assertTrue(is_string($version));
}
- public function testGetEditionString() {
+ public function testGetEditionString(): void {
$edition = \OC_Util::getEditionString();
$this->assertTrue(is_string($edition));
}
- public function testSanitizeHTML() {
+ public function testSanitizeHTML(): void {
$badArray = [
'While it is unusual to pass an array',
'this function actually <blink>supports</blink> it.',
@@ -67,13 +67,13 @@ class UtilTest extends \Test\TestCase {
$this->assertEquals('This is a good string without HTML.', $result);
}
- public function testEncodePath() {
+ public function testEncodePath(): void {
$component = '/§#@test%&^ä/-child';
$result = OC_Util::encodePath($component);
- $this->assertEquals("/%C2%A7%23%40test%25%26%5E%C3%A4/-child", $result);
+ $this->assertEquals('/%C2%A7%23%40test%25%26%5E%C3%A4/-child', $result);
}
- public function testIsNonUTF8Locale() {
+ public function testIsNonUTF8Locale(): void {
// OC_Util::isNonUTF8Locale() assumes escapeshellcmd('§') returns '' with non-UTF-8 locale.
$locale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'C');
@@ -85,7 +85,7 @@ class UtilTest extends \Test\TestCase {
setlocale(LC_CTYPE, $locale);
}
- public function testFileInfoLoaded() {
+ public function testFileInfoLoaded(): void {
$expected = function_exists('finfo_open');
$this->assertEquals($expected, \OC_Util::fileInfoLoaded());
}
@@ -95,41 +95,41 @@ class UtilTest extends \Test\TestCase {
* but not for default strict email verification that requires a top level domain.
* So we check that with strict email verification we fallback to the default
*/
- public function testGetDefaultEmailAddressStrict() {
- $email = \OCP\Util::getDefaultEmailAddress("no-reply");
+ public function testGetDefaultEmailAddressStrict(): void {
+ $email = \OCP\Util::getDefaultEmailAddress('no-reply');
$this->assertEquals('no-reply@localhost.localdomain', $email);
}
/**
* If no strict email check is enabled "localhost" should validate as a valid email domain
*/
- public function testGetDefaultEmailAddress() {
+ public function testGetDefaultEmailAddress(): void {
$config = \OC::$server->getConfig();
$config->setAppValue('core', 'enforce_strict_email_check', 'no');
- $email = \OCP\Util::getDefaultEmailAddress("no-reply");
+ $email = \OCP\Util::getDefaultEmailAddress('no-reply');
$this->assertEquals('no-reply@localhost', $email);
$config->deleteAppValue('core', 'enforce_strict_email_check');
}
- public function testGetDefaultEmailAddressFromConfig() {
+ public function testGetDefaultEmailAddressFromConfig(): void {
$config = \OC::$server->getConfig();
$config->setSystemValue('mail_domain', 'example.com');
- $email = \OCP\Util::getDefaultEmailAddress("no-reply");
+ $email = \OCP\Util::getDefaultEmailAddress('no-reply');
$this->assertEquals('no-reply@example.com', $email);
$config->deleteSystemValue('mail_domain');
}
- public function testGetConfiguredEmailAddressFromConfig() {
+ public function testGetConfiguredEmailAddressFromConfig(): void {
$config = \OC::$server->getConfig();
$config->setSystemValue('mail_domain', 'example.com');
$config->setSystemValue('mail_from_address', 'owncloud');
- $email = \OCP\Util::getDefaultEmailAddress("no-reply");
+ $email = \OCP\Util::getDefaultEmailAddress('no-reply');
$this->assertEquals('owncloud@example.com', $email);
$config->deleteSystemValue('mail_domain');
$config->deleteSystemValue('mail_from_address');
}
- public function testGetInstanceIdGeneratesValidId() {
+ public function testGetInstanceIdGeneratesValidId(): void {
\OC::$server->getConfig()->deleteSystemValue('instanceid');
$instanceId = OC_Util::getInstanceId();
$this->assertStringStartsWith('oc', $instanceId);
@@ -138,67 +138,9 @@ class UtilTest extends \Test\TestCase {
}
/**
- * @dataProvider filenameValidationProvider
- */
- public function testFilenameValidation($file, $valid) {
- // private API
- $this->assertEquals($valid, \OC_Util::isValidFileName($file));
- // public API
- $this->assertEquals($valid, \OCP\Util::isValidFileName($file));
- }
-
- public function filenameValidationProvider() {
- return [
- // valid names
- ['boringname', true],
- ['something.with.extension', true],
- ['now with spaces', true],
- ['.a', true],
- ['..a', true],
- ['.dotfile', true],
- ['single\'quote', true],
- [' spaces before', true],
- ['spaces after ', true],
- ['allowed chars including the crazy ones $%&_-^@!,()[]{}=;#', true],
- ['汉字也能用', true],
- ['und Ümläüte sind auch willkommen', true],
- // disallowed names
- ['', false],
- [' ', false],
- ['.', false],
- ['..', false],
- ['back\\slash', false],
- ['sl/ash', false],
- ['lt<lt', true],
- ['gt>gt', true],
- ['col:on', true],
- ['double"quote', true],
- ['pi|pe', true],
- ['dont?ask?questions?', true],
- ['super*star', true],
- ['new\nline', false],
-
- // better disallow these to avoid unexpected trimming to have side effects
- [' ..', false],
- ['.. ', false],
- ['. ', false],
- [' .', false],
-
- // part files not allowed
- ['.part', false],
- ['notallowed.part', false],
- ['neither.filepart', false],
-
- // part in the middle is ok
- ['super movie part one.mkv', true],
- ['super.movie.part.mkv', true],
- ];
- }
-
- /**
* Test needUpgrade() when the core version is increased
*/
- public function testNeedUpgradeCore() {
+ public function testNeedUpgradeCore(): void {
$config = \OC::$server->getConfig();
$oldConfigVersion = $config->getSystemValue('version', '0.0.0');
$oldSessionVersion = \OC::$server->getSession()->get('OC_Version');
@@ -218,9 +160,9 @@ class UtilTest extends \Test\TestCase {
$this->assertFalse(\OCP\Util::needUpgrade());
}
- public function testCheckDataDirectoryValidity() {
+ public function testCheckDataDirectoryValidity(): void {
$dataDir = \OC::$server->getTempManager()->getTemporaryFolder();
- touch($dataDir . '/.ocdata');
+ touch($dataDir . '/.ncdata');
$errors = \OC_Util::checkDataDirectoryValidity($dataDir);
$this->assertEmpty($errors);
\OCP\Files::rmdirr($dataDir);
@@ -252,7 +194,7 @@ class UtilTest extends \Test\TestCase {
self::invokePrivate(\OCP\Util::class, 'scriptDeps', [[]]);
}
- public function testAddScript() {
+ public function testAddScript(): void {
\OCP\Util::addScript('first', 'myFirstJSFile');
\OCP\Util::addScript('core', 'myFancyJSFile1');
\OCP\Util::addScript('files', 'myFancyJSFile2', 'core');
@@ -320,32 +262,32 @@ class UtilTest extends \Test\TestCase {
// All scripts still there
$scripts = [
- "core/js/common",
- "core/js/main",
- "core/js/myFancyJSFile1",
- "core/js/myFancyJSFile4",
- "core/js/myFancyJSFile5",
- "first/l10n/en",
- "first/js/myFirstJSFile",
- "files/l10n/en",
- "files/js/myFancyJSFile2",
- "myApp/l10n/en",
- "myApp/js/myFancyJSFile3",
- "myApp2/l10n/en",
- "myApp2/js/myApp2JSFile",
- "myApp5/l10n/en",
- "myApp5/js/myApp5JSFile",
- "myApp3/l10n/en",
- "myApp3/js/myApp3JSFile",
- "myApp4/l10n/en",
- "myApp4/js/myApp4JSFile",
+ 'core/js/common',
+ 'core/js/main',
+ 'core/js/myFancyJSFile1',
+ 'core/js/myFancyJSFile4',
+ 'core/js/myFancyJSFile5',
+ 'first/l10n/en',
+ 'first/js/myFirstJSFile',
+ 'files/l10n/en',
+ 'files/js/myFancyJSFile2',
+ 'myApp/l10n/en',
+ 'myApp/js/myFancyJSFile3',
+ 'myApp2/l10n/en',
+ 'myApp2/js/myApp2JSFile',
+ 'myApp5/l10n/en',
+ 'myApp5/js/myApp5JSFile',
+ 'myApp3/l10n/en',
+ 'myApp3/js/myApp3JSFile',
+ 'myApp4/l10n/en',
+ 'myApp4/js/myApp4JSFile',
];
foreach ($scripts as $script) {
$this->assertContains($script, $scripts);
}
}
- public function testAddScriptCircularDependency() {
+ public function testAddScriptCircularDependency(): void {
\OCP\Util::addScript('circular', 'file1', 'dependency');
\OCP\Util::addScript('dependency', 'file2', 'circular');
@@ -354,7 +296,7 @@ class UtilTest extends \Test\TestCase {
$this->assertContains('dependency/js/file2', $scripts);
}
- public function testAddVendorScript() {
+ public function testAddVendorScript(): void {
\OC_Util::addVendorScript('core', 'myFancyJSFile1');
\OC_Util::addVendorScript('myApp', 'myFancyJSFile2');
\OC_Util::addVendorScript('core', 'myFancyJSFile0', true);
@@ -371,7 +313,7 @@ class UtilTest extends \Test\TestCase {
$this->assertEquals([], \OC_Util::$styles);
}
- public function testAddTranslations() {
+ public function testAddTranslations(): void {
\OC_Util::addTranslations('appId', 'de');
$this->assertEquals([
@@ -380,7 +322,7 @@ class UtilTest extends \Test\TestCase {
$this->assertEquals([], \OC_Util::$styles);
}
- public function testAddStyle() {
+ public function testAddStyle(): void {
\OC_Util::addStyle('core', 'myFancyCSSFile1');
\OC_Util::addStyle('myApp', 'myFancyCSSFile2');
\OC_Util::addStyle('core', 'myFancyCSSFile0', true);
@@ -397,7 +339,7 @@ class UtilTest extends \Test\TestCase {
], \OC_Util::$styles);
}
- public function testAddVendorStyle() {
+ public function testAddVendorStyle(): void {
\OC_Util::addVendorStyle('core', 'myFancyCSSFile1');
\OC_Util::addVendorStyle('myApp', 'myFancyCSSFile2');
\OC_Util::addVendorStyle('core', 'myFancyCSSFile0', true);
@@ -414,7 +356,7 @@ class UtilTest extends \Test\TestCase {
], \OC_Util::$styles);
}
- public function testShortenMultibyteString() {
+ public function testShortenMultibyteString(): void {
$this->assertEquals('Short nuff', \OCP\Util::shortenMultibyteString('Short nuff', 255));
$this->assertEquals('ABC', \OCP\Util::shortenMultibyteString('ABCDEF', 3));
// each of the characters is 12 bytes
diff --git a/tests/preseed-config.php b/tests/preseed-config.php
index 3739335676a..f9c15939469 100644
--- a/tests/preseed-config.php
+++ b/tests/preseed-config.php
@@ -78,3 +78,24 @@ if (getenv('OBJECT_STORE') === 's3') {
]
];
}
+
+if (getenv('SHARDING') == '1') {
+ $CONFIG['dbsharding'] = [
+ 'filecache' => [
+ 'shards' => [
+ [
+ 'port' => 5001,
+ ],
+ [
+ 'port' => 5002,
+ ],
+ [
+ 'port' => 5003,
+ ],
+ [
+ 'port' => 5004,
+ ],
+ ]
+ ]
+ ];
+}
diff --git a/tests/startsessionlistener.php b/tests/startsessionlistener.php
index c0ea9a1cb45..f62142ec4e0 100644
--- a/tests/startsessionlistener.php
+++ b/tests/startsessionlistener.php
@@ -19,7 +19,7 @@ class StartSessionListener implements TestListener {
public function endTest(Test $test, float $time): void {
// reopen the session - only allowed for memory session
if (\OC::$server->getSession() instanceof Memory) {
- /** @var $session Memory */
+ /** @var Memory $session */
$session = \OC::$server->getSession();
$session->reopen();
}