From 30f01535c2a2b0ac6280373f2dfa2120bbe7949f Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 25 Dec 2023 12:21:32 +0100 Subject: [PATCH] Implement generic version of testUnmarshalling --- composer.json | 2 +- phpunit.xml | 18 ++++++++------ tests/XML/CustomSignableTest.php | 13 ---------- tests/XML/SignableElementTest.php | 13 ---------- tests/XML/ds/CanonicalizationMethodTest.php | 10 -------- tests/XML/ds/DigestMethodTest.php | 13 ---------- tests/XML/ds/DigestValueTest.php | 13 ---------- tests/XML/ds/ExponentTest.php | 13 ---------- tests/XML/ds/KeyInfoTest.php | 13 ---------- tests/XML/ds/KeyNameTest.php | 13 ---------- tests/XML/ds/KeyValueTest.php | 13 ---------- tests/XML/ds/ManifestTest.php | 13 ---------- tests/XML/ds/ModulusTest.php | 10 -------- tests/XML/ds/ObjectTest.php | 13 ---------- tests/XML/ds/RSAKeyValueTest.php | 13 ---------- tests/XML/ds/ReferenceTest.php | 13 ---------- tests/XML/ds/RetrievalMethodTest.php | 13 ---------- tests/XML/ds/SignatureMethodTest.php | 13 ---------- tests/XML/ds/SignaturePropertiesTest.php | 13 ---------- tests/XML/ds/SignaturePropertyTest.php | 13 ---------- tests/XML/ds/SignatureTest.php | 27 --------------------- tests/XML/ds/SignatureValueTest.php | 17 ------------- tests/XML/ds/SignedInfoTest.php | 13 ---------- tests/XML/ds/TransformTest.php | 13 ---------- tests/XML/ds/TransformsTest.php | 13 ---------- tests/XML/ds/X509CertificateTest.php | 13 ---------- tests/XML/ds/X509DataTest.php | 13 ---------- tests/XML/ds/X509IssuerNameTest.php | 13 ---------- tests/XML/ds/X509IssuerSerialTest.php | 13 ---------- tests/XML/ds/X509SerialNumberTest.php | 13 ---------- tests/XML/ds/X509SubjectNameTest.php | 13 ---------- tests/XML/ds/XPathTest.php | 19 --------------- tests/XML/dsig11/KeyInfoReferenceTest.php | 13 ---------- tests/XML/dsig11/X509DigestTest.php | 11 --------- tests/XML/ec/InclusiveNamespacesTest.php | 15 ------------ tests/XML/xenc/CarriedKeyNameTest.php | 13 ---------- tests/XML/xenc/CipherDataTest.php | 16 ------------ tests/XML/xenc/CipherReferenceTest.php | 16 ------------ tests/XML/xenc/CipherValueTest.php | 13 ---------- tests/XML/xenc/DataReferenceTest.php | 16 ------------ tests/XML/xenc/EncryptedDataTest.php | 16 ------------ tests/XML/xenc/EncryptedKeyTest.php | 16 ------------ tests/XML/xenc/EncryptionMethodTest.php | 14 ----------- tests/XML/xenc/KeyReferenceTest.php | 16 ------------ tests/XML/xenc/KeySizeTest.php | 13 ---------- tests/XML/xenc/OAEPparamsTest.php | 13 ---------- tests/XML/xenc/ReferenceListTest.php | 16 ------------ tests/XML/xenc/TransformsTest.php | 13 ---------- 48 files changed, 11 insertions(+), 647 deletions(-) diff --git a/composer.json b/composer.json index d81f0368..f87ea9cf 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-spl": "*", "simplesamlphp/assert": "^1.0", - "simplesamlphp/xml-common": "^1.13" + "simplesamlphp/xml-common": "^1.14" }, "require-dev": { "simplesamlphp/simplesamlphp-test-framework": "^1.5" diff --git a/phpunit.xml b/phpunit.xml index 0439cd61..1f416b6a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,13 +1,6 @@ - + - - ./src/ - - - ./vendor/ - ./tests/ - @@ -17,4 +10,13 @@ ./tests + + + ./src/ + + + ./vendor/ + ./tests/ + + diff --git a/tests/XML/CustomSignableTest.php b/tests/XML/CustomSignableTest.php index 244fa9f8..76aebcfb 100644 --- a/tests/XML/CustomSignableTest.php +++ b/tests/XML/CustomSignableTest.php @@ -60,17 +60,4 @@ public function testMarshalling(): void strval($customSignable), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $customSignable = CustomSignable::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($customSignable), - ); - } } diff --git a/tests/XML/SignableElementTest.php b/tests/XML/SignableElementTest.php index 9c17cb11..6cb906a4 100644 --- a/tests/XML/SignableElementTest.php +++ b/tests/XML/SignableElementTest.php @@ -253,17 +253,4 @@ public function testSigningWithDifferentRoot(): void ); $customSignable->toXML($doc->documentElement); } - - - /** - */ - public function testUnmarshalling(): void - { - $customSignable = CustomSignable::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($customSignable), - ); - } } diff --git a/tests/XML/ds/CanonicalizationMethodTest.php b/tests/XML/ds/CanonicalizationMethodTest.php index 32deca75..74ef0bec 100644 --- a/tests/XML/ds/CanonicalizationMethodTest.php +++ b/tests/XML/ds/CanonicalizationMethodTest.php @@ -52,14 +52,4 @@ public function testMarshalling(): void strval($canonicalizationMethod), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $canonicalizationMethod = CanonicalizationMethod::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals(C::C14N_EXCLUSIVE_WITHOUT_COMMENTS, $canonicalizationMethod->getAlgorithm()); - } } diff --git a/tests/XML/ds/DigestMethodTest.php b/tests/XML/ds/DigestMethodTest.php index cb39e792..69730971 100644 --- a/tests/XML/ds/DigestMethodTest.php +++ b/tests/XML/ds/DigestMethodTest.php @@ -61,17 +61,4 @@ public function testMarshalling(): void strval($digestMethod), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $digestMethod = DigestMethod::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($digestMethod), - ); - } } diff --git a/tests/XML/ds/DigestValueTest.php b/tests/XML/ds/DigestValueTest.php index 2d14c853..a6a8996b 100644 --- a/tests/XML/ds/DigestValueTest.php +++ b/tests/XML/ds/DigestValueTest.php @@ -63,17 +63,4 @@ public function testMarshallingNotBase64(): void $this->expectException(AssertionFailedException::class); new DigestValue('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); } - - - /** - */ - public function testUnmarshalling(): void - { - $digestValue = DigestValue::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($digestValue), - ); - } } diff --git a/tests/XML/ds/ExponentTest.php b/tests/XML/ds/ExponentTest.php index 751bfb41..93969535 100644 --- a/tests/XML/ds/ExponentTest.php +++ b/tests/XML/ds/ExponentTest.php @@ -59,17 +59,4 @@ public function testMarshallingNotBase64(): void $this->expectException(SchemaViolationException::class); new Exponent('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); } - - - /** - */ - public function testUnmarshalling(): void - { - $exponent = Exponent::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($exponent), - ); - } } diff --git a/tests/XML/ds/KeyInfoTest.php b/tests/XML/ds/KeyInfoTest.php index aefb8380..0551b070 100644 --- a/tests/XML/ds/KeyInfoTest.php +++ b/tests/XML/ds/KeyInfoTest.php @@ -120,19 +120,6 @@ public function testMarshallingEmpty(): void } - /** - */ - public function testUnmarshalling(): void - { - $keyInfo = KeyInfo::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keyInfo), - ); - } - - /** */ public function testUnmarshallingEmpty(): void diff --git a/tests/XML/ds/KeyNameTest.php b/tests/XML/ds/KeyNameTest.php index 28e033c5..e613c502 100644 --- a/tests/XML/ds/KeyNameTest.php +++ b/tests/XML/ds/KeyNameTest.php @@ -51,17 +51,4 @@ public function testMarshalling(): void strval($keyName), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $keyName = KeyName::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keyName), - ); - } } diff --git a/tests/XML/ds/KeyValueTest.php b/tests/XML/ds/KeyValueTest.php index a35fd986..4f95c102 100644 --- a/tests/XML/ds/KeyValueTest.php +++ b/tests/XML/ds/KeyValueTest.php @@ -121,19 +121,6 @@ public function testMarshallingEmpty(): void } - /** - */ - public function testUnmarshalling(): void - { - $keyValue = KeyValue::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keyValue), - ); - } - - /** */ public function testUnmarshallingWithOtherElement(): void diff --git a/tests/XML/ds/ManifestTest.php b/tests/XML/ds/ManifestTest.php index 7b3051e9..d3acb9fd 100644 --- a/tests/XML/ds/ManifestTest.php +++ b/tests/XML/ds/ManifestTest.php @@ -71,17 +71,4 @@ public function testMarshalling(): void strval($manifest), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $manifest = Manifest::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($manifest), - ); - } } diff --git a/tests/XML/ds/ModulusTest.php b/tests/XML/ds/ModulusTest.php index 66e786bf..523269e1 100644 --- a/tests/XML/ds/ModulusTest.php +++ b/tests/XML/ds/ModulusTest.php @@ -59,14 +59,4 @@ public function testMarshallingNotBase64(): void $this->expectException(SchemaViolationException::class); new Modulus('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); } - - - /** - */ - public function testUnmarshalling(): void - { - $modulus = Modulus::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals('dGhpcyBpcyBzb21lIHJhbmRvbSBtb2R1bHVzCg==', $modulus->getContent()); - } } diff --git a/tests/XML/ds/ObjectTest.php b/tests/XML/ds/ObjectTest.php index aff59df1..c6259c09 100644 --- a/tests/XML/ds/ObjectTest.php +++ b/tests/XML/ds/ObjectTest.php @@ -67,19 +67,6 @@ public function testMarshalling(): void } - /** - */ - public function testUnmarshalling(): void - { - $obj = DsObject::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($obj) - ); - } - - /** * Adding an empty Object-element should yield an empty element. */ diff --git a/tests/XML/ds/RSAKeyValueTest.php b/tests/XML/ds/RSAKeyValueTest.php index 50fbe2cd..34934039 100644 --- a/tests/XML/ds/RSAKeyValueTest.php +++ b/tests/XML/ds/RSAKeyValueTest.php @@ -83,17 +83,4 @@ public function testMarshallingElementOrder(): void $this->assertCount(1, $RSAKeyValueElements); $this->assertEquals('ds:Exponent', $RSAKeyValueElements[0]->tagName); } - - - /** - */ - public function testUnmarshalling(): void - { - $RSAKeyValue = RSAKeyValue::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($RSAKeyValue), - ); - } } diff --git a/tests/XML/ds/ReferenceTest.php b/tests/XML/ds/ReferenceTest.php index 756209fd..6d6df44e 100644 --- a/tests/XML/ds/ReferenceTest.php +++ b/tests/XML/ds/ReferenceTest.php @@ -96,17 +96,4 @@ public function testMarshallingReferenceElementOrdering(): void $this->assertEquals('ds:DigestMethod', $children[1]->tagName); $this->assertEquals('ds:DigestValue', $children[2]->tagName); } - - - /** - */ - public function testUnmarshalling(): void - { - $reference = Reference::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($reference), - ); - } } diff --git a/tests/XML/ds/RetrievalMethodTest.php b/tests/XML/ds/RetrievalMethodTest.php index 879a3b59..81953440 100644 --- a/tests/XML/ds/RetrievalMethodTest.php +++ b/tests/XML/ds/RetrievalMethodTest.php @@ -62,17 +62,4 @@ public function testMarshalling(): void strval($retrievalMethod), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $retrievalMethod = retrievalMethod::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($retrievalMethod), - ); - } } diff --git a/tests/XML/ds/SignatureMethodTest.php b/tests/XML/ds/SignatureMethodTest.php index 50b92ab8..1166b41c 100644 --- a/tests/XML/ds/SignatureMethodTest.php +++ b/tests/XML/ds/SignatureMethodTest.php @@ -53,17 +53,4 @@ public function testMarshalling(): void strval($signatureMethod), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $signatureMethod = SignatureMethod::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($signatureMethod), - ); - } } diff --git a/tests/XML/ds/SignaturePropertiesTest.php b/tests/XML/ds/SignaturePropertiesTest.php index 4e5106f9..e5aca637 100644 --- a/tests/XML/ds/SignaturePropertiesTest.php +++ b/tests/XML/ds/SignaturePropertiesTest.php @@ -64,17 +64,4 @@ public function testMarshalling(): void strval($signatureProperties) ); } - - - /** - */ - public function testUnmarshalling(): void - { - $signatureProperties = SignatureProperties::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($signatureProperties) - ); - } } diff --git a/tests/XML/ds/SignaturePropertyTest.php b/tests/XML/ds/SignaturePropertyTest.php index f4b8b83b..21d2e33c 100644 --- a/tests/XML/ds/SignaturePropertyTest.php +++ b/tests/XML/ds/SignaturePropertyTest.php @@ -62,17 +62,4 @@ public function testMarshalling(): void strval($signatureProperty) ); } - - - /** - */ - public function testUnmarshalling(): void - { - $signatureProperty = SignatureProperty::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($signatureProperty) - ); - } } diff --git a/tests/XML/ds/SignatureTest.php b/tests/XML/ds/SignatureTest.php index 30fdbd29..fb3e0336 100644 --- a/tests/XML/ds/SignatureTest.php +++ b/tests/XML/ds/SignatureTest.php @@ -144,31 +144,4 @@ public function testMarshallingElementOrdering(): void $this->assertEquals('ds:KeyInfo', $signatureElements[1]->tagName); $this->assertEquals('ds:Object', $signatureElements[2]->tagName); } - - - /** - * Test creating a SignatureValue object from XML. - */ - public function testUnmarshalling(): void - { - $signature = Signature::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals('def456', $signature->getId()); - - $signedInfo = $signature->getSignedInfo(); - $this->assertInstanceOf(SignedInfo::class, $signedInfo); - - $signatureValue = $signature->getSignatureValue(); - $this->assertInstanceOf(SignatureValue::class, $signatureValue); - - $keyInfo = $signature->getKeyInfo(); - $this->assertInstanceOf(KeyInfo::class, $keyInfo); - - $objects = $signature->getObjects(); - $this->assertCount(1, $objects); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($signature), - ); - } } diff --git a/tests/XML/ds/SignatureValueTest.php b/tests/XML/ds/SignatureValueTest.php index 60d3124a..cf81be06 100644 --- a/tests/XML/ds/SignatureValueTest.php +++ b/tests/XML/ds/SignatureValueTest.php @@ -73,21 +73,4 @@ public function testMarshallingNotBase64(): void 'abc123', ); } - - - /** - * Test creating a SignatureValue object from XML. - */ - public function testUnmarshalling(): void - { - $signatureValue = SignatureValue::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals( - 'j14G9v6AnsOiEJYgkTg864DG3e/KLqoGpuybPGSGblVTn7ST6M/BsvP7YiVZjLqJEuEvWmf2mW4DPb+pbArzzDcsLWEtNveMrw+F' . - 'kWehDUQV9oe20iepo+W46wmj7zB/eWL+Z8MrGvlycoTndJU6CVwHTLsB+dq2FDa7JV4pAPjMY32JZTbiwKhzqw3nEi/eVrujJE4Y' . - 'RrlW28D+rXhITfoUAGGvsqPzcwGzp02lnMe2SmXADY1u9lbVjOhUrJpgvWfn9YuiCR+wjvaGMwIwzfJxChLJZOBV+1ad1CyNTiu6' . - 'qAblxZ4F8cWlMWJ7f0KkWvtw66HOf2VNR6Qan2Ra7Q==', - $signatureValue->getContent(), - ); - $this->assertEquals('abc123', $signatureValue->getId()); - } } diff --git a/tests/XML/ds/SignedInfoTest.php b/tests/XML/ds/SignedInfoTest.php index ff032b3f..13e0b660 100644 --- a/tests/XML/ds/SignedInfoTest.php +++ b/tests/XML/ds/SignedInfoTest.php @@ -69,19 +69,6 @@ public function testMarshalling(): void } - /** - */ - public function testUnmarshalling(): void - { - $signedInfo = SignedInfo::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($signedInfo), - ); - } - - /** * */ diff --git a/tests/XML/ds/TransformTest.php b/tests/XML/ds/TransformTest.php index 4431e7f0..1464ed8d 100644 --- a/tests/XML/ds/TransformTest.php +++ b/tests/XML/ds/TransformTest.php @@ -77,17 +77,4 @@ public function testMarshalling(): void strval($transform), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $transform = Transform::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($transform), - ); - } } diff --git a/tests/XML/ds/TransformsTest.php b/tests/XML/ds/TransformsTest.php index 00ff4a04..8b150bc1 100644 --- a/tests/XML/ds/TransformsTest.php +++ b/tests/XML/ds/TransformsTest.php @@ -65,19 +65,6 @@ public function testMarshalling(): void } - /** - */ - public function testUnmarshalling(): void - { - $transforms = Transforms::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($transforms), - ); - } - - /** * Adding an empty Transforms element should yield an empty element. */ diff --git a/tests/XML/ds/X509CertificateTest.php b/tests/XML/ds/X509CertificateTest.php index 2a09251a..8f9a688f 100644 --- a/tests/XML/ds/X509CertificateTest.php +++ b/tests/XML/ds/X509CertificateTest.php @@ -88,17 +88,4 @@ public function testMarshallingInvalidBase64(): void $this->expectException(AssertionFailedException::class); new X509Certificate($certificate); } - - - /** - */ - public function testUnmarshalling(): void - { - $x509cert = X509Certificate::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($x509cert), - ); - } } diff --git a/tests/XML/ds/X509DataTest.php b/tests/XML/ds/X509DataTest.php index 4b3109b7..f8b2e020 100644 --- a/tests/XML/ds/X509DataTest.php +++ b/tests/XML/ds/X509DataTest.php @@ -118,17 +118,4 @@ public function testMarshalling(): void strval($x509data), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $x509data = X509Data::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($x509data), - ); - } } diff --git a/tests/XML/ds/X509IssuerNameTest.php b/tests/XML/ds/X509IssuerNameTest.php index 12620013..cc0adcac 100644 --- a/tests/XML/ds/X509IssuerNameTest.php +++ b/tests/XML/ds/X509IssuerNameTest.php @@ -50,17 +50,4 @@ public function testMarshalling(): void strval($issuerName), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $issuerName = X509IssuerName::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($issuerName), - ); - } } diff --git a/tests/XML/ds/X509IssuerSerialTest.php b/tests/XML/ds/X509IssuerSerialTest.php index ce1eca46..16416a5d 100644 --- a/tests/XML/ds/X509IssuerSerialTest.php +++ b/tests/XML/ds/X509IssuerSerialTest.php @@ -96,17 +96,4 @@ public function testMarshallingElementOrdering(): void $this->assertCount(1, $X509IssuerSerialElements); $this->assertEquals('ds:X509SerialNumber', $X509IssuerSerialElements[0]->tagName); } - - - /** - */ - public function testUnmarshalling(): void - { - $X509IssuerSerial = X509IssuerSerial::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($X509IssuerSerial), - ); - } } diff --git a/tests/XML/ds/X509SerialNumberTest.php b/tests/XML/ds/X509SerialNumberTest.php index 2cf5c542..9533d4d0 100644 --- a/tests/XML/ds/X509SerialNumberTest.php +++ b/tests/XML/ds/X509SerialNumberTest.php @@ -53,19 +53,6 @@ public function testMarshalling(): void } - /** - */ - public function testUnmarshalling(): void - { - $serialNumber = X509SerialNumber::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($serialNumber), - ); - } - - /** */ public function testUnmarshallingIncorrectTypeThrowsException(): void diff --git a/tests/XML/ds/X509SubjectNameTest.php b/tests/XML/ds/X509SubjectNameTest.php index 972ab684..750a0b33 100644 --- a/tests/XML/ds/X509SubjectNameTest.php +++ b/tests/XML/ds/X509SubjectNameTest.php @@ -48,17 +48,4 @@ public function testMarshalling(): void strval($subjectName), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $subjectName = X509SubjectName::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($subjectName), - ); - } } diff --git a/tests/XML/ds/XPathTest.php b/tests/XML/ds/XPathTest.php index 58e7cd06..2c9e3483 100644 --- a/tests/XML/ds/XPathTest.php +++ b/tests/XML/ds/XPathTest.php @@ -51,25 +51,6 @@ public function testMarshalling(): void $this->assertArrayHasKey('xenc', $namespaces); $this->assertEquals('http://www.w3.org/2001/04/xmlenc#', $namespaces['xenc']); - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($xpath), - ); - } - - - /** - */ - public function testUnmarshalling(): void - { - $xpath = XPath::fromXML(self::$xmlRepresentation->documentElement); - $this->assertEquals('self::xenc:CipherValue[@Id="example1"]', $xpath->getExpression()); - $namespaces = $xpath->getNamespaces(); - $this->assertCount(2, $namespaces); - $this->assertEquals('xenc', array_keys($namespaces)[0]); - $this->assertEquals('ds', array_keys($namespaces)[1]); - - $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($xpath), diff --git a/tests/XML/dsig11/KeyInfoReferenceTest.php b/tests/XML/dsig11/KeyInfoReferenceTest.php index 5db4f7b4..aa680fd6 100644 --- a/tests/XML/dsig11/KeyInfoReferenceTest.php +++ b/tests/XML/dsig11/KeyInfoReferenceTest.php @@ -53,17 +53,4 @@ public function testMarshalling(): void strval($KeyInfoReference), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $KeyInfoReference = KeyInfoReference::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($KeyInfoReference), - ); - } } diff --git a/tests/XML/dsig11/X509DigestTest.php b/tests/XML/dsig11/X509DigestTest.php index 8f93f510..e5b264bb 100644 --- a/tests/XML/dsig11/X509DigestTest.php +++ b/tests/XML/dsig11/X509DigestTest.php @@ -66,15 +66,4 @@ public function testMarshalling(): void strval($x509digest), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $x509digest = X509Digest::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals($x509digest->getContent(), self::$digest); - $this->assertEquals(C::DIGEST_SHA256, $x509digest->getAlgorithm()); - } } diff --git a/tests/XML/ec/InclusiveNamespacesTest.php b/tests/XML/ec/InclusiveNamespacesTest.php index 0e8df323..cae8e02e 100644 --- a/tests/XML/ec/InclusiveNamespacesTest.php +++ b/tests/XML/ec/InclusiveNamespacesTest.php @@ -53,19 +53,4 @@ public function testMarshalling(): void strval($inclusiveNamespaces), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $inclusiveNamespaces = InclusiveNamespaces::fromXML( - self::$xmlRepresentation->documentElement, - ); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($inclusiveNamespaces), - ); - } } diff --git a/tests/XML/xenc/CarriedKeyNameTest.php b/tests/XML/xenc/CarriedKeyNameTest.php index 4c2d54fd..5c87bfd5 100644 --- a/tests/XML/xenc/CarriedKeyNameTest.php +++ b/tests/XML/xenc/CarriedKeyNameTest.php @@ -47,17 +47,4 @@ public function testMarshalling(): void strval($keyName), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $keyName = CarriedKeyName::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keyName), - ); - } } diff --git a/tests/XML/xenc/CipherDataTest.php b/tests/XML/xenc/CipherDataTest.php index 10b651ac..6ce80b06 100644 --- a/tests/XML/xenc/CipherDataTest.php +++ b/tests/XML/xenc/CipherDataTest.php @@ -58,20 +58,4 @@ public function testMarshalling(): void strval($cipherData), ); } - - - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $cipherData = CipherData::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($cipherData), - ); - } } diff --git a/tests/XML/xenc/CipherReferenceTest.php b/tests/XML/xenc/CipherReferenceTest.php index 7cd3599c..568b9437 100644 --- a/tests/XML/xenc/CipherReferenceTest.php +++ b/tests/XML/xenc/CipherReferenceTest.php @@ -67,20 +67,4 @@ public function testMarshalling(): void strval($cipherReference), ); } - - - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $cipherReference = CipherReference::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($cipherReference), - ); - } } diff --git a/tests/XML/xenc/CipherValueTest.php b/tests/XML/xenc/CipherValueTest.php index ad54771b..ddb30a25 100644 --- a/tests/XML/xenc/CipherValueTest.php +++ b/tests/XML/xenc/CipherValueTest.php @@ -59,17 +59,4 @@ public function testMarshallingNotBase64(): void $this->expectException(AssertionFailedException::class); new CipherValue('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); } - - - /** - */ - public function testUnmarshalling(): void - { - $cipherValue = CipherValue::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - XMLDumper::dumpDOMDocumentXMLWithBase64Content(self::$xmlRepresentation), - strval($cipherValue), - ); - } } diff --git a/tests/XML/xenc/DataReferenceTest.php b/tests/XML/xenc/DataReferenceTest.php index f522bdb1..bd108cf5 100644 --- a/tests/XML/xenc/DataReferenceTest.php +++ b/tests/XML/xenc/DataReferenceTest.php @@ -67,20 +67,4 @@ public function testMarshalling(): void strval($dataReference), ); } - - - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $dataReference = DataReference::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($dataReference), - ); - } } diff --git a/tests/XML/xenc/EncryptedDataTest.php b/tests/XML/xenc/EncryptedDataTest.php index 32bf1842..3b2446a2 100644 --- a/tests/XML/xenc/EncryptedDataTest.php +++ b/tests/XML/xenc/EncryptedDataTest.php @@ -134,20 +134,4 @@ public function testMarshallingElementOrdering(): void // EncryptionProperties is currently not supported //$this->assertEquals('xenc:EncryptionProperties', $encryptedDataElements[2]->tagName); } - - - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $encryptedData = EncryptedData::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($encryptedData), - ); - } } diff --git a/tests/XML/xenc/EncryptedKeyTest.php b/tests/XML/xenc/EncryptedKeyTest.php index 166ce58f..3c55ed1e 100644 --- a/tests/XML/xenc/EncryptedKeyTest.php +++ b/tests/XML/xenc/EncryptedKeyTest.php @@ -168,22 +168,6 @@ public function testMarshallingElementOrdering(): void } - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $encryptedKey = EncryptedKey::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($encryptedKey), - ); - } - - /** * Test encryption and decryption with PKCS1 RSA 1.5. */ diff --git a/tests/XML/xenc/EncryptionMethodTest.php b/tests/XML/xenc/EncryptionMethodTest.php index 8e1855e0..904e426b 100644 --- a/tests/XML/xenc/EncryptionMethodTest.php +++ b/tests/XML/xenc/EncryptionMethodTest.php @@ -115,20 +115,6 @@ public function testMarshallingElementOrdering(): void // test unmarshalling - /** - * Test creating an EncryptionMethod object from XML. - */ - public function testUnmarshalling(): void - { - $em = EncryptionMethod::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($em), - ); - } - - /** * Test that creating an EncryptionMethod object from XML without an Algorithm attribute fails. */ diff --git a/tests/XML/xenc/KeyReferenceTest.php b/tests/XML/xenc/KeyReferenceTest.php index da680a84..ad0868d8 100644 --- a/tests/XML/xenc/KeyReferenceTest.php +++ b/tests/XML/xenc/KeyReferenceTest.php @@ -67,20 +67,4 @@ public function testMarshalling(): void strval($keyReference), ); } - - - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $keyReference = KeyReference::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keyReference), - ); - } } diff --git a/tests/XML/xenc/KeySizeTest.php b/tests/XML/xenc/KeySizeTest.php index 93a2cb37..3b224347 100644 --- a/tests/XML/xenc/KeySizeTest.php +++ b/tests/XML/xenc/KeySizeTest.php @@ -47,17 +47,4 @@ public function testMarshalling(): void strval($keySize), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $keySize = KeySize::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($keySize), - ); - } } diff --git a/tests/XML/xenc/OAEPparamsTest.php b/tests/XML/xenc/OAEPparamsTest.php index 9f2afe1b..666f45c6 100644 --- a/tests/XML/xenc/OAEPparamsTest.php +++ b/tests/XML/xenc/OAEPparamsTest.php @@ -47,17 +47,4 @@ public function testMarshalling(): void strval($params), ); } - - - /** - */ - public function testUnmarshalling(): void - { - $params = OAEPparams::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($params), - ); - } } diff --git a/tests/XML/xenc/ReferenceListTest.php b/tests/XML/xenc/ReferenceListTest.php index a891f5b5..15b7c07d 100644 --- a/tests/XML/xenc/ReferenceListTest.php +++ b/tests/XML/xenc/ReferenceListTest.php @@ -76,20 +76,4 @@ public function testMarshalling(): void strval($referenceList), ); } - - - // unmarshalling - - - /** - */ - public function testUnmarshalling(): void - { - $referenceList = ReferenceList::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($referenceList), - ); - } } diff --git a/tests/XML/xenc/TransformsTest.php b/tests/XML/xenc/TransformsTest.php index e3dc091e..3b5b0b9e 100644 --- a/tests/XML/xenc/TransformsTest.php +++ b/tests/XML/xenc/TransformsTest.php @@ -62,19 +62,6 @@ public function testMarshalling(): void } - /** - */ - public function testUnmarshalling(): void - { - $transforms = Transforms::fromXML(self::$xmlRepresentation->documentElement); - - $this->assertEquals( - self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), - strval($transforms), - ); - } - - /** * Adding an empty Transforms element should yield an empty element. */