Skip to content

Commit 774a6f8

Browse files
committed
Update hreview backcompat tests
1 parent 113d3af commit 774a6f8

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

tests/Mf2/ClassicMicroformatsTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ public function testHReviewItemVevent()
959959
<span><span class="rating">5</span> out of 5 stars</span>
960960
<span class="item vevent">
961961
<span class="summary">IndieWebCamp 2014</span> -
962-
<a href="http://indiewebcamp.com/2014/" class="url">indiewebcamp.com/2014/</a>
962+
<a href="https://indieweb.org/2014" class="url">indieweb.org/2014</a>
963963
</span>
964964
</div>';
965965
$parser = new Parser($input);
@@ -983,7 +983,7 @@ public function testHReviewItemHproduct()
983983
<span><span class="rating">4</span> out of 5 stars</span>
984984
<span class="item hproduct">
985985
<span class="fn">Widget</span> -
986-
<a href="http://example.com/widget/" class="url">example.com/widget/</a>
986+
<a href="https://example.com/widget/" class="url">example.com/widget/</a>
987987
</span>
988988
</div>';
989989
$parser = new Parser($input);

tests/Mf2/ParserTest.php

+10-6
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,21 @@ public function testParseEWithWhitespace() {
139139
* @group parseH
140140
*/
141141
public function testInvalidClassnamesContainingHAreIgnored() {
142-
self::expectNotToPerformAssertions();
143-
144-
$input = '<div class="asdfgh-jkl"></div>';
142+
$classname = 'asdfgh-jkl';
143+
$input = sprintf('<div class="%s"></div>', $classname);
145144
$parser = new Parser($input);
146145
$output = $parser->parse();
147146

148-
// Look through $output for an item which indicate failure
147+
// Look through parsed items for `type` matching the classname.
148+
// There shouldn't be any
149+
$matches = 0;
149150
foreach ($output['items'] as $item) {
150-
if (in_array('asdfgh-jkl', $item['type']))
151-
$this->fail();
151+
if (in_array($classname, $item['type'])) {
152+
$matches++;
153+
}
152154
}
155+
156+
$this->assertEquals(0, $matches, sprintf('Class name "%s" should not have parsed as a root microformat', $classname));
153157
}
154158

155159
public function testHtmlSpecialCharactersWorks() {

0 commit comments

Comments
 (0)