public function testIsBuggyNss200()
 {
     $this->checkSetupController->expects($this->once())->method('getCurlVersion')->will($this->returnValue(['ssl_version' => 'NSS/1.0.2b']));
     $client = $this->getMockBuilder('\\OCP\\Http\\Client\\IClient')->disableOriginalConstructor()->getMock();
     $exception = $this->getMockBuilder('\\GuzzleHttp\\Exception\\ClientException')->disableOriginalConstructor()->getMock();
     $response = $this->getMockBuilder('\\GuzzleHttp\\Message\\ResponseInterface')->disableOriginalConstructor()->getMock();
     $response->expects($this->once())->method('getStatusCode')->will($this->returnValue(200));
     $exception->expects($this->once())->method('getResponse')->will($this->returnValue($response));
     $client->expects($this->at(0))->method('get')->with('https://www.owncloud.org/', [])->will($this->throwException($exception));
     $this->clientService->expects($this->once())->method('newClient')->will($this->returnValue($client));
     $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated'));
 }
 public function testCheck()
 {
     $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('memcache.local', null)->will($this->returnValue('SomeProvider'));
     $client = $this->getMockBuilder('\\OCP\\Http\\Client\\IClient')->disableOriginalConstructor()->getMock();
     $client->expects($this->at(0))->method('get')->with('https://www.owncloud.org/', []);
     $client->expects($this->at(1))->method('get')->with('http://www.owncloud.org/', [])->will($this->throwException(new \Exception()));
     $this->clientService->expects($this->once())->method('newClient')->will($this->returnValue($client));
     $this->util->expects($this->once())->method('isHtaccessWorking')->will($this->returnValue(true));
     $this->urlGenerator->expects($this->once())->method('linkToDocs')->with('admin-performance')->willReturn('http://doc.owncloud.org/server/go.php?to=admin-performance');
     $expected = new DataResponse(['serverHasInternetConnection' => false, 'dataDirectoryProtected' => true, 'isMemcacheConfigured' => true, 'memcacheDocs' => 'http://doc.owncloud.org/server/go.php?to=admin-performance']);
     $this->assertEquals($expected, $this->checkSetupController->check());
 }
 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'));
 }
    public function testGetFailedIntegrityCheckFilesWithSomeErrorsFound()
    {
        $this->checker->expects($this->once())->method('getResults')->will($this->returnValue(array('core' => array('EXTRA_FILE' => array('/testfile' => array()), 'INVALID_HASH' => array('/.idea/workspace.xml' => array('expected' => 'f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216', 'current' => 'ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094'), '/lib/private/integritycheck/checker.php' => array('expected' => 'c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea', 'current' => '88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585'), '/settings/controller/checksetupcontroller.php' => array('expected' => '3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4', 'current' => '09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a'))), 'bookmarks' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'dav' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'encryption' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'external' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'federation' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_antivirus' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_drop' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_external' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_pdfviewer' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_sharing' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_trashbin' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_versions' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'files_videoviewer' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'firstrunwizard' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'gitsmart' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'logreader' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature could not get verified.')), 'password_policy' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'provisioning_api' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'sketch' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'threatblock' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'two_factor_auth' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'user_ldap' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')), 'user_shibboleth' => array('EXCEPTION' => array('class' => 'OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException', 'message' => 'Signature data not found.')))));
        $expected = new DataDisplayResponse('Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- core
	- EXTRA_FILE
		- /testfile
	- INVALID_HASH
		- /.idea/workspace.xml
		- /lib/private/integritycheck/checker.php
		- /settings/controller/checksetupcontroller.php
- bookmarks
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- dav
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- encryption
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- external
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- federation
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_antivirus
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_drop
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_external
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_pdfviewer
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_sharing
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_trashbin
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_versions
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- files_videoviewer
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- firstrunwizard
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- gitsmart
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- logreader
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature could not get verified.
- password_policy
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- provisioning_api
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- sketch
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- threatblock
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- two_factor_auth
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- user_ldap
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.
- user_shibboleth
	- EXCEPTION
		- OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
		- Signature data not found.

Raw output
==========
Array
(
    [core] => Array
        (
            [EXTRA_FILE] => Array
                (
                    [/testfile] => Array
                        (
                        )

                )

            [INVALID_HASH] => Array
                (
                    [/.idea/workspace.xml] => Array
                        (
                            [expected] => f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3c2521b050955d9d452769f61454c9ddfa9c308146ade10546cfa829794448eaffbc9a04a29d216
                            [current] => ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d32142cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec231d4a230559d4f3e2c471d3ea094
                        )

                    [/lib/private/integritycheck/checker.php] => Array
                        (
                            [expected] => c5a03bacae8dedf8b239997901ba1fffd2fe51271d13a00cc4b34b09cca5176397a89fc27381cbb1f72855fa18b69b6f87d7d5685c3b45aee373b09be54742ea
                            [current] => 88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300c478e6c156c5955ed53c40d06585
                        )

                    [/settings/controller/checksetupcontroller.php] => Array
                        (
                            [expected] => 3e1de26ce93c7bfe0ede7c19cb6c93cadc010340225b375607a7178812e9de163179b0dc33809f451e01f491d93f6f5aaca7929685d21594cccf8bda732327c4
                            [current] => 09563164f9904a837f9ca0b5f626db56c838e5098e0ccc1d8b935f68fa03a25c5ec6f6b2d9e44a868e8b85764dafd1605522b4af8db0ae269d73432e9a01e63a
                        )

                )

        )

    [bookmarks] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [dav] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [encryption] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [external] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [federation] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_antivirus] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_drop] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_external] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_pdfviewer] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_sharing] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_trashbin] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_versions] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [files_videoviewer] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [firstrunwizard] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [gitsmart] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [logreader] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature could not get verified.
                )

        )

    [password_policy] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [provisioning_api] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [sketch] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [threatblock] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [two_factor_auth] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [user_ldap] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

    [user_shibboleth] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\\IntegrityCheck\\Exceptions\\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

)
', Http::STATUS_OK, ['Content-Type' => 'text/plain']);
        $this->assertEquals($expected, $this->checkSetupController->getFailedIntegrityCheckFiles());
    }