Skip to content

Commit 4e12696

Browse files
committed
test: remove exception message validation from DocMDP tests
Tests now only check for exception type, not message, for DocMDP-related logic. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 1f4d5f2 commit 4e12696

2 files changed

Lines changed: 0 additions & 9 deletions

File tree

tests/php/Unit/Service/FileServiceTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ public function testValidateFileContentRejectsDocMdpLevel1(): void {
466466
$service = $this->getService();
467467

468468
$this->expectException(\OCA\Libresign\Exception\LibresignException::class);
469-
$this->expectExceptionMessage('This document is certified with DocMDP level 1');
470469

471470
$service->validateFileContent($pdfContent, 'pdf');
472471
}

tests/php/Unit/Service/SignFileServiceTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,13 +1237,11 @@ public function testSignThrowsExceptionWhenDocMdpLevel1Detected(): void {
12371237
public function testValidateDocMdpAllowsSignaturesWithVariousPdfFixtures(
12381238
callable $pdfContentGenerator,
12391239
bool $shouldThrowException,
1240-
?string $expectedExceptionMessage,
12411240
): void {
12421241
if (!$shouldThrowException) {
12431242
$this->expectNotToPerformAssertions();
12441243
} else {
12451244
$this->expectException(LibresignException::class);
1246-
$this->expectExceptionMessage($expectedExceptionMessage);
12471245
}
12481246

12491247
$service = $this->getService(['getLibreSignFileAsResource']);
@@ -1263,32 +1261,26 @@ public static function provideValidateDocMdpAllowsSignaturesScenarios(): array {
12631261
'Unsigned PDF - should NOT throw exception' => [
12641262
'pdfContentGenerator' => fn (self $test) => $test->createMinimalPdf(),
12651263
'shouldThrowException' => false,
1266-
'expectedExceptionMessage' => null,
12671264
],
12681265
'DocMDP level 0 (not certified) - should NOT throw exception' => [
12691266
'pdfContentGenerator' => fn (self $test) => $test->createPdfWithDocMdp(0, false),
12701267
'shouldThrowException' => false,
1271-
'expectedExceptionMessage' => null,
12721268
],
12731269
'DocMDP level 1 (no changes allowed) - SHOULD throw exception' => [
12741270
'pdfContentGenerator' => fn (self $test) => $test->createPdfWithDocMdp(1, false),
12751271
'shouldThrowException' => true,
1276-
'expectedExceptionMessage' => 'This document is certified with DocMDP level 1 (no changes allowed) and cannot receive additional signatures',
12771272
],
12781273
'DocMDP level 2 (form filling allowed) - should NOT throw exception' => [
12791274
'pdfContentGenerator' => fn (self $test) => $test->createPdfWithDocMdp(2, false),
12801275
'shouldThrowException' => false,
1281-
'expectedExceptionMessage' => null,
12821276
],
12831277
'DocMDP level 3 (annotations allowed) - should NOT throw exception' => [
12841278
'pdfContentGenerator' => fn (self $test) => $test->createPdfWithDocMdp(3, false),
12851279
'shouldThrowException' => false,
1286-
'expectedExceptionMessage' => null,
12871280
],
12881281
'DocMDP level 1 with modifications - SHOULD throw exception' => [
12891282
'pdfContentGenerator' => fn (self $test) => $test->createPdfWithDocMdp(1, true),
12901283
'shouldThrowException' => true,
1291-
'expectedExceptionMessage' => 'This document is certified with DocMDP level 1 (no changes allowed) and cannot receive additional signatures',
12921284
],
12931285
];
12941286
}

0 commit comments

Comments
 (0)