Browse Source

add test for parsing a parsed mf2 object with html

pull/60/head
Aaron Parecki 6 years ago
parent
commit
ba309e9cfe
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      tests/ParseTest.php

+ 19
- 0
tests/ParseTest.php View File

@ -613,6 +613,25 @@ class ParseTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('http://example.com/photo.jpg', $data['data']['photo'][0]); $this->assertEquals('http://example.com/photo.jpg', $data['data']['photo'][0]);
} }
public function testInputIsParsedMf2WithHTML() {
$html = '<div class="h-entry"><p class="e-content p-name"><b>Hello</b> <i>World</i></p><img src="/photo.jpg"></p></div>';
$mf2 = Mf2\parse($html, 'http://example.com/entry');
$url = 'http://example.com/entry';
$response = $this->parse([
'url' => $url,
'body' => json_encode($mf2)
]);
$body = $response->getContent();
$this->assertEquals(200, $response->getStatusCode());
$data = json_decode($body, true);
$this->assertEquals('Hello World', $data['data']['content']['text']);
$this->assertEquals('<b>Hello</b> <i>World</i>', $data['data']['content']['html']);
$this->assertEquals('http://example.com/photo.jpg', $data['data']['photo'][0]);
}
public function testHApp() { public function testHApp() {
$url = 'http://source.example.com/h-app'; $url = 'http://source.example.com/h-app';
$response = $this->parse(['url' => $url]); $response = $this->parse(['url' => $url]);

Loading…
Cancel
Save