Skip to content

Commit 50ee221

Browse files
szaimenbackportbot[bot]
authored andcommitted
fix tests
Signed-off-by: szaimen <szaimen@e.mail.de>
1 parent 8753de4 commit 50ee221

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed

apps/settings/tests/Controller/CheckSetupControllerTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,16 @@ public function testCheck() {
548548
->method('getAppDirsWithDifferentOwner')
549549
->willReturn([]);
550550

551+
$this->checkSetupController
552+
->expects($this->once())
553+
->method('isImagickEnabled')
554+
->willReturn(false);
555+
556+
$this->checkSetupController
557+
->expects($this->once())
558+
->method('areWebauthnExtensionsEnabled')
559+
->willReturn(false);
560+
551561
$this->checkSetupController
552562
->expects($this->once())
553563
->method('hasRecommendedPHPModules')
@@ -642,6 +652,8 @@ public function testCheck() {
642652
'missingColumns' => [],
643653
'isMemoryLimitSufficient' => true,
644654
'appDirsWithDifferentOwner' => [],
655+
'isImagickEnabled' => false,
656+
'areWebauthnExtensionsEnabled' => false,
645657
'recommendedPHPModules' => [],
646658
'pendingBigIntConversionColumns' => [],
647659
'isMysqlUsedWithoutUTF8MB4' => false,

core/js/tests/specs/setupchecksSpec.js

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ describe('OC.SetupChecks tests', function() {
249249
},
250250
isMemoryLimitSufficient: true,
251251
appDirsWithDifferentOwner: [],
252+
isImagickEnabled: true,
253+
areWebauthnExtensionsEnabled: true,
252254
recommendedPHPModules: [],
253255
pendingBigIntConversionColumns: [],
254256
isMysqlUsedWithoutUTF8MB4: false,
@@ -307,6 +309,8 @@ describe('OC.SetupChecks tests', function() {
307309
},
308310
isMemoryLimitSufficient: true,
309311
appDirsWithDifferentOwner: [],
312+
isImagickEnabled: true,
313+
areWebauthnExtensionsEnabled: true,
310314
recommendedPHPModules: [],
311315
pendingBigIntConversionColumns: [],
312316
isMysqlUsedWithoutUTF8MB4: false,
@@ -366,6 +370,8 @@ describe('OC.SetupChecks tests', function() {
366370
},
367371
isMemoryLimitSufficient: true,
368372
appDirsWithDifferentOwner: [],
373+
isImagickEnabled: true,
374+
areWebauthnExtensionsEnabled: true,
369375
recommendedPHPModules: [],
370376
pendingBigIntConversionColumns: [],
371377
isMysqlUsedWithoutUTF8MB4: false,
@@ -423,6 +429,8 @@ describe('OC.SetupChecks tests', function() {
423429
},
424430
isMemoryLimitSufficient: true,
425431
appDirsWithDifferentOwner: [],
432+
isImagickEnabled: true,
433+
areWebauthnExtensionsEnabled: true,
426434
recommendedPHPModules: [],
427435
pendingBigIntConversionColumns: [],
428436
isMysqlUsedWithoutUTF8MB4: false,
@@ -478,6 +486,8 @@ describe('OC.SetupChecks tests', function() {
478486
},
479487
isMemoryLimitSufficient: true,
480488
appDirsWithDifferentOwner: [],
489+
isImagickEnabled: true,
490+
areWebauthnExtensionsEnabled: true,
481491
recommendedPHPModules: [],
482492
pendingBigIntConversionColumns: [],
483493
isMysqlUsedWithoutUTF8MB4: false,
@@ -533,6 +543,8 @@ describe('OC.SetupChecks tests', function() {
533543
},
534544
isMemoryLimitSufficient: true,
535545
appDirsWithDifferentOwner: [],
546+
isImagickEnabled: true,
547+
areWebauthnExtensionsEnabled: true,
536548
recommendedPHPModules: [],
537549
pendingBigIntConversionColumns: [],
538550
isMysqlUsedWithoutUTF8MB4: false,
@@ -590,6 +602,8 @@ describe('OC.SetupChecks tests', function() {
590602
appDirsWithDifferentOwner: [
591603
'/some/path'
592604
],
605+
isImagickEnabled: true,
606+
areWebauthnExtensionsEnabled: true,
593607
recommendedPHPModules: [],
594608
pendingBigIntConversionColumns: [],
595609
isMysqlUsedWithoutUTF8MB4: false,
@@ -645,6 +659,8 @@ describe('OC.SetupChecks tests', function() {
645659
},
646660
isMemoryLimitSufficient: true,
647661
appDirsWithDifferentOwner: [],
662+
isImagickEnabled: true,
663+
areWebauthnExtensionsEnabled: true,
648664
recommendedPHPModules: [],
649665
pendingBigIntConversionColumns: [],
650666
isMysqlUsedWithoutUTF8MB4: false,
@@ -700,6 +716,8 @@ describe('OC.SetupChecks tests', function() {
700716
},
701717
isMemoryLimitSufficient: true,
702718
appDirsWithDifferentOwner: [],
719+
isImagickEnabled: true,
720+
areWebauthnExtensionsEnabled: true,
703721
recommendedPHPModules: [],
704722
pendingBigIntConversionColumns: [],
705723
isMysqlUsedWithoutUTF8MB4: false,
@@ -755,6 +773,8 @@ describe('OC.SetupChecks tests', function() {
755773
},
756774
isMemoryLimitSufficient: false,
757775
appDirsWithDifferentOwner: [],
776+
isImagickEnabled: true,
777+
areWebauthnExtensionsEnabled: true,
758778
recommendedPHPModules: [],
759779
pendingBigIntConversionColumns: [],
760780
isMysqlUsedWithoutUTF8MB4: false,
@@ -831,6 +851,8 @@ describe('OC.SetupChecks tests', function() {
831851
},
832852
isMemoryLimitSufficient: true,
833853
appDirsWithDifferentOwner: [],
854+
isImagickEnabled: true,
855+
areWebauthnExtensionsEnabled: true,
834856
recommendedPHPModules: [],
835857
pendingBigIntConversionColumns: [],
836858
isMysqlUsedWithoutUTF8MB4: false,
@@ -886,6 +908,8 @@ describe('OC.SetupChecks tests', function() {
886908
},
887909
isMemoryLimitSufficient: true,
888910
appDirsWithDifferentOwner: [],
911+
isImagickEnabled: true,
912+
areWebauthnExtensionsEnabled: true,
889913
recommendedPHPModules: [],
890914
pendingBigIntConversionColumns: [],
891915
isMysqlUsedWithoutUTF8MB4: false,
@@ -941,6 +965,8 @@ describe('OC.SetupChecks tests', function() {
941965
},
942966
isMemoryLimitSufficient: true,
943967
appDirsWithDifferentOwner: [],
968+
isImagickEnabled: true,
969+
areWebauthnExtensionsEnabled: true,
944970
recommendedPHPModules: [],
945971
pendingBigIntConversionColumns: [],
946972
isMysqlUsedWithoutUTF8MB4: false,
@@ -996,6 +1022,8 @@ describe('OC.SetupChecks tests', function() {
9961022
},
9971023
isMemoryLimitSufficient: true,
9981024
appDirsWithDifferentOwner: [],
1025+
isImagickEnabled: true,
1026+
areWebauthnExtensionsEnabled: true,
9991027
recommendedPHPModules: [],
10001028
pendingBigIntConversionColumns: [],
10011029
isMysqlUsedWithoutUTF8MB4: true,
@@ -1055,6 +1083,8 @@ describe('OC.SetupChecks tests', function() {
10551083
},
10561084
isMemoryLimitSufficient: true,
10571085
appDirsWithDifferentOwner: [],
1086+
isImagickEnabled: true,
1087+
areWebauthnExtensionsEnabled: true,
10581088
recommendedPHPModules: [],
10591089
pendingBigIntConversionColumns: [],
10601090
isMysqlUsedWithoutUTF8MB4: false,
@@ -1111,6 +1141,8 @@ describe('OC.SetupChecks tests', function() {
11111141
},
11121142
isMemoryLimitSufficient: true,
11131143
appDirsWithDifferentOwner: [],
1144+
isImagickEnabled: true,
1145+
areWebauthnExtensionsEnabled: true,
11141146
recommendedPHPModules: [],
11151147
pendingBigIntConversionColumns: [],
11161148
isMysqlUsedWithoutUTF8MB4: false,
@@ -1164,6 +1196,8 @@ describe('OC.SetupChecks tests', function() {
11641196
},
11651197
isMemoryLimitSufficient: true,
11661198
appDirsWithDifferentOwner: [],
1199+
isImagickEnabled: true,
1200+
areWebauthnExtensionsEnabled: true,
11671201
recommendedPHPModules: [],
11681202
pendingBigIntConversionColumns: [],
11691203
isMysqlUsedWithoutUTF8MB4: false,
@@ -1183,6 +1217,122 @@ describe('OC.SetupChecks tests', function() {
11831217
});
11841218
});
11851219

1220+
1221+
it('should return an error if imagick is not enabled', function(done) {
1222+
var async = OC.SetupChecks.checkSetup();
1223+
1224+
suite.server.requests[0].respond(
1225+
200,
1226+
{
1227+
'Content-Type': 'application/json',
1228+
},
1229+
JSON.stringify({
1230+
hasFileinfoInstalled: true,
1231+
isGetenvServerWorking: true,
1232+
isReadOnlyConfig: false,
1233+
wasEmailTestSuccessful: true,
1234+
hasWorkingFileLocking: true,
1235+
hasValidTransactionIsolationLevel: true,
1236+
suggestedOverwriteCliURL: '',
1237+
isRandomnessSecure: true,
1238+
securityDocs: 'https://docs.nextcloud.com/myDocs.html',
1239+
isFairUseOfFreePushService: true,
1240+
serverHasInternetConnectionProblems: false,
1241+
isMemcacheConfigured: true,
1242+
forwardedForHeadersWorking: true,
1243+
isCorrectMemcachedPHPModuleInstalled: true,
1244+
hasPassedCodeIntegrityCheck: true,
1245+
OpcacheSetupRecommendations: [],
1246+
isSettimelimitAvailable: true,
1247+
hasFreeTypeSupport: true,
1248+
missingIndexes: [],
1249+
missingPrimaryKeys: [],
1250+
missingColumns: [],
1251+
cronErrors: [],
1252+
cronInfo: {
1253+
diffInSeconds: 0
1254+
},
1255+
isMemoryLimitSufficient: true,
1256+
appDirsWithDifferentOwner: [],
1257+
isImagickEnabled: false,
1258+
areWebauthnExtensionsEnabled: true,
1259+
recommendedPHPModules: [],
1260+
pendingBigIntConversionColumns: [],
1261+
isMysqlUsedWithoutUTF8MB4: false,
1262+
isDefaultPhoneRegionSet: true,
1263+
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
1264+
reverseProxyGeneratedURL: 'https://server',
1265+
temporaryDirectoryWritable: true,
1266+
})
1267+
);
1268+
1269+
async.done(function( data, s, x ){
1270+
expect(data).toEqual([{
1271+
msg: 'The PHP module "imagick" is not enabled although the theming app is. For favicon generation to work correctly, you need to install and enable this module.',
1272+
type: OC.SetupChecks.MESSAGE_TYPE_INFO
1273+
}]);
1274+
done();
1275+
});
1276+
});
1277+
1278+
1279+
it('should return an error if gmp or bcmath are not enabled', function(done) {
1280+
var async = OC.SetupChecks.checkSetup();
1281+
1282+
suite.server.requests[0].respond(
1283+
200,
1284+
{
1285+
'Content-Type': 'application/json',
1286+
},
1287+
JSON.stringify({
1288+
hasFileinfoInstalled: true,
1289+
isGetenvServerWorking: true,
1290+
isReadOnlyConfig: false,
1291+
wasEmailTestSuccessful: true,
1292+
hasWorkingFileLocking: true,
1293+
hasValidTransactionIsolationLevel: true,
1294+
suggestedOverwriteCliURL: '',
1295+
isRandomnessSecure: true,
1296+
securityDocs: 'https://docs.nextcloud.com/myDocs.html',
1297+
isFairUseOfFreePushService: true,
1298+
serverHasInternetConnectionProblems: false,
1299+
isMemcacheConfigured: true,
1300+
forwardedForHeadersWorking: true,
1301+
isCorrectMemcachedPHPModuleInstalled: true,
1302+
hasPassedCodeIntegrityCheck: true,
1303+
OpcacheSetupRecommendations: [],
1304+
isSettimelimitAvailable: true,
1305+
hasFreeTypeSupport: true,
1306+
missingIndexes: [],
1307+
missingPrimaryKeys: [],
1308+
missingColumns: [],
1309+
cronErrors: [],
1310+
cronInfo: {
1311+
diffInSeconds: 0
1312+
},
1313+
isMemoryLimitSufficient: true,
1314+
appDirsWithDifferentOwner: [],
1315+
isImagickEnabled: true,
1316+
areWebauthnExtensionsEnabled: false,
1317+
recommendedPHPModules: [],
1318+
pendingBigIntConversionColumns: [],
1319+
isMysqlUsedWithoutUTF8MB4: false,
1320+
isDefaultPhoneRegionSet: true,
1321+
isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed: true,
1322+
reverseProxyGeneratedURL: 'https://server',
1323+
temporaryDirectoryWritable: true,
1324+
})
1325+
);
1326+
1327+
async.done(function( data, s, x ){
1328+
expect(data).toEqual([{
1329+
msg: 'The PHP modules "gmp" and/or "bcmath" are not enabled. If you use WebAuthn passwordless authentication, these modules are required.',
1330+
type: OC.SetupChecks.MESSAGE_TYPE_INFO
1331+
}]);
1332+
done();
1333+
});
1334+
});
1335+
11861336
it('should return an info if there is no default phone region', function(done) {
11871337
var async = OC.SetupChecks.checkSetup();
11881338

@@ -1219,6 +1369,8 @@ describe('OC.SetupChecks tests', function() {
12191369
},
12201370
isMemoryLimitSufficient: true,
12211371
appDirsWithDifferentOwner: [],
1372+
isImagickEnabled: true,
1373+
areWebauthnExtensionsEnabled: true,
12221374
recommendedPHPModules: [],
12231375
pendingBigIntConversionColumns: [],
12241376
isMysqlUsedWithoutUTF8MB4: false,
@@ -1274,6 +1426,8 @@ describe('OC.SetupChecks tests', function() {
12741426
},
12751427
isMemoryLimitSufficient: true,
12761428
appDirsWithDifferentOwner: [],
1429+
isImagickEnabled: true,
1430+
areWebauthnExtensionsEnabled: true,
12771431
recommendedPHPModules: [],
12781432
pendingBigIntConversionColumns: [],
12791433
isMysqlUsedWithoutUTF8MB4: false,

0 commit comments

Comments
 (0)