зеркало из https://github.com/nextcloud/server.git
Adapt tests to config value typing
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Родитель
426c0341ff
Коммит
8d5165e8dc
|
@ -96,7 +96,7 @@ class LanguageIterator implements ILanguageIterator {
|
|||
return $this->config->getSystemValueString('default_language', 'en');
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 5:
|
||||
$defaultLang = $this->config->getSystemValue('default_language', 'en');
|
||||
$defaultLang = $this->config->getSystemValueString('default_language', 'en');
|
||||
if (($truncated = $this->getTruncatedLanguage($defaultLang)) !== $defaultLang) {
|
||||
return $truncated;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ class PreviewManager implements IPreview {
|
|||
* Get all providers
|
||||
*/
|
||||
public function getProviders(): array {
|
||||
if (!$this->config->getSystemValue('enable_previews', true)) {
|
||||
if (!$this->config->getSystemValueBool('enable_previews', true)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ class PreviewManager implements IPreview {
|
|||
* @return boolean
|
||||
*/
|
||||
public function isMimeSupported($mimeType = '*') {
|
||||
if (!$this->config->getSystemValue('enable_previews', true)) {
|
||||
if (!$this->config->getSystemValueBool('enable_previews', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ class PreviewManager implements IPreview {
|
|||
* Check if a preview can be generated for a file
|
||||
*/
|
||||
public function isAvailable(\OCP\Files\FileInfo $file): bool {
|
||||
if (!$this->config->getSystemValue('enable_previews', true)) {
|
||||
if (!$this->config->getSystemValueBool('enable_previews', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
Загрузка…
Ссылка в новой задаче