Skip to content

Commit

Permalink
Raise coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 30, 2023
1 parent 7a59433 commit 43e661d
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 60 deletions.
5 changes: 3 additions & 2 deletions src/XML/sp/AbstractIssuedTokenType.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ final public function __construct(
/**
* Collect the value of the Issuer property.
*
* @return \SimpleSAML\WSSecurity\XML\sp\Issuer|\SimpleSAML\WSSecurity\XML\sp\IssuerName
* @return \SimpleSAML\WSSecurity\XML\sp\Issuer|\SimpleSAML\WSSecurity\XML\sp\IssuerName|null
*/
public function getIssuer(): Issuer|IssuerName
public function getIssuer(): Issuer|IssuerName|null
{
return $this->issuer;
}
Expand Down Expand Up @@ -173,6 +173,7 @@ public function toXML(DOMElement $parent = null): DOMElement
$this->getRequestSecurityTokenTemplate()->toXML($e);

foreach ($this->getElements() as $elt) {
/** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
$elt->toXML($e);
}

Expand Down
1 change: 1 addition & 0 deletions src/XML/sp/AbstractKeyValueTokenType.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function toXML(DOMElement $parent = null): DOMElement
}

foreach ($this->getElements() as $elt) {
/** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
$elt->toXML($e);
}

Expand Down
1 change: 1 addition & 0 deletions src/XML/sp/AbstractRequestSecurityTokenTemplateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function toXML(DOMElement $parent = null): DOMElement
}

foreach ($this->getElements() as $elt) {
/** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
$elt->toXML($e);
}

Expand Down
1 change: 1 addition & 0 deletions src/XML/sp/AbstractSerElementsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function toXML(DOMElement $parent = null): DOMElement
}

foreach ($this->getElements() as $elt) {
/** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
$elt->toXML($e);
}

Expand Down
1 change: 1 addition & 0 deletions src/XML/sp/AbstractTokenAssertionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function toXML(DOMElement $parent = null): DOMElement
}

foreach ($this->getElements() as $elt) {
/** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
$elt->toXML($e);
}

Expand Down
51 changes: 0 additions & 51 deletions src/XML/sp/IncludeTokenOpenTypeTrait.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/XML/sp/IssuerName.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(
* Validate the content of the element.
*
* @param string $content The value to go in the XML textContent
* @throws \SimpleSAML\XML\Exception\SchemaViolationExcetion on failure
* @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateContent(string $content): void
Expand Down
7 changes: 6 additions & 1 deletion tests/WSSecurity/XML/sp/EncryptedElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public function testMarshallingElementOrdering(): void

// Test ordering of EncryptedElements contents
/** @psalm-var \DOMElement[] $EncryptedElementsElements */
$EncryptedElementsElements = XMLXPath::xpQuery($EncryptedElementsElement, './sp:XPath/following-sibling::*', $xpCache);
$EncryptedElementsElements = XMLXPath::xpQuery(
$EncryptedElementsElement,
'./sp:XPath/following-sibling::*',
$xpCache,
);

$this->assertCount(1, $EncryptedElementsElements);
$this->assertEquals('ssp:Chunk', $EncryptedElementsElements[0]->tagName);
}
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/HttpsTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\HttpsTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\HttpsToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
13 changes: 11 additions & 2 deletions tests/WSSecurity/XML/sp/IssuedTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\IssuedTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\IssuedToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractIssuedTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down Expand Up @@ -58,7 +59,11 @@ public function testMarshallingElementOrdering(): void
$chunk = new Chunk(DOMDocumentFactory::fromString(
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>'
)->documentElement);
$requestSecurityTokenTemplate = new RequestSecurityTokenTemplate('urn:x-simplesamlphp:version', [$chunk], [$attr]);
$requestSecurityTokenTemplate = new RequestSecurityTokenTemplate(
'urn:x-simplesamlphp:version',
[$chunk],
[$attr],
);

$issuedToken = new IssuedToken($requestSecurityTokenTemplate, $issuer, IncludeToken::Always, [$chunk], [$attr]);
$issuedTokenElement = $issuedToken->toXML();
Expand Down Expand Up @@ -91,7 +96,11 @@ public function testMarshalling(): void
)->documentElement);

$issuer = new IssuerName('urn:x-simplesamlphp:issuer');
$requestSecurityTokenTemplate = new RequestSecurityTokenTemplate('urn:x-simplesamlphp:version', [$chunk], [$attr]);
$requestSecurityTokenTemplate = new RequestSecurityTokenTemplate(
'urn:x-simplesamlphp:version',
[$chunk],
[$attr],
);

$issuedToken = new IssuedToken($requestSecurityTokenTemplate, $issuer, IncludeToken::Always, [$chunk], [$attr]);
$this->assertEquals(
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/KerberosTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\KerberosTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\KerberosToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/KeyValueTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\KeyValueTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\KeyValueToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractKeyValueTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/RelTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\RelTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\RelToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
7 changes: 6 additions & 1 deletion tests/WSSecurity/XML/sp/RequestSecurityTokenTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ public function testMarshalling(): void
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>'
)->documentElement);

$RequestSecurityTokenTemplateElements = new RequestSecurityTokenTemplate('urn:x-simplesamlphp:version', [$chunk], [$attr]);
$RequestSecurityTokenTemplateElements = new RequestSecurityTokenTemplate(
'urn:x-simplesamlphp:version',
[$chunk],
[$attr],
);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($RequestSecurityTokenTemplateElements),
Expand Down
7 changes: 6 additions & 1 deletion tests/WSSecurity/XML/sp/RequiredElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public function testMarshallingElementOrdering(): void

// Test ordering of RequiredElements contents
/** @psalm-var \DOMElement[] $requiredElementsElements */
$requiredElementsElements = XMLXPath::xpQuery($requiredElementsElement, './sp:XPath/following-sibling::*', $xpCache);
$requiredElementsElements = XMLXPath::xpQuery(
$requiredElementsElement,
'./sp:XPath/following-sibling::*',
$xpCache,
);

$this->assertCount(1, $requiredElementsElements);
$this->assertEquals('ssp:Chunk', $requiredElementsElements[0]->tagName);
}
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/SamlTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\SamlTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\SamlToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/SecurityContextTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\SecurityContextTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\SecurityContextToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
7 changes: 6 additions & 1 deletion tests/WSSecurity/XML/sp/SignedElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ public function testMarshallingElementOrdering(): void

// Test ordering of SignedElements contents
/** @psalm-var \DOMElement[] $SignedElementsElements */
$SignedElementsElements = XMLXPath::xpQuery($SignedElementsElement, './sp:XPath/following-sibling::*', $xpCache);
$SignedElementsElements = XMLXPath::xpQuery(
$SignedElementsElement,
'./sp:XPath/following-sibling::*',
$xpCache,
);

$this->assertCount(1, $SignedElementsElements);
$this->assertEquals('ssp:Chunk', $SignedElementsElements[0]->tagName);
}
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/UsernameTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\UsernameTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\UsernameToken
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down
1 change: 1 addition & 0 deletions tests/WSSecurity/XML/sp/X509TokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Class \SimpleSAML\WSSecurity\XML\sp\X509lTokenTest
*
* @covers \SimpleSAML\WSSecurity\XML\sp\X509Token
* @covers \SimpleSAML\WSSecurity\XML\sp\IncludeTokenTypeTrait
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractAssertionTokenType
* @covers \SimpleSAML\WSSecurity\XML\sp\AbstractSpElement
*
Expand Down

0 comments on commit 43e661d

Please sign in to comment.