Skip to content

Commit 17124a3

Browse files
author
BenRoberts
committed
add test of h-card in category
1 parent e097f59 commit 17124a3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/Mf2/ParserTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,25 @@ public function testAreaTag() {
285285
$this->assertEquals('Person Bee', $output['items'][0]['properties']['category'][0]['value']);
286286

287287
}
288+
289+
public function testParseHcardInCategory() {
290+
291+
$input = '<span class="h-entry">
292+
<a class="p-author h-card" href="http://a.example.com/">Alice</a> tagged
293+
<a href="http://b.example.com/" class="p-category h-card">Bob Smith</a> in
294+
<a class="u-tag-of u-in-reply-to" href="http://s.example.com/permalink47">
295+
<img src="http://s.example.com/photo47.png" alt="a photo of Bob and Cole" /></a>
296+
</span>';
297+
298+
$parser = new Parser($input);
299+
$output = $parser->parse();
300+
301+
$this->assertContains('h-entry', $output['items'][0]['type']);
302+
$this->assertArrayHasKey('category', $output['items'][0]['properties']);
303+
$this->assertContains('h-card', $output['items'][0]['properties']['category'][0]['type']);
304+
$this->assertArrayHasKey('name', $output['items'][0]['properties']['category'][0]['properties']);
305+
$this->assertEquals('Bob Smith', $output['items'][0]['properties']['category'][0]['properties']['name'][0]);
306+
$this->assertArrayHasKey('url', $output['items'][0]['properties']['category'][0]['properties']);
307+
$this->assertEquals('http://b.example.com/', $output['items'][0]['properties']['category'][0]['properties']['url'][0]);
308+
}
288309
}

0 commit comments

Comments
 (0)