Skip to content

Commit a40908d

Browse files
committed
minor #487 [Store] Add withContent validation test case (OskarStark)
This PR was merged into the main branch. Discussion ---------- [Store] Add `withContent` validation test case | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | -- | License | MIT Add test case to verify that `TextDocument::withContent()` properly validates the new content parameter and throws InvalidArgumentException when given empty or whitespace-only content. Commits ------- 13352b3 [Store] Add withContent validation test case
2 parents 0ee0c18 + 13352b3 commit a40908d

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)