Skip to content

Commit f101447

Browse files
committed
Added XML loading test for HTML fragment language testing (#121)
1 parent acda009 commit f101447

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/Mf2/ParseLanguageTest.php

+25
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,31 @@ public function testFragmentHEntryLangOnly()
6464
$this->assertEquals('en', $result['items'][0]['properties']['html-lang']);
6565
} # end method testFragmentHEntryLangOnly()
6666

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+
6792
/**
6893
* Test with different <html lang>, h-entry lang, and h-entry without lang,
6994
* which should inherit from the <html lang>

0 commit comments

Comments
 (0)