@@ -526,6 +526,57 @@ public function test_next_tag_with_query(): void {
526
526
$ this ->assertSame ( 5 , $ p ->get_current_depth () );
527
527
}
528
528
529
+ /**
530
+ * Test next_tag() without passing query.
531
+ *
532
+ * @todo This test will need to be updated once next_tag() defaults to not visiting closers by default.
533
+ *
534
+ * @covers ::next_tag
535
+ */
536
+ public function test_next_tag_without_query (): void {
537
+ $ html = '
538
+ <!DOCTYPE html>
539
+ <html>
540
+ <head>
541
+ <title></title>
542
+ </head>
543
+ <body></body>
544
+ </html>
545
+ ' ;
546
+
547
+ $ p = new OD_HTML_Tag_Processor ( $ html );
548
+ $ this ->assertTrue ( $ p ->next_tag () );
549
+ $ this ->assertSame ( 'HTML ' , $ p ->get_tag () );
550
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
551
+
552
+ $ this ->assertTrue ( $ p ->next_tag () );
553
+ $ this ->assertSame ( 'HEAD ' , $ p ->get_tag () );
554
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
555
+
556
+ $ this ->assertTrue ( $ p ->next_tag () );
557
+ $ this ->assertSame ( 'TITLE ' , $ p ->get_tag () );
558
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
559
+
560
+ // Note: This is not a closing TITLE tag as would be expected since it is special.
561
+ $ this ->assertTrue ( $ p ->next_tag () );
562
+ $ this ->assertSame ( 'HEAD ' , $ p ->get_tag () );
563
+ $ this ->assertTrue ( $ p ->is_tag_closer () );
564
+
565
+ $ this ->assertTrue ( $ p ->next_tag () );
566
+ $ this ->assertSame ( 'BODY ' , $ p ->get_tag () );
567
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
568
+
569
+ $ this ->assertTrue ( $ p ->next_tag () );
570
+ $ this ->assertSame ( 'BODY ' , $ p ->get_tag () );
571
+ $ this ->assertTrue ( $ p ->is_tag_closer () );
572
+
573
+ $ this ->assertTrue ( $ p ->next_tag () );
574
+ $ this ->assertSame ( 'HTML ' , $ p ->get_tag () );
575
+ $ this ->assertTrue ( $ p ->is_tag_closer () );
576
+
577
+ $ this ->assertFalse ( $ p ->next_tag () );
578
+ }
579
+
529
580
/**
530
581
* Test expects_closer().
531
582
*
0 commit comments