@@ -52,6 +52,43 @@ public function testHtmlAndHEntryLang()
52
52
$ this ->assertEquals ('es ' , $ result ['items ' ][0 ]['properties ' ]['html-lang ' ]);
53
53
} # end method testHtmlAndHEntryLang()
54
54
55
+ /**
56
+ * Test HTML fragment with only h-entry lang
57
+ */
58
+ public function testFragmentHEntryLangOnly ()
59
+ {
60
+ $ input = '<div class="h-entry" lang="en">This test is in English.</div> ' ;
61
+ $ parser = new Parser ($ input );
62
+ $ result = $ parser ->parse ();
63
+
64
+ $ this ->assertEquals ('en ' , $ result ['items ' ][0 ]['properties ' ]['html-lang ' ]);
65
+ } # end method testFragmentHEntryLangOnly()
66
+
67
+ /**
68
+ * Test HTML fragment with no lang
69
+ */
70
+ public function testFragmentHEntryNoLang ()
71
+ {
72
+ $ input = '<div class="h-entry">This test is in English.</div> ' ;
73
+ $ parser = new Parser ($ input );
74
+ $ result = $ parser ->parse ();
75
+
76
+ $ this ->assertFalse (isset ($ result ['items ' ][0 ]['properties ' ]['html-lang ' ]));
77
+ } # end method testFragmentHEntryNoLang()
78
+
79
+ /**
80
+ * Test HTML fragment with no lang, loaded with loadXML()
81
+ */
82
+ public function testFragmentHEntryNoLangXML ()
83
+ {
84
+ $ input = new \DOMDocument ();
85
+ $ input ->loadXML ('<div class="h-entry">This test is in English.</div> ' );
86
+ $ parser = new Parser ($ input );
87
+ $ result = $ parser ->parse ();
88
+
89
+ $ this ->assertFalse (isset ($ result ['items ' ][0 ]['properties ' ]['html-lang ' ]));
90
+ } # end method testFragmentHEntryNoLangXML()
91
+
55
92
/**
56
93
* Test with different <html lang>, h-entry lang, and h-entry without lang,
57
94
* which should inherit from the <html lang>
0 commit comments