Passed
Pull Request — master (#60)
by Tim
02:16
created

SignatureValueTest::testMarshallingNotBase64()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\ds;
6
7
use PHPUnit\Framework\Attributes\{CoversClass, Group};
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...
Bug introduced by
The type PHPUnit\Framework\Attributes\Group 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\DOMDocumentFactory;
10
use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait};
11
use SimpleSAML\XML\Type\{Base64BinaryValue, IDValue};
12
use SimpleSAML\XMLSecurity\XML\ds\{AbstractDsElement, SignatureValue};
13
14
use function dirname;
15
use function strval;
16
17
/**
18
 * Class \SimpleSAML\XMLSecurity\Test\XML\ds\SignatureValueTest
19
 *
20
 * @package simplesamlphp/xml-security
21
 */
22
#[Group('ds')]
23
#[CoversClass(AbstractDsElement::class)]
24
#[CoversClass(SignatureValue::class)]
25
final class SignatureValueTest extends TestCase
26
{
27
    use SchemaValidationTestTrait;
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...L\ds\SignatureValueTest.
Loading history...
29
30
    /**
31
     * Set up the test.
32
     */
33
    public static function setUpBeforeClass(): void
34
    {
35
        self::$testedClass = SignatureValue::class;
36
37
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
38
            dirname(__FILE__, 3) . '/resources/xml/ds_SignatureValue.xml',
39
        );
40
    }
41
42
43
    /**
44
     * Test creating a SignatureValue from scratch.
45
     */
46
    public function testMarshalling(): void
47
    {
48
        $signatureValue = new SignatureValue(
49
            Base64BinaryValue::fromString(
50
                'j14G9v6AnsOiEJYgkTg864DG3e/KLqoGpuybPGSGblVTn7ST6M/BsvP7YiVZjLqJEuEvWmf2mW4DPb+pbArzzDcsLWEtNveMrw+F' .
51
                'kWehDUQV9oe20iepo+W46wmj7zB/eWL+Z8MrGvlycoTndJU6CVwHTLsB+dq2FDa7JV4pAPjMY32JZTbiwKhzqw3nEi/eVrujJE4Y' .
52
                'RrlW28D+rXhITfoUAGGvsqPzcwGzp02lnMe2SmXADY1u9lbVjOhUrJpgvWfn9YuiCR+wjvaGMwIwzfJxChLJZOBV+1ad1CyNTiu6' .
53
                'qAblxZ4F8cWlMWJ7f0KkWvtw66HOf2VNR6Qan2Ra7Q==',
54
            ),
55
            IDValue::fromString('abc123'),
56
        );
57
58
        $this->assertEquals(
59
            self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
60
            strval($signatureValue),
61
        );
62
    }
63
}
64