Skip to content

Commit 82d69d4

Browse files
committed
test: update form tests to include lockedBy and lockedUntil fields
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent e811350 commit 82d69d4

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

tests/Unit/Controller/ApiControllerTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ public function dataTestCreateNewForm() {
407407
'submissionMessage' => null,
408408
'fileId' => null,
409409
'fileFormat' => null,
410-
'allowEditSubmissions' => false
410+
'allowEditSubmissions' => false,
411+
'lockedBy' => null,
412+
'lockedUntil' => null,
411413
]]
412414
];
413415
}
@@ -982,7 +984,7 @@ public function testTransferNewOwnerNotFound() {
982984
->with('newOwner')
983985
->willReturn(null);
984986

985-
$this->expectException(OCSBadRequestException::class);
987+
$this->expectException(NoSuchFormException::class);
986988
$this->apiController->updateForm(1, ['ownerId' => 'newOwner']);
987989
}
988990

@@ -997,6 +999,11 @@ public function testTransferOwner() {
997999
->with(1)
9981000
->willReturn($form);
9991001

1002+
$this->formsService
1003+
->method('canEditForm')
1004+
->with($form)
1005+
->willReturn(true);
1006+
10001007
$newOwner = $this->createMock(IUser::class);
10011008
$this->userManager->expects($this->once())
10021009
->method('get')

tests/Unit/FormsMigratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function testExport(string $expectedJson) {
253253
public function dataImport() {
254254
return [
255255
'exactlyOneOfEach' => [
256-
'$inputJson' => '[{"title":"Link","description":"","created":1646251830,"access":{"permitAllUsers":false,"showToAllUsers":false},"expires":0,"state":0,"isAnonymous":false,"submitMultiple":false,"allowEditSubmissions":false,"showExpiration":false,"lastUpdated":123456789,"questions":[{"id":14,"order":2,"type":"multiple","isRequired":false,"text":"checkbox","description":"huhu","extraSettings":{},"options":[{"text":"ans1"}]}],"submissions":[{"userId":"anyUser@localhost","timestamp":1651354059,"answers":[{"questionId":14,"text":"ans1"}]}]}]'
256+
'$inputJson' => '[{"title":"Link","description":"","created":1646251830,"access":{"permitAllUsers":false,"showToAllUsers":false},"expires":0,"state":0,"lockedBy":null,"lockedUntil":null,"isAnonymous":false,"submitMultiple":false,"allowEditSubmissions":false,"showExpiration":false,"lastUpdated":123456789,"questions":[{"id":14,"order":2,"type":"multiple","isRequired":false,"text":"checkbox","description":"huhu","extraSettings":{},"options":[{"text":"ans1"}]}],"submissions":[{"userId":"anyUser@localhost","timestamp":1651354059,"answers":[{"questionId":14,"text":"ans1"}]}]}]'
257257
]
258258
];
259259
}

tests/Unit/Service/FormsServiceTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ public function dataGetForm() {
244244
'fileId' => null,
245245
'fileFormat' => null,
246246
'permissions' => Constants::PERMISSION_ALL,
247-
'allowEditSubmissions' => false
247+
'allowEditSubmissions' => false,
248+
'lockedBy' => null,
249+
'lockedUntil' => null,
248250
]]
249251
];
250252
}
@@ -358,6 +360,8 @@ public function dataGetPartialForm() {
358360
'permissions' => Constants::PERMISSION_ALL,
359361
'submissionCount' => 123,
360362
'partial' => true,
363+
'lockedBy' => null,
364+
'lockedUntil' => null,
361365
]]
362366
];
363367
}
@@ -397,6 +401,8 @@ public function dataGetPartialFormShared() {
397401
'submissionCount' => 123,
398402
'state' => 0,
399403
'partial' => true,
404+
'lockedBy' => null,
405+
'lockedUntil' => null,
400406
]]
401407
];
402408
}
@@ -458,6 +464,8 @@ public function dataGetPublicForm() {
458464
],
459465
'submissionMessage' => null,
460466
'allowEditSubmissions' => false,
467+
'lockedBy' => null,
468+
'lockedUntil' => null,
461469
]]
462470
];
463471
}

0 commit comments

Comments
 (0)