diff --git a/docs/DataStructure.md b/docs/DataStructure.md index d0e9acfa3..a358456e0 100644 --- a/docs/DataStructure.md +++ b/docs/DataStructure.md @@ -238,6 +238,7 @@ Currently supported Question-Types are: | `time` | Showing a dropdown menu to select a time. | | `file` | One or multiple files. It is possible to specify which mime types are allowed | | `linearscale` | A linear or Likert scale question where you choose an option that best fits your opinion | +| `rating` | A rating from 1 to the highest value, shown as stars, hearts or thumbs up. The answer is the number of the chosen icon. | | `color` | A color answer, hex string representation (e. g. `#123456`) | | `ranking` | Using pre-defined options, the user ranks them from most to least preferred. Needs at least one option available. Answers are stored in ranked order (one answer row per option). | @@ -264,9 +265,10 @@ Optional extra settings for some [Question Types](#question-types) | `timeMin` | `time` | string | - | Minimum allowed time to be chosen (as `HH:mm` string) | | `timeRange` | `time` | Boolean | `true/false` | The time picker should query a time range | | `optionsLowest` | `linearscale` | Integer | `0, 1` | Set the lowest value of the scale, default: `1` | -| `optionsHighest` | `linearscale` | Integer | `2, 3, 4, 5, 6, 7, 8, 9, 10` | Set the highest value of the scale, default: `5` | +| `optionsHighest` | `linearscale, rating` | Integer | `2, 3, 4, 5, 6, 7, 8, 9, 10` | Set the highest value of the scale, default: `5` | | `optionsLabelLowest` | `linearscale` | string | - | Set the label of the lowest value, default: `'Strongly disagree'` | | `optionsLabelHighest` | `linearscale` | string | - | Set the label of the highest value, default: `'Strongly agree'` | +| `ratingIcon` | `rating` | string | `'star', 'heart', 'thumb'` | Set the icon of the rating, default: `'star'` | | `columns` | `grid` | Array | - | Array of column identifiers / labels for grid questions | | `rows` | `grid` | Array | - | Array of row identifiers / labels for grid questions | | `questionType` | `grid` | String | `checkbox`, `number`, `radio` | Type of cell for grid questions (checkbox, numeric input, or radio) | diff --git a/lib/Constants.php b/lib/Constants.php index 3e465cd0c..2e00287a9 100644 --- a/lib/Constants.php +++ b/lib/Constants.php @@ -111,6 +111,7 @@ class Constants { public const ANSWER_TYPE_MULTIPLE = 'multiple'; public const ANSWER_TYPE_MULTIPLEUNIQUE = 'multiple_unique'; public const ANSWER_TYPE_RANKING = 'ranking'; + public const ANSWER_TYPE_RATING = 'rating'; public const ANSWER_TYPE_SHORT = 'short'; public const ANSWER_TYPE_TIME = 'time'; @@ -131,10 +132,18 @@ class Constants { self::ANSWER_TYPE_MULTIPLE, self::ANSWER_TYPE_MULTIPLEUNIQUE, self::ANSWER_TYPE_RANKING, + self::ANSWER_TYPE_RATING, self::ANSWER_TYPE_SHORT, self::ANSWER_TYPE_TIME, ]; + // AnswerTypes for date/time questions + public const ANSWER_TYPES_DATETIME = [ + self::ANSWER_TYPE_DATE, + self::ANSWER_TYPE_DATETIME, + self::ANSWER_TYPE_TIME, + ]; + // AnswerTypes, that need/have predefined Options public const ANSWER_TYPES_PREDEFINED = [ self::ANSWER_TYPE_DROPDOWN, @@ -145,18 +154,17 @@ class Constants { self::ANSWER_TYPE_RANKING, ]; - // AnswerTypes for date/time questions - public const ANSWER_TYPES_DATETIME = [ - self::ANSWER_TYPE_DATE, - self::ANSWER_TYPE_DATETIME, - self::ANSWER_TYPE_TIME + // AnswerTypes for scale questions + // TODO: add linearscale + public const ANSWER_TYPES_SCALE = [ + self::ANSWER_TYPE_RATING, ]; // Formats for AnswerTypes date/datetime/time public const ANSWER_PHPDATETIME_FORMAT = [ self::ANSWER_TYPE_DATE => 'Y-m-d', self::ANSWER_TYPE_DATETIME => 'Y-m-d H:i', - self::ANSWER_TYPE_TIME => 'H:i' + self::ANSWER_TYPE_TIME => 'H:i', ]; /** @@ -168,7 +176,7 @@ class Constants { 'phone', 'email', 'regex', - 'number' + 'number', ]; // This are allowed extra settings @@ -229,6 +237,18 @@ class Constants { 'rows' => ['array'], ]; + public const EXTRA_SETTINGS_RATING = [ + 'optionsHighest' => ['integer', 'NULL'], + 'ratingIcon' => ['string', 'NULL'], + ]; + + // should be in sync with ICON_CHOICES in QuestionRating.vue + public const EXTRA_SETTINGS_RATING_ICONS = [ + 'star', + 'heart', + 'thumb', + ]; + public const EXTRA_SETTINGS_RANKING = [ 'shuffleOptions' => ['boolean'], ]; diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 15ed97324..d662de78d 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -35,6 +35,7 @@ * optionsLimitMax?: int, * optionsLimitMin?: int, * optionsLowest?: 0|1, + * ratingIcon?: "star"|"heart"|"thumb", * shuffleOptions?: bool, * timeMax?: string, * timeMin?: string, diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index 197ababbc..b8f8f5783 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -909,6 +909,7 @@ public function areExtraSettingsValid(array $extraSettings, string $questionType Constants::ANSWER_TYPE_DATE => Constants::EXTRA_SETTINGS_DATE, Constants::ANSWER_TYPE_GRID => Constants::EXTRA_SETTINGS_GRID, Constants::ANSWER_TYPE_RANKING => Constants::EXTRA_SETTINGS_RANKING, + Constants::ANSWER_TYPE_RATING => Constants::EXTRA_SETTINGS_RATING, Constants::ANSWER_TYPE_TIME => Constants::EXTRA_SETTINGS_TIME, Constants::ANSWER_TYPE_LINEARSCALE => Constants::EXTRA_SETTINGS_LINEARSCALE, default => [], @@ -1045,10 +1046,13 @@ public function areExtraSettingsValid(array $extraSettings, string $questionType } // Special handling of linear scale validation - } elseif ($questionType === Constants::ANSWER_TYPE_LINEARSCALE) { - // Ensure limits are sane + } elseif ($questionType === Constants::ANSWER_TYPE_LINEARSCALE + || $questionType === Constants::ANSWER_TYPE_RATING) { + // Ensure limits are sane. A rating cannot set optionsLowest at all, so for it + // only the top end is checked. if (isset($extraSettings['optionsLowest']) && ($extraSettings['optionsLowest'] < 0 || $extraSettings['optionsLowest'] > 1) - || isset($extraSettings['optionsHighest']) && ($extraSettings['optionsHighest'] < 2 || $extraSettings['optionsHighest'] > 10)) { + || isset($extraSettings['optionsHighest']) && ($extraSettings['optionsHighest'] < 2 || $extraSettings['optionsHighest'] > 10) + || isset($extraSettings['ratingIcon']) && !in_array($extraSettings['ratingIcon'], Constants::EXTRA_SETTINGS_RATING_ICONS, true)) { return false; } } diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 0678b7ad8..f635e6d98 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -695,7 +695,14 @@ public function validateSubmission(array $questions, array $answers, string $for * Otherwise, validate the single answer for the date/time question */ if (in_array($question['type'], Constants::ANSWER_TYPES_DATETIME)) { - $this->validateDateTime($answers[$questionId], Constants::ANSWER_PHPDATETIME_FORMAT[$question['type']], $question['text'] ?? null, $question['extraSettings'] ?? null); + $this->validateDateTimeQuestion($answers[$questionId], Constants::ANSWER_PHPDATETIME_FORMAT[$question['type']], $question['text'] ?? null, $question['extraSettings'] ?? null); + } + + // Check if answers to scale questions are within the limits + if (in_array($question['type'], Constants::ANSWER_TYPES_SCALE)) { + foreach ($answers[$questionId] as $answer) { + $this->validateScaleQuestion($question, $answer); + } } // Check if all answers are within the possible options @@ -705,12 +712,9 @@ public function validateSubmission(array $questions, array $answers, string $for foreach ($answers[$questionId] as $answer) { // Handle linear scale questions + // TODO: move to scale question check if ($question['type'] === Constants::ANSWER_TYPE_LINEARSCALE) { - $optionsLowest = $question['extraSettings']['optionsLowest'] ?? 1; - $optionsHighest = $question['extraSettings']['optionsHighest'] ?? 5; - if (!is_scalar($answer) || is_bool($answer) || !ctype_digit((string)$answer) || intval($answer) < $optionsLowest || intval($answer) > $optionsHighest) { - throw new \InvalidArgumentException(sprintf('The answer for question "%s" must be an integer between %d and %d.', $question['text'], $optionsLowest, $optionsHighest)); - } + $this->validateScaleQuestion($question, $answer); } // Check if all grid rows, columns and values match the configured grid subtype elseif ($question['type'] === Constants::ANSWER_TYPE_GRID) { @@ -791,6 +795,25 @@ public function validateSubmission(array $questions, array $answers, string $for } } + /** + * Check one answer to a question answered on a numbered scale. + * + * Shared by the linear scale and the rating, which differ only in how the scale is + * drawn. The bounds and their defaults are the linear scale's; a rating does not + * accept optionsLowest, so its lowest end always falls back to 1. + * + * @param array $question the question being answered + * @param mixed $answer one submitted value + * @throws \InvalidArgumentException if the answer is not a whole number within range, written without leading zeros + */ + private function validateScaleQuestion(array $question, mixed $answer): void { + $optionsLowest = $question['extraSettings']['optionsLowest'] ?? 1; + $optionsHighest = $question['extraSettings']['optionsHighest'] ?? 5; + if (!is_scalar($answer) || is_bool($answer) || !ctype_digit((string)$answer) || (string)intval($answer) !== (string)$answer || intval($answer) < $optionsLowest || intval($answer) > $optionsHighest) { + throw new \InvalidArgumentException(sprintf('The answer for question "%s" must be an integer between %d and %d.', $question['text'], $optionsLowest, $optionsHighest)); + } + } + /** * Validate correct date/time formats * @param array $answers Array with date from answer @@ -798,7 +821,7 @@ public function validateSubmission(array $questions, array $answers, string $for * @param string|null $text String with the title of the question * @param array|null $extraSettings Array with extra settings for validation */ - private function validateDateTime(array $answers, string $format, ?string $text = null, ?array $extraSettings = null): void { + private function validateDateTimeQuestion(array $answers, string $format, ?string $text = null, ?array $extraSettings = null): void { $previousDate = null; foreach ($answers as $dateStr) { diff --git a/openapi.json b/openapi.json index 4336a8c92..8be94e556 100644 --- a/openapi.json +++ b/openapi.json @@ -575,6 +575,14 @@ 1 ] }, + "ratingIcon": { + "type": "string", + "enum": [ + "star", + "heart", + "thumb" + ] + }, "shuffleOptions": { "type": "boolean" }, diff --git a/playwright/e2e/rating-question.spec.ts b/playwright/e2e/rating-question.spec.ts new file mode 100644 index 000000000..c007d174b --- /dev/null +++ b/playwright/e2e/rating-question.spec.ts @@ -0,0 +1,144 @@ +/** + * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { expect, mergeTests } from '@playwright/test' +import { test as formTest } from '../support/fixtures/form.ts' +import { test as appNavigationTest } from '../support/fixtures/navigation.ts' +import { test as randomUserTest } from '../support/fixtures/random-user.ts' +import { test as resultsTest } from '../support/fixtures/results.ts' +import { test as submitTest } from '../support/fixtures/submit.ts' +import { test as topBarTest } from '../support/fixtures/topBar.ts' +import { QuestionType } from '../support/sections/QuestionType.ts' +import { FormsView } from '../support/sections/TopBarSection.ts' + +const test = mergeTests( + randomUserTest, + appNavigationTest, + formTest, + topBarTest, + submitTest, + resultsTest, +) + +test.describe('Rating question', () => { + test.beforeEach(async ({ page, appNavigation, form }) => { + await page.goto('apps/forms') + await page.waitForURL(/apps\/forms\/?$/) + await appNavigation.clickNewForm() + await form.fillTitle('Rating test form') + + await form.addQuestion(QuestionType.Rating) + const questions = await form.getQuestions() + await questions[0].fillTitle('Rate the service') + await questions[0].fillDescription('One star is poor') + }) + + test('Names the rating by its question and each option by its value', async ({ + topBar, + submitView, + }) => { + await topBar.toggleView(FormsView.View) + + const group = submitView.getQuestion('Rate the service').getByRole('group') + await expect(group).toHaveAttribute('aria-labelledby', 'q1_title') + await expect(group).toHaveAttribute('aria-describedby', 'q1_desc') + const options = group.getByRole('radio') + await expect(options).toHaveCount(5) + for (let value = 1; value <= 5; value++) { + await expect(options.nth(value - 1)).toHaveAccessibleName( + `${value} of 5`, + ) + } + }) + + test('Restores the rating from local storage on reload', async ({ + topBar, + submitView, + page, + }) => { + await topBar.toggleView(FormsView.View) + await submitView.checkRadio('Rate the service', '4 of 5') + + await page.reload() + + await expect( + submitView + .getQuestion('Rate the service') + .getByRole('radio', { name: '4 of 5' }), + ).toBeChecked() + }) + + test('Restores the rating when editing a submission', async ({ + topBar, + submitView, + resultsView, + page, + }) => { + await topBar.toggleView(FormsView.View) + await submitView.checkRadio('Rate the service', '4 of 5') + await submitView.submit() + await expect(submitView.successMessage).toBeVisible() + + await page.goto(page.url().replace(/\/submit.*$/, '/results')) + await resultsView.switchToResponses() + await resultsView.editSubmission() + + await expect( + submitView + .getQuestion('Rate the service') + .getByRole('radio', { name: '4 of 5' }), + ).toBeChecked() + }) + + test('Moves on from a rating on Enter instead of submitting', async ({ + topBar, + submitView, + }) => { + await topBar.toggleView(FormsView.View) + await submitView.checkRadio('Rate the service', '4 of 5') + + const question = submitView.getQuestion('Rate the service') + await question.getByRole('radio', { name: '4 of 5' }).press('Enter') + + await expect(question.getByRole('radio', { name: '5 of 5' })).toBeFocused() + await expect(submitView.successMessage).toHaveCount(0) + }) + + test('Shows an error when a required rating is left empty', async ({ + form, + topBar, + submitView, + }) => { + const questions = await form.getQuestions() + await questions[0].toggleRequired() + await topBar.toggleView(FormsView.View) + + await submitView.submitButton.click() + + const question = submitView.getQuestion('Rate the service') + await expect( + question.getByText('You must answer this question'), + ).toBeVisible() + await expect(question.getByRole('radio').first()).toHaveAttribute( + 'aria-invalid', + 'true', + ) + }) + + test('Focuses a new rating question and offers to insert a question after it', async ({ + form, + page, + }) => { + await form.addQuestion(QuestionType.Rating) + + const questions = await form.getQuestions() + await expect(questions[1].titleInput).toBeFocused() + await expect( + page.getByRole('button', { + name: 'Insert question after question 1', + }), + ).toHaveCount(1) + }) +}) diff --git a/playwright/support/sections/QuestionType.ts b/playwright/support/sections/QuestionType.ts index 1f51c8f70..e9275bda9 100644 --- a/playwright/support/sections/QuestionType.ts +++ b/playwright/support/sections/QuestionType.ts @@ -13,6 +13,7 @@ export enum QuestionType { LinearScale = 'Linear scale', LongAnswer = 'Long text', Ranking = 'Ranking', + Rating = 'Rating', RadioButtons = 'Radio buttons', ShortAnswer = 'Short answer', } diff --git a/src/components/Questions/QuestionRating.vue b/src/components/Questions/QuestionRating.vue new file mode 100644 index 000000000..7ba6f01b2 --- /dev/null +++ b/src/components/Questions/QuestionRating.vue @@ -0,0 +1,306 @@ + + + + + + + diff --git a/src/components/Results/ResultsSummary.vue b/src/components/Results/ResultsSummary.vue index 4156ba3ef..98058bfef 100644 --- a/src/components/Results/ResultsSummary.vue +++ b/src/components/Results/ResultsSummary.vue @@ -247,7 +247,7 @@ export default defineComponent({ const questionOptions = computed(() => { // Build list of question options let questionOptionsStats: OptionStats[] - if (props.question.type !== 'linearscale') { + if (!answerTypes[props.question.type]?.scale) { questionOptionsStats = (props.question.options ?? []).map( (option) => ({ ...option, @@ -342,7 +342,7 @@ export default defineComponent({ }) // Sort options by response count - if (props.question.type !== 'linearscale') { + if (!answerTypes[props.question.type]?.scale) { questionOptionsStats.sort( (object1, object2) => object2.count - object1.count, ) diff --git a/src/models/AnswerTypes.ts b/src/models/AnswerTypes.ts index e2bc47b9e..9108e3a2d 100644 --- a/src/models/AnswerTypes.ts +++ b/src/models/AnswerTypes.ts @@ -17,6 +17,7 @@ import IconPalette from '@material-symbols/svg-400/outlined/palette.svg?raw' import IconRadioboxMarked from '@material-symbols/svg-400/outlined/radio_button_checked.svg?raw' import IconClockOutline from '@material-symbols/svg-400/outlined/schedule.svg?raw' import IconTextShort from '@material-symbols/svg-400/outlined/short_text.svg?raw' +import IconStar from '@material-symbols/svg-400/outlined/star.svg?raw' import IconTextLong from '@material-symbols/svg-400/outlined/subject.svg?raw' import IconSwapVertical from '@material-symbols/svg-400/outlined/swap_vert.svg?raw' import { t } from '@nextcloud/l10n' @@ -30,6 +31,7 @@ import QuestionLinearScale from '../components/Questions/QuestionLinearScale.vue import QuestionLong from '../components/Questions/QuestionLong.vue' import QuestionMultiple from '../components/Questions/QuestionMultiple.vue' import QuestionRanking from '../components/Questions/QuestionRanking.vue' +import QuestionRating from '../components/Questions/QuestionRating.vue' import QuestionShort from '../components/Questions/QuestionShort.vue' import { OptionType } from './Constants.ts' @@ -46,6 +48,7 @@ export interface AnswerTypeConfig { icon: string label: string predefined?: boolean + scale?: boolean validate?: (question: FormsQuestion) => boolean titlePlaceholder: string createPlaceholder?: string @@ -262,11 +265,23 @@ const answerTypes: Record = { icon: IconLinearScale, label: t('forms', 'Linear scale'), predefined: true, + scale: true, titlePlaceholder: t('forms', 'Linear scale question title'), warningInvalid: t('forms', 'This question needs a title!'), }, + rating: { + component: markRaw(QuestionRating), + icon: IconStar, + label: t('forms', 'Rating'), + predefined: true, + scale: true, + + titlePlaceholder: t('forms', 'Rating question title'), + warningInvalid: t('forms', 'This question needs a title!'), + }, + color: { component: markRaw(QuestionColor), icon: IconPalette, diff --git a/src/views/Submit.vue b/src/views/Submit.vue index 7a8c8a920..7c9ec2ff9 100644 --- a/src/views/Submit.vue +++ b/src/views/Submit.vue @@ -679,7 +679,7 @@ export default defineComponent({ } /** - * The values of an answer the question still offers: its options or an answer "Other" while it allows one, the rows and columns of a grid, the values within the bounds of a linear scale + * The values of an answer the question still offers: its options or an answer "Other" while it allows one, the rows and columns of a grid, the values within the bounds of a linear scale or rating * * @param question the question * @param value the values of the answer @@ -693,7 +693,7 @@ export default defineComponent({ ? withExistingGridCells(question, value) : value } - if (question.type === 'linearscale') { + if (answerTypes[question.type]?.scale) { const lowest = Number(question.extraSettings?.optionsLowest ?? 1) const highest = Number(question.extraSettings?.optionsHighest ?? 5) return value.filter( diff --git a/tests/Unit/Service/FormsServiceTest.php b/tests/Unit/Service/FormsServiceTest.php index 04185d43d..fe3469d2f 100644 --- a/tests/Unit/Service/FormsServiceTest.php +++ b/tests/Unit/Service/FormsServiceTest.php @@ -1662,6 +1662,43 @@ public function testAreExtraSettingsValidNormalizesLegacyDateLimitsAsUtcDates(): public static function dataAreExtraSettingsValid() { return [ + 'valid-rating-settings' => [ + 'extraSettings' => [ + 'optionsHighest' => 10, + 'ratingIcon' => 'heart', + ], + 'questionType' => Constants::ANSWER_TYPE_RATING, + 'expected' => true + ], + 'rating-unknown-icon' => [ + 'extraSettings' => [ + 'ratingIcon' => 'smiley', + ], + 'questionType' => Constants::ANSWER_TYPE_RATING, + 'expected' => false + ], + 'rating-top-above-scale-limit' => [ + 'extraSettings' => [ + 'optionsHighest' => 11, + ], + 'questionType' => Constants::ANSWER_TYPE_RATING, + 'expected' => false + ], + 'rating-top-below-scale-limit' => [ + 'extraSettings' => [ + 'optionsHighest' => 1, + ], + 'questionType' => Constants::ANSWER_TYPE_RATING, + 'expected' => false + ], + 'rating-has-no-lowest-end' => [ + // A rating always starts at 1, so the linear scale's lower bound is refused. + 'extraSettings' => [ + 'optionsLowest' => 0, + ], + 'questionType' => Constants::ANSWER_TYPE_RATING, + 'expected' => false + ], 'empty-extra-settings' => [ 'extraSettings' => [], 'questionType' => Constants::ANSWER_TYPE_LONG, diff --git a/tests/Unit/Service/SubmissionServiceTest.php b/tests/Unit/Service/SubmissionServiceTest.php index 8771f47bf..1d44c066f 100644 --- a/tests/Unit/Service/SubmissionServiceTest.php +++ b/tests/Unit/Service/SubmissionServiceTest.php @@ -972,6 +972,90 @@ public static function dataValidateSubmission() { [], 'Question "q1" is required.', ], + 'rating-within-configured-top' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false, 'extraSettings' => ['optionsHighest' => 10]], + ], + // Answers + [ + '1' => ['7'], + ], + // Expected Result + null, + ], + 'rating-at-default-top' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false], + ], + // Answers + [ + '1' => ['5'], + ], + // Expected Result + null, + ], + 'rating-above-default-top' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false], + ], + // Answers + [ + '1' => ['6'], + ], + // Expected Result + 'The answer for question "r" must be an integer between 1 and 5.', + ], + 'rating-above-configured-top' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false, 'extraSettings' => ['optionsHighest' => 3]], + ], + // Answers + [ + '1' => ['4'], + ], + // Expected Result + 'The answer for question "r" must be an integer between 1 and 3.', + ], + 'rating-zero' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false], + ], + // Answers + [ + '1' => ['0'], + ], + // Expected Result + 'The answer for question "r" must be an integer between 1 and 5.', + ], + 'rating-not-a-number' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false], + ], + // Answers + [ + '1' => ['three'], + ], + // Expected Result + 'The answer for question "r" must be an integer between 1 and 5.', + ], + 'rating-leading-zero' => [ + // Questions + [ + ['id' => 1, 'type' => 'rating', 'text' => 'r', 'isRequired' => false], + ], + // Answers + [ + '1' => ['05'], + ], + // Expected Result + 'The answer for question "r" must be an integer between 1 and 5.', + ], 'required-not-answered' => [ // Questions [