Skip to content

Commit 23699b1

Browse files
test: update DocMdpHandlerTest to use new enum names
Update all test assertions and data providers to use renamed enum cases: - NONE → NOT_CERTIFIED - NO_CHANGES → CERTIFIED_NO_CHANGES_ALLOWED - FORM_FILL → CERTIFIED_FORM_FILLING - FORM_FILL_AND_ANNOTATIONS → CERTIFIED_FORM_FILLING_AND_ANNOTATIONS All 30 tests passing with new nomenclature. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 8565ad9 commit 23699b1

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

tests/php/Unit/Handler/DocMdpHandlerTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testUnsignedPdfIsDetectedAsLevelNone(): void {
3434
$result = $this->handler->extractDocMdpData($resource);
3535
fclose($resource);
3636

37-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level']);
37+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level']);
3838
}
3939

4040
public function testP0AllowsAnyModification(): void {
@@ -154,7 +154,7 @@ public function testExtractsDocMdpFromSignatureReferenceNotPerms(): void {
154154
$result = $this->handler->extractDocMdpData($resource);
155155
fclose($resource);
156156

157-
$this->assertSame(DocMdpLevel::FORM_FILL->value, $result['docmdp']['level'], 'Must extract DocMDP from /Reference per ICP-Brasil recommendation (not /Perms)');
157+
$this->assertSame(DocMdpLevel::CERTIFIED_FORM_FILLING->value, $result['docmdp']['level'], 'Must extract DocMDP from /Reference per ICP-Brasil recommendation (not /Perms)');
158158
}
159159

160160
public function testExtractsDocMdpFromFirstCertifyingSignature(): void {
@@ -164,7 +164,7 @@ public function testExtractsDocMdpFromFirstCertifyingSignature(): void {
164164
$result = $this->handler->extractDocMdpData($resource);
165165
fclose($resource);
166166

167-
$this->assertSame(DocMdpLevel::NO_CHANGES->value, $result['docmdp']['level'], 'Must extract DocMDP from first CERTIFYING signature, not first signature in file');
167+
$this->assertSame(DocMdpLevel::CERTIFIED_NO_CHANGES_ALLOWED->value, $result['docmdp']['level'], 'Must extract DocMDP from first CERTIFYING signature, not first signature in file');
168168
}
169169

170170
public function testP2AllowsPageTemplateInstantiation(): void {
@@ -196,7 +196,7 @@ public function testExtractsDocMdpWithIndirectReferenceItiStyle(): void {
196196
$result = $this->handler->extractDocMdpData($resource);
197197
fclose($resource);
198198

199-
$this->assertSame(DocMdpLevel::FORM_FILL->value, $result['docmdp']['level'], 'Must extract DocMDP from indirect references per ICP-Brasil example');
199+
$this->assertSame(DocMdpLevel::CERTIFIED_FORM_FILLING->value, $result['docmdp']['level'], 'Must extract DocMDP from indirect references per ICP-Brasil example');
200200
}
201201

202202
public function testValidatesTransformParamsVersion(): void {
@@ -206,7 +206,7 @@ public function testValidatesTransformParamsVersion(): void {
206206
$result = $this->handler->extractDocMdpData($resource);
207207
fclose($resource);
208208

209-
$this->assertSame(DocMdpLevel::FORM_FILL->value, $result['docmdp']['level'], 'Must accept /V /1.2 in TransformParams per ICP-Brasil');
209+
$this->assertSame(DocMdpLevel::CERTIFIED_FORM_FILLING->value, $result['docmdp']['level'], 'Must accept /V /1.2 in TransformParams per ICP-Brasil');
210210
}
211211

212212
public function testRejectsDocMdpWithoutVersion(): void {
@@ -216,7 +216,7 @@ public function testRejectsDocMdpWithoutVersion(): void {
216216
$result = $this->handler->extractDocMdpData($resource);
217217
fclose($resource);
218218

219-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'Must reject DocMDP without /V version per ICP-Brasil requirement');
219+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'Must reject DocMDP without /V version per ICP-Brasil requirement');
220220
}
221221

222222
public function testRejectsDocMdpWithInvalidVersion(): void {
@@ -226,7 +226,7 @@ public function testRejectsDocMdpWithInvalidVersion(): void {
226226
$result = $this->handler->extractDocMdpData($resource);
227227
fclose($resource);
228228

229-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'Must reject DocMDP with /V 1.0 (only /V /1.2 allowed per ICP-Brasil)');
229+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'Must reject DocMDP with /V 1.0 (only /V /1.2 allowed per ICP-Brasil)');
230230
}
231231

232232
public function testRejectsDocMdpWithInvalidVersionIndirectRef(): void {
@@ -236,15 +236,15 @@ public function testRejectsDocMdpWithInvalidVersionIndirectRef(): void {
236236
$result = $this->handler->extractDocMdpData($resource);
237237
fclose($resource);
238238

239-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'Must reject indirect DocMDP with /V 1.3 (only /V /1.2 allowed)');
239+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'Must reject indirect DocMDP with /V 1.3 (only /V /1.2 allowed)');
240240
}
241241

242242
public static function docMdpLevelExtractionProvider(): array {
243243
return [
244-
'Level P=0 NONE' => [0, DocMdpLevel::NONE],
245-
'Level P=1 NO_CHANGES' => [1, DocMdpLevel::NO_CHANGES],
246-
'Level P=2 FORM_FILL' => [2, DocMdpLevel::FORM_FILL],
247-
'Level P=3 FORM_FILL_AND_ANNOTATIONS' => [3, DocMdpLevel::FORM_FILL_AND_ANNOTATIONS],
244+
'Level P=0 NOT_CERTIFIED' => [0, DocMdpLevel::NOT_CERTIFIED],
245+
'Level P=1 CERTIFIED_NO_CHANGES_ALLOWED' => [1, DocMdpLevel::CERTIFIED_NO_CHANGES_ALLOWED],
246+
'Level P=2 CERTIFIED_FORM_FILLING' => [2, DocMdpLevel::CERTIFIED_FORM_FILLING],
247+
'Level P=3 CERTIFIED_FORM_FILLING_AND_ANNOTATIONS' => [3, DocMdpLevel::CERTIFIED_FORM_FILLING_AND_ANNOTATIONS],
248248
];
249249
}
250250

@@ -726,7 +726,7 @@ public function testRejectsSignatureDictionaryWithoutTypeWhenPresent(): void {
726726
$result = $this->handler->extractDocMdpData($resource);
727727
fclose($resource);
728728

729-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'ISO 32000-1 Table 252: if /Type present in signature dict, must be /Sig');
729+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'ISO 32000-1 Table 252: if /Type present in signature dict, must be /Sig');
730730
}
731731

732732
public function testRejectsSignatureWithoutFilterEntry(): void {
@@ -744,7 +744,7 @@ public function testRejectsSignatureWithoutFilterEntry(): void {
744744
$result = $this->handler->extractDocMdpData($resource);
745745
fclose($resource);
746746

747-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'ISO 32000-1 Table 252: /Filter is Required in signature dictionary');
747+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'ISO 32000-1 Table 252: /Filter is Required in signature dictionary');
748748
}
749749

750750
public function testRejectsSignatureWithoutByteRange(): void {
@@ -762,7 +762,7 @@ public function testRejectsSignatureWithoutByteRange(): void {
762762
$result = $this->handler->extractDocMdpData($resource);
763763
fclose($resource);
764764

765-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'ISO 32000-1: ByteRange required when DocMDP transform method is used');
765+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'ISO 32000-1: ByteRange required when DocMDP transform method is used');
766766
}
767767

768768
public function testRejectsMultipleDocMdpSignatures(): void {
@@ -792,7 +792,7 @@ public function testRejectsMultipleDocMdpSignatures(): void {
792792
$result = $this->handler->extractDocMdpData($resource);
793793
fclose($resource);
794794

795-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'ISO 32000-1 12.8.2.2.1: A document can contain only one signature field that contains a DocMDP transform method');
795+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'ISO 32000-1 12.8.2.2.1: A document can contain only one signature field that contains a DocMDP transform method');
796796
}
797797

798798
public function testRejectsDocMdpNotFirstSignature(): void {
@@ -820,7 +820,7 @@ public function testRejectsDocMdpNotFirstSignature(): void {
820820
$result = $this->handler->extractDocMdpData($resource);
821821
fclose($resource);
822822

823-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'ISO 32000-1 12.8.2.2.1: DocMDP signature shall be the first signed field in the document');
823+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'ISO 32000-1 12.8.2.2.1: DocMDP signature shall be the first signed field in the document');
824824
}
825825

826826
public function testRejectsSigRefWithoutTransformMethod(): void {
@@ -839,6 +839,6 @@ public function testRejectsSigRefWithoutTransformMethod(): void {
839839
$result = $this->handler->extractDocMdpData($resource);
840840
fclose($resource);
841841

842-
$this->assertSame(DocMdpLevel::NONE->value, $result['docmdp']['level'], 'ISO 32000-1 Table 253: /TransformMethod is Required in signature reference dictionary');
842+
$this->assertSame(DocMdpLevel::NOT_CERTIFIED->value, $result['docmdp']['level'], 'ISO 32000-1 Table 253: /TransformMethod is Required in signature reference dictionary');
843843
}
844844
}

0 commit comments

Comments
 (0)