Skip to content

Commit

Permalink
Bail out early if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 16, 2024
1 parent bed3740 commit edae558
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/TestUtils/SchemaValidationTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ public function testSchemaValidation(): void
if (!class_exists(self::$testedClass)) {
$this->markTestSkipped(
'Unable to run ' . self::class . '::testSchemaValidation(). Please set ' . self::class
. ':$testedClass to a class-string representing the XML-class being tested',
. ':$testedClass to a class-string representing the XML-class being tested.',
);
} elseif (!(self::$testedClass instanceof SchemaValidatableElementInterface)) {
$this->markTestSkipped(
'Unable to run ' . self::class . '::testSchemaValidation() because the class set in ' . self::class
. ':$testedClass does not implement the SchemaValidableElementInterface.',
);
} elseif (empty(self::$xmlRepresentation)) {
$this->markTestSkipped(
'Unable to run ' . self::class . '::testSchemaValidation(). Please set ' . self::class
. ':$xmlRepresentation to a DOMDocument representing the XML-class being tested',
. ':$xmlRepresentation to a DOMDocument representing the XML-class being tested.',
);
} else {
// Validate before serialization
Expand Down
2 changes: 1 addition & 1 deletion tests/Utils/URIElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
namespace SimpleSAML\Test\XML;

use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\URIElementTrait;
use SimpleSAML\XML\SchemaValidatableElementInterface;
use SimpleSAML\XML\SchemaValidatableElementTrait;
use SimpleSAML\XML\URIElementTrait;

/**
* Empty shell class for testing URIElement.
Expand Down

0 comments on commit edae558

Please sign in to comment.