File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,10 @@ final class Base64BinaryElement extends AbstractElement implements SchemaValidat
2929 public const SCHEMA = 'tests/resources/schemas/deliberately-wrong-file.xsd ' ;
3030
3131 /** @var string */
32- public const TEXTCONTENT_TYPE = Base64BinaryValue::class;
32+ public const TEXTCONTENT_TYPE = AbstractElement::class; // Deliberately wrong class
33+
34+
35+ /**
36+ * NOTE: This class has some deliberately wrong values for testing purposes!!
37+ */
3338}
Original file line number Diff line number Diff line change @@ -40,17 +40,18 @@ public function testTypedContentPassesForBoolean(): void
4040 }
4141
4242
43- public function testTypedContentForBase64Binary (): void
43+ public function testTypedContentFailsForWrongType (): void
4444 {
45- $ file = 'tests/resources/xml/ssp_Base64BinaryElement .xml ' ;
45+ $ file = 'tests/resources/xml/ssp_BooleanElement .xml ' ;
4646 $ chunk = DOMDocumentFactory::fromFile ($ file );
47+ $ chunk ->documentElement ->textContent = 'not-a-boolean ' ;
4748
48- $ stringElt = Base64BinaryElement:: fromXML ( $ chunk -> documentElement );
49- $ this -> assertInstanceOf (Base64BinaryElement::class, $ stringElt );
49+ $ this -> expectException (SchemaViolationException::class );
50+ BooleanElement:: fromXML ( $ chunk -> documentElement );
5051 }
5152
5253
53- public function testTypedContentFailsForWrongType (): void
54+ public function testTypedContentFailsForWrongClass (): void
5455 {
5556 $ file = 'tests/resources/xml/ssp_BooleanElement.xml ' ;
5657 $ chunk = DOMDocumentFactory::fromFile ($ file );
You can’t perform that action at this time.
0 commit comments