From 420f3321228d4016cf8487a3e70dd16d33b3a590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Marsza=C5=82?= Date: Mon, 1 Jul 2024 10:36:09 +0200 Subject: [PATCH 1/2] feat: modify ItemIdentifier validation --- src/qtism/data/AssessmentItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qtism/data/AssessmentItem.php b/src/qtism/data/AssessmentItem.php index ffcd4f8b7..792fc903f 100644 --- a/src/qtism/data/AssessmentItem.php +++ b/src/qtism/data/AssessmentItem.php @@ -228,7 +228,7 @@ public function __construct($identifier, $title, $timeDependent, $lang = '') */ public function setIdentifier($identifier): void { - if (Format::isIdentifier($identifier, false)) { + if (Format::isNormalizedString($identifier)) { $this->identifier = $identifier; $this->notify(); } else { From 6bc47c38ce9b6b8b31a4cd9785f228b3f4ab0d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Marsza=C5=82?= Date: Mon, 1 Jul 2024 10:57:16 +0200 Subject: [PATCH 2/2] feat: update unit test --- test/qtismtest/data/AssessmentItemTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/qtismtest/data/AssessmentItemTest.php b/test/qtismtest/data/AssessmentItemTest.php index 0a379fd42..3b13b4112 100644 --- a/test/qtismtest/data/AssessmentItemTest.php +++ b/test/qtismtest/data/AssessmentItemTest.php @@ -768,9 +768,9 @@ public function getResponseValidityConstraintsProvider(): array public function testCreateAssessmentItemWrongIdentifier(): void { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("The identifier argument must be a valid QTI Identifier, '999' given."); + $this->expectExceptionMessage("The identifier argument must be a valid QTI Identifier, '99\t9' given."); - $assessmentItem = new AssessmentItem('999', 'Nine Nine Nine', false); + $assessmentItem = new AssessmentItem("99\t9", 'Nine Nine Nine', false); } public function testCreateAssessmentItemWrongTitle(): void