remove empty translation keys
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-07-18 14:02:49 +02:00
parent 63aad5d9e9
commit 12d63fdd9f
3 changed files with 72 additions and 3 deletions

View File

@ -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);
}
}