This commit is contained in:
@ -107,5 +107,39 @@ final class QuestionnaireEditingTest extends QdbTestCase
|
||||
'Bitte dem Klienten deutlich machen: Ohne Einwilligung keine Teilnahme.',
|
||||
$de['consent_q_note_before'] ?? null
|
||||
);
|
||||
|
||||
$clear = $this->api()->withToken($adminToken, 'PUT', 'questions', [
|
||||
'questionID' => $f->questionId,
|
||||
'questionKey' => 'consent_q',
|
||||
'defaultText' => 'Consent?',
|
||||
'type' => 'single_choice_question',
|
||||
'isRequired' => 1,
|
||||
'configJson' => json_encode(['questionKey' => 'consent_q'], JSON_UNESCAPED_UNICODE),
|
||||
'noteBefore' => '',
|
||||
'noteAfter' => '',
|
||||
]);
|
||||
$this->assertApiOk($clear);
|
||||
$this->assertGreaterThan(
|
||||
$revAfter,
|
||||
(int)($clear['data']['structureRevision'] ?? 0),
|
||||
'clearing notes must bump structureRevision'
|
||||
);
|
||||
|
||||
$detailCleared = $this->api()->withMobileToken($coachLogin['token'], 'GET', 'app_questionnaires', null, [
|
||||
'id' => $f->questionnaireId,
|
||||
]);
|
||||
$this->assertApiOk($detailCleared);
|
||||
$matchedCleared = null;
|
||||
foreach ($detailCleared['data']['questions'] ?? [] as $q) {
|
||||
if (($q['question'] ?? '') === 'consent_q' || ($q['id'] ?? '') === 'q1') {
|
||||
$matchedCleared = $q;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->assertNotNull($matchedCleared);
|
||||
$this->assertArrayNotHasKey('noteBeforeKey', $matchedCleared);
|
||||
$this->assertArrayNotHasKey('noteAfterKey', $matchedCleared);
|
||||
$deCleared = $detailCleared['data']['translations']['de'] ?? [];
|
||||
$this->assertArrayNotHasKey('consent_q_note_before', $deCleared);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user