From 2a0bb63ee118377b889b6de9c3478d9c53ed0caa Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 7 Sep 2022 19:00:19 +0200 Subject: [PATCH] Add schema validation --- {src/schemas => schemas}/cas-server-protocol-3.0.xsd | 0 tests/XML/cas/AuthenticationFailureTest.php | 1 + tests/XML/cas/AuthenticationSuccessTest.php | 1 + tests/XML/cas/ProxiesTest.php | 1 - tests/XML/cas/ProxyFailureTest.php | 1 + tests/XML/cas/ProxySuccessTest.php | 1 + tests/XML/cas/ServiceResponseTest.php | 4 ++++ 7 files changed, 8 insertions(+), 1 deletion(-) rename {src/schemas => schemas}/cas-server-protocol-3.0.xsd (100%) diff --git a/src/schemas/cas-server-protocol-3.0.xsd b/schemas/cas-server-protocol-3.0.xsd similarity index 100% rename from src/schemas/cas-server-protocol-3.0.xsd rename to schemas/cas-server-protocol-3.0.xsd diff --git a/tests/XML/cas/AuthenticationFailureTest.php b/tests/XML/cas/AuthenticationFailureTest.php index 3996079..f7b9800 100644 --- a/tests/XML/cas/AuthenticationFailureTest.php +++ b/tests/XML/cas/AuthenticationFailureTest.php @@ -18,6 +18,7 @@ * Class \SimpleSAML\CAS\XML\cas\AuthenticationFailureTest * * @covers \SimpleSAML\CAS\XML\cas\AuthenticationFailure + * @covers \SimpleSAML\CAS\XML\cas\AbstractResponse * @covers \SimpleSAML\CAS\XML\cas\AbstractCasElement * * @package simplesamlphp/cas diff --git a/tests/XML/cas/AuthenticationSuccessTest.php b/tests/XML/cas/AuthenticationSuccessTest.php index 08509be..b976eaa 100644 --- a/tests/XML/cas/AuthenticationSuccessTest.php +++ b/tests/XML/cas/AuthenticationSuccessTest.php @@ -28,6 +28,7 @@ * * @covers \SimpleSAML\CAS\Utils\XPath * @covers \SimpleSAML\CAS\XML\cas\AuthenticationSuccess + * @covers \SimpleSAML\CAS\XML\cas\AbstractResponse * @covers \SimpleSAML\CAS\XML\cas\AbstractCasElement * * @package simplesamlphp/cas diff --git a/tests/XML/cas/ProxiesTest.php b/tests/XML/cas/ProxiesTest.php index a8733c8..509ffb9 100644 --- a/tests/XML/cas/ProxiesTest.php +++ b/tests/XML/cas/ProxiesTest.php @@ -27,7 +27,6 @@ final class ProxiesTest extends TestCase { use SerializableElementTestTrait; - /** */ protected function setUp(): void diff --git a/tests/XML/cas/ProxyFailureTest.php b/tests/XML/cas/ProxyFailureTest.php index 5a46463..6b2e52b 100644 --- a/tests/XML/cas/ProxyFailureTest.php +++ b/tests/XML/cas/ProxyFailureTest.php @@ -18,6 +18,7 @@ * Class \SimpleSAML\CAS\XML\cas\ProxyFailureTest * * @covers \SimpleSAML\CAS\XML\cas\ProxyFailure + * @covers \SimpleSAML\CAS\XML\cas\AbstractResponse * @covers \SimpleSAML\CAS\XML\cas\AbstractCasElement * * @package simplesamlphp/cas diff --git a/tests/XML/cas/ProxySuccessTest.php b/tests/XML/cas/ProxySuccessTest.php index e5ca2ad..f2fea10 100644 --- a/tests/XML/cas/ProxySuccessTest.php +++ b/tests/XML/cas/ProxySuccessTest.php @@ -19,6 +19,7 @@ * Class \SimpleSAML\CAS\XML\cas\ProxySuccessTest * * @covers \SimpleSAML\CAS\XML\cas\ProxySuccess + * @covers \SimpleSAML\CAS\XML\cas\AbstractResponse * @covers \SimpleSAML\CAS\XML\cas\AbstractCasElement * * @package simplesamlphp/cas diff --git a/tests/XML/cas/ServiceResponseTest.php b/tests/XML/cas/ServiceResponseTest.php index d0846aa..075224c 100644 --- a/tests/XML/cas/ServiceResponseTest.php +++ b/tests/XML/cas/ServiceResponseTest.php @@ -14,6 +14,7 @@ use SimpleSAML\CAS\XML\cas\ProxyGrantingTicket; use SimpleSAML\CAS\XML\cas\ServiceResponse; use SimpleSAML\CAS\XML\cas\User; +use SimpleSAML\Test\XML\SchemaValidationTestTrait; use SimpleSAML\Test\XML\SerializableElementTestTrait; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; @@ -31,12 +32,15 @@ */ final class ServiceResponseTest extends TestCase { + use SchemaValidationTestTrait; use SerializableElementTestTrait; /** */ protected function setUp(): void { + $this->schema = dirname(dirname(dirname(dirname(__FILE__)))) . '/schemas/cas-server-protocol-3.0.xsd'; + $this->testedClass = ServiceResponse::class; $this->xmlRepresentation = DOMDocumentFactory::fromFile(