aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php4
-rw-r--r--tests/lib/App/AppStore/Fetcher/AppFetcherTest.php47
-rw-r--r--tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php4
-rw-r--r--tests/lib/App/AppStore/Fetcher/FetcherBase.php100
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php12
-rw-r--r--tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php4
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php13
-rw-r--r--tests/lib/Collaboration/Collaborators/LookupPluginTest.php67
-rw-r--r--tests/lib/DB/MigratorTest.php6
-rw-r--r--tests/lib/Encryption/Keys/StorageTest.php18
-rw-r--r--tests/lib/Encryption/ManagerTest.php10
-rw-r--r--tests/lib/Files/EtagTest.php2
-rw-r--r--tests/lib/Files/FilesystemTest.php6
-rw-r--r--tests/lib/GlobalScale/ConfigTest.php4
-rw-r--r--tests/lib/Http/Client/ClientTest.php156
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php38
-rw-r--r--tests/lib/L10N/FactoryTest.php30
-rw-r--r--tests/lib/L10N/LanguageIteratorTest.php4
-rw-r--r--tests/lib/Mail/MailerTest.php38
-rw-r--r--tests/lib/Repair/ClearGeneratedAvatarCacheTest.php2
-rw-r--r--tests/lib/Repair/RepairCollationTest.php2
-rw-r--r--tests/lib/Repair/RepairDavSharesTest.php2
-rw-r--r--tests/lib/Repair/RepairInvalidSharesTest.php2
-rw-r--r--tests/lib/Repair/RepairMimeTypesTest.php2
-rw-r--r--tests/lib/Repair/RepairSqliteAutoincrementTest.php2
-rw-r--r--tests/lib/Security/Bruteforce/ThrottlerTest.php2
-rw-r--r--tests/lib/Security/CertificateManagerTest.php2
-rw-r--r--tests/lib/Security/HasherTest.php6
-rw-r--r--tests/lib/Security/VerificationToken/VerificationTokenTest.php12
-rw-r--r--tests/lib/Support/Subscription/RegistryTest.php2
-rw-r--r--tests/lib/TestCase.php2
-rw-r--r--tests/lib/Updater/VersionCheckTest.php10
-rw-r--r--tests/lib/UpdaterTest.php2
-rw-r--r--tests/lib/UrlGeneratorTest.php2
-rw-r--r--tests/lib/User/SessionTest.php6
-rw-r--r--tests/lib/User/UserTest.php15
36 files changed, 332 insertions, 304 deletions
diff --git a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
index b5d339eef2f..6d34babe76a 100644
--- a/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
+++ b/tests/Test/Repair/Owncloud/UpdateLanguageCodesTest.php
@@ -109,7 +109,7 @@ class UpdateLanguageCodesTest extends TestCase {
);
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('version', '0.0.0')
->willReturn('12.0.0.13');
@@ -155,7 +155,7 @@ class UpdateLanguageCodesTest extends TestCase {
->method('info');
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('version', '0.0.0')
->willReturn('12.0.0.14');
diff --git a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
index a2d56838b07..39b0a699092 100644
--- a/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
@@ -1872,7 +1872,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
}
public function testGetWithFilter() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '11.0.0.2';
@@ -1884,8 +1884,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
});
$this->config
->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ ->willReturnArgument(1);
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -1957,7 +1956,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testAppstoreDisabled() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
if ($var === 'version') {
return '11.0.0.2';
@@ -1966,8 +1965,14 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
});
$this->config
->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(false);
+ ->willReturnCallback(function ($var, $default) {
+ if ($var === 'has_internet_connection') {
+ return true;
+ } elseif ($var === 'appstoreenabled') {
+ return false;
+ }
+ return $default;
+ });
$this->appData
->expects($this->never())
->method('getFolder');
@@ -1978,7 +1983,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
public function testNoInternet() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
if ($var === 'has_internet_connection') {
return false;
@@ -1989,8 +1994,14 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
});
$this->config
->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ ->willReturnCallback(function ($var, $default) {
+ if ($var === 'has_internet_connection') {
+ return false;
+ } elseif ($var === 'appstoreenabled') {
+ return true;
+ }
+ return $default;
+ });
$this->appData
->expects($this->never())
->method('getFolder');
@@ -1999,7 +2010,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
}
public function testSetVersion() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '10.0.7.2';
@@ -2011,8 +2022,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
});
$this->config
->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ ->willReturnArgument(1);
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
@@ -2084,13 +2094,19 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
}
public function testGetAppsAllowlist() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '11.0.0.2';
} elseif ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') {
return 'https://custom.appsstore.endpoint/api/v1';
- } elseif ($key === 'appsallowlist') {
+ } else {
+ return $default;
+ }
+ });
+ $this->config->method('getSystemValue')
+ ->willReturnCallback(function ($key, $default) {
+ if ($key === 'appsallowlist') {
return ['contacts'];
} else {
return $default;
@@ -2098,8 +2114,7 @@ EJL3BaQAQaASSsvFrcozYxrQG4VzEg==
});
$this->config
->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ ->willReturnArgument(1);
$file = $this->createMock(ISimpleFile::class);
$folder = $this->createMock(ISimpleFolder::class);
diff --git a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
index b83e405db61..874a58fc6ba 100644
--- a/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
+++ b/tests/lib/App/AppStore/Fetcher/CategoryFetcherTest.php
@@ -41,7 +41,7 @@ class CategoryFetcherTest extends FetcherBase {
public function testAppstoreDisabled() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
if ($var === 'appstoreenabled') {
return false;
@@ -57,7 +57,7 @@ class CategoryFetcherTest extends FetcherBase {
public function testNoInternet() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->willReturnCallback(function ($var, $default) {
if ($var === 'has_internet_connection') {
return false;
diff --git a/tests/lib/App/AppStore/Fetcher/FetcherBase.php b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
index 42ad02ce6d8..dbc3f2a687c 100644
--- a/tests/lib/App/AppStore/Fetcher/FetcherBase.php
+++ b/tests/lib/App/AppStore/Fetcher/FetcherBase.php
@@ -76,20 +76,12 @@ abstract class FetcherBase extends TestCase {
public function testGetWithAlreadyExistingFileAndUpToDateTimestampAndVersion() {
$this->config
- ->expects($this->once())
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
- $this->config
- ->expects($this->exactly(2))
- ->method('getSystemValue')
- ->withConsecutive(
- ['has_internet_connection', true],
- [$this->equalTo('version'), $this->anything()],
- )->willReturnOnConsecutiveCalls(
- true,
- '11.0.0.2',
- );
+ ->expects($this->exactly(1))
+ ->method('getSystemValueString')
+ ->with($this->equalTo('version'), $this->anything())
+ ->willReturn('11.0.0.2');
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -122,21 +114,17 @@ abstract class FetcherBase extends TestCase {
public function testGetWithNotExistingFileAndUpToDateTimestampAndVersion() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
- if ($var === 'has_internet_connection') {
- return true;
- } elseif ($var === 'appstoreurl') {
+ if ($var === 'appstoreurl') {
return 'https://apps.nextcloud.com/api/v1';
} elseif ($var === 'version') {
return '11.0.0.2';
}
return $default;
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', $this->anything())
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -200,7 +188,7 @@ abstract class FetcherBase extends TestCase {
}
public function testGetWithAlreadyExistingFileAndOutdatedTimestamp() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '11.0.0.2';
@@ -208,10 +196,8 @@ abstract class FetcherBase extends TestCase {
return $default;
}
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -277,21 +263,17 @@ abstract class FetcherBase extends TestCase {
public function testGetWithAlreadyExistingFileAndNoVersion() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
- if ($var === 'has_internet_connection') {
- return true;
- } elseif ($var === 'appstoreurl') {
+ if ($var === 'appstoreurl') {
return 'https://apps.nextcloud.com/api/v1';
} elseif ($var === 'version') {
return '11.0.0.2';
}
return $default;
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -354,21 +336,17 @@ abstract class FetcherBase extends TestCase {
public function testGetWithAlreadyExistingFileAndOutdatedVersion() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnCallback(function ($var, $default) {
- if ($var === 'has_internet_connection') {
- return true;
- } elseif ($var === 'appstoreurl') {
+ if ($var === 'appstoreurl') {
return 'https://apps.nextcloud.com/api/v1';
} elseif ($var === 'version') {
return '11.0.0.2';
}
return $default;
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -429,14 +407,10 @@ abstract class FetcherBase extends TestCase {
}
public function testGetWithExceptionInClient() {
- $this->config->method('getSystemValue')
- ->willReturnCallback(function ($key, $default) {
- return $default;
- });
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueString')
+ ->willReturnArgument(1);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -469,7 +443,7 @@ abstract class FetcherBase extends TestCase {
}
public function testGetMatchingETag() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '11.0.0.2';
@@ -477,10 +451,8 @@ abstract class FetcherBase extends TestCase {
return $default;
}
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -550,7 +522,7 @@ abstract class FetcherBase extends TestCase {
}
public function testGetNoMatchingETag() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '11.0.0.2';
@@ -558,10 +530,8 @@ abstract class FetcherBase extends TestCase {
return $default;
}
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
@@ -637,7 +607,7 @@ abstract class FetcherBase extends TestCase {
public function testFetchAfterUpgradeNoETag() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'version') {
return '11.0.0.3';
@@ -645,10 +615,8 @@ abstract class FetcherBase extends TestCase {
return $default;
}
});
- $this->config
- ->method('getSystemValueBool')
- ->with('appstoreenabled', true)
- ->willReturn(true);
+ $this->config->method('getSystemValueBool')
+ ->willReturnArgument(1);
$folder = $this->createMock(ISimpleFolder::class);
$file = $this->createMock(ISimpleFile::class);
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index 78e656f5fc3..839c7ad4338 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -938,7 +938,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerProtocolWithOverride() {
$this->config
->expects($this->exactly(3))
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnMap([
['overwriteprotocol', '', 'customProtocol'],
['overwritecondaddr', '', ''],
@@ -1358,7 +1358,7 @@ class RequestTest extends \Test\TestCase {
public function testGetServerHostWithOverwriteHost() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnCallback(function ($key, $default) {
if ($key === 'overwritecondaddr') {
return '';
@@ -1513,7 +1513,7 @@ class RequestTest extends \Test\TestCase {
public function testGetOverwriteHostDefaultNull() {
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('overwritehost')
->willReturn('');
$request = new Request(
@@ -1530,7 +1530,7 @@ class RequestTest extends \Test\TestCase {
public function testGetOverwriteHostWithOverwrite() {
$this->config
->expects($this->exactly(3))
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnMap([
['overwritehost', '', 'www.owncloud.org'],
['overwritecondaddr', '', ''],
@@ -1717,7 +1717,7 @@ class RequestTest extends \Test\TestCase {
public function testGetRequestUriWithoutOverwrite() {
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('overwritewebroot')
->willReturn('');
@@ -1749,7 +1749,7 @@ class RequestTest extends \Test\TestCase {
public function testGetRequestUriWithOverwrite($expectedUri, $overwriteWebRoot, $overwriteCondAddr) {
$this->config
->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnMap([
['overwritewebroot', '', $overwriteWebRoot],
['overwritecondaddr', '', $overwriteCondAddr],
diff --git a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
index d6f18ad9eff..890dd63892a 100644
--- a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
+++ b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
@@ -62,7 +62,7 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
public function testProcess() {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('auto_logout', false)
->willReturn(false);
$this->userSession->expects($this->once())
@@ -77,7 +77,7 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
public function testProcessNotRemeberedLoginWithAutologout() {
$data = $this->getLoggedInLoginData();
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('auto_logout', false)
->willReturn(true);
$this->userSession->expects($this->never())
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index d19f98eeda9..a614780a908 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -67,13 +67,20 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->hasher = \OC::$server->getHasher();
$this->crypto = \OC::$server->getCrypto();
$this->config = $this->createMock(IConfig::class);
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueInt')
->willReturnMap([
['session_lifetime', 60 * 60 * 24, 150],
['remember_login_cookie_lifetime', 60 * 60 * 24 * 15, 300],
- ['secret', '', '1f4h9s'],
+ ['token_auth_activity_update', 60, 60],
+ ]);
+ $this->config->method('getSystemValue')
+ ->willReturnMap([
['openssl', [], []],
]);
+ $this->config->method('getSystemValueString')
+ ->willReturnMap([
+ ['secret', '', '1f4h9s'],
+ ]);
$this->db = $this->createMock(IDBConnection::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->timeFactory = $this->createMock(ITimeFactory::class);
@@ -336,7 +343,7 @@ class PublicKeyTokenProviderTest extends TestCase {
$defaultSessionLifetime = 60 * 60 * 24;
$defaultRememberMeLifetime = 60 * 60 * 24 * 15;
$this->config->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueInt')
->willReturnMap([
['session_lifetime', $defaultSessionLifetime, 150],
['remember_login_cookie_lifetime', $defaultRememberMeLifetime, 300],
diff --git a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
index 462497c637b..3eb28a861a5 100644
--- a/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/LookupPluginTest.php
@@ -92,19 +92,19 @@ class LookupPluginTest extends TestCase {
->with('files_sharing', 'lookupServerEnabled', 'yes')
->willReturn('yes');
$this->config->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->withConsecutive(
['gs.enabled', false],
- ['lookup_server', 'https://lookup.nextcloud.com'],
+ ['has_internet_connection', true],
)->willReturnOnConsecutiveCalls(
false,
- '',
+ true,
);
$this->config->expects($this->once())
- ->method('getSystemValueBool')
- ->with('has_internet_connection', true)
- ->willReturn(true);
+ ->method('getSystemValueString')
+ ->with('lookup_server', 'https://lookup.nextcloud.com')
+ ->willReturn('');
$this->clientService->expects($this->never())
->method('newClient');
@@ -120,15 +120,15 @@ class LookupPluginTest extends TestCase {
->method('getAppValue')
->with('files_sharing', 'lookupServerEnabled', 'yes')
->willReturn('yes');
- $this->config->expects($this->once())
- ->method('getSystemValue')
- ->with('gs.enabled', false)
- ->willReturn(false);
-
- $this->config->expects($this->once())
+ $this->config->expects($this->exactly(2))
->method('getSystemValueBool')
- ->with('has_internet_connection', true)
- ->willReturn(false);
+ ->withConsecutive(
+ ['gs.enabled', false],
+ ['has_internet_connection', true],
+ )->willReturnOnConsecutiveCalls(
+ false,
+ false,
+ );
$this->clientService->expects($this->never())
->method('newClient');
@@ -157,19 +157,19 @@ class LookupPluginTest extends TestCase {
->with('files_sharing', 'lookupServerEnabled', 'yes')
->willReturn('yes');
$this->config->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->withConsecutive(
['gs.enabled', false],
- ['lookup_server', 'https://lookup.nextcloud.com'],
+ ['has_internet_connection', true],
)->willReturnOnConsecutiveCalls(
false,
- $searchParams['server'],
+ true,
);
$this->config->expects($this->once())
- ->method('getSystemValueBool')
- ->with('has_internet_connection', true)
- ->willReturn(true);
+ ->method('getSystemValueString')
+ ->with('lookup_server', 'https://lookup.nextcloud.com')
+ ->willReturn($searchParams['server']);
$response = $this->createMock(IResponse::class);
$response->expects($this->once())
@@ -221,19 +221,19 @@ class LookupPluginTest extends TestCase {
->method('addResultSet')
->with($type, $searchParams['expectedResult'], []);
- $this->config->expects($this->once())
- ->method('getSystemValueBool')
- ->with('has_internet_connection', true)
- ->willReturn(true);
$this->config->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->withConsecutive(
['gs.enabled', false],
- ['lookup_server', 'https://lookup.nextcloud.com'],
+ ['has_internet_connection', true],
)->willReturnOnConsecutiveCalls(
$GSEnabled,
- $searchParams['server'],
+ true,
);
+ $this->config->expects($this->once())
+ ->method('getSystemValueString')
+ ->with('lookup_server', 'https://lookup.nextcloud.com')
+ ->willReturn($searchParams['server']);
$response = $this->createMock(IResponse::class);
$response->expects($this->once())
@@ -254,10 +254,15 @@ class LookupPluginTest extends TestCase {
->willReturn($client);
} else {
$searchResult->expects($this->never())->method('addResultSet');
- $this->config->expects($this->once())
- ->method('getSystemValue')
- ->with('gs.enabled', false)
- ->willReturn($GSEnabled);
+ $this->config->expects($this->exactly(2))
+ ->method('getSystemValueBool')
+ ->withConsecutive(
+ ['gs.enabled', false],
+ ['has_internet_connection', true],
+ )->willReturnOnConsecutiveCalls(
+ $GSEnabled,
+ true,
+ );
}
$moreResults = $this->plugin->search(
$searchParams['search'],
diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php
index 6a2b113a796..4d7d9cab19f 100644
--- a/tests/lib/DB/MigratorTest.php
+++ b/tests/lib/DB/MigratorTest.php
@@ -76,7 +76,7 @@ class MigratorTest extends \Test\TestCase {
}
private function getUniqueTableName() {
- return strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix', 'oc_') . 'test_'));
+ return strtolower($this->getUniqueID($this->config->getSystemValueString('dbtableprefix', 'oc_') . 'test_'));
}
protected function tearDown(): void {
@@ -160,10 +160,10 @@ class MigratorTest extends \Test\TestCase {
}
public function testUpgradeDifferentPrefix() {
- $oldTablePrefix = $this->config->getSystemValue('dbtableprefix', 'oc_');
+ $oldTablePrefix = $this->config->getSystemValueString('dbtableprefix', 'oc_');
$this->config->setSystemValue('dbtableprefix', 'ownc_');
- $this->tableName = strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix') . 'test_'));
+ $this->tableName = strtolower($this->getUniqueID($this->config->getSystemValueString('dbtableprefix') . 'test_'));
[$startSchema, $endSchema] = $this->getDuplicateKeySchemas();
$migrator = $this->getMigrator();
diff --git a/tests/lib/Encryption/Keys/StorageTest.php b/tests/lib/Encryption/Keys/StorageTest.php
index d1c0257cc6e..a47edb3fdd6 100644
--- a/tests/lib/Encryption/Keys/StorageTest.php
+++ b/tests/lib/Encryption/Keys/StorageTest.php
@@ -77,7 +77,7 @@ class StorageTest extends TestCase {
}
public function testSetFileKey() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
$this->util->expects($this->any())
@@ -103,7 +103,7 @@ class StorageTest extends TestCase {
}
public function testSetFileOld() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.0');
$this->util->expects($this->any())
@@ -145,7 +145,7 @@ class StorageTest extends TestCase {
* @param string $expectedKeyContent
*/
public function testGetFileKey($path, $strippedPartialName, $originalKeyExists, $expectedKeyContent) {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
$this->util->expects($this->any())
@@ -201,7 +201,7 @@ class StorageTest extends TestCase {
}
public function testSetFileKeySystemWide() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -233,7 +233,7 @@ class StorageTest extends TestCase {
}
public function testGetFileKeySystemWide() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -261,7 +261,7 @@ class StorageTest extends TestCase {
}
public function testSetSystemUserKey() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -281,7 +281,7 @@ class StorageTest extends TestCase {
}
public function testSetUserKey() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -301,7 +301,7 @@ class StorageTest extends TestCase {
}
public function testGetSystemUserKey() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
@@ -324,7 +324,7 @@ class StorageTest extends TestCase {
}
public function testGetUserKey() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('version')
->willReturn('20.0.0.2');
diff --git a/tests/lib/Encryption/ManagerTest.php b/tests/lib/Encryption/ManagerTest.php
index 79d2c216080..4e354ad518c 100644
--- a/tests/lib/Encryption/ManagerTest.php
+++ b/tests/lib/Encryption/ManagerTest.php
@@ -66,7 +66,7 @@ class ManagerTest extends TestCase {
}
public function testManagerIsEnabled() {
- $this->config->expects($this->any())->method('getSystemValue')->willReturn(true);
+ $this->config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
$this->config->expects($this->any())->method('getAppValue')->willReturn('yes');
$this->assertTrue($this->manager->isEnabled());
}
@@ -199,7 +199,7 @@ class ManagerTest extends TestCase {
// */
// public function testModuleRegistration() {
// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValue')->willReturn(true);
+// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
// $em = $this->createMock(IEncryptionModule::class);
// $em->expects($this->any())->method('getId')->willReturn(0);
// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
@@ -211,7 +211,7 @@ class ManagerTest extends TestCase {
//
// public function testModuleUnRegistration() {
// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValue')->willReturn(true);
+// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
// $em = $this->createMock(IEncryptionModule::class);
// $em->expects($this->any())->method('getId')->willReturn(0);
// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
@@ -228,7 +228,7 @@ class ManagerTest extends TestCase {
// */
// public function testGetEncryptionModuleUnknown() {
// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValue')->willReturn(true);
+// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
// $em = $this->createMock(IEncryptionModule::class);
// $em->expects($this->any())->method('getId')->willReturn(0);
// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
@@ -240,7 +240,7 @@ class ManagerTest extends TestCase {
//
// public function testGetEncryptionModule() {
// $config = $this->createMock(IConfig::class);
-// $config->expects($this->any())->method('getSystemValue')->willReturn(true);
+// $config->expects($this->any())->method('getSystemValueBool')->willReturn(true);
// $em = $this->createMock(IEncryptionModule::class);
// $em->expects($this->any())->method('getId')->willReturn(0);
// $em->expects($this->any())->method('getDisplayName')->willReturn('TestDummyModule0');
diff --git a/tests/lib/Files/EtagTest.php b/tests/lib/Files/EtagTest.php
index 43b92c12391..b9583a6ac7c 100644
--- a/tests/lib/Files/EtagTest.php
+++ b/tests/lib/Files/EtagTest.php
@@ -41,7 +41,7 @@ class EtagTest extends \Test\TestCase {
\OC\Share\Share::registerBackend('folder', 'OCA\Files_Sharing\ShareBackend\Folder', 'file');
$config = \OC::$server->getConfig();
- $this->datadir = $config->getSystemValue('datadirectory');
+ $this->datadir = $config->getSystemValueString('datadirectory');
$this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder();
$config->setSystemValue('datadirectory', $this->tmpDir);
diff --git a/tests/lib/Files/FilesystemTest.php b/tests/lib/Files/FilesystemTest.php
index 8f34860d85a..96fcab77474 100644
--- a/tests/lib/Files/FilesystemTest.php
+++ b/tests/lib/Files/FilesystemTest.php
@@ -347,7 +347,7 @@ class FilesystemTest extends \Test\TestCase {
\OC\Files\Filesystem::initMountPoints($userId);
}
-
+
public function testNullUserThrows() {
$this->expectException(\OC\User\NoUserException::class);
@@ -427,7 +427,7 @@ class FilesystemTest extends \Test\TestCase {
public function testMountDefaultCacheDir() {
$userId = $this->getUniqueID('user_');
$config = \OC::$server->getConfig();
- $oldCachePath = $config->getSystemValue('cache_path', '');
+ $oldCachePath = $config->getSystemValueString('cache_path', '');
// no cache path configured
$config->setSystemValue('cache_path', '');
@@ -457,7 +457,7 @@ class FilesystemTest extends \Test\TestCase {
$userId = $this->getUniqueID('user_');
$config = \OC::$server->getConfig();
- $oldCachePath = $config->getSystemValue('cache_path', '');
+ $oldCachePath = $config->getSystemValueString('cache_path', '');
// set cache path to temp dir
$cachePath = \OC::$server->getTempManager()->getTemporaryFolder() . '/extcache';
$config->setSystemValue('cache_path', $cachePath);
diff --git a/tests/lib/GlobalScale/ConfigTest.php b/tests/lib/GlobalScale/ConfigTest.php
index e67cb392d64..826a57a2b30 100644
--- a/tests/lib/GlobalScale/ConfigTest.php
+++ b/tests/lib/GlobalScale/ConfigTest.php
@@ -52,7 +52,7 @@ class ConfigTest extends TestCase {
public function testIsGlobalScaleEnabled() {
$gsConfig = $this->getInstance();
- $this->config->expects($this->once())->method('getSystemValue')
+ $this->config->expects($this->once())->method('getSystemValueBool')
->with('gs.enabled', false)->willReturn(true);
$result = $gsConfig->isGlobalScaleEnabled();
@@ -73,7 +73,7 @@ class ConfigTest extends TestCase {
$gsConfig->expects($this->any())->method('isGlobalScaleEnabled')->willReturn($gsEnabled);
- $this->config->expects($this->any())->method('getSystemValue')
+ $this->config->expects($this->any())->method('getSystemValueString')
->with('gs.federation', 'internal')->willReturn($gsFederation);
$this->assertSame($expected, $gsConfig->onlyInternalFederation());
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php
index 93948a5daf3..9a4fb1c657e 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -54,22 +54,25 @@ class ClientTest extends \Test\TestCase {
public function testGetProxyUri(): void {
$this->config
- ->method('getSystemValue')
- ->with('proxy', null)
- ->willReturn(null);
+ ->method('getSystemValueString')
+ ->with('proxy', '')
+ ->willReturn('');
$this->assertNull(self::invokePrivate($this->client, 'getProxyUri'));
}
public function testGetProxyUriProxyHostEmptyPassword(): void {
- $map = [
- ['proxy', '', 'foo'],
- ['proxyuserpwd', '', null],
- ['proxyexclude', [], []],
- ];
-
$this->config
->method('getSystemValue')
- ->will($this->returnValueMap($map));
+ ->will($this->returnValueMap([
+ ['proxyexclude', [], []],
+ ]));
+
+ $this->config
+ ->method('getSystemValueString')
+ ->will($this->returnValueMap([
+ ['proxy', '', 'foo'],
+ ['proxyuserpwd', '', ''],
+ ]));
$this->assertEquals([
'http' => 'foo',
@@ -79,32 +82,20 @@ class ClientTest extends \Test\TestCase {
public function testGetProxyUriProxyHostWithPassword(): void {
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->once())
->method('getSystemValue')
+ ->with('proxyexclude', [])
+ ->willReturn([]);
+ $this->config
+ ->expects($this->exactly(2))
+ ->method('getSystemValueString')
->withConsecutive(
- [
- $this->equalTo('proxy'),
- $this->callback(function ($input) {
- return $input === '';
- })
- ],
- [
- $this->equalTo('proxyuserpwd'),
- $this->callback(function ($input) {
- return $input === '';
- })
- ],
- [
- $this->equalTo('proxyexclude'),
- $this->callback(function ($input) {
- return $input === [];
- })
- ],
+ ['proxy', ''],
+ ['proxyuserpwd', ''],
)
->willReturnOnConsecutiveCalls(
'foo',
'username:password',
- [],
);
$this->assertEquals([
'http' => 'username:password@foo',
@@ -114,32 +105,20 @@ class ClientTest extends \Test\TestCase {
public function testGetProxyUriProxyHostWithPasswordAndExclude(): void {
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->once())
->method('getSystemValue')
+ ->with('proxyexclude', [])
+ ->willReturn(['bar']);
+ $this->config
+ ->expects($this->exactly(2))
+ ->method('getSystemValueString')
->withConsecutive(
- [
- $this->equalTo('proxy'),
- $this->callback(function ($input) {
- return $input === '';
- })
- ],
- [
- $this->equalTo('proxyuserpwd'),
- $this->callback(function ($input) {
- return $input === '';
- })
- ],
- [
- $this->equalTo('proxyexclude'),
- $this->callback(function ($input) {
- return $input === [];
- })
- ],
+ ['proxy', ''],
+ ['proxyuserpwd', ''],
)
->willReturnOnConsecutiveCalls(
'foo',
'username:password',
- ['bar'],
);
$this->assertEquals([
'http' => 'username:password@foo',
@@ -271,19 +250,23 @@ class ClientTest extends \Test\TestCase {
}
private function setUpDefaultRequestOptions(): void {
- $map = [
- ['proxy', '', 'foo'],
- ['proxyuserpwd', '', null],
- ['proxyexclude', [], []],
- ];
-
$this->config
->method('getSystemValue')
- ->will($this->returnValueMap($map));
+ ->will($this->returnValueMap([
+ ['proxyexclude', [], []],
+ ]));
+ $this->config
+ ->method('getSystemValueString')
+ ->will($this->returnValueMap([
+ ['proxy', '', 'foo'],
+ ['proxyuserpwd', '', ''],
+ ]));
$this->config
->method('getSystemValueBool')
- ->with('allow_local_remote_servers', false)
- ->willReturn(true);
+ ->will($this->returnValueMap([
+ ['installed', false, true],
+ ['allow_local_remote_servers', false, true],
+ ]));
$this->certificateManager
->expects($this->once())
@@ -467,15 +450,20 @@ class ClientTest extends \Test\TestCase {
public function testSetDefaultOptionsWithNotInstalled(): void {
$this->config
->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->withConsecutive(
- ['proxy', ''],
['installed', false],
+ ['allow_local_remote_servers', false],
)
->willReturnOnConsecutiveCalls(
- '',
+ false,
false,
);
+ $this->config
+ ->expects($this->once())
+ ->method('getSystemValueString')
+ ->with('proxy', '')
+ ->willReturn('');
$this->certificateManager
->expects($this->never())
->method('listCertificates');
@@ -503,19 +491,31 @@ class ClientTest extends \Test\TestCase {
public function testSetDefaultOptionsWithProxy(): void {
$this->config
- ->expects($this->exactly(4))
+ ->expects($this->exactly(2))
+ ->method('getSystemValueBool')
+ ->withConsecutive(
+ ['installed', false],
+ ['allow_local_remote_servers', false],
+ )
+ ->willReturnOnConsecutiveCalls(
+ true,
+ false,
+ );
+ $this->config
+ ->expects($this->once())
->method('getSystemValue')
+ ->with('proxyexclude', [])
+ ->willReturn([]);
+ $this->config
+ ->expects($this->exactly(2))
+ ->method('getSystemValueString')
->withConsecutive(
['proxy', ''],
['proxyuserpwd', ''],
- ['proxyexclude', []],
- ['installed', false],
)
->willReturnOnConsecutiveCalls(
'foo',
'',
- [],
- true,
);
$this->certificateManager
->expects($this->once())
@@ -550,19 +550,31 @@ class ClientTest extends \Test\TestCase {
public function testSetDefaultOptionsWithProxyAndExclude(): void {
$this->config
- ->expects($this->exactly(4))
+ ->expects($this->exactly(2))
+ ->method('getSystemValueBool')
+ ->withConsecutive(
+ ['installed', false],
+ ['allow_local_remote_servers', false],
+ )
+ ->willReturnOnConsecutiveCalls(
+ true,
+ false,
+ );
+ $this->config
+ ->expects($this->once())
->method('getSystemValue')
+ ->with('proxyexclude', [])
+ ->willReturn(['bar']);
+ $this->config
+ ->expects($this->exactly(2))
+ ->method('getSystemValueString')
->withConsecutive(
['proxy', ''],
['proxyuserpwd', ''],
- ['proxyexclude', []],
- ['installed', false],
)
->willReturnOnConsecutiveCalls(
'foo',
'',
- ['bar'],
- true,
);
$this->certificateManager
->expects($this->once())
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index 62938ad6c1b..203e7e97227 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -164,7 +164,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -184,7 +184,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -223,7 +223,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -268,7 +268,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -329,7 +329,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -389,7 +389,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -433,7 +433,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -654,7 +654,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -674,7 +674,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -711,7 +711,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -774,7 +774,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -801,7 +801,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -838,7 +838,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -881,7 +881,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -939,7 +939,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -982,7 +982,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -1104,7 +1104,7 @@ class CheckerTest extends TestCase {
->willReturn('stable');
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(true);
@@ -1134,7 +1134,7 @@ class CheckerTest extends TestCase {
->willReturn($channel);
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(false);
@@ -1152,7 +1152,7 @@ class CheckerTest extends TestCase {
->willReturn($channel);
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('integrity.check.disabled', false)
->willReturn(true);
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index 0b536971e90..2db1e0302e8 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -47,6 +47,12 @@ class FactoryTest extends TestCase {
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->serverRoot = \OC::$SERVERROOT;
+
+ $this->config
+ ->method('getSystemValueBool')
+ ->willReturnMap([
+ ['installed', false, true],
+ ]);
}
/**
@@ -121,14 +127,12 @@ class FactoryTest extends TestCase {
true,
);
$this->config
- ->expects($this->exactly(2))
+ ->expects($this->exactly(1))
->method('getSystemValue')
->withConsecutive(
['force_language', false],
- ['installed', false],
)->willReturnOnConsecutiveCalls(
false,
- true,
);
$user = $this->getMockBuilder(IUser::class)
->getMock();
@@ -159,11 +163,10 @@ class FactoryTest extends TestCase {
['MyApp', 'es', true],
]);
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->exactly(2))
->method('getSystemValue')
->willReturnMap([
['force_language', false, false],
- ['installed', false, true],
['default_language', false, 'es']
]);
$user = $this->getMockBuilder(IUser::class)
@@ -195,11 +198,10 @@ class FactoryTest extends TestCase {
['MyApp', 'es', false],
]);
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->exactly(2))
->method('getSystemValue')
->willReturnMap([
['force_language', false, false],
- ['installed', false, true],
['default_language', false, 'es']
]);
$user = $this->getMockBuilder(IUser::class)
@@ -234,11 +236,10 @@ class FactoryTest extends TestCase {
['MyApp', 'es', false],
]);
$this->config
- ->expects($this->exactly(3))
+ ->expects($this->exactly(2))
->method('getSystemValue')
->willReturnMap([
['force_language', false, false],
- ['installed', false, true],
['default_language', false, 'es']
]);
$user = $this->getMockBuilder(IUser::class)
@@ -319,7 +320,7 @@ class FactoryTest extends TestCase {
->willReturn($this->serverRoot . '/apps/files/l10n/');
$this->config
->expects(self::once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('theme')
->willReturn('abc');
@@ -474,9 +475,7 @@ class FactoryTest extends TestCase {
$this->config->expects(self::any())
->method('getSystemValue')
->willReturnCallback(function ($var, $default) use ($defaultLang) {
- if ($var === 'installed') {
- return true;
- } elseif ($var === 'default_language') {
+ if ($var === 'default_language') {
return $defaultLang;
} else {
return $default;
@@ -562,12 +561,11 @@ class FactoryTest extends TestCase {
public function testFindGenericLanguageByUserLanguage(): void {
$factory = $this->getFactory();
- $this->config->expects(self::exactly(3))
+ $this->config->expects(self::exactly(2))
->method('getSystemValue')
->willReturnMap([
['force_language', false, false,],
['default_language', false, false,],
- ['installed', false, true],
]);
$user = $this->createMock(IUser::class);
$this->userSession->expects(self::once())
@@ -590,7 +588,6 @@ class FactoryTest extends TestCase {
->willReturnMap([
['force_language', false, false,],
['default_language', false, false,],
- ['installed', false, true],
]);
$user = $this->createMock(IUser::class);
$this->userSession->expects(self::once())
@@ -621,7 +618,6 @@ class FactoryTest extends TestCase {
->willReturnMap([
['force_language', false, false,],
['default_language', false, false,],
- ['installed', false, true],
]);
$user = $this->createMock(IUser::class);
$this->userSession->expects(self::once())
diff --git a/tests/lib/L10N/LanguageIteratorTest.php b/tests/lib/L10N/LanguageIteratorTest.php
index bbbbb145c75..1d5335cebaa 100644
--- a/tests/lib/L10N/LanguageIteratorTest.php
+++ b/tests/lib/L10N/LanguageIteratorTest.php
@@ -82,6 +82,10 @@ class LanguageIteratorTest extends TestCase {
->method('getSystemValue')
->willReturnMap([
['force_language', false, $forcedLang],
+ ]);
+ $this->config->expects($this->any())
+ ->method('getSystemValueString')
+ ->willReturnMap([
['default_language', 'en', $sysLang],
]);
$this->config->expects($this->any())
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php
index 39e4d689a37..ba1d52f4baf 100644
--- a/tests/lib/Mail/MailerTest.php
+++ b/tests/lib/Mail/MailerTest.php
@@ -84,7 +84,7 @@ class MailerTest extends TestCase {
public function testGetSendmailInstanceSendMail($sendmailMode, $binaryParam) {
$this->config
->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnMap([
['mail_smtpmode', 'smtp', 'sendmail'],
['mail_sendmailmode', 'smtp', $sendmailMode],
@@ -107,7 +107,7 @@ class MailerTest extends TestCase {
public function testGetSendmailInstanceSendMailQmail($sendmailMode, $binaryParam) {
$this->config
->expects($this->exactly(2))
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnMap([
['mail_smtpmode', 'smtp', 'qmail'],
['mail_sendmailmode', 'smtp', $sendmailMode],
@@ -133,7 +133,7 @@ class MailerTest extends TestCase {
public function testGetInstanceSendmail() {
$this->config
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->willReturnMap([
['mail_smtpmode', 'smtp', 'sendmail'],
['mail_sendmailmode', 'smtp', 'smtp'],
@@ -180,7 +180,7 @@ class MailerTest extends TestCase {
public function testCreateMessage() {
$this->config
->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('mail_send_plaintext_only', false)
->willReturn(false);
$this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage());
@@ -229,7 +229,7 @@ class MailerTest extends TestCase {
}
public function testCreateEMailTemplate() {
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueString')
->with('mail_template_class', '')
->willReturnArgument(1);
@@ -239,12 +239,16 @@ class MailerTest extends TestCase {
public function testStreamingOptions() {
$this->config->method('getSystemValue')
->willReturnMap([
- ['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtpstreamoptions', [], ['foo' => 1]],
['mail_smtphost', '127.0.0.1', '127.0.0.1'],
['mail_smtpport', 25, 25],
['mail_smtptimeout', 10, 10],
]);
+ $this->config->method('getSystemValueString')
+ ->willReturnMap([
+ ['mail_smtpmode', 'smtp', 'smtp'],
+ ['overwrite.cli.url', '', ''],
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
/** @var EsmtpTransport $transport */
$transport = self::invokePrivate($mailer, 'transport');
@@ -256,12 +260,16 @@ class MailerTest extends TestCase {
public function testStreamingOptionsWrongType() {
$this->config->method('getSystemValue')
->willReturnMap([
- ['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtpstreamoptions', [], 'bar'],
['mail_smtphost', '127.0.0.1', '127.0.0.1'],
['mail_smtpport', 25, 25],
['mail_smtptimeout', 10, 10],
]);
+ $this->config->method('getSystemValueString')
+ ->willReturnMap([
+ ['mail_smtpmode', 'smtp', 'smtp'],
+ ['overwrite.cli.url', '', ''],
+ ]);
$mailer = self::invokePrivate($this->mailer, 'getInstance');
/** @var EsmtpTransport $transport */
$transport = self::invokePrivate($mailer, 'transport');
@@ -272,14 +280,15 @@ class MailerTest extends TestCase {
public function testLocalDomain(): void {
$this->config->method('getSystemValue')
->willReturnMap([
- ['mail_smtpmode', 'smtp', 'smtp'],
['mail_smtphost', '127.0.0.1', '127.0.0.1'],
['mail_smtpport', 25, 25],
['mail_smtptimeout', 10, 10],
]);
$this->config->method('getSystemValueString')
- ->with('overwrite.cli.url', '')
- ->willReturn('https://some.valid.url.com:8080');
+ ->willReturnMap([
+ ['mail_smtpmode', 'smtp', 'smtp'],
+ ['overwrite.cli.url', '', 'https://some.valid.url.com:8080'],
+ ]);
/** @var SymfonyMailer $mailer */
$mailer = self::invokePrivate($this->mailer, 'getInstance');
@@ -294,14 +303,15 @@ class MailerTest extends TestCase {
public function testLocalDomainInvalidUrl(): void {
$this->config->method('getSystemValue')
->willReturnMap([
- ['mail_smtpmode', 'smtp', 'smtp'],
- ['mail_smtphost', '127.0.0.1', '127.0.0.1'],
['mail_smtpport', 25, 25],
['mail_smtptimeout', 10, 10],
+ ['mail_smtphost', '127.0.0.1', '127.0.0.1'],
]);
$this->config->method('getSystemValueString')
- ->with('overwrite.cli.url', '')
- ->willReturn('https:only.slash.does.not.work:8080');
+ ->willReturnMap([
+ ['mail_smtpmode', 'smtp', 'smtp'],
+ ['overwrite.cli.url', '', 'https:only.slash.does.not.work:8080'],
+ ]);
/** @var SymfonyMailer $mailer */
$mailer = self::invokePrivate($this->mailer, 'getInstance');
diff --git a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
index 7aa7831e44e..44fc709c72a 100644
--- a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
+++ b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
@@ -76,7 +76,7 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase {
*/
public function testShouldRun($from, $expected) {
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('version', '0.0.0.0')
->willReturn($from);
diff --git a/tests/lib/Repair/RepairCollationTest.php b/tests/lib/Repair/RepairCollationTest.php
index 902ddcd4539..9e76a81080f 100644
--- a/tests/lib/Repair/RepairCollationTest.php
+++ b/tests/lib/Repair/RepairCollationTest.php
@@ -66,7 +66,7 @@ class RepairCollationTest extends TestCase {
$this->markTestSkipped("Test only relevant on MySql");
}
- $dbPrefix = $this->config->getSystemValue("dbtableprefix");
+ $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();
diff --git a/tests/lib/Repair/RepairDavSharesTest.php b/tests/lib/Repair/RepairDavSharesTest.php
index 5eeafd7bf9f..394fc985469 100644
--- a/tests/lib/Repair/RepairDavSharesTest.php
+++ b/tests/lib/Repair/RepairDavSharesTest.php
@@ -71,7 +71,7 @@ class RepairDavSharesTest extends TestCase {
public function testRun() {
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('version', '0.0.0')
->willReturn('20.0.2');
diff --git a/tests/lib/Repair/RepairInvalidSharesTest.php b/tests/lib/Repair/RepairInvalidSharesTest.php
index f93940cc3ed..486e11230b8 100644
--- a/tests/lib/Repair/RepairInvalidSharesTest.php
+++ b/tests/lib/Repair/RepairInvalidSharesTest.php
@@ -36,7 +36,7 @@ class RepairInvalidSharesTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('version')
->willReturn('12.0.0.0');
diff --git a/tests/lib/Repair/RepairMimeTypesTest.php b/tests/lib/Repair/RepairMimeTypesTest.php
index 176bc0ec102..61cf5858241 100644
--- a/tests/lib/Repair/RepairMimeTypesTest.php
+++ b/tests/lib/Repair/RepairMimeTypesTest.php
@@ -42,7 +42,7 @@ class RepairMimeTypesTest extends \Test\TestCase {
->disableOriginalConstructor()
->getMock();
$config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('version')
->willReturn('11.0.0.0');
diff --git a/tests/lib/Repair/RepairSqliteAutoincrementTest.php b/tests/lib/Repair/RepairSqliteAutoincrementTest.php
index 5b3a388dea3..b4be47d0157 100644
--- a/tests/lib/Repair/RepairSqliteAutoincrementTest.php
+++ b/tests/lib/Repair/RepairSqliteAutoincrementTest.php
@@ -46,7 +46,7 @@ class RepairSqliteAutoincrementTest extends \Test\TestCase {
$this->markTestSkipped("Test only relevant on Sqlite");
}
- $dbPrefix = $this->config->getSystemValue('dbtableprefix', 'oc_');
+ $dbPrefix = $this->config->getSystemValueString('dbtableprefix', 'oc_');
$this->tableName = $this->getUniqueID($dbPrefix . 'autoinc_test');
$this->connection->prepare('CREATE TABLE ' . $this->tableName . '("someid" INTEGER NOT NULL, "text" VARCHAR(16), PRIMARY KEY("someid"))')->execute();
diff --git a/tests/lib/Security/Bruteforce/ThrottlerTest.php b/tests/lib/Security/Bruteforce/ThrottlerTest.php
index 6639f884ae1..f23b15a06d7 100644
--- a/tests/lib/Security/Bruteforce/ThrottlerTest.php
+++ b/tests/lib/Security/Bruteforce/ThrottlerTest.php
@@ -183,7 +183,7 @@ class ThrottlerTest extends TestCase {
->willReturn(array_keys($whitelists));
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('auth.bruteforce.protection.enabled', true)
->willReturn($enabled);
diff --git a/tests/lib/Security/CertificateManagerTest.php b/tests/lib/Security/CertificateManagerTest.php
index fdc6b40533e..6ad8231a61d 100644
--- a/tests/lib/Security/CertificateManagerTest.php
+++ b/tests/lib/Security/CertificateManagerTest.php
@@ -48,7 +48,7 @@ class CertificateManagerTest extends \Test\TestCase {
\OC_Util::setupFS($this->username);
$config = $this->createMock(IConfig::class);
- $config->expects($this->any())->method('getSystemValue')
+ $config->expects($this->any())->method('getSystemValueBool')
->with('installed', false)->willReturn(true);
$this->random = $this->createMock(ISecureRandom::class);
diff --git a/tests/lib/Security/HasherTest.php b/tests/lib/Security/HasherTest.php
index 37e2adcc13c..3848b216f2b 100644
--- a/tests/lib/Security/HasherTest.php
+++ b/tests/lib/Security/HasherTest.php
@@ -209,7 +209,7 @@ class HasherTest extends \Test\TestCase {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
}
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueBool')
->with('hashing_default_password')
->willReturn(true);
@@ -233,7 +233,7 @@ class HasherTest extends \Test\TestCase {
$this->markTestSkipped('Need ARGON2ID support to test ARGON2ID hashes');
}
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueBool')
->with('hashing_default_password')
->willReturn(false);
@@ -251,7 +251,7 @@ class HasherTest extends \Test\TestCase {
$this->markTestSkipped('Need ARGON2 support to test ARGON2 hashes');
}
- $this->config->method('getSystemValue')
+ $this->config->method('getSystemValueBool')
->with('hashing_default_password')
->willReturn(true);
diff --git a/tests/lib/Security/VerificationToken/VerificationTokenTest.php b/tests/lib/Security/VerificationToken/VerificationTokenTest.php
index 481646f26ab..a71d2b09f71 100644
--- a/tests/lib/Security/VerificationToken/VerificationTokenTest.php
+++ b/tests/lib/Security/VerificationToken/VerificationTokenTest.php
@@ -116,7 +116,7 @@ class VerificationTokenTest extends TestCase {
->with('alice', 'core', 'fingerprintToken', null)
->willReturn('encryptedToken');
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('secret')
->willReturn('357111317');
@@ -143,7 +143,7 @@ class VerificationTokenTest extends TestCase {
->with('alice', 'core', 'fingerprintToken', null)
->willReturn('encryptedToken');
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('secret')
->willReturn('357111317');
@@ -173,7 +173,7 @@ class VerificationTokenTest extends TestCase {
->with('alice', 'core', 'fingerprintToken', null)
->willReturn('encryptedToken');
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('secret')
->willReturn('357111317');
@@ -207,7 +207,7 @@ class VerificationTokenTest extends TestCase {
->with('alice', 'core', 'fingerprintToken', null)
->willReturn('encryptedToken');
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('secret')
->willReturn('357111317');
@@ -241,7 +241,7 @@ class VerificationTokenTest extends TestCase {
->with('alice', 'core', 'fingerprintToken', null)
->willReturn('encryptedToken');
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('secret')
->willReturn('357111317');
@@ -275,7 +275,7 @@ class VerificationTokenTest extends TestCase {
->with('alice', 'core', 'fingerprintToken', null)
->willReturn('encryptedToken');
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('secret')
->willReturn('357111317');
diff --git a/tests/lib/Support/Subscription/RegistryTest.php b/tests/lib/Support/Subscription/RegistryTest.php
index f4a278cca4e..2a6d5e5569f 100644
--- a/tests/lib/Support/Subscription/RegistryTest.php
+++ b/tests/lib/Support/Subscription/RegistryTest.php
@@ -206,7 +206,7 @@ class RegistryTest extends TestCase {
->with('one-click-instance')
->willReturn(true);
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueInt')
->with('one-click-instance.user-limit')
->willReturn($userLimit);
$this->config->expects($this->once())
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index 256fb95a85b..a242a51a887 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -266,7 +266,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase {
return self::$realDatabase;
});
}
- $dataDir = \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data-autotest');
+ $dataDir = \OC::$server->getConfig()->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data-autotest');
if (self::$wasDatabaseAllowed && \OC::$server->getDatabaseConnection()) {
$db = \OC::$server->getDatabaseConnection();
if ($db->inTransaction()) {
diff --git a/tests/lib/Updater/VersionCheckTest.php b/tests/lib/Updater/VersionCheckTest.php
index 85c74db2ca6..1cd632875c3 100644
--- a/tests/lib/Updater/VersionCheckTest.php
+++ b/tests/lib/Updater/VersionCheckTest.php
@@ -118,7 +118,7 @@ class VersionCheckTest extends \Test\TestCase {
);
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
@@ -170,7 +170,7 @@ class VersionCheckTest extends \Test\TestCase {
);
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
@@ -224,7 +224,7 @@ class VersionCheckTest extends \Test\TestCase {
);
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
@@ -277,7 +277,7 @@ class VersionCheckTest extends \Test\TestCase {
);
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
@@ -331,7 +331,7 @@ class VersionCheckTest extends \Test\TestCase {
);
$this->config
->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with('updater.server.url', 'https://updates.nextcloud.com/updater_server/')
->willReturnArgument(1);
$this->config
diff --git a/tests/lib/UpdaterTest.php b/tests/lib/UpdaterTest.php
index 5a7422cbad5..579761208db 100644
--- a/tests/lib/UpdaterTest.php
+++ b/tests/lib/UpdaterTest.php
@@ -105,7 +105,7 @@ class UpdaterTest extends TestCase {
*/
public function testIsUpgradePossible($oldVersion, $newVersion, $allowedVersions, $result, $debug = false, $vendor = 'nextcloud') {
$this->config->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('debug', false)
->willReturn($debug);
$this->config->expects($this->any())
diff --git a/tests/lib/UrlGeneratorTest.php b/tests/lib/UrlGeneratorTest.php
index 523616b4532..b95cb115217 100644
--- a/tests/lib/UrlGeneratorTest.php
+++ b/tests/lib/UrlGeneratorTest.php
@@ -222,7 +222,7 @@ class UrlGeneratorTest extends \Test\TestCase {
->willReturn('');
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('htaccess.IgnoreFrontController', $this->anything())
->willReturn($ignoreFrontControllerConfig);
}
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php
index 4928744ed1c..e0afb5330d9 100644
--- a/tests/lib/User/SessionTest.php
+++ b/tests/lib/User/SessionTest.php
@@ -353,7 +353,7 @@ class SessionTest extends \Test\TestCase {
->with('doe')
->will($this->throwException(new InvalidTokenException()));
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('token_auth_enforced', false)
->willReturn(true);
$request
@@ -389,7 +389,7 @@ class SessionTest extends \Test\TestCase {
->with('doe')
->will($this->throwException(new InvalidTokenException()));
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('token_auth_enforced', false)
->willReturn(false);
$manager->method('getByEmail')
@@ -457,7 +457,7 @@ class SessionTest extends \Test\TestCase {
->with('doe')
->will($this->throwException(new InvalidTokenException()));
$this->config->expects($this->once())
- ->method('getSystemValue')
+ ->method('getSystemValueBool')
->with('token_auth_enforced', false)
->willReturn(false);
diff --git a/tests/lib/User/UserTest.php b/tests/lib/User/UserTest.php
index b8fa8efced0..7f4ca97e18b 100644
--- a/tests/lib/User/UserTest.php
+++ b/tests/lib/User/UserTest.php
@@ -306,7 +306,7 @@ class UserTest extends TestCase {
->method('getUserValue')
->willReturn(true);
$allConfig->expects($this->any())
- ->method('getSystemValue')
+ ->method('getSystemValueString')
->with($this->equalTo('datadirectory'))
->willReturn('arbitrary/path');
@@ -364,7 +364,12 @@ class UserTest extends TestCase {
}
});
- $user = new User('foo', $backend, $this->dispatcher);
+ $config = $this->createMock(IConfig::class);
+ $config->method('getSystemValueBool')
+ ->with('allow_user_to_change_display_name')
+ ->willReturn(true);
+
+ $user = new User('foo', $backend, $this->dispatcher, null, $config);
$this->assertTrue($user->canChangeDisplayName());
}
@@ -534,6 +539,12 @@ class UserTest extends TestCase {
$config->method('getSystemValue')
->willReturnArgument(1);
+ $config->method('getSystemValueString')
+ ->willReturnArgument(1);
+ $config->method('getSystemValueBool')
+ ->willReturnArgument(1);
+ $config->method('getSystemValueInt')
+ ->willReturnArgument(1);
if ($result) {
$config->expects($this->once())