File tree Expand file tree Collapse file tree 3 files changed +83
-0
lines changed Expand file tree Collapse file tree 3 files changed +83
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace SimpleSAML \XMLSecurity \XML \dsig11 ;
6+
7+ use SimpleSAML \XML \Base64ElementTrait ;
8+
9+ /**
10+ * Class representing a dsig11:PublicKey element.
11+ *
12+ * @package simplesaml/xml-security
13+ */
14+ final class PublicKey extends AbstractDsig11Element
15+ {
16+ use Base64ElementTrait;
17+
18+
19+ /**
20+ * Initialize a PublicKey element.
21+ *
22+ * @param string $value
23+ */
24+ public function __construct (
25+ string $ value ,
26+ ) {
27+ $ this ->setContent ($ value );
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace SimpleSAML \XMLSecurity \Test \XML \dsig11 ;
6+
7+ use PHPUnit \Framework \Attributes \CoversClass ;
8+ use PHPUnit \Framework \TestCase ;
9+ use SimpleSAML \XML \DOMDocumentFactory ;
10+ use SimpleSAML \XML \TestUtils \SerializableElementTestTrait ;
11+ use SimpleSAML \XMLSecurity \Test \XML \XMLDumper ;
12+ use SimpleSAML \XMLSecurity \XML \dsig11 \AbstractDsig11Element ;
13+ use SimpleSAML \XMLSecurity \XML \dsig11 \PublicKey ;
14+
15+ use function dirname ;
16+ use function strval ;
17+
18+ /**
19+ * Class \SimpleSAML\XMLSecurity\Test\XML\dsig11\PublicKeyTest
20+ *
21+ * @package simplesamlphp/xml-security
22+ */
23+ #[CoversClass(AbstractDsig11Element::class)]
24+ #[CoversClass(PublicKey::class)]
25+ final class PublicKeyTest extends TestCase
26+ {
27+ use SerializableElementTestTrait;
28+
29+
30+ /**
31+ */
32+ public static function setUpBeforeClass (): void
33+ {
34+ self ::$ testedClass = PublicKey::class;
35+
36+ self ::$ xmlRepresentation = DOMDocumentFactory::fromFile (
37+ dirname (__FILE__ , 3 ) . '/resources/xml/dsig11_PublicKey.xml ' ,
38+ );
39+ }
40+
41+
42+ /**
43+ */
44+ public function testMarshalling (): void
45+ {
46+ $ publicKey = new PublicKey ('6tN39Q9d6IevlAWLeM7lQGazUnVlJOe1wCk3sro2rfE= ' );
47+
48+ $ this ->assertEquals (
49+ XMLDumper::dumpDOMDocumentXMLWithBase64Content (self ::$ xmlRepresentation ),
50+ strval ($ publicKey ),
51+ );
52+ }
53+ }
Original file line number Diff line number Diff line change 1+ <dsig11 : PublicKey xmlns : dsig11 =" http://www.w3.org/2009/xmldsig11#" >6tN39Q9d6IevlAWLeM7lQGazUnVlJOe1wCk3sro2rfE=</dsig11 : PublicKey >
You can’t perform that action at this time.
0 commit comments