Browse Source

include author for events

for https://github.com/aaronpk/Aperture/issues/56
pull/94/head v1.9.0
Aaron Parecki 5 years ago
parent
commit
1213ee080d
No known key found for this signature in database GPG Key ID: 276C2817346D6056
3 changed files with 9 additions and 0 deletions
  1. +3
    -0
      lib/XRay/Formats/Mf2.php
  2. +4
    -0
      tests/ParseTest.php
  3. +2
    -0
      tests/data/source.example.com/h-event-text-content

+ 3
- 0
lib/XRay/Formats/Mf2.php View File

@ -657,6 +657,9 @@ class Mf2 extends Format {
$data['content'] = $content; $data['content'] = $content;
} }
if($author = self::findAuthor($mf2, $item, $http, $url))
$data['author'] = $author;
$data['post-type'] = \p3k\XRay\PostType::discover($data); $data['post-type'] = \p3k\XRay\PostType::discover($data);
$response = [ $response = [

+ 4
- 0
tests/ParseTest.php View File

@ -554,6 +554,7 @@ class ParseTest extends PHPUnit_Framework_TestCase {
$body = $response->getContent(); $body = $response->getContent();
$this->assertEquals(200, $response->getStatusCode()); $this->assertEquals(200, $response->getStatusCode());
$data = json_decode($body, true); $data = json_decode($body, true);
$this->assertEquals('mf2+html', $data['source-format']); $this->assertEquals('mf2+html', $data['source-format']);
$this->assertEquals('event', $data['data']['type']); $this->assertEquals('event', $data['data']['type']);
$this->assertEquals('event', $data['data']['post-type']); $this->assertEquals('event', $data['data']['post-type']);
@ -564,6 +565,9 @@ class ParseTest extends PHPUnit_Framework_TestCase {
$this->assertStringStartsWith("Are you building your own website? Indie reader? Personal publishing web app? Or some other digital magic-cloud proxy? If so, come on by and join a gathering of people with likeminded interests. Bring your friends that want to start a personal web site. Exchange information, swap ideas, talk shop, help work on a project...", $data['data']['content']['text']); $this->assertStringStartsWith("Are you building your own website? Indie reader? Personal publishing web app? Or some other digital magic-cloud proxy? If so, come on by and join a gathering of people with likeminded interests. Bring your friends that want to start a personal web site. Exchange information, swap ideas, talk shop, help work on a project...", $data['data']['content']['text']);
$this->assertStringEndsWith("See the Homebrew Website Club Newsletter Volume 1 Issue 1 for a description of the first meeting.", $data['data']['content']['text']); $this->assertStringEndsWith("See the Homebrew Website Club Newsletter Volume 1 Issue 1 for a description of the first meeting.", $data['data']['content']['text']);
$this->assertArrayNotHasKey('html', $data['data']['content']); $this->assertArrayNotHasKey('html', $data['data']['content']);
$this->assertEquals('card', $data['data']['author']['type']);
$this->assertEquals('Event Author', $data['data']['author']['name']);
$this->assertEquals('http://source.example.com/', $data['data']['author']['url']);
} }
public function testEventWithHCardLocation() { public function testEventWithHCardLocation() {

+ 2
- 0
tests/data/source.example.com/h-event-text-content View File

@ -20,5 +20,7 @@ Connection: keep-alive
<p>See the <a href="http://tantek.com/2013/332/b1/homebrew-website-club-newsletter">Homebrew Website Club Newsletter Volume 1 Issue 1</a> for a description of the first meeting.</p> <p>See the <a href="http://tantek.com/2013/332/b1/homebrew-website-club-newsletter">Homebrew Website Club Newsletter Volume 1 Issue 1</a> for a description of the first meeting.</p>
</div> </div>
<a href="/" class="u-author h-card">Event Author</a>
</body> </body>
</html> </html>

Loading…
Cancel
Save