|
@ -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]); |
|
|