Browse Source

add test with two h-cards before the h-entry

pull/83/head
sebsel 6 years ago
parent
commit
fdbeb4fdc1
2 changed files with 31 additions and 0 deletions
  1. +12
    -0
      tests/ParseTest.php
  2. +19
    -0
      tests/data/source.example.com/h-entry-with-two-h-cards-before-it

+ 12
- 0
tests/ParseTest.php View File

@ -460,6 +460,18 @@ class ParseTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('Hello World', $data['data']['content']['text']); $this->assertEquals('Hello World', $data['data']['content']['text']);
} }
public function testHEntryWithTwoHCardsBeforeIt() {
$url = 'http://source.example.com/h-entry-with-two-h-cards-before-it';
$response = $this->parse(['url' => $url]);
$body = $response->getContent();
$this->assertEquals(200, $response->getStatusCode());
$data = json_decode($body, true);
$this->assertEquals('mf2+html', $data['source-format']);
$this->assertEquals('entry', $data['data']['type']);
$this->assertEquals('Hello World', $data['data']['content']['text']);
}
public function testHEntryRedirectWithHCardSibling() { public function testHEntryRedirectWithHCardSibling() {
$url = 'http://source.example.com/h-entry-redirect-with-h-card-sibling'; $url = 'http://source.example.com/h-entry-redirect-with-h-card-sibling';
$response = $this->parse(['url' => $url]); $response = $this->parse(['url' => $url]);

+ 19
- 0
tests/data/source.example.com/h-entry-with-two-h-cards-before-it View File

@ -0,0 +1,19 @@
HTTP/1.1 200 OK
Server: Apache
Date: Wed, 09 Dec 2015 03:29:14 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
<html>
<head>
<title>Test</title>
</head>
<body>
<a href="/" class="h-card">Author Name</a>
<a href="http://example.com" class="h-card">Author Org</a>
<div class="h-entry">
<p class="p-content">Hello World</p>
<a href="/h-entry-with-two-h-cards-before-it">permalink</a>
</div>
</body>
</html>

Loading…
Cancel
Save