Skip to content

Commit 13352b3

Browse files
committed
[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.
1 parent 0ee0c18 commit 13352b3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/store/tests/Document/TextDocumentTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,15 @@ public function testWithContent()
265265
$this->assertSame($metadata, $updatedDocument->metadata);
266266
$this->assertSame($originalContent, $originalDocument->content);
267267
}
268+
269+
#[TestDox('withContent validates new content')]
270+
public function testWithContentValidatesContent()
271+
{
272+
$document = new TextDocument(Uuid::v4(), 'Valid content');
273+
274+
$this->expectException(InvalidArgumentException::class);
275+
$this->expectExceptionMessage('The content shall not be an empty string.');
276+
277+
$document->withContent(' ');
278+
}
268279
}

0 commit comments

Comments
 (0)