From 13352b367ce9f678f30b63da3781293808717108 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 8 Sep 2025 13:55:02 +0200 Subject: [PATCH] [Store] Add withContent validation test case Add test case to verify that TextDocument.withContent() properly validates the new content parameter and throws InvalidArgumentException when given empty or whitespace-only content. --- src/store/tests/Document/TextDocumentTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/store/tests/Document/TextDocumentTest.php b/src/store/tests/Document/TextDocumentTest.php index 42aff7902..eaa3887d3 100644 --- a/src/store/tests/Document/TextDocumentTest.php +++ b/src/store/tests/Document/TextDocumentTest.php @@ -265,4 +265,15 @@ public function testWithContent() $this->assertSame($metadata, $updatedDocument->metadata); $this->assertSame($originalContent, $originalDocument->content); } + + #[TestDox('withContent validates new content')] + public function testWithContentValidatesContent() + { + $document = new TextDocument(Uuid::v4(), 'Valid content'); + + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage('The content shall not be an empty string.'); + + $document->withContent(' '); + } }