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

SignatureMethodTest::testUnmarshalling()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\ds;
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\Constants as C;
12
use SimpleSAML\XMLSecurity\XML\ds\SignatureMethod;
13
14
use function dirname;
15
use function strval;
16
17
/**
18
 * Class \SimpleSAML\XMLSecurity\Test\XML\ds\SignatureMethodTest
19
 *
20
 * @covers \SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement
21
 * @covers \SimpleSAML\XMLSecurity\XML\ds\SignatureMethod
22
 *
23
 * @package simplesamlphp/xml-security
24
 */
25
final class SignatureMethodTest 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...\ds\SignatureMethodTest: $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...\ds\SignatureMethodTest.
Loading history...
29
30
    /**
31
     */
32
    public static function setUpBeforeClass(): void
33
    {
34
        self::$testedClass = SignatureMethod::class;
35
36
        self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd';
37
38
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
39
            dirname(__FILE__, 3) . '/resources/xml/ds_SignatureMethod.xml',
40
        );
41
    }
42
43
44
    /**
45
     */
46
    public function testMarshalling(): void
47
    {
48
        $signatureMethod = new SignatureMethod(C::SIG_RSA_SHA256);
49
50
        $this->assertEquals(
51
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
52
            strval($signatureMethod),
53
        );
54
    }
55
}
56