Skip to content

Commit

Permalink
Implement DOM schema validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 19, 2024
1 parent e360ca0 commit 25d0136
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/XML/cas/AbstractCasElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ abstract class AbstractCasElement extends AbstractElement

/** @var string */
public const NS_PREFIX = 'cas';

/** @var string */
public const SCHEMA = 'resources/schemas/cas-server-protocol-3.0.xsd';
}
6 changes: 5 additions & 1 deletion src/XML/cas/ServiceResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XML\Exception\MissingElementException;
use SimpleSAML\XML\Exception\TooManyElementsException;
use SimpleSAML\XML\SchemaValidatableElementInterface;
use SimpleSAML\XML\SchemaValidatableElementTrait;

use function array_merge;
use function array_pop;
Expand All @@ -18,8 +20,10 @@
*
* @package simplesamlphp/cas
*/
final class ServiceResponse extends AbstractCasElement
final class ServiceResponse extends AbstractCasElement implements SchemaValidatableElementInterface
{
use SchemaValidatableElementTrait;

/** @var string */
final public const LOCALNAME = 'serviceResponse';

Expand Down
2 changes: 0 additions & 2 deletions tests/XML/cas/ServiceResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ final class ServiceResponseTest extends TestCase
*/
public static function setUpBeforeClass(): void
{
self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/cas-server-protocol-3.0.xsd';

self::$testedClass = ServiceResponse::class;

self::$xmlRepresentation = DOMDocumentFactory::fromFile(
Expand Down

0 comments on commit 25d0136

Please sign in to comment.