Skip to content

Commit ca83e9e

Browse files
committed
Cover chainMatchesIssuer() no-PEM-block path
1 parent bc2b9b2 commit ca83e9e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/Unit/Endpoints/EndpointsTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,19 @@ function certOrderData(): OrderData
15351535
expect($parsed['subject']['CN'])->toBe('Default Root CA');
15361536
});
15371537

1538+
it('chainMatchesIssuer() returns false when caBundle has no PEM certificate blocks', function () {
1539+
$cert = makeEndpointApi(endpointMock(), withKeyStorage())->certificate();
1540+
$method = new \ReflectionMethod($cert, 'chainMatchesIssuer');
1541+
1542+
$bundle = new \CoyoteCert\DTO\CertificateBundleData(
1543+
certificate: '',
1544+
fullchain: '',
1545+
caBundle: 'not-a-pem-block',
1546+
);
1547+
1548+
expect($method->invoke($cert, $bundle, 'ISRG Root X1'))->toBeFalse();
1549+
});
1550+
15381551
it('Certificate::getBundle() handles multiple Link headers (comma-separated) and selects matching chain', function () {
15391552
$storage = withKeyStorage();
15401553
$primaryBundle = makeCertBundle('Default Root CA');

0 commit comments

Comments
 (0)