1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\XMLSecurity\Test\XML\ds; |
6
|
|
|
|
7
|
|
|
use PHPUnit\Framework\Attributes\{CoversClass, Group}; |
|
|
|
|
8
|
|
|
use PHPUnit\Framework\TestCase; |
9
|
|
|
use SimpleSAML\XML\DOMDocumentFactory; |
10
|
|
|
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; |
11
|
|
|
use SimpleSAML\XML\Type\Base64BinaryValue; |
12
|
|
|
use SimpleSAML\XMLSecurity\Test\XML\XMLDumper; |
13
|
|
|
use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; |
14
|
|
|
use SimpleSAML\XMLSecurity\XML\ds\{AbstractDsElement, X509Certificate}; |
15
|
|
|
|
16
|
|
|
use function dirname; |
17
|
|
|
use function str_replace; |
18
|
|
|
use function strval; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class \SimpleSAML\XMLSecurity\Test\XML\ds\X509CertificateTest |
22
|
|
|
* |
23
|
|
|
* @package simplesamlphp/xml-security |
24
|
|
|
*/ |
25
|
|
|
#[Group('ds')] |
26
|
|
|
#[CoversClass(AbstractDsElement::class)] |
27
|
|
|
#[CoversClass(X509Certificate::class)] |
28
|
|
|
final class X509CertificateTest extends TestCase |
29
|
|
|
{ |
30
|
|
|
use SerializableElementTestTrait; |
|
|
|
|
31
|
|
|
|
32
|
|
|
/** @var string */ |
33
|
|
|
private static string $certificate; |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
*/ |
38
|
|
|
public static function setUpBeforeClass(): void |
39
|
|
|
{ |
40
|
|
|
self::$testedClass = X509Certificate::class; |
41
|
|
|
|
42
|
|
|
self::$xmlRepresentation = DOMDocumentFactory::fromFile( |
43
|
|
|
dirname(__FILE__, 3) . '/resources/xml/ds_X509Certificate.xml', |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
self::$certificate = str_replace( |
47
|
|
|
[ |
48
|
|
|
'-----BEGIN CERTIFICATE-----', |
49
|
|
|
'-----END CERTIFICATE-----', |
50
|
|
|
'-----BEGIN RSA PUBLIC KEY-----', |
51
|
|
|
'-----END RSA PUBLIC KEY-----', |
52
|
|
|
"\r\n", |
53
|
|
|
"\n", |
54
|
|
|
], |
55
|
|
|
[ |
56
|
|
|
'', |
57
|
|
|
'', |
58
|
|
|
'', |
59
|
|
|
'', |
60
|
|
|
"\n", |
61
|
|
|
'', |
62
|
|
|
], |
63
|
|
|
PEMCertificatesMock::getPlainCertificate(PEMCertificatesMock::SELFSIGNED_CERTIFICATE), |
64
|
|
|
); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
*/ |
70
|
|
|
public function testMarshalling(): void |
71
|
|
|
{ |
72
|
|
|
$x509cert = new X509Certificate( |
73
|
|
|
Base64BinaryValue::fromString(self::$certificate), |
74
|
|
|
); |
75
|
|
|
|
76
|
|
|
$this->assertEquals( |
77
|
|
|
XMLDumper::dumpDOMDocumentXMLWithBase64Content(self::$xmlRepresentation), |
78
|
|
|
strval($x509cert), |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths