Skip to content

Commit

Permalink
Fix QA
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Jul 23, 2024
1 parent b3b246c commit fd76b57
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/SAML2/Assert/CustomAssertionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
trait CustomAssertionTrait
{
private const SCHEME_REGEX = '/^([a-z][a-z0-9\+\-\.]+[:])/i';
private static string $scheme_regex = '/^([a-z][a-z0-9\+\-\.]+[:])/i';

/***********************************************************************************
* NOTE: Custom assertions may be added below this line. *
Expand Down Expand Up @@ -66,7 +66,7 @@ private static function validURI(string $value, string $message = ''): void
BaseAssert::notWhitespaceOnly($value, $message ?: '%s is not a SAML2-compliant URI');

// If it doesn't have a scheme, it's not an absolute URI
BaseAssert::regex($value, self::SCHEME_REGEX, $message ?: '%s is not a SAML2-compliant URI');
BaseAssert::regex($value, self::$scheme_regex, $message ?: '%s is not a SAML2-compliant URI');
} catch (AssertionFailedException $e) {
throw new ProtocolViolationException($e->getMessage());
}
Expand Down
2 changes: 0 additions & 2 deletions src/SAML2/XML/md/AffiliateMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace SimpleSAML\SAML2\XML\md;

use SimpleSAML\SAML2\Assert\Assert as SAMLAssert;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
use SimpleSAML\XML\StringElementTrait;

/**
Expand Down
1 change: 0 additions & 1 deletion src/SAML2/XML/md/AffiliationDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use SimpleSAML\Assert\Assert;
use SimpleSAML\SAML2\Assert\Assert as SAMLAssert;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XML\Exception\TooManyElementsException;
use SimpleSAML\XML\ExtendableAttributesTrait;
Expand Down
8 changes: 4 additions & 4 deletions tests/InterOperability/EntitiesDescriptorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
use Exception;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use SimpleSAML\Assert\AssertionFailedException;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Utils\XPath;
use SimpleSAML\SAML2\XML\md\EntitiesDescriptor;
use SimpleSAML\SAML2\XML\md\EntityDescriptor;
use SimpleSAML\XML\DOMDocumentFactory;

Expand Down Expand Up @@ -51,11 +48,14 @@ private function parseMetadata(DOMElement $metadata): void
// Test for an EntitiesDescriptor or EntityDescriptor
$entityDescriptorElements = XPath::xpQuery($metadata, './saml_metadata:EntityDescriptor', $xpCache);
$entitiesDescriptorElements = XPath::xpQuery($metadata, './saml_metadata:EntitiesDescriptor', $xpCache);
$descriptors = array_merge($entityDescriptorElements ?? [], $entitiesDescriptorElement ?? []);
$descriptors = array_merge($entityDescriptorElements, $entitiesDescriptorElements);

foreach ($descriptors as $descriptor) {
/** @var \DOMElement $descriptor */
$this->parseMetadata($descriptor);
}
} elseif ($metadata->localName === 'EntityDescriptor') {
/** @var \DOMAttr[] $entityID */
$entityID = XPath::xpQuery($metadata, './@entityID', $xpCache);

try {
Expand Down
2 changes: 1 addition & 1 deletion tests/SAML2/Assert/EntityIDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use SimpleSAML\SAML2\Assert\Assert as SAML2Assert;
use SimpleSAML\SAML2\Constants as C;
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
use SimpleSAML\SAML2\Assert\Assert as SAML2Assert;
use SimpleSAML\XML\Exception\SchemaViolationException;

use function str_pad;
Expand Down
2 changes: 1 addition & 1 deletion tests/SAML2/Assert/URITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
use SimpleSAML\SAML2\Assert\Assert as SAML2Assert;
use SimpleSAML\SAML2\Exception\ProtocolViolationException;
use SimpleSAML\XML\Exception\SchemaViolationException;

/**
Expand Down

0 comments on commit fd76b57

Please sign in to comment.