1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\XMLSecurity\Test\XML\xenc; |
6
|
|
|
|
7
|
|
|
use PHPUnit\Framework\Attributes\{CoversClass, Group}; |
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\Type\CryptoBinaryValue; |
13
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc\{AbstractXencElement, PgenCounter}; |
14
|
|
|
|
15
|
|
|
use function dirname; |
16
|
|
|
use function strval; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class \SimpleSAML\XMLSecurity\Test\XML\xenc\PgenCounterTest |
20
|
|
|
* |
21
|
|
|
* @covers \SimpleSAML\XMLSecurity\XML\xenc\AbstractXencElement |
22
|
|
|
* @covers \SimpleSAML\XMLSecurity\XML\xenc\PgenCounter |
23
|
|
|
* |
24
|
|
|
* @package simplesamlphp/xml-security |
25
|
|
|
*/ |
26
|
|
|
#[Group('xenc')] |
27
|
|
|
#[CoversClass(AbstractXencElement::class)] |
28
|
|
|
#[CoversClass(PgenCounter::class)] |
29
|
|
|
final class PgenCounterTest extends TestCase |
30
|
|
|
{ |
31
|
|
|
use SerializableElementTestTrait; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
*/ |
35
|
|
|
public static function setUpBeforeClass(): void |
36
|
|
|
{ |
37
|
|
|
self::$testedClass = PgenCounter::class; |
38
|
|
|
|
39
|
|
|
self::$xmlRepresentation = DOMDocumentFactory::fromFile( |
40
|
|
|
dirname(__FILE__, 3) . '/resources/xml/xenc_pgenCounter.xml', |
41
|
|
|
); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
*/ |
47
|
|
|
public function testMarshalling(): void |
48
|
|
|
{ |
49
|
|
|
$pgenCounter = new PgenCounter( |
50
|
|
|
CryptoBinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='), |
51
|
|
|
); |
52
|
|
|
|
53
|
|
|
$this->assertEquals( |
54
|
|
|
XMLDumper::dumpDOMDocumentXMLWithBase64Content(self::$xmlRepresentation), |
55
|
|
|
strval($pgenCounter), |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|