Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Dec 13, 2017
1 parent ab37416 commit 7d20598
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 10 deletions.
59 changes: 50 additions & 9 deletions core/js/tests/specs/setupchecksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -189,7 +190,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -223,7 +225,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -255,7 +258,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -285,7 +289,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: false,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -315,7 +320,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -345,7 +351,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: false
isSettimelimitAvailable: false,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -396,7 +403,8 @@ describe('OC.SetupChecks tests', function() {
isCorrectMemcachedPHPModuleInstalled: true,
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: true,
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand Down Expand Up @@ -427,7 +435,8 @@ describe('OC.SetupChecks tests', function() {
hasPassedCodeIntegrityCheck: true,
isOpcacheProperlySetup: false,
phpOpcacheDocumentation: 'https://example.org/link/to/doc',
isSettimelimitAvailable: true
isSettimelimitAvailable: true,
hasFreeTypeSupport: true
})
);

Expand All @@ -439,6 +448,38 @@ describe('OC.SetupChecks tests', function() {
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 can result in broken avatars.',
type: OC.SetupChecks.MESSAGE_TYPE_INFO
}]);
done();
});
});
});

describe('checkGeneric', function() {
Expand Down
6 changes: 5 additions & 1 deletion tests/Settings/Controller/CheckSetupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function setUp() {
$this->checker,
$this->logger
])
->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup'])->getMock();
->setMethods(['getCurlVersion', 'isPhpOutdated', 'isOpcacheProperlySetup', 'hasFreeTypeSupport'])->getMock();
}

public function testIsInternetConnectionWorkingDisabledViaConfig() {
Expand Down Expand Up @@ -321,6 +321,9 @@ public function testCheck() {
->method('linkToDocs')
->with('admin-php-opcache')
->willReturn('http://docs.example.org/server/go.php?to=admin-php-opcache');
$this->checkSetupController
->method('hasFreeTypeSupport')
->willReturn(false);

$expected = new DataResponse(
[
Expand All @@ -342,6 +345,7 @@ public function testCheck() {
'isOpcacheProperlySetup' => false,
'phpOpcacheDocumentation' => 'http://docs.example.org/server/go.php?to=admin-php-opcache',
'isSettimelimitAvailable' => true,
'hasFreeTypeSupport' => false,
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
Expand Down

0 comments on commit 7d20598

Please sign in to comment.