From d61b7bb99b83b5ec644e16458e70c29341d97511 Mon Sep 17 00:00:00 2001 From: Toon Verwerft Date: Fri, 23 Feb 2024 07:40:03 +0100 Subject: [PATCH] Differences between legacy and new API --- src/Xml/Dom/Builder/escaped_value.php | 2 +- src/Xml/Dom/Builder/value.php | 2 +- src/Xml/Dom/Collection/NodeList.php | 9 ++++ src/Xml/Dom/Configurator/loader.php | 21 ---------- src/Xml/Dom/Configurator/pretty_print.php | 3 +- src/Xml/Dom/Configurator/trim_spaces.php | 3 +- src/Xml/Dom/Configurator/utf8.php | 2 +- src/Xml/Dom/Document.php | 35 ++++++++-------- src/Xml/Dom/Loader/Loader.php | 2 +- src/Xml/Dom/Loader/load.php | 25 ----------- src/Xml/Dom/Loader/xml_file_loader.php | 18 ++++---- src/Xml/Dom/Loader/xml_node_loader.php | 14 ++++--- src/Xml/Dom/Loader/xml_string_loader.php | 9 ++-- .../Element/locate_by_namespaced_tag_name.php | 2 +- .../Locator/Element/locate_by_tag_name.php | 2 +- src/Xml/Dom/Locator/Node/detect_document.php | 5 +-- src/Xml/Dom/Mapper/xslt_template.php | 10 ++--- src/bootstrap.php | 2 - tests/Xml/Dom/Configurator/LoaderTest.php | 41 ------------------- .../Xml/Dom/Configurator/PrettyPrintTest.php | 2 +- tests/Xml/Dom/Configurator/TrimSpacesTest.php | 2 +- tests/Xml/Dom/Configurator/Utf8Test.php | 2 +- tests/Xml/Dom/Loader/XmlFileLoaderTest.php | 16 +++----- tests/Xml/Dom/Loader/XmlNodeLoaderTest.php | 8 ++-- tests/Xml/Dom/Loader/XmlStringLoaderTest.php | 11 ++--- .../Dom/Locator/Node/DetectDocumentTest.php | 12 ------ .../Dom/Locator/Xsd/LocateXsdSchemasTest.php | 2 +- 27 files changed, 81 insertions(+), 181 deletions(-) delete mode 100644 src/Xml/Dom/Configurator/loader.php delete mode 100644 src/Xml/Dom/Loader/load.php delete mode 100644 tests/Xml/Dom/Configurator/LoaderTest.php diff --git a/src/Xml/Dom/Builder/escaped_value.php b/src/Xml/Dom/Builder/escaped_value.php index 2d63b83..01838bd 100644 --- a/src/Xml/Dom/Builder/escaped_value.php +++ b/src/Xml/Dom/Builder/escaped_value.php @@ -13,7 +13,7 @@ function escaped_value(string $value): Closure { return static function (\DOM\Element $node) use ($value): \DOM\Element { - $node->nodeValue = htmlspecialchars($value, ENT_XML1|ENT_QUOTES); + $node->textContent = htmlspecialchars($value, ENT_XML1|ENT_QUOTES); return $node; }; diff --git a/src/Xml/Dom/Builder/value.php b/src/Xml/Dom/Builder/value.php index 48c3eb5..ddcc145 100644 --- a/src/Xml/Dom/Builder/value.php +++ b/src/Xml/Dom/Builder/value.php @@ -13,7 +13,7 @@ function value(string $value): Closure { return static function (\DOM\Element $node) use ($value): \DOM\Element { - $node->nodeValue = $value; + $node->textContent = $value; return $node; }; diff --git a/src/Xml/Dom/Collection/NodeList.php b/src/Xml/Dom/Collection/NodeList.php index 8ead96a..fa8191e 100644 --- a/src/Xml/Dom/Collection/NodeList.php +++ b/src/Xml/Dom/Collection/NodeList.php @@ -59,6 +59,15 @@ public static function empty(): self return new self(); } + /** + * @param \DOM\HTMLCollection $list + * @return NodeList<\DOM\Element> + */ + public static function fromDOMHTMLCollection(\DOM\HTMLCollection $list): self + { + return new self(...values($list->getIterator())); + } + /** * @template X of \DOM\Node * @param DOMNodeList $list diff --git a/src/Xml/Dom/Configurator/loader.php b/src/Xml/Dom/Configurator/loader.php deleted file mode 100644 index fe5bb56..0000000 --- a/src/Xml/Dom/Configurator/loader.php +++ /dev/null @@ -1,21 +0,0 @@ -preserveWhiteSpace = false; + // TODO : not fully implemented yet in the new API + //$document->preserveWhiteSpace = false; $document->formatOutput = true; return $document; diff --git a/src/Xml/Dom/Configurator/trim_spaces.php b/src/Xml/Dom/Configurator/trim_spaces.php index 6009749..9b23089 100644 --- a/src/Xml/Dom/Configurator/trim_spaces.php +++ b/src/Xml/Dom/Configurator/trim_spaces.php @@ -13,7 +13,8 @@ function trim_spaces(): Closure { return static function (\DOM\XMLDocument $document): \DOM\XMLDocument { - $document->preserveWhiteSpace = false; + // TODO : not fully implemented yet in the new API + //$document->preserveWhiteSpace = false; $document->formatOutput = false; return $document; diff --git a/src/Xml/Dom/Configurator/utf8.php b/src/Xml/Dom/Configurator/utf8.php index 688aaf2..afdeaa2 100644 --- a/src/Xml/Dom/Configurator/utf8.php +++ b/src/Xml/Dom/Configurator/utf8.php @@ -13,7 +13,7 @@ function utf8(): Closure { return static function (\DOM\XMLDocument $document): \DOM\XMLDocument { - $document->encoding = 'UTF-8'; + $document->charset = 'UTF-8'; return $document; }; diff --git a/src/Xml/Dom/Document.php b/src/Xml/Dom/Document.php index 61786d1..bb6b096 100644 --- a/src/Xml/Dom/Document.php +++ b/src/Xml/Dom/Document.php @@ -14,10 +14,7 @@ use VeeWee\Xml\ErrorHandling\Issue\IssueCollection; use VeeWee\Xml\Exception\RuntimeException; use function Psl\Vec\map; -use function VeeWee\Xml\Dom\Configurator\loader; -use function VeeWee\Xml\Dom\Loader\xml_file_loader; -use function VeeWee\Xml\Dom\Loader\xml_node_loader; -use function VeeWee\Xml\Dom\Loader\xml_string_loader; +use function VeeWee\Xml\Dom\Loader; use function VeeWee\Xml\Dom\Locator\document_element; use function VeeWee\Xml\Dom\Mapper\xml_string; use function VeeWee\Xml\Internal\configure; @@ -47,18 +44,28 @@ public static function configure(callable ... $configurators): self } /** + * @param callable(): XMLDocument $loader * @param list $configurators * * @throws RuntimeException */ - public static function fromXmlFile(string $file, callable ...$configurators): self + public static function fromLoader(callable $loader, callable ...$configurators): self { return new self( - configure(...$configurators)(XMLDocument::createFromFile($file)) - // TODO : What with loader(xml_file_loader($file)) + configure(...$configurators)($loader()) ); } + /** + * @param list $configurators + * + * @throws RuntimeException + */ + public static function fromXmlFile(string $file, callable ...$configurators): self + { + return self::fromLoader(Loader\xml_file_loader($file), ...$configurators); + } + /** * @param non-empty-string $xml * @param list $configurators @@ -67,10 +74,7 @@ public static function fromXmlFile(string $file, callable ...$configurators): se */ public static function fromXmlString(string $xml, callable ...$configurators): self { - return new self( - configure(...$configurators)(XMLDocument::createFromString($xml)) - // TODO : What with loader(xml_string_loader($file)) - ); + return self::fromLoader(Loader\xml_string_loader($xml), ...$configurators); } /** @@ -80,10 +84,7 @@ public static function fromXmlString(string $xml, callable ...$configurators): s */ public static function fromXmlNode(\DOM\Node $node, callable ...$configurators): self { - return self::configure( - loader(xml_node_loader($node)), - ...$configurators - ); + return self::fromLoader(Loader\xml_node_loader($node), ...$configurators); } /** @@ -93,9 +94,7 @@ public static function fromXmlNode(\DOM\Node $node, callable ...$configurators): */ public static function fromUnsafeDocument(XMLDocument $document, callable ...$configurators): self { - return new self( - configure(...$configurators)($document) - ); + return self::fromLoader(static fn () => $document, ...$configurators); } public function toUnsafeDocument(): XMLDocument diff --git a/src/Xml/Dom/Loader/Loader.php b/src/Xml/Dom/Loader/Loader.php index 98b1e5e..f0c34c9 100644 --- a/src/Xml/Dom/Loader/Loader.php +++ b/src/Xml/Dom/Loader/Loader.php @@ -8,5 +8,5 @@ interface Loader { - public function __invoke(\DOM\XMLDocument $document): void; + public function __invoke(): XMLDocument; } diff --git a/src/Xml/Dom/Loader/load.php b/src/Xml/Dom/Loader/load.php deleted file mode 100644 index 8f1bc64..0000000 --- a/src/Xml/Dom/Loader/load.php +++ /dev/null @@ -1,25 +0,0 @@ -load($file, $options); - } - ); - }; + return static fn () => disallow_issues(static function () use ($file, $options): XMLDocument { + Assert::fileExists($file); + + return XMLDocument::createFromFile($file, $options); + }); } diff --git a/src/Xml/Dom/Loader/xml_node_loader.php b/src/Xml/Dom/Loader/xml_node_loader.php index 7a5f1ef..9222cd1 100644 --- a/src/Xml/Dom/Loader/xml_node_loader.php +++ b/src/Xml/Dom/Loader/xml_node_loader.php @@ -6,16 +6,20 @@ use Closure; use \DOM\XMLDocument; - use \DOM\Node; use function VeeWee\Xml\Dom\Manipulator\Node\append_external_node; +use function VeeWee\Xml\ErrorHandling\disallow_issues; /** - * @return Closure(\DOM\XMLDocument): void + * @return Closure(): XMLDocument */ function xml_node_loader(\DOM\Node $importedNode): Closure { - return static function (\DOM\XMLDocument $document) use ($importedNode): void { - load(static fn (): bool => (bool) append_external_node($document, $importedNode)); - }; + return static fn () => disallow_issues(static function () use ($importedNode): XMLDocument { + $document = XMLDocument::createEmpty(); + + append_external_node($document, $importedNode); + + return $document; + }); } diff --git a/src/Xml/Dom/Loader/xml_string_loader.php b/src/Xml/Dom/Loader/xml_string_loader.php index 8191be2..c7dd097 100644 --- a/src/Xml/Dom/Loader/xml_string_loader.php +++ b/src/Xml/Dom/Loader/xml_string_loader.php @@ -6,15 +6,16 @@ use Closure; use \DOM\XMLDocument; +use function VeeWee\Xml\ErrorHandling\disallow_issues; /** * @param non-empty-string $xml * @param int $options - bitmask of LIBXML_* constants https://www.php.net/manual/en/libxml.constants.php - * @return Closure(\DOM\XMLDocument): void + * @return Closure(): XMLDocument */ function xml_string_loader(string $xml, int $options = 0): Closure { - return static function (\DOM\XMLDocument $document) use ($xml, $options): void { - load(static fn (): bool => $document->loadXML($xml, $options)); - }; + return static fn () => disallow_issues(static function () use ($xml, $options): XMLDocument { + return XMLDocument::createFromString($xml, $options); + }); } diff --git a/src/Xml/Dom/Locator/Element/locate_by_namespaced_tag_name.php b/src/Xml/Dom/Locator/Element/locate_by_namespaced_tag_name.php index 5124bb5..55dd221 100644 --- a/src/Xml/Dom/Locator/Element/locate_by_namespaced_tag_name.php +++ b/src/Xml/Dom/Locator/Element/locate_by_namespaced_tag_name.php @@ -12,5 +12,5 @@ */ function locate_by_namespaced_tag_name(\DOM\Element $node, string $namespace, string $localTagName): NodeList { - return NodeList::fromDOMNodeList($node->getElementsByTagNameNS($namespace, $localTagName)); + return NodeList::fromDOMHTMLCollection($node->getElementsByTagNameNS($namespace, $localTagName)); } diff --git a/src/Xml/Dom/Locator/Element/locate_by_tag_name.php b/src/Xml/Dom/Locator/Element/locate_by_tag_name.php index b134ca2..f299118 100644 --- a/src/Xml/Dom/Locator/Element/locate_by_tag_name.php +++ b/src/Xml/Dom/Locator/Element/locate_by_tag_name.php @@ -12,5 +12,5 @@ */ function locate_by_tag_name(\DOM\Element $node, string $tag): NodeList { - return NodeList::fromDOMNodeList($node->getElementsByTagName($tag)); + return NodeList::fromDOMHTMLCollection($node->getElementsByTagName($tag)); } diff --git a/src/Xml/Dom/Locator/Node/detect_document.php b/src/Xml/Dom/Locator/Node/detect_document.php index 6511250..86a5c7a 100644 --- a/src/Xml/Dom/Locator/Node/detect_document.php +++ b/src/Xml/Dom/Locator/Node/detect_document.php @@ -16,8 +16,5 @@ */ function detect_document(\DOM\Node $node): \DOM\XMLDocument { - $document = is_document($node) ? $node : $node->ownerDocument; - Assert::notNull($document, 'Expected to find an ownerDocument on provided \DOM\Node.'); - - return $document; + return is_document($node) ? $node : $node->ownerDocument; } diff --git a/src/Xml/Dom/Mapper/xslt_template.php b/src/Xml/Dom/Mapper/xslt_template.php index 9862e39..1f736b8 100644 --- a/src/Xml/Dom/Mapper/xslt_template.php +++ b/src/Xml/Dom/Mapper/xslt_template.php @@ -5,19 +5,19 @@ namespace VeeWee\Xml\Dom\Mapper; use Closure; -use DOMDocument as DOMDocument; -use VeeWee\XmlDOMDocument; +use VeeWee\Xml\Dom\Document; +use DOM\XmlDocument; use VeeWee\Xml\Xslt\Processor; use XSLTProcessor; /** * @param list $configurators - * @return Closure(DOMDocument): string + * @return Closure(XmlDocument): string */ function xslt_template(Document $template, callable ... $configurators): Closure { - return static fn (DOMDocument $document): string - => Processor::fromTemplateDocument($template, ...$configurators)->transformDocumentToString( + return static fn (XmlDocument $document): string => + Processor::fromTemplateDocument($template, ...$configurators)->transformDocumentToString( Document::fromUnsafeDocument($document) ); } diff --git a/src/bootstrap.php b/src/bootstrap.php index a6e0898..ce099e0 100644 --- a/src/bootstrap.php +++ b/src/bootstrap.php @@ -24,7 +24,6 @@ 'Xml\Dom\Configurator\canonicalize' => __DIR__.'/Xml/Dom/Configurator/canonicalize.php', 'Xml\Dom\Configurator\comparable' => __DIR__.'/Xml/Dom/Configurator/comparable.php', 'Xml\Dom\Configurator\document_uri' => __DIR__.'/Xml/Dom/Configurator/document_uri.php', - 'Xml\Dom\Configurator\loader' => __DIR__.'/Xml/Dom/Configurator/loader.php', 'Xml\Dom\Configurator\normalize' => __DIR__.'/Xml/Dom/Configurator/normalize.php', 'Xml\Dom\Configurator\optimize_namespaces' => __DIR__.'/Xml/Dom/Configurator/optimize_namespaces.php', 'Xml\Dom\Configurator\pretty_print' => __DIR__.'/Xml/Dom/Configurator/pretty_print.php', @@ -32,7 +31,6 @@ 'Xml\Dom\Configurator\trim_spaces' => __DIR__.'/Xml/Dom/Configurator/trim_spaces.php', 'Xml\Dom\Configurator\utf8' => __DIR__.'/Xml/Dom/Configurator/utf8.php', 'Xml\Dom\Configurator\validator' => __DIR__.'/Xml/Dom/Configurator/validator.php', - 'Xml\Dom\Loader\load' => __DIR__.'/Xml/Dom/Loader/load.php', 'Xml\Dom\Loader\xml_file_loader' => __DIR__.'/Xml/Dom/Loader/xml_file_loader.php', 'Xml\Dom\Loader\xml_node_loader' => __DIR__.'/Xml/Dom/Loader/xml_node_loader.php', 'Xml\Dom\Loader\xml_string_loader' => __DIR__.'/Xml/Dom/Loader/xml_string_loader.php', diff --git a/tests/Xml/Dom/Configurator/LoaderTest.php b/tests/Xml/Dom/Configurator/LoaderTest.php deleted file mode 100644 index 788cd87..0000000 --- a/tests/Xml/Dom/Configurator/LoaderTest.php +++ /dev/null @@ -1,41 +0,0 @@ -toUnsafeDocument(); - $xml = ''; - - $loader = loader(static function (\DOM\XMLDocument $doc) use ($xml): void { - $doc->loadXML($xml); - }); - - $result = $loader($doc); - static::assertSame($doc, $result); - static::assertXmlStringEqualsXmlString($xml, $doc->saveXML()); - } - - - public function test_it_can_mark_xml_loading_as_failed(): void - { - $doc = Document::empty()->toUnsafeDocument(); - $exception = new Exception('Could not load the XML document'); - $loader = loader(static function (\DOM\XMLDocument $doc) use ($exception): void { - throw $exception; - }); - - $this->expectExceptionObject($exception); - $loader($doc); - } -} diff --git a/tests/Xml/Dom/Configurator/PrettyPrintTest.php b/tests/Xml/Dom/Configurator/PrettyPrintTest.php index 79ed80c..2933760 100644 --- a/tests/Xml/Dom/Configurator/PrettyPrintTest.php +++ b/tests/Xml/Dom/Configurator/PrettyPrintTest.php @@ -26,7 +26,7 @@ public function test_it_can_trim_contents(): void EOXML; static::assertSame($doc, $result); - static::assertFalse($doc->preserveWhiteSpace); + // TODO : static::assertFalse($doc->preserveWhiteSpace); static::assertTrue($doc->formatOutput); static::assertSame($expected, xml_string()($doc->documentElement)); } diff --git a/tests/Xml/Dom/Configurator/TrimSpacesTest.php b/tests/Xml/Dom/Configurator/TrimSpacesTest.php index f12fff1..9fd1e13 100644 --- a/tests/Xml/Dom/Configurator/TrimSpacesTest.php +++ b/tests/Xml/Dom/Configurator/TrimSpacesTest.php @@ -19,7 +19,7 @@ public function test_it_can_trim_contents(): void $result = $configurator($doc); static::assertSame($doc, $result); - static::assertFalse($doc->preserveWhiteSpace); + // TODO : static::assertFalse($doc->preserveWhiteSpace); static::assertFalse($doc->formatOutput); static::assertSame('', xml_string()($doc->documentElement)); } diff --git a/tests/Xml/Dom/Configurator/Utf8Test.php b/tests/Xml/Dom/Configurator/Utf8Test.php index ac45857..de470e6 100644 --- a/tests/Xml/Dom/Configurator/Utf8Test.php +++ b/tests/Xml/Dom/Configurator/Utf8Test.php @@ -19,6 +19,6 @@ public function test_it_can_convert_to_utf8(): void $result = $configurator($doc); static::assertSame($doc, $result); - static::assertSame('UTF-8', $doc->encoding); + static::assertSame('UTF-8', $doc->charset); } } diff --git a/tests/Xml/Dom/Loader/XmlFileLoaderTest.php b/tests/Xml/Dom/Loader/XmlFileLoaderTest.php index 9f3f68d..8dd63a0 100644 --- a/tests/Xml/Dom/Loader/XmlFileLoaderTest.php +++ b/tests/Xml/Dom/Loader/XmlFileLoaderTest.php @@ -16,12 +16,11 @@ final class XmlFileLoaderTest extends TestCase public function test_it_can_load_xml_file(): void { - $doc = new \DOM\XMLDocument(); $xml = ''; [$file, $handle] = $this->fillFile($xml); $loader = xml_file_loader($file); - $loader($doc); + $doc = $loader(); fclose($handle); static::assertXmlStringEqualsXmlString($xml, $doc->saveXML()); @@ -29,39 +28,36 @@ public function test_it_can_load_xml_file(): void public function test_it_can_load_with_options(): void { - $doc = new \DOM\XMLDocument(); $xml = ''; [$file, $handle] = $this->fillFile($xml); $loader = xml_file_loader($file, LIBXML_NOCDATA); - $loader($doc); + $doc = $loader(); fclose($handle); static::assertSame('HELLO', $doc->saveXML($doc->documentElement)); } - + public function test_it_cannot_load_invalid_xml_file(): void { - $doc = new \DOM\XMLDocument(); $xml = 'fillFile($xml); $loader = xml_file_loader($file); $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Could not load the DOM Document'); + $this->expectExceptionMessage('XML document is malformed'); - $loader($doc); + $doc = $loader(); fclose($handle); } public function test_it_throws_exception_on_invalid_file(): void { - $doc = new \DOM\XMLDocument(); $loader = xml_file_loader('invalid-file'); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The file "invalid-file" does not exist'); - $loader($doc); + $loader(); } } diff --git a/tests/Xml/Dom/Loader/XmlNodeLoaderTest.php b/tests/Xml/Dom/Loader/XmlNodeLoaderTest.php index c0a115e..ca3cc5a 100644 --- a/tests/Xml/Dom/Loader/XmlNodeLoaderTest.php +++ b/tests/Xml/Dom/Loader/XmlNodeLoaderTest.php @@ -15,11 +15,10 @@ final class XmlNodeLoaderTest extends TestCase public function test_it_can_load_xml_node(): void { $source = Document::fromXmlString($xml = '')->toUnsafeDocument(); - $doc = Document::empty()->toUnsafeDocument(); $loader = xml_node_loader($source->documentElement); - $loader($doc); + $doc = $loader(); static::assertXmlStringEqualsXmlString($xml, $doc->saveXML()); } @@ -27,13 +26,12 @@ public function test_it_can_load_xml_node(): void public function test_it_can_not_load_invalid_xml_node(): void { $source = Document::fromXmlString($xml = '')->toUnsafeDocument(); - $doc = Document::empty()->toUnsafeDocument(); $loader = xml_node_loader($source); $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Cannot import node: Node Type Not Supported'); + $this->expectExceptionMessage('Not Supported Error'); - $loader($doc); + $loader(); } } diff --git a/tests/Xml/Dom/Loader/XmlStringLoaderTest.php b/tests/Xml/Dom/Loader/XmlStringLoaderTest.php index ebed914..8233ce0 100644 --- a/tests/Xml/Dom/Loader/XmlStringLoaderTest.php +++ b/tests/Xml/Dom/Loader/XmlStringLoaderTest.php @@ -13,33 +13,30 @@ final class XmlStringLoaderTest extends TestCase { public function test_it_can_load_xml_string(): void { - $doc = new \DOM\XMLDocument(); $xml = ''; $loader = xml_string_loader($xml); + $doc = $loader(); - $loader($doc); static::assertXmlStringEqualsXmlString($xml, $doc->saveXML()); } public function test_it_can_not_load_invalid_xml_string(): void { - $doc = new \DOM\XMLDocument(); $xml = 'expectException(RuntimeException::class); - $this->expectExceptionMessage('Could not load the DOM Document'); + $this->expectExceptionMessage('XML document is malformed'); - $loader($doc); + $loader(); } public function test_it_can_load_with_options(): void { - $doc = new \DOM\XMLDocument(); $xml = ''; $loader = xml_string_loader($xml, LIBXML_NOCDATA); + $doc = $loader(); - $loader($doc); static::assertSame('HELLO', $doc->saveXML($doc->documentElement)); } } diff --git a/tests/Xml/Dom/Locator/Node/DetectDocumentTest.php b/tests/Xml/Dom/Locator/Node/DetectDocumentTest.php index 4c7e101..2d5ef0d 100644 --- a/tests/Xml/Dom/Locator/Node/DetectDocumentTest.php +++ b/tests/Xml/Dom/Locator/Node/DetectDocumentTest.php @@ -5,7 +5,6 @@ namespace VeeWee\Tests\Xml\Dom\Locator\Node; use \DOM\Element; -use InvalidArgumentException; use PHPUnit\Framework\TestCase; use VeeWee\Xml\Dom\Document; use function VeeWee\Xml\Dom\Locator\Node\detect_document; @@ -20,15 +19,4 @@ public function test_it_can_detect_document(): void static::assertSame($domdoc, detect_document($domdoc)); static::assertSame($domdoc, detect_document($domdoc->documentElement)); } - - - public function test_it_throws_exception_on_unlinked_node(): void - { - $element = new \DOM\Element('name'); - - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('Expected to find an ownerDocument on provided \DOM\Node.'); - - detect_document($element); - } } diff --git a/tests/Xml/Dom/Locator/Xsd/LocateXsdSchemasTest.php b/tests/Xml/Dom/Locator/Xsd/LocateXsdSchemasTest.php index a0d6bfd..3289e5d 100644 --- a/tests/Xml/Dom/Locator/Xsd/LocateXsdSchemasTest.php +++ b/tests/Xml/Dom/Locator/Xsd/LocateXsdSchemasTest.php @@ -12,7 +12,7 @@ use function VeeWee\Xml\Dom\Locator\Xsd\locate_namespaced_xsd_schemas; use function VeeWee\Xml\Dom\Locator\Xsd\locate_no_namespaced_xsd_schemas; -final class LocateAllXsdSchemasTest extends TestCase +final class LocateXsdSchemasTest extends TestCase { public function test_it_can_locate_namespaced_xsd_schemas(): void {