Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CommentIni.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private function findIniComment(iterable $walker):array {

$this->assertCommentIsLeadingNode($commentNode);
$commentNodeToRemove = $commentNode;
break;
}

return [$commentNodeToRemove, $ini];
Expand Down
7 changes: 7 additions & 0 deletions test/phpunit/CommentIniTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions test/phpunit/TestHelper/HTMLPageContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,16 @@ class HTMLPageContent {
<article>
<h1>Hello from within a sub-template!</h1>
</article>
HTML;

const HTML_COMMENT_WITH_INI_AND_ANOTHER_COMMENT = <<<HTML
<!--
extends=base-page
-->
<article>
<!-- This is just another comment -->
<h1>Hello from within a sub-template!</h1>
</article>
HTML;

const HTML_COMPONENT = <<<HTML
Expand Down
Loading