ParserTest.php 20.7 KB
Newer Older
1
<?php
2

3
namespace Mf2\Parser\Test;
4

5
use Mf2\Parser;
6
use Mf2;
7
use PHPUnit_Framework_TestCase;
8

9 10
/**
 * Parser Test
11
 *
12 13
 * Contains tests for internal parsing functions and stuff which doesn’t go anywhere else, i.e.
 * isn’t related to a particular property as such.
14
 *
15 16
 * Stuff for parsing E goes in here until there is enough of it to go elsewhere (like, never?)
 */
17 18
class ParserTest extends PHPUnit_Framework_TestCase {

19 20 21
	public function setUp() {
		date_default_timezone_set('Europe/London');
	}
22

23 24 25 26 27
	public function testUnicodeTrim() {
		$this->assertEquals('thing', Mf2\unicodeTrim('  thing  '));
		$this->assertEquals('thing', Mf2\unicodeTrim('			thing			'));
		$this->assertEquals('thing', Mf2\unicodeTrim(mb_convert_encoding(' &nbsp; thing &nbsp; ', 'UTF-8', 'HTML-ENTITIES') ));
	}
28

29 30
	public function testMicroformatNameFromClassReturnsFullRootName() {
		$expected = array('h-card');
31
		$actual = Mf2\mfNamesFromClass('someclass h-card someotherclass', 'h-');
32

33
		$this->assertEquals($expected, $actual);
34 35 36 37
	}

	public function testMicroformatNameFromClassHandlesMultipleHNames() {
		$expected = array('h-card', 'h-person');
38
		$actual = Mf2\mfNamesFromClass('someclass h-card someotherclass h-person yetanotherclass', 'h-');
39

40
		$this->assertEquals($expected, $actual);
41 42 43
	}

	public function testMicroformatStripsPrefixFromPropertyClassname() {
44
		$expected = array('name');
45
		$actual = Mf2\mfNamesFromClass('someclass p-name someotherclass', 'p-');
46

47
		$this->assertEquals($expected, $actual);
48 49 50
	}

	public function testNestedMicroformatPropertyNameWorks() {
51 52
		$expected = array('location' => array('p-'), 'author' => array('u-', 'p-'));
		$test = 'someclass p-location someotherclass u-author p-author';
53
		$actual = Mf2\nestedMfPropertyNamesFromClass($test);
54

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
		$this->assertEquals($expected, $actual);
	}

	public function testMicroformatNamesFromClassIgnoresPrefixesWithoutNames() {
		$expected = array();
		$actual = Mf2\mfNamesFromClass('someclass h- someotherclass', 'h-');

		$this->assertEquals($expected, $actual);
	}

	public function testMicroformatNamesFromClassHandlesExcessiveWhitespace() {
		$expected = array('h-card');
		$actual = Mf2\mfNamesFromClass('  someclass
			 	h-card 	 someotherclass		   	 ', 'h-');

		$this->assertEquals($expected, $actual);
	}

	public function testMicroformatNamesFromClassIgnoresUppercaseClassnames() {
		$expected = array();
		$actual = Mf2\mfNamesFromClass('H-ENTRY', 'h-');

		$this->assertEquals($expected, $actual);
78
	}
79

80 81
	public function testParseE() {
		$input = '<div class="h-entry"><div class="e-content">Here is a load of <strong>embedded markup</strong></div></div>';
82 83
		//$parser = new Parser($input);
		$output = Mf2\parse($input);
84 85

		$this->assertArrayHasKey('content', $output['items'][0]['properties']);
86 87
		$this->assertEquals('Here is a load of <strong>embedded markup</strong>', $output['items'][0]['properties']['content'][0]['html']);
		$this->assertEquals('Here is a load of embedded markup', $output['items'][0]['properties']['content'][0]['value']);
88
	}
89

90
	public function testParseEResolvesRelativeLinks() {
91
		$input = '<div class="h-entry"><p class="e-content">Blah blah <a href="/a-url">thing</a>. <object data="/object"></object> <img src="/img" /></p></div>';
92 93
		$parser = new Parser($input, 'http://example.com');
		$output = $parser->parse();
94

95
		$this->assertEquals('Blah blah <a href="http://example.com/a-url">thing</a>. <object data="http://example.com/object"></object> <img src="http://example.com/img">', $output['items'][0]['properties']['content'][0]['html']);
96
		$this->assertEquals('Blah blah thing.  http://example.com/img', $output['items'][0]['properties']['content'][0]['value']);
97
	}
98

99 100 101 102 103 104 105 106 107 108
	public function testParseEWithBR() {
		$input = '<div class="h-entry"><div class="e-content">Here is content with two lines.<br>The br tag should not be converted to an XML br/br element.</div></div>';
		//$parser = new Parser($input);
		$output = Mf2\parse($input);

		$this->assertArrayHasKey('content', $output['items'][0]['properties']);
		$this->assertEquals('Here is content with two lines.<br>The br tag should not be converted to an XML br/br element.', $output['items'][0]['properties']['content'][0]['html']);
		$this->assertEquals('Here is content with two lines.'."\n".'The br tag should not be converted to an XML br/br element.', $output['items'][0]['properties']['content'][0]['value']);
	}

109 110 111 112 113 114 115 116 117 118 119 120 121 122
	/**
	 * @group parseH
	 */
	public function testInvalidClassnamesContainingHAreIgnored() {
		$input = '<div class="asdfgh-jkl"></div>';
		$parser = new Parser($input);
		$output = $parser->parse();

		// Look through $output for an item which indicate failure
		foreach ($output['items'] as $item) {
			if (in_array('asdfgh-jkl', $item['type']))
				$this->fail();
		}
	}
123

124 125 126
	public function testHtmlSpecialCharactersWorks() {
		$this->assertEquals('&lt;&gt;', htmlspecialchars('<>'));
	}
127

128 129 130 131 132 133
	public function testHtmlEncodesNonEProperties() {
		$input = '<div class="h-card">
			<span class="p-name">&lt;p&gt;</span>
			<span class="dt-published">&lt;dt&gt;</span>
			<span class="u-url">&lt;u&gt;</span>
			</div>';
134

135
		$parser = new Parser($input);
136
		$output = $parser->parse();
137

138 139 140
		$this->assertEquals('<p>', $output['items'][0]['properties']['name'][0]);
		$this->assertEquals('<dt>', $output['items'][0]['properties']['published'][0]);
		$this->assertEquals('<u>', $output['items'][0]['properties']['url'][0]);
141
	}
142

143

144
	public function testHtmlEncodesImpliedProperties() {
145 146
		$input = '<a class="h-card" href="&lt;url&gt;"><img src="&lt;img&gt;" />&lt;name&gt;</a>';
		$parser = new Parser($input);
147
		$output = $parser->parse();
148

149 150 151
		$this->assertEquals('<name>', $output['items'][0]['properties']['name'][0]);
		$this->assertEquals('<url>', $output['items'][0]['properties']['url'][0]);
		$this->assertEquals('<img>', $output['items'][0]['properties']['photo'][0]);
152
	}
153

154
	public function testParsesRelValues() {
155 156
		$input = '<a rel="author" href="http://example.com">Mr. Author</a>';
		$parser = new Parser($input);
157

158
		$output = $parser->parse();
159

160 161
		$this->assertArrayHasKey('rels', $output);
		$this->assertEquals('http://example.com', $output['rels']['author'][0]);
162
	}
163

164
	public function testParsesRelAlternateValues() {
165
		$input = '<a rel="alternate home" href="http://example.org" hreflang="de", media="screen" type="text/html" title="German Homepage Link">German Homepage</a>';
166 167
		$parser = new Parser($input);
		$output = $parser->parse();
168

169 170 171 172 173
		$this->assertArrayHasKey('alternates', $output);
		$this->assertEquals('http://example.org', $output['alternates'][0]['url']);
		$this->assertEquals('home', $output['alternates'][0]['rel']);
		$this->assertEquals('de', $output['alternates'][0]['hreflang']);
		$this->assertEquals('screen', $output['alternates'][0]['media']);
174
		$this->assertEquals('text/html', $output['alternates'][0]['type']);
175
		$this->assertEquals('German Homepage Link', $output['alternates'][0]['title']);
176
		$this->assertEquals('German Homepage', $output['alternates'][0]['text']);
177
	}
178

179
	public function testParseFromIdOnlyReturnsMicroformatsWithinThatId() {
180 181 182 183 184 185 186 187 188
		$input = <<<EOT
<div class="h-entry"><span class="p-name">Not Included</span></div>

<div id="parse-here">
	<span class="h-card">Included</span>
</div>

<div class="h-entry"><span class="p-name">Not Included</span></div>
EOT;
189

190
		$parser = new Parser($input);
191
		$output = $parser->parseFromId('parse-here');
192

193 194 195
		$this->assertCount(1, $output['items']);
		$this->assertEquals('Included', $output['items'][0]['properties']['name'][0]);
	}
196

197 198 199
	/**
	 * Issue #21 github.com/indieweb/php-mf2/issues/21
	 */
200 201 202 203 204 205
	public function testDoesntAddArraysWithOnlyValueForAlreadyParsedNestedMicroformats() {
		$input = <<<EOT
<div class="h-entry">
	<div class="p-in-reply-to h-entry">
		<span class="p-author h-card">Nested Author</span>
	</div>
206

207 208 209 210 211
	<span class="p-author h-card">Real Author</span>
</div>
EOT;
		$parser = new Parser($input);
		$output = $parser->parse();
212

213 214
		$this->assertCount(1, $output['items'][0]['properties']['author']);
	}
215

216 217 218
	public function testParsesNestedMicroformatsWithClassnamesInAnyOrder() {
		$input = <<<EOT
<div class="h-entry">
219
	<div class="note- p-in-reply-to h-entry">Name</div>
220 221 222 223
</div>
EOT;
		$parser = new Parser($input);
		$output = $parser->parse();
224

225
		$this->assertCount(1, $output['items'][0]['properties']['in-reply-to']);
226
		$this->assertEquals('Name', $output['items'][0]['properties']['in-reply-to'][0]['properties']['name'][0]);
227
	}
Barnaby Walters's avatar
Barnaby Walters committed
228 229 230 231 232 233 234 235 236 237 238 239

	/**
	 * @group network
	 */
	public function testFetchMicroformats() {
		$mf = Mf2\fetch('http://waterpigs.co.uk/');
		$this->assertArrayHasKey('items', $mf);

		$mf = Mf2\fetch('http://waterpigs.co.uk/photo.jpg', null, $curlInfo);
		$this->assertNull($mf);
		$this->assertContains('jpeg', $curlInfo['content_type']);
	}
Gregor Morrill's avatar
Gregor Morrill committed
240 241 242 243 244 245 246 247 248 249 250 251

	/**
	 * @see https://github.com/indieweb/php-mf2/issues/48
	 */
	public function testIgnoreClassesEndingInHyphen() {
		$input = '<span class="h-entry"> <span class="e-">foo</span> </span>';
		$parser = new Parser($input);
		$output = $parser->parse();

		$this->assertArrayNotHasKey('0', $output['items'][0]['properties']);
	}

252 253 254 255 256 257 258 259
	/**
	 * @see https://github.com/indieweb/php-mf2/issues/52
	 * @see https://github.com/tommorris/mf2py/commit/92740deb7e19b8f1e7fbf6bec001cf52f2b07e99
	 */
	public function testIgnoresTemplateElements() {
		$result = Mf2\parse('<template class="h-card"><span class="p-name">Tom Morris</span></template>');
		$this->assertCount(0, $result['items']);
	}
260 261 262 263 264 265 266 267 268 269 270 271 272 273

	/**
	 * @see https://github.com/indieweb/php-mf2/issues/53
	 * @see http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property
	 */
	public function testConvertsNestedImgElementToAltOrSrc() {
		$input = <<<EOT
<div class="h-entry">
	<p class="e-content">It is a strange thing to see a <img alt="five legged elephant" src="/photos/five-legged-elephant.jpg" /></p>
</div>
EOT;
		$result = Mf2\parse($input, 'http://waterpigs.co.uk/articles/five-legged-elephant');
		$this->assertEquals('It is a strange thing to see a five legged elephant', $result['items'][0]['properties']['content'][0]['value']);
	}
274

275
	// parser not respecting not[h-*] in rule  "else if .h-x>a[href]:only-of-type:not[.h-*] then use that [href] for url"
276
	public function testNotImpliedUrlFromHCard() {
277 278 279 280 281
		$input = <<<EOT
<span class="h-entry">
	<a class="h-card" href="http://test.com">John Q</a>
</span>
EOT;
282

283 284
		$parser = new Parser($input);
		$output = $parser->parse();
285

286 287 288
		$this->assertArrayNotHasKey('url', $output['items'][0]['properties']);
	}

289 290 291 292 293 294
	public function testAreaTag() {
		$input = <<<EOT
<div class="h-entry">
	<area class="p-category h-card" href="http://personB.example.com" alt="Person Bee" shape="rect" coords="100,100,120,120">
</div>
EOT;
295

296 297
		$parser = new Parser($input);
		$output = $parser->parse();
298

Gregor Morrill's avatar
Gregor Morrill committed
299
		$this->assertEquals('Person Bee', $output['items'][0]['properties']['name'][0]);
300 301 302
		$this->assertEquals('rect', $output['items'][0]['properties']['category'][0]['shape']);
		$this->assertEquals('100,100,120,120', $output['items'][0]['properties']['category'][0]['coords']);
		$this->assertEquals('Person Bee', $output['items'][0]['properties']['category'][0]['value']);
303
	}
304 305

	public function testParseHcardInCategory() {
306 307 308 309 310 311 312 313 314
		$input = <<<EOT
<span class="h-entry">
	<a class="p-author h-card" href="http://a.example.com/">Alice</a> tagged
	<a href="http://b.example.com/" class="u-category h-card">Bob Smith</a> in
	<a class="u-tag-of u-in-reply-to" href="http://s.example.com/permalink47">
		<img src="http://s.example.com/photo47.png" alt="a photo of Bob and Cole" />
	</a>
</span>
EOT;
315 316 317 318 319 320 321 322 323 324 325 326

		$parser = new Parser($input);
		$output = $parser->parse();

		$this->assertContains('h-entry', $output['items'][0]['type']);
		$this->assertArrayHasKey('category', $output['items'][0]['properties']);
		$this->assertContains('h-card', $output['items'][0]['properties']['category'][0]['type']);
		$this->assertArrayHasKey('name', $output['items'][0]['properties']['category'][0]['properties']);
		$this->assertEquals('Bob Smith', $output['items'][0]['properties']['category'][0]['properties']['name'][0]);
		$this->assertArrayHasKey('url', $output['items'][0]['properties']['category'][0]['properties']);
		$this->assertEquals('http://b.example.com/', $output['items'][0]['properties']['category'][0]['properties']['url'][0]);
	}
327 328 329 330 331 332 333 334 335 336 337
	
	public function testApplyTransformationToSrcset() {
		$transformation = function ($url) {
			return 'https://example.com/' . ltrim($url, '/');
		};
		
		// Example from https://developers.whatwg.org/edits.html#attr-img-srcset
		$srcset = 'banner-HD.jpeg 2x, banner-phone.jpeg 100w, banner-phone-HD.jpeg 100w 2x';
		$result = Mf2\applySrcsetUrlTransformation($srcset, $transformation);
		$this->assertEquals('https://example.com/banner-HD.jpeg 2x, https://example.com/banner-phone.jpeg 100w, https://example.com/banner-phone-HD.jpeg 100w 2x', $result);
	}
338

Barnaby Walters's avatar
Barnaby Walters committed
339

340 341 342 343 344 345 346 347
	/**
	 * @see https://github.com/indieweb/php-mf2/issues/84
	 */
	public function testRelativeURLResolvedWithFinalURL() {
		$mf = Mf2\fetch('http://aaron.pk/4Zn5');

		$this->assertEquals('https://aaronparecki.com/2014/12/23/5/photo.jpeg', $mf['items'][0]['properties']['photo'][0]);
	}
Barnaby Walters's avatar
Barnaby Walters committed
348
	
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
	public function testScriptTagContentsRemovedFromTextValue() {
		$input = <<<EOT
<div class="h-entry">
	<div class="p-content">
		<b>Hello World</b>
		<script>alert("hi");</script>
	</div>
</div>
EOT;

		$parser = new Parser($input);
		$output = $parser->parse();

		$this->assertContains('h-entry', $output['items'][0]['type']);
		$this->assertContains('Hello World', $output['items'][0]['properties']['content'][0]);
		$this->assertNotContains('alert', $output['items'][0]['properties']['content'][0]);
	}
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
	
	public function testScriptElementContentsRemovedFromAllPlaintextValues() {
		$input = <<<EOT
<div class="h-entry">
	<span class="dt-published">contained<script>not contained</script><style>not contained</style></span>
	<span class="u-url">contained<script>not contained</script><style>not contained</style></span>
</div>
EOT;

		$parser = new Parser($input);
		$output = $parser->parse();
		
		$this->assertNotContains('not contained', $output['items'][0]['properties']['published'][0]);
		$this->assertNotContains('not contained', $output['items'][0]['properties']['url'][0]);
	}
381

382
	public function testScriptTagContentsNotRemovedFromHTMLValue() {
383 384 385 386 387
		$input = <<<EOT
<div class="h-entry">
	<div class="e-content">
		<b>Hello World</b>
		<script>alert("hi");</script>
388 389 390 391 392
		<style>body{ visibility: hidden; }</style>
		<p>
			<script>alert("hi");</script>
			<style>body{ visibility: hidden; }</style>
		</p>
393 394 395 396 397 398 399 400 401 402
	</div>
</div>
EOT;

		$parser = new Parser($input);
		$output = $parser->parse();

		$this->assertContains('h-entry', $output['items'][0]['type']);
		$this->assertContains('Hello World', $output['items'][0]['properties']['content'][0]['value']);
		$this->assertContains('<b>Hello World</b>', $output['items'][0]['properties']['content'][0]['html']);
403 404
		# The script and style tags should be removed from plaintext results but left in HTML results.
		$this->assertContains('alert', $output['items'][0]['properties']['content'][0]['html']);
405
		$this->assertNotContains('alert', $output['items'][0]['properties']['content'][0]['value']);
406
		$this->assertContains('visibility', $output['items'][0]['properties']['content'][0]['html']);
407
		$this->assertNotContains('visibility', $output['items'][0]['properties']['content'][0]['value']);
408
	}
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
	
	public function testWhitespaceBetweenElements() {
		$input = <<<EOT
<div class="h-entry">
	<data class="p-rsvp" value="yes">I'm attending</data>
	<a class="u-in-reply-to" href="https://snarfed.org/2014-06-16_homebrew-website-club-at-quip">Homebrew Website Club at Quip</a>
	<div class="p-content">Thanks for hosting!</div>
</div>
EOT;

		$parser = new Parser($input);
		$output = $parser->parse();

		$this->assertContains('h-entry', $output['items'][0]['type']);
		$this->assertNotContains('attendingHomebrew', $output['items'][0]['properties']['name'][0]);
	}
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502


	/**
	 * @see http://www.kevinmarks.com/twitterutils.html
	 */
	public function testCamelCaseClassNames() {
		$input = <<<EOT
<div class="EmbeddedTweet js-clickToOpenTarget" data-click-to-open-target="https://twitter.com/kevinmarks/status/700752598123433985" data-iframe-title="Twitter Tweet" data-dt-full="%{hours12}:%{minutes} %{amPm} - %{day} %{month} %{year}" data-dt-months="Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec" data-dt-am="AM" data-dt-pm="PM" data-dt-now="now" data-dt-s="s" data-dt-m="m" data-dt-h="h" data-dt-second="second" data-dt-seconds="seconds" data-dt-minute="minute" data-dt-minutes="minutes" data-dt-hour="hour" data-dt-hours="hours" data-dt-abbr="%{number}%{symbol}" data-dt-short="%{day} %{month}" data-dt-long="%{day} %{month} %{year}" data-scribe="page:tweet" id="twitter-widget-0" lang="en" data-twitter-event-id="0">

    <div class="EmbeddedTweet-tweet">
<blockquote class="Tweet h-entry js-tweetIdInfo subject expanded
                   is-deciderHtmlWhitespace" cite="https://twitter.com/kevinmarks/status/700752598123433985" data-tweet-id="700752598123433985" data-scribe="section:subject">
  <div class="Tweet-header u-cf">
    <div class="Tweet-brand u-floatRight">
      <span class="u-hiddenInNarrowEnv">
<a class="FollowButton follow-button profile" data-scribe="component:followbutton" href="https://twitter.com/kevinmarks" role="button" title="Follow Kevin Marks on Twitter"><span class="FollowButton-bird"><div class="Icon Icon--twitter " aria-label="" title="" role="presentation"></div></span> Follow</a>
</span>
      <span class="u-hiddenInWideEnv"><a href="https://twitter.com/download" data-scribe="element:logo"><div class="Icon Icon--twitter " aria-label="Get Twitter app" title="Get Twitter app" role="img"></div></a></span>
    </div>
    
<div class="TweetAuthor" data-scribe="component:author">
  <a class="TweetAuthor-link Identity u-linkBlend" data-scribe="element:user_link" href="https://twitter.com/kevinmarks" aria-label="Kevin Marks (screen name: kevinmarks)">
    <span class="TweetAuthor-avatar Identity-avatar">
      <img class="Avatar" data-scribe="element:avatar" data-src-2x="https://pbs.twimg.com/profile_images/553009683087114240/tU5HkXEI_bigger.jpeg" alt="" data-src-1x="https://pbs.twimg.com/profile_images/553009683087114240/tU5HkXEI_normal.jpeg" src="https://pbs.twimg.com/profile_images/553009683087114240/tU5HkXEI_normal.jpeg">
    </span>
    <span class="TweetAuthor-name Identity-name customisable-highlight" title="Kevin Marks" data-scribe="element:name">Kevin Marks</span>
    
    <span class="TweetAuthor-screenName Identity-screenName" title="@kevinmarks" data-scribe="element:screen_name">@kevinmarks</span>
  </a>
</div>

  </div>

  <div class="Tweet-body e-entry-content" data-scribe="component:tweet">
    <p class="Tweet-text e-entry-title" lang="en" dir="ltr">I wish people would stop using u- as a prefix for utility classes in CSS. Use util- instead. You're messing with my microformats.</p>


    <div class="Tweet-metadata dateline">
      

<a class="u-linkBlend u-url customisable-highlight long-permalink" data-datetime="2016-02-19T18:43:33+0000" data-scribe="element:full_timestamp" href="https://twitter.com/kevinmarks/status/700752598123433985">
<time class="dt-updated" datetime="2016-02-19T18:43:33+0000" pubdate="" title="Time posted: 19 Feb 2016, 18:43:33 (UTC)">10:43 AM - 19 Feb 2016</time></a>
    </div>


    <ul class="Tweet-actions" data-scribe="component:actions" role="menu" aria-label="Tweet actions">
      <li class="Tweet-action">
<a class="TweetAction TweetAction--reply web-intent" href="https://twitter.com/intent/tweet?in_reply_to=700752598123433985" data-scribe="element:reply"><div class="Icon Icon--reply TweetAction-icon" aria-label="Reply" title="Reply" role="img"></div></a></li>
      <li class="Tweet-action">
<a class="TweetAction TweetAction--retweet web-intent" href="https://twitter.com/intent/retweet?tweet_id=700752598123433985" data-scribe="element:retweet"><div class="Icon Icon--retweet TweetAction-icon" aria-label="Retweet" title="Retweet" role="img"></div>    <span class="TweetAction-stat" data-scribe="element:retweet_count" aria-hidden="true">1</span>
    <span class="u-hiddenVisually">1 Retweet</span>
</a></li>
      <li class="Tweet-action">
<a class="TweetAction TweetAction--heart web-intent" href="https://twitter.com/intent/like?tweet_id=700752598123433985" data-scribe="element:heart"><div class="Icon Icon--heart TweetAction-icon" aria-label="Like" title="Like" role="img"></div>    <span class="TweetAction-stat" data-scribe="element:heart_count" aria-hidden="true">4</span>
    <span class="u-hiddenVisually">4 likes</span>
</a></li>
    </ul>
  </div>
</blockquote>
</div>
  </div>
EOT;

		$output = Mf2\parse($input);

		$this->assertArrayNotHasKey('linkBlend', $output['items'][0]['properties']);
		$this->assertArrayNotHasKey('hiddenInNarrowEnv', $output['items'][0]['properties']);
		$this->assertArrayNotHasKey('floatRight', $output['items'][0]['properties']);
	}


	public function testClassNameNumbers() {
		$input = '<div class="h-entry"> <div class="u-column1"> <p class="p-title">Test</p> </div> </div>';
		$output = Mf2\parse($input);

		$this->assertArrayNotHasKey('column1', $output['items'][0]['properties']);
	}

503
}