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