diff options
Diffstat (limited to 'tests/settings/controller')
-rw-r--r-- | tests/settings/controller/CheckSetupControllerTest.php | 118 |
1 files changed, 105 insertions, 13 deletions
diff --git a/tests/settings/controller/CheckSetupControllerTest.php b/tests/settings/controller/CheckSetupControllerTest.php index c453822464f..ebba18de5fd 100644 --- a/tests/settings/controller/CheckSetupControllerTest.php +++ b/tests/settings/controller/CheckSetupControllerTest.php @@ -293,6 +293,10 @@ class CheckSetupControllerTest extends TestCase { ->will($this->returnValue('SomeProvider')); $this->config->expects($this->at(2)) ->method('getSystemValue') + ->with('has_internet_connection', true) + ->will($this->returnValue(false)); + $this->config->expects($this->at(3)) + ->method('getSystemValue') ->with('trusted_proxies', []) ->willReturn(['1.2.3.4']); @@ -365,10 +369,13 @@ class CheckSetupControllerTest extends TestCase { ]) ->setMethods(null)->getMock(); - $this->assertArrayHasKey('ssl_version', $checkSetupController->getCurlVersion()); + $this->assertArrayHasKey('ssl_version', $this->invokePrivate($checkSetupController, 'getCurlVersion')); } public function testIsUsedTlsLibOutdatedWithAnotherLibrary() { + $this->config->expects($this->any()) + ->method('getSystemValue') + ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) ->method('getCurlVersion') @@ -377,6 +384,9 @@ class CheckSetupControllerTest extends TestCase { } public function testIsUsedTlsLibOutdatedWithMisbehavingCurl() { + $this->config->expects($this->any()) + ->method('getSystemValue') + ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) ->method('getCurlVersion') @@ -385,10 +395,8 @@ class CheckSetupControllerTest extends TestCase { } public function testIsUsedTlsLibOutdatedWithOlderOpenSsl() { - $this->config - ->expects($this->once()) + $this->config->expects($this->any()) ->method('getSystemValue') - ->with('appstoreenabled', true) ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) @@ -399,10 +407,10 @@ class CheckSetupControllerTest extends TestCase { public function testIsUsedTlsLibOutdatedWithOlderOpenSslAndWithoutAppstore() { $this->config - ->expects($this->once()) + ->expects($this->at(0)) ->method('getSystemValue') - ->with('appstoreenabled', true) - ->will($this->returnValue(false)); + ->with('has_internet_connection', true) + ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) ->method('getCurlVersion') @@ -411,10 +419,8 @@ class CheckSetupControllerTest extends TestCase { } public function testIsUsedTlsLibOutdatedWithOlderOpenSsl1() { - $this->config - ->expects($this->once()) + $this->config->expects($this->any()) ->method('getSystemValue') - ->with('appstoreenabled', true) ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) @@ -424,6 +430,9 @@ class CheckSetupControllerTest extends TestCase { } public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion() { + $this->config->expects($this->any()) + ->method('getSystemValue') + ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) ->method('getCurlVersion') @@ -432,6 +441,9 @@ class CheckSetupControllerTest extends TestCase { } public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion1() { + $this->config->expects($this->any()) + ->method('getSystemValue') + ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) ->method('getCurlVersion') @@ -440,10 +452,8 @@ class CheckSetupControllerTest extends TestCase { } public function testIsBuggyNss400() { - $this->config - ->expects($this->once()) + $this->config->expects($this->any()) ->method('getSystemValue') - ->with('appstoreenabled', true) ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) @@ -476,6 +486,9 @@ class CheckSetupControllerTest extends TestCase { public function testIsBuggyNss200() { + $this->config->expects($this->any()) + ->method('getSystemValue') + ->will($this->returnValue(true)); $this->checkSetupController ->expects($this->once()) ->method('getCurlVersion') @@ -504,4 +517,83 @@ class CheckSetupControllerTest extends TestCase { $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); } + + public function testIsUsedTlsLibOutdatedWithInternetDisabled() { + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('has_internet_connection', true) + ->will($this->returnValue(false)); + $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); + } + + public function testIsUsedTlsLibOutdatedWithAppstoreDisabledAndServerToServerSharingEnabled() { + // Appstore is disabled by default in EE + $appStoreDefault = false; + if (\OC_Util::getEditionString() === '') { + $appStoreDefault = true; + } + + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('has_internet_connection', true) + ->will($this->returnValue(true)); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', $appStoreDefault) + ->will($this->returnValue(false)); + $this->config + ->expects($this->at(2)) + ->method('getAppValue') + ->with('files_sharing', 'outgoing_server2server_share_enabled', 'yes') + ->will($this->returnValue('no')); + $this->config + ->expects($this->at(3)) + ->method('getAppValue') + ->with('files_sharing', 'incoming_server2server_share_enabled', 'yes') + ->will($this->returnValue('yes')); + + $this->checkSetupController + ->expects($this->once()) + ->method('getCurlVersion') + ->will($this->returnValue([])); + $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); + } + + public function testIsUsedTlsLibOutdatedWithAppstoreDisabledAndServerToServerSharingDisabled() { + // Appstore is disabled by default in EE + $appStoreDefault = false; + if (\OC_Util::getEditionString() === '') { + $appStoreDefault = true; + } + + $this->config + ->expects($this->at(0)) + ->method('getSystemValue') + ->with('has_internet_connection', true) + ->will($this->returnValue(true)); + $this->config + ->expects($this->at(1)) + ->method('getSystemValue') + ->with('appstoreenabled', $appStoreDefault) + ->will($this->returnValue(false)); + $this->config + ->expects($this->at(2)) + ->method('getAppValue') + ->with('files_sharing', 'outgoing_server2server_share_enabled', 'yes') + ->will($this->returnValue('no')); + $this->config + ->expects($this->at(3)) + ->method('getAppValue') + ->with('files_sharing', 'incoming_server2server_share_enabled', 'yes') + ->will($this->returnValue('no')); + + $this->checkSetupController + ->expects($this->never()) + ->method('getCurlVersion') + ->will($this->returnValue([])); + $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); + } } |