Passed
Push — master ( 2d3781...f48916 )
by Tim
11:07 queued 06:44
created

ConcatKDFParamsTest::testMarshalling()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 15
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 23
rs 9.7666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\xenc11;
6
7
use PHPUnit\Framework\Attributes\CoversClass;
1 ignored issue
show
Bug introduced by
The type PHPUnit\Framework\Attributes\CoversClass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\TestCase;
9
use SimpleSAML\XML\Chunk;
10
use SimpleSAML\XML\DOMDocumentFactory;
11
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait;
12
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
13
use SimpleSAML\XMLSecurity\Constants as C;
14
use SimpleSAML\XMLSecurity\XML\ds\DigestMethod;
15
use SimpleSAML\XMLSecurity\XML\xenc11\AbstractConcatKDFParamsType;
16
use SimpleSAML\XMLSecurity\XML\xenc11\AbstractXenc11Element;
17
use SimpleSAML\XMLSecurity\XML\xenc11\ConcatKDFParams;
18
19
use function dirname;
20
use function strval;
21
22
/**
23
 * Class \SimpleSAML\XMLSecurity\XML\Test\xenc11\ConcatKDFParamsTest
24
 *
25
 * @package simplesamlphp/xml-security
26
 */
27
#[CoversClass(AbstractXenc11Element::class)]
28
#[CoversClass(AbstractConcatKDFParamsType::class)]
29
#[CoversClass(ConcatKDFParams::class)]
30
final class ConcatKDFParamsTest extends TestCase
31
{
32
    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...c11\ConcatKDFParamsTest: $documentElement, $ownerDocument, $message, $line
Loading history...
33
    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...c11\ConcatKDFParamsTest.
Loading history...
34
35
    /**
36
     */
37
    public static function setUpBeforeClass(): void
38
    {
39
        self::$testedClass = ConcatKDFParams::class;
40
41
        self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd';
42
43
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
44
            dirname(__FILE__, 3) . '/resources/xml/xenc11_ConcatKDFParams.xml',
45
        );
46
    }
47
48
49
    /**
50
     */
51
    public function testMarshalling(): void
52
    {
53
        $digestMethod = new DigestMethod(
54
            C::DIGEST_SHA256,
55
            [
56
                new Chunk(DOMDocumentFactory::fromString(
57
                    '<some:Chunk xmlns:some="urn:test:some">Random</some:Chunk>',
58
                )->documentElement),
59
            ],
60
        );
61
62
        $concatKdfParams = new ConcatKDFParams(
63
            $digestMethod,
64
            'a1b2',
65
            'b2c3',
66
            'c3d4',
67
            'd4e5',
68
            'e5f6',
69
        );
70
71
        $this->assertEquals(
72
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
73
            strval($concatKdfParams),
74
        );
75
    }
76
}
77