File tree Expand file tree Collapse file tree 3 files changed +78
-0
lines changed
Expand file tree Collapse file tree 3 files changed +78
-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 \ds ;
6+
7+ use SimpleSAML \XML \Base64ElementTrait ;
8+
9+ /**
10+ * Class representing a ds:SPKISexp element.
11+ *
12+ * @package simplesaml/xml-security
13+ */
14+ final class SPKISexp extends AbstractDsElement
15+ {
16+ use Base64ElementTrait;
17+
18+
19+ /**
20+ * @param string $content
21+ */
22+ public function __construct (string $ content )
23+ {
24+ $ this ->setContent ($ content );
25+ }
26+ }
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 \ds ;
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 \XML \ds \AbstractDsElement ;
12+ use SimpleSAML \XMLSecurity \XML \ds \SPKISexp ;
13+
14+ use function dirname ;
15+ use function strval ;
16+
17+ /**
18+ * Class \SimpleSAML\XMLSecurity\Test\XML\ds\SPKISexpTest
19+ *
20+ * @package simplesamlphp/xml-security
21+ */
22+ #[CoversClass(AbstractDsElement::class)]
23+ #[CoversClass(SPKISexp::class)]
24+ final class SPKISexpTest extends TestCase
25+ {
26+ use SerializableElementTestTrait;
27+
28+ /**
29+ */
30+ public static function setUpBeforeClass (): void
31+ {
32+ self ::$ testedClass = SPKISexp::class;
33+
34+ self ::$ xmlRepresentation = DOMDocumentFactory::fromFile (
35+ dirname (__FILE__ , 3 ) . '/resources/xml/ds_SPKISexp.xml ' ,
36+ );
37+ }
38+
39+
40+ /**
41+ */
42+ public function testMarshalling (): void
43+ {
44+ $ SPKISexp = new SPKISexp ('GpM6 ' );
45+
46+ $ this ->assertEquals (
47+ self ::$ xmlRepresentation ->saveXML (self ::$ xmlRepresentation ->documentElement ),
48+ strval ($ SPKISexp ),
49+ );
50+ }
51+ }
Original file line number Diff line number Diff line change 1+ <ds : SPKISexp xmlns : ds =" http://www.w3.org/2000/09/xmldsig#" >GpM6</ds : SPKISexp >
You can’t perform that action at this time.
0 commit comments