Skip to content

Commit

Permalink
Update hreview backcompat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gRegorLove committed Mar 8, 2024
1 parent 113d3af commit 774a6f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/Mf2/ClassicMicroformatsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ public function testHReviewItemVevent()
<span><span class="rating">5</span> out of 5 stars</span>
<span class="item vevent">
<span class="summary">IndieWebCamp 2014</span> -
<a href="http://indiewebcamp.com/2014/" class="url">indiewebcamp.com/2014/</a>
<a href="https://indieweb.org/2014" class="url">indieweb.org/2014</a>
</span>
</div>';
$parser = new Parser($input);
Expand All @@ -983,7 +983,7 @@ public function testHReviewItemHproduct()
<span><span class="rating">4</span> out of 5 stars</span>
<span class="item hproduct">
<span class="fn">Widget</span> -
<a href="http://example.com/widget/" class="url">example.com/widget/</a>
<a href="https://example.com/widget/" class="url">example.com/widget/</a>
</span>
</div>';
$parser = new Parser($input);
Expand Down
16 changes: 10 additions & 6 deletions tests/Mf2/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,21 @@ public function testParseEWithWhitespace() {
* @group parseH
*/
public function testInvalidClassnamesContainingHAreIgnored() {
self::expectNotToPerformAssertions();

$input = '<div class="asdfgh-jkl"></div>';
$classname = 'asdfgh-jkl';
$input = sprintf('<div class="%s"></div>', $classname);
$parser = new Parser($input);
$output = $parser->parse();

// Look through $output for an item which indicate failure
// Look through parsed items for `type` matching the classname.
// There shouldn't be any
$matches = 0;
foreach ($output['items'] as $item) {
if (in_array('asdfgh-jkl', $item['type']))
$this->fail();
if (in_array($classname, $item['type'])) {
$matches++;
}
}

$this->assertEquals(0, $matches, sprintf('Class name "%s" should not have parsed as a root microformat', $classname));
}

public function testHtmlSpecialCharactersWorks() {
Expand Down

0 comments on commit 774a6f8

Please sign in to comment.