Skip to content

Commit 5dd8dd2

Browse files
committed
test(SignFileServiceTest): regression for clickToSign with placed element
Add case: canCreateSignature=true, signer submits no element but an admin-placed file element exists. The visibleElements list must still contain that element (with empty tempFile) so the stamp is rendered. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent a6bf9f3 commit 5dd8dd2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/php/Unit/Service/SignFileServiceTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,18 @@ public static function providerSetVisibleElements(): array {
16391639
expectedException: LibresignException::class,
16401640
),
16411641

1642+
// Regression: canCreateSignature=true but signer submits no element (clickToSign).
1643+
// Before the fix `if (!$element) { continue; }` silently skipped the DB file element,
1644+
// producing an empty visibleElements array and no stamp on the document.
1645+
'canCreateSignature true, signer submits no element (clickToSign): element still included' => self::createScenarioSetVisibleElements(
1646+
signerList: [], // user did not submit any drawn signature
1647+
fileElements: [['id' => $validDocumentId]], // admin placed element on doc
1648+
tempFiles: [],
1649+
signatureFile: [],
1650+
canCreateSignature: true,
1651+
isAuthenticatedSigner: true,
1652+
),
1653+
16421654
'cannot create signature, visible element fallback' => self::createScenarioSetVisibleElements(
16431655
signerList: [
16441656
['documentElementId' => $validDocumentId],

0 commit comments

Comments
 (0)