diff --git a/tests/Unit/Controller/ApiControllerTest.php b/tests/Unit/Controller/ApiControllerTest.php index 9657a216c..9b41d1796 100644 --- a/tests/Unit/Controller/ApiControllerTest.php +++ b/tests/Unit/Controller/ApiControllerTest.php @@ -387,6 +387,7 @@ public function dataTestCreateNewForm() { 'submissionMessage' => null, 'fileId' => null, 'fileFormat' => null, + 'allowEdit' => null, ]] ]; } diff --git a/tests/Unit/FormsMigratorTest.php b/tests/Unit/FormsMigratorTest.php index 5dfd16c42..c477a7139 100644 --- a/tests/Unit/FormsMigratorTest.php +++ b/tests/Unit/FormsMigratorTest.php @@ -108,6 +108,7 @@ public function dataExport() { "state": 0, "isAnonymous": false, "submitMultiple": false, + "allowEdit": false, "showExpiration": false, "lastUpdated": 123456789, "submissionMessage": "Back to website", @@ -179,6 +180,7 @@ public function testExport(string $expectedJson) { $form->setExpires(0); $form->setIsAnonymous(false); $form->setSubmitMultiple(false); + $form->setAllowEdit(false); $form->setShowExpiration(false); $form->setLastUpdated(123456789); $form->setSubmissionMessage('Back to website'); @@ -251,7 +253,7 @@ public function testExport(string $expectedJson) { public function dataImport() { return [ 'exactlyOneOfEach' => [ - '$inputJson' => '[{"title":"Link","description":"","created":1646251830,"access":{"permitAllUsers":false,"showToAllUsers":false},"expires":0,"state":0,"isAnonymous":false,"submitMultiple":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"}]}]}]' + '$inputJson' => '[{"title":"Link","description":"","created":1646251830,"access":{"permitAllUsers":false,"showToAllUsers":false},"expires":0,"state":0,"isAnonymous":false,"submitMultiple":false,"allowEdit":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"}]}]}]' ] ]; } diff --git a/tests/Unit/Service/FormsServiceTest.php b/tests/Unit/Service/FormsServiceTest.php index a5b06b752..4814834ef 100644 --- a/tests/Unit/Service/FormsServiceTest.php +++ b/tests/Unit/Service/FormsServiceTest.php @@ -42,6 +42,7 @@ function microtime(bool|float $asFloat = false) { use OCA\Forms\Db\ShareMapper; use OCA\Forms\Db\Submission; use OCA\Forms\Db\SubmissionMapper; +use OCA\Forms\Db\AnswerMapper; use OCA\Forms\Service\CirclesService; use OCA\Forms\Service\ConfigService; use OCA\Forms\Service\FormsService; @@ -85,6 +86,9 @@ class FormsServiceTest extends TestCase { /** @var SubmissionMapper|MockObject */ private $submissionMapper; + /** @var AnswerMapper|MockObject */ + private $answerMapper; + /** @var ConfigService|MockObject */ private $configService; @@ -114,6 +118,7 @@ public function setUp(): void { $this->questionMapper = $this->createMock(QuestionMapper::class); $this->shareMapper = $this->createMock(ShareMapper::class); $this->submissionMapper = $this->createMock(SubmissionMapper::class); + $this->answerMapper = $this->createMock(AnswerMapper::class); $this->configService = $this->createMock(ConfigService::class); $this->groupManager = $this->createMock(IGroupManager::class); @@ -147,6 +152,7 @@ public function setUp(): void { $this->questionMapper, $this->shareMapper, $this->submissionMapper, + $this->answerMapper, $this->configService, $this->groupManager, $this->userManager, @@ -243,7 +249,8 @@ public function dataGetForm() { 'submissionMessage' => null, 'fileId' => null, 'fileFormat' => null, - 'permissions' => Constants::PERMISSION_ALL + 'permissions' => Constants::PERMISSION_ALL, + 'allowEdit' => false, ]] ]; } @@ -456,6 +463,7 @@ public function dataGetPublicForm() { 'submit' ], 'submissionMessage' => null, + 'allowEdit' => false, ]] ]; } @@ -622,6 +630,7 @@ public function testGetPermissions_NotLoggedIn() { $this->questionMapper, $this->shareMapper, $this->submissionMapper, + $this->answerMapper, $this->configService, $this->groupManager, $this->userManager, @@ -861,6 +870,7 @@ public function testPublicCanSubmit() { $this->questionMapper, $this->shareMapper, $this->submissionMapper, + $this->answerMapper, $this->configService, $this->groupManager, $this->userManager, @@ -972,6 +982,7 @@ public function testHasUserAccess_NotLoggedIn() { $this->questionMapper, $this->shareMapper, $this->submissionMapper, + $this->answerMapper, $this->configService, $this->groupManager, $this->userManager, @@ -1203,6 +1214,7 @@ public function testNotifyNewSubmission($shares, $shareNotifications) { $this->questionMapper, $this->shareMapper, $this->submissionMapper, + $this->answerMapper, $this->configService, $this->groupManager, $this->userManager,