Passed
Push — master ( be09b3...67068d )
by Tim
13:28
created

CipherDataTest::testUnmarshalling()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\xenc;
6
7
use PHPUnit\Framework\TestCase;
8
use SimpleSAML\XML\DOMDocumentFactory;
9
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait;
10
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
11
use SimpleSAML\XMLSecurity\XML\xenc\CipherData;
12
use SimpleSAML\XMLSecurity\XML\xenc\CipherValue;
13
14
use function dirname;
15
use function strval;
16
17
/**
18
 * Class \SimpleSAML\XMLSecurity\Test\XML\xenc\CipherDataTest
19
 *
20
 * @covers \SimpleSAML\XMLSecurity\XML\xenc\AbstractXencElement
21
 * @covers \SimpleSAML\XMLSecurity\XML\xenc\CipherData
22
 *
23
 * @package simplesamlphp/xml-security
24
 */
25
final class CipherDataTest extends TestCase
26
{
27
    use SchemaValidationTestTrait;
0 ignored issues
show
introduced by
The trait SimpleSAML\XML\TestUtils\SchemaValidationTestTrait requires some properties which are not provided by SimpleSAML\XMLSecurity\T...XML\xenc\CipherDataTest: $documentElement, $ownerDocument, $message, $line
Loading history...
28
    use SerializableElementTestTrait;
0 ignored issues
show
Bug introduced by
The trait SimpleSAML\XML\TestUtils...lizableElementTestTrait requires the property $documentElement which is not provided by SimpleSAML\XMLSecurity\T...XML\xenc\CipherDataTest.
Loading history...
29
30
    /**
31
     */
32
    public static function setUpBeforeClass(): void
33
    {
34
        self::$testedClass = CipherData::class;
35
36
        self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd';
37
38
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
39
            dirname(__FILE__, 3) . '/resources/xml/xenc_CipherData.xml',
40
        );
41
    }
42
43
44
    // marshalling
45
46
47
    /**
48
     */
49
    public function testMarshalling(): void
50
    {
51
        $cipherData = new CipherData(new CipherValue('c29tZSB0ZXh0'));
52
53
        $this->assertEquals(
54
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
55
            strval($cipherData),
56
        );
57
    }
58
}
59