File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ private function findIniComment(iterable $walker):array {
7070
7171 $ this ->assertCommentIsLeadingNode ($ commentNode );
7272 $ commentNodeToRemove = $ commentNode ;
73+ break ;
7374 }
7475
7576 return [$ commentNodeToRemove , $ ini ];
Original file line number Diff line number Diff line change @@ -35,6 +35,13 @@ public function testContainsIniData_emptyIfMalformedIniSyntax():void {
3535 self ::assertStringContainsString ("something: broken " , $ document ->saveHTML ());
3636 }
3737
38+ public function testContainsIniData_onlyFindsFirstComment ():void {
39+ $ document = new HTMLDocument (HTMLPageContent::HTML_COMMENT_WITH_INI_AND_ANOTHER_COMMENT );
40+ $ sut = new CommentIni ($ document );
41+ self ::assertTrue ($ sut ->containsIniData ());
42+ self ::assertEquals ("base-page " , $ sut ->get ("extends " ));
43+ }
44+
3845 public function testGet_noMatchingData ():void {
3946 $ document = new HTMLDocument (HTMLPageContent::HTML_EXTENDS_PARTIAL_VIEW );
4047 $ sut = new CommentIni ($ document );
Original file line number Diff line number Diff line change @@ -934,6 +934,16 @@ class HTMLPageContent {
934934<article>
935935 <h1>Hello from within a sub-template!</h1>
936936</article>
937+ HTML ;
938+
939+ const HTML_COMMENT_WITH_INI_AND_ANOTHER_COMMENT = <<<HTML
940+ <!--
941+ extends=base-page
942+ -->
943+ <article>
944+ <!-- This is just another comment -->
945+ <h1>Hello from within a sub-template!</h1>
946+ </article>
937947HTML ;
938948
939949 const HTML_COMPONENT = <<<HTML
You can’t perform that action at this time.
0 commit comments