From 271d943cfb48b5ed06c9f492fb048a8977d40afb Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 26 Nov 2024 23:41:33 +0100 Subject: [PATCH] Add element xenc:KA-nonce --- src/XML/xenc/KANonce.php | 29 ++++++++++++ tests/XML/xenc/KANonceTest.php | 65 +++++++++++++++++++++++++++ tests/resources/xml/xenc_KA-Nonce.xml | 1 + 3 files changed, 95 insertions(+) create mode 100644 src/XML/xenc/KANonce.php create mode 100644 tests/XML/xenc/KANonceTest.php create mode 100644 tests/resources/xml/xenc_KA-Nonce.xml diff --git a/src/XML/xenc/KANonce.php b/src/XML/xenc/KANonce.php new file mode 100644 index 00000000..44e72e2a --- /dev/null +++ b/src/XML/xenc/KANonce.php @@ -0,0 +1,29 @@ +setContent($content); + } +} diff --git a/tests/XML/xenc/KANonceTest.php b/tests/XML/xenc/KANonceTest.php new file mode 100644 index 00000000..fb72c681 --- /dev/null +++ b/tests/XML/xenc/KANonceTest.php @@ -0,0 +1,65 @@ +assertEquals( + XMLDumper::dumpDOMDocumentXMLWithBase64Content(self::$xmlRepresentation), + strval($kaNonce), + ); + } + + + /** + */ + public function testMarshallingNotBase64(): void + { + $this->expectException(AssertionFailedException::class); + new KANonce('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); + } +} diff --git a/tests/resources/xml/xenc_KA-Nonce.xml b/tests/resources/xml/xenc_KA-Nonce.xml new file mode 100644 index 00000000..28552277 --- /dev/null +++ b/tests/resources/xml/xenc_KA-Nonce.xml @@ -0,0 +1 @@ +/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=