@@ -577,6 +577,42 @@ public function test_next_tag_without_query(): void {
577
577
$ this ->assertFalse ( $ p ->next_tag () );
578
578
}
579
579
580
+ /**
581
+ * Test next_open_tag().
582
+ *
583
+ * @covers ::next_open_tag
584
+ */
585
+ public function test_next_open_tag (): void {
586
+ $ html = '
587
+ <!DOCTYPE html>
588
+ <html>
589
+ <head>
590
+ <title></title>
591
+ </head>
592
+ <body></body>
593
+ </html>
594
+ ' ;
595
+
596
+ $ p = new OD_HTML_Tag_Processor ( $ html );
597
+ $ this ->assertTrue ( $ p ->next_open_tag () ); // @phpstan-ignore method.deprecated
598
+ $ this ->assertSame ( 'HTML ' , $ p ->get_tag () );
599
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
600
+
601
+ $ this ->assertTrue ( $ p ->next_open_tag () ); // @phpstan-ignore method.deprecated
602
+ $ this ->assertSame ( 'HEAD ' , $ p ->get_tag () );
603
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
604
+
605
+ $ this ->assertTrue ( $ p ->next_open_tag () ); // @phpstan-ignore method.deprecated
606
+ $ this ->assertSame ( 'TITLE ' , $ p ->get_tag () );
607
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
608
+
609
+ $ this ->assertTrue ( $ p ->next_open_tag () ); // @phpstan-ignore method.deprecated
610
+ $ this ->assertSame ( 'BODY ' , $ p ->get_tag () );
611
+ $ this ->assertFalse ( $ p ->is_tag_closer () );
612
+
613
+ $ this ->assertFalse ( $ p ->next_open_tag () ); // @phpstan-ignore method.deprecated
614
+ }
615
+
580
616
/**
581
617
* Test expects_closer().
582
618
*
@@ -632,7 +668,7 @@ public function test_append_head_and_body_html(): void {
632
668
$ saw_head = false ;
633
669
$ saw_body = false ;
634
670
$ did_seek = false ;
635
- while ( $ processor ->next_open_tag ( ) ) {
671
+ while ( $ processor ->next_tag ( array ( ' tag_closers ' => ' skip ' ) ) ) {
636
672
$ this ->assertStringNotContainsString ( $ head_injected , $ processor ->get_updated_html (), 'Only expecting end-of-head injection once document was finalized. ' );
637
673
$ this ->assertStringNotContainsString ( $ body_injected , $ processor ->get_updated_html (), 'Only expecting end-of-body injection once document was finalized. ' );
638
674
$ tag = $ processor ->get_tag ();
@@ -708,7 +744,7 @@ public function test_get_updated_html_when_out_of_bookmarks(): void {
708
744
709
745
$ saw_head = false ;
710
746
$ saw_body = false ;
711
- while ( $ processor ->next_open_tag ( ) ) {
747
+ while ( $ processor ->next_tag ( array ( ' tag_closers ' => ' skip ' ) ) ) {
712
748
$ tag = $ processor ->get_tag ();
713
749
if ( 'HEAD ' === $ tag ) {
714
750
$ saw_head = true ;
@@ -732,7 +768,7 @@ public function test_get_updated_html_when_out_of_bookmarks(): void {
732
768
*/
733
769
public function test_html_tag_processor_wrapper_methods (): void {
734
770
$ processor = new OD_HTML_Tag_Processor ( '<html lang="en" class="foo" dir="ltr" data-novalue></html> ' );
735
- while ( $ processor ->next_open_tag ( ) ) {
771
+ while ( $ processor ->next_tag ( array ( ' tag_closers ' => ' skip ' ) ) ) {
736
772
$ open_tag = $ processor ->get_tag ();
737
773
if ( 'HTML ' === $ open_tag ) {
738
774
$ processor ->set_attribute ( 'lang ' , 'es ' );
@@ -787,7 +823,7 @@ public function test_bookmarking_and_seeking(): void {
787
823
$ this ->assertSame ( 0 , $ last_cursor_move_count );
788
824
789
825
$ bookmarks = array ();
790
- while ( $ processor ->next_open_tag ( ) ) {
826
+ while ( $ processor ->next_tag ( array ( ' tag_closers ' => ' skip ' ) ) ) {
791
827
$ this_cursor_move_count = $ processor ->get_cursor_move_count ();
792
828
$ this ->assertGreaterThan ( $ last_cursor_move_count , $ this_cursor_move_count );
793
829
$ last_cursor_move_count = $ this_cursor_move_count ;
0 commit comments