Skip to content

Commit edae558

Browse files
committed
Bail out early if possible
1 parent bed3740 commit edae558

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/TestUtils/SchemaValidationTestTrait.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ public function testSchemaValidation(): void
3232
if (!class_exists(self::$testedClass)) {
3333
$this->markTestSkipped(
3434
'Unable to run ' . self::class . '::testSchemaValidation(). Please set ' . self::class
35-
. ':$testedClass to a class-string representing the XML-class being tested',
35+
. ':$testedClass to a class-string representing the XML-class being tested.',
36+
);
37+
} elseif (!(self::$testedClass instanceof SchemaValidatableElementInterface)) {
38+
$this->markTestSkipped(
39+
'Unable to run ' . self::class . '::testSchemaValidation() because the class set in ' . self::class
40+
. ':$testedClass does not implement the SchemaValidableElementInterface.',
3641
);
3742
} elseif (empty(self::$xmlRepresentation)) {
3843
$this->markTestSkipped(
3944
'Unable to run ' . self::class . '::testSchemaValidation(). Please set ' . self::class
40-
. ':$xmlRepresentation to a DOMDocument representing the XML-class being tested',
45+
. ':$xmlRepresentation to a DOMDocument representing the XML-class being tested.',
4146
);
4247
} else {
4348
// Validate before serialization

tests/Utils/URIElement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace SimpleSAML\Test\XML;
66

77
use SimpleSAML\XML\AbstractElement;
8-
use SimpleSAML\XML\URIElementTrait;
98
use SimpleSAML\XML\SchemaValidatableElementInterface;
109
use SimpleSAML\XML\SchemaValidatableElementTrait;
10+
use SimpleSAML\XML\URIElementTrait;
1111

1212
/**
1313
* Empty shell class for testing URIElement.

0 commit comments

Comments
 (0)