diff --git a/src/CommentIni.php b/src/CommentIni.php
index 248adf0..c3cf641 100644
--- a/src/CommentIni.php
+++ b/src/CommentIni.php
@@ -70,6 +70,7 @@ private function findIniComment(iterable $walker):array {
$this->assertCommentIsLeadingNode($commentNode);
$commentNodeToRemove = $commentNode;
+ break;
}
return [$commentNodeToRemove, $ini];
diff --git a/test/phpunit/CommentIniTest.php b/test/phpunit/CommentIniTest.php
index ab9acac..1ce752e 100644
--- a/test/phpunit/CommentIniTest.php
+++ b/test/phpunit/CommentIniTest.php
@@ -35,6 +35,13 @@ public function testContainsIniData_emptyIfMalformedIniSyntax():void {
self::assertStringContainsString("something: broken", $document->saveHTML());
}
+ public function testContainsIniData_onlyFindsFirstComment():void {
+ $document = new HTMLDocument(HTMLPageContent::HTML_COMMENT_WITH_INI_AND_ANOTHER_COMMENT);
+ $sut = new CommentIni($document);
+ self::assertTrue($sut->containsIniData());
+ self::assertEquals("base-page", $sut->get("extends"));
+ }
+
public function testGet_noMatchingData():void {
$document = new HTMLDocument(HTMLPageContent::HTML_EXTENDS_PARTIAL_VIEW);
$sut = new CommentIni($document);
diff --git a/test/phpunit/TestHelper/HTMLPageContent.php b/test/phpunit/TestHelper/HTMLPageContent.php
index f234317..19b56d2 100644
--- a/test/phpunit/TestHelper/HTMLPageContent.php
+++ b/test/phpunit/TestHelper/HTMLPageContent.php
@@ -934,6 +934,16 @@ class HTMLPageContent {
Hello from within a sub-template!
+HTML;
+
+ const HTML_COMMENT_WITH_INI_AND_ANOTHER_COMMENT = <<
+
+
+ Hello from within a sub-template!
+
HTML;
const HTML_COMPONENT = <<