Add tests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2017-12-13 12:53:12 +01:00 committed by Daniel Calviño Sánchez
parent 7618473a44
commit ee20741526
2 changed files with 55 additions and 10 deletions

View File

@ -156,7 +156,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -189,7 +190,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -223,7 +225,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -255,7 +258,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -285,7 +289,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: false, isCorrectMemcachedPHPModuleInstalled: false,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -315,7 +320,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -345,7 +351,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: false isSettimelimitAvailable: false,
hasFreeTypeSupport: true
}) })
); );
@ -396,7 +403,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true, isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true, isOpcacheProperlySetup: true,
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -427,7 +435,8 @@ describe('OC.SetupChecks tests', function() {
hasPassedCodeIntegrityCheck: true, hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: false, isOpcacheProperlySetup: false,
phpOpcacheDocumentation: 'https://example.org/link/to/doc', phpOpcacheDocumentation: 'https://example.org/link/to/doc',
isSettimelimitAvailable: true isSettimelimitAvailable: true,
hasFreeTypeSupport: true
}) })
); );
@ -439,6 +448,38 @@ describe('OC.SetupChecks tests', function() {
done(); done();
}); });
}); });
it('should return an info if server has no freetype support', function(done) {
var async = OC.SetupChecks.checkSetup();
suite.server.requests[0].respond(
200,
{
'Content-Type': 'application/json'
},
JSON.stringify({
isUrandomAvailable: true,
securityDocs: 'https://docs.owncloud.org/myDocs.html',
serverHasInternetConnection: true,
isMemcacheConfigured: true,
forwardedForHeadersWorking: true,
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
phpOpcacheDocumentation: 'https://example.org/link/to/doc',
isSettimelimitAvailable: true,
hasFreeTypeSupport: false
})
);
async.done(function( data, s, x ){
expect(data).toEqual([{
msg: 'Your PHP does not have freetype support. This will result in broken profile pictures and settings interface.',
type: OC.SetupChecks.MESSAGE_TYPE_INFO
}]);
done();
});
});
}); });
describe('checkGeneric', function() { describe('checkGeneric', function() {

View File

@ -96,7 +96,7 @@ class CheckSetupControllerTest extends TestCase {
$this->checker, $this->checker,
$this->logger $this->logger
]) ])
->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup'])->getMock(); ->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport'])->getMock();
} }
public function testIsInternetConnectionWorkingDisabledViaConfig() { public function testIsInternetConnectionWorkingDisabledViaConfig() {
@ -321,6 +321,9 @@ class CheckSetupControllerTest extends TestCase {
->method('linkToDocs') ->method('linkToDocs')
->with('admin-php-opcache') ->with('admin-php-opcache')
->willReturn('http://docs.example.org/server/go.php?to=admin-php-opcache'); ->willReturn('http://docs.example.org/server/go.php?to=admin-php-opcache');
$this->checkSetupController
->method('hasFreeTypeSupport')
->willReturn(false);
$expected = new DataResponse( $expected = new DataResponse(
[ [
@ -342,6 +345,7 @@ class CheckSetupControllerTest extends TestCase {
'isOpcacheProperlySetup' => false, 'isOpcacheProperlySetup' => false,
'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache', 'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache',
'isSettimelimitAvailable' => true, 'isSettimelimitAvailable' => true,
'hasFreeTypeSupport' => false,
] ]
); );
$this->assertEquals($expected, $this->checkSetupController->check()); $this->assertEquals($expected, $this->checkSetupController->check());