Passed
Push — master ( ae601f...feb95e )
by Tim
02:20
created

X509CRLTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 37
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testMarshallingNotBase64() 0 4 1
A testMarshalling() 0 7 1
A setUpBeforeClass() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\XMLSecurity\Test\XML\ds;
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\Assert\AssertionFailedException;
10
use SimpleSAML\XML\DOMDocumentFactory;
11
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
12
use SimpleSAML\XMLSecurity\Test\XML\XMLDumper;
13
use SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement;
14
use SimpleSAML\XMLSecurity\XML\ds\X509CRL;
15
16
use function dirname;
17
use function strval;
18
19
/**
20
 * Class \SimpleSAML\XMLSecurity\Test\XML\ds\X509CRLTest
21
 *
22
 * @package simplesamlphp/xml-security
23
 */
24
#[CoversClass(AbstractDsElement::class)]
25
#[CoversClass(X509CRL::class)]
26
final class X509CRLTest extends TestCase
27
{
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\Test\XML\ds\X509CRLTest.
Loading history...
29
30
    /**
31
     */
32
    public static function setUpBeforeClass(): void
33
    {
34
        self::$testedClass = X509CRL::class;
35
36
        self::$xmlRepresentation = DOMDocumentFactory::fromFile(
37
            dirname(__FILE__, 3) . '/resources/xml/ds_X509CRL.xml',
38
        );
39
    }
40
41
42
    /**
43
     */
44
    public function testMarshalling(): void
45
    {
46
        $X509CRL = new X509CRL('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=');
47
48
        $this->assertEquals(
49
            XMLDumper::dumpDOMDocumentXMLWithBase64Content(self::$xmlRepresentation),
50
            strval($X509CRL),
51
        );
52
    }
53
54
55
    /**
56
     */
57
    public function testMarshallingNotBase64(): void
58
    {
59
        $this->expectException(AssertionFailedException::class);
60
        new X509CRL('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=');
61
    }
62
}
63