Browse Source

return jsonfeed photos as arrays too

pull/93/head
Aaron Parecki 5 years ago
parent
commit
7c48a0c1fb
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      lib/XRay/Formats/JSONFeed.php
  2. +2
    -2
      tests/FeedTest.php

+ 1
- 1
lib/XRay/Formats/JSONFeed.php View File

@ -99,7 +99,7 @@ class JSONFeed extends Format {
} }
if(isset($item['image'])) { if(isset($item['image'])) {
$entry['photo'] = \Mf2\resolveUrl($baseURL, $item['image']);
$entry['photo'] = [\Mf2\resolveUrl($baseURL, $item['image'])];
} }
if(isset($item['tags'])) { if(isset($item['tags'])) {

+ 2
- 2
tests/FeedTest.php View File

@ -294,10 +294,10 @@ class FeedTest extends PHPUnit_Framework_TestCase {
$data = $result->data; $data = $result->data;
// Relative image on an item that has a url // Relative image on an item that has a url
$this->assertEquals('http://www.manton.org/2017/11/image.jpg', $data->items[9]->photo);
$this->assertEquals('http://www.manton.org/2017/11/image.jpg', $data->items[9]->photo[0]);
// Relative image on an item that has no URL, fall back to feed URL // Relative image on an item that has no URL, fall back to feed URL
$this->assertEquals('http://feed.example.com/image.jpg', $data->items[10]->photo);
$this->assertEquals('http://feed.example.com/image.jpg', $data->items[10]->photo[0]);
// Relative image inside the content html // Relative image inside the content html
$this->assertContains('http://www.manton.org/2017/11/img.jpg', $data->items[9]->content->html); $this->assertContains('http://www.manton.org/2017/11/img.jpg', $data->items[9]->content->html);

Loading…
Cancel
Save