Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions tests/lib/Service/OpenProjectAPIServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,46 @@ private function getOpenProjectAPIService(
$client = new GuzzleClient();
$clientConfigMock = $this->getMockBuilder(IConfig::class)->getMock();

$clientConfigMock

if (version_compare(OC_Util::getVersionString(), '27') >= 0) {
$clientConfigMock
->method('getSystemValueBool')
->withConsecutive(
['allow_local_remote_servers', false],
['installed', false],
['allow_local_remote_servers', false],
['allow_local_remote_servers', false],
['installed', false],
['allow_local_remote_servers', false],
['allow_local_remote_servers', false],
['installed', false],
['allow_local_remote_servers', false]
)
->willReturnOnConsecutiveCalls(
true,
true,
true,
true,
true,
true,
true,
true,
true
);
//changed from nextcloud 26
// @phpstan-ignore-next-line
$ocClient = new Client(
$clientConfigMock, // @phpstan-ignore-line
$certificateManager, // @phpstan-ignore-line
$client, // @phpstan-ignore-line
$this->createMock(IRemoteHostValidator::class) // @phpstan-ignore-line
);
} elseif (version_compare(OC_Util::getVersionString(), '26') >= 0) {
$clientConfigMock
->method('getSystemValueBool')
->with('allow_local_remote_servers', false)
->willReturn(true);

if (version_compare(OC_Util::getVersionString(), '26') >= 0) {
//changed from nextcloud 26
// @phpstan-ignore-next-line
$ocClient = new Client(
Expand All @@ -241,6 +275,10 @@ private function getOpenProjectAPIService(
$this->createMock(IRemoteHostValidator::class) // @phpstan-ignore-line
);
} elseif (version_compare(OC_Util::getVersionString(), '24') >= 0) {
$clientConfigMock
->method('getSystemValueBool')
->with('allow_local_remote_servers', false)
->willReturn(true);
//changed from nextcloud 24
// @phpstan-ignore-next-line
$ocClient = new Client(
Expand All @@ -250,6 +288,10 @@ private function getOpenProjectAPIService(
$this->createMock(\OC\Http\Client\LocalAddressChecker::class) // @phpstan-ignore-line
);
} else {
$clientConfigMock
->method('getSystemValueBool')
->with('allow_local_remote_servers', false)
->willReturn(true);
// @phpstan-ignore-next-line
$ocClient = new Client(
$clientConfigMock, // @phpstan-ignore-line
Expand Down