diff --git a/tests/lib/Service/OpenProjectAPIServiceTest.php b/tests/lib/Service/OpenProjectAPIServiceTest.php index 6437a901b..69260d577 100644 --- a/tests/lib/Service/OpenProjectAPIServiceTest.php +++ b/tests/lib/Service/OpenProjectAPIServiceTest.php @@ -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( @@ -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( @@ -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