diff --git a/tests/XMLParserCDataTest.php b/tests/XMLParserCDataTest.php
index b74633d..8639e78 100644
--- a/tests/XMLParserCDataTest.php
+++ b/tests/XMLParserCDataTest.php
@@ -37,5 +37,6 @@ public function testCDataIsProperlyParsed(): void
$this->assertInstanceOf(XMLNodeContent::class, $node);
$this->assertStringStartsWith("
\n ", trim($node->content));
+ $this->assertEquals('item', $node->parentName);
}
}
diff --git a/tests/XMLParserLargeFileTest.php b/tests/XMLParserLargeFileTest.php
index ef13f5b..cbeb747 100644
--- a/tests/XMLParserLargeFileTest.php
+++ b/tests/XMLParserLargeFileTest.php
@@ -35,6 +35,7 @@ public function testIterateByNodeContent()
foreach($this->getParser()->iterateByNodeContent(name: 'loc') as $node) {
$this->assertInstanceOf(XMLNodeContent::class, $node);
$this->assertEquals('loc', $node->name);
+ $this->assertEquals('url', $node->parentName);
$this->assertStringStartsWith('http', $node->content);
$cnt++;
diff --git a/tests/XMLParserTest.php b/tests/XMLParserTest.php
index a6489cd..ab059cf 100644
--- a/tests/XMLParserTest.php
+++ b/tests/XMLParserTest.php
@@ -24,6 +24,7 @@ public function testParsesTheOpeningTags(): void
$this->assertInstanceOf(XMLNodeOpen::class, $sitemapIndex);
$this->assertEquals('sitemapindex', $sitemapIndex->name);
+ $this->assertNull($sitemapIndex->parentName, 'Root nodes will get null as their parent');
$this->assertEquals('http://www.sitemaps.org/schemas/sitemap/0.9', $sitemapIndex->attributes['xmlns'] ?? null);
}
@@ -39,6 +40,7 @@ public function testParsesTheClosingTags(): void
$this->assertInstanceOf(XMLNodeClose::class, $closingTag);
$this->assertEquals('sitemapindex', $closingTag->name);
+ $this->assertNull($closingTag->parentName);
}
public function testParsesTheLocNodes(): void
@@ -48,6 +50,7 @@ public function testParsesTheLocNodes(): void
foreach($this->getParser() as $item) {
if ($item instanceof XMLNodeContent && $item->name === 'loc') {
$locations[] = $item->content;
+ $this->assertEquals('sitemap', $item->parentName);
}
}
diff --git a/tests/XMLParserWhitespacesTest.php b/tests/XMLParserWhitespacesTest.php
index 8beaf92..df0a577 100644
--- a/tests/XMLParserWhitespacesTest.php
+++ b/tests/XMLParserWhitespacesTest.php
@@ -30,5 +30,6 @@ public function testProperlyReportWhitespacesBetweenClosingTags(): void
$this->assertCount(1, $locNodesContent);
$this->assertEquals('https://elecena.pl/sitemap-001-search.xml.gz', $locNodesContent[0]->content);
+ $this->assertEquals('sitemap', $locNodesContent[0]->parentName);
}
}