mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Changed all TTRSS outputs to match original types exactly; improves #125
This commit is contained in:
parent
b4890eaced
commit
40e9b7f986
2 changed files with 105 additions and 96 deletions
|
@ -227,7 +227,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
foreach (Arsse::$db->subscriptionList(Arsse::$user->id) as $sub) {
|
foreach (Arsse::$db->subscriptionList(Arsse::$user->id) as $sub) {
|
||||||
$out += $sub['unread'];
|
$out += $sub['unread'];
|
||||||
}
|
}
|
||||||
return ['unread' => $out];
|
return ['unread' => (string) $out]; // string cast to be consistent with TTRSS
|
||||||
}
|
}
|
||||||
|
|
||||||
public function opGetCounters(array $data): array {
|
public function opGetCounters(array $data): array {
|
||||||
|
@ -254,7 +254,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
foreach (Arsse::$db->subscriptionList($user) as $f) {
|
foreach (Arsse::$db->subscriptionList($user) as $f) {
|
||||||
if ($f['unread']) {
|
if ($f['unread']) {
|
||||||
// add the feed to the list of feeds
|
// add the feed to the list of feeds
|
||||||
$feeds[] = ['id' => $f['id'], 'updated' => Date::transform($f['updated'], "iso8601", "sql"),'counter' => $f['unread'], 'has_img' => (int) (strlen((string) $f['favicon']) > 0)];
|
$feeds[] = ['id' => (string) $f['id'], 'updated' => Date::transform($f['updated'], "iso8601", "sql"),'counter' => $f['unread'], 'has_img' => (int) (strlen((string) $f['favicon']) > 0)]; // ID is cast to string for consistency with TTRSS
|
||||||
// add the feed's unread count to the global unread count
|
// add the feed's unread count to the global unread count
|
||||||
$countAll += $f['unread'];
|
$countAll += $f['unread'];
|
||||||
// add the feed's unread count to its category unread count
|
// add the feed's unread count to its category unread count
|
||||||
|
@ -492,6 +492,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$cats = Arsse::$db->folderList($user, null, $deep)->getAll();
|
$cats = Arsse::$db->folderList($user, null, $deep)->getAll();
|
||||||
$map = [];
|
$map = [];
|
||||||
for ($a = 0; $a < sizeof($cats); $a++) {
|
for ($a = 0; $a < sizeof($cats); $a++) {
|
||||||
|
$cats[$a]['id'] = (string) $cats[$a]['id']; // real categories have IDs as strings in TTRSS
|
||||||
$map[$cats[$a]['id']] = $a;
|
$map[$cats[$a]['id']] = $a;
|
||||||
$cats[$a]['unread'] = 0;
|
$cats[$a]['unread'] = 0;
|
||||||
$cats[$a]['order'] = $a + 1;
|
$cats[$a]['order'] = $a + 1;
|
||||||
|
@ -547,6 +548,10 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
// transform the result and return
|
// transform the result and return
|
||||||
$out = [];
|
$out = [];
|
||||||
for ($a = 0; $a < sizeof($cats); $a++) {
|
for ($a = 0; $a < sizeof($cats); $a++) {
|
||||||
|
if ($cats[$a]['id']==-2) {
|
||||||
|
// the Labels category has its unread count as a string in TTRSS (don't ask me why)
|
||||||
|
settype($cats[$a]['unread'], "string");
|
||||||
|
}
|
||||||
$out[] = $this->fieldMapNames($cats[$a], [
|
$out[] = $this->fieldMapNames($cats[$a], [
|
||||||
'id' => "id",
|
'id' => "id",
|
||||||
'title' => "name",
|
'title' => "name",
|
||||||
|
@ -563,7 +568,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'parent' => $data['parent_id'],
|
'parent' => $data['parent_id'],
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
return Arsse::$db->folderAdd(Arsse::$user->id, $in);
|
return (string) Arsse::$db->folderAdd(Arsse::$user->id, $in); // output is a string in TTRSS
|
||||||
} catch (ExceptionInput $e) {
|
} catch (ExceptionInput $e) {
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
case 10236: // folder already exists
|
case 10236: // folder already exists
|
||||||
|
@ -571,7 +576,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$folders = Arsse::$db->folderList(Arsse::$user->id, $in['parent'], false);
|
$folders = Arsse::$db->folderList(Arsse::$user->id, $in['parent'], false);
|
||||||
foreach ($folders as $folder) {
|
foreach ($folders as $folder) {
|
||||||
if ($folder['name']==$in['name']) {
|
if ($folder['name']==$in['name']) {
|
||||||
return (int) $folder['id'];
|
return (string) ((int) $folder['id']); // output is a string in TTRSS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false; // @codeCoverageIgnore
|
return false; // @codeCoverageIgnore
|
||||||
|
@ -663,7 +668,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => $this->labelOut($l['id']),
|
'id' => $this->labelOut($l['id']),
|
||||||
'title' => $l['name'],
|
'title' => $l['name'],
|
||||||
'unread' => $l['unread'],
|
'unread' => (string) $l['unread'], // the unread count of labels is output as a string in TTRSS
|
||||||
'cat_id' => self::CAT_LABELS,
|
'cat_id' => self::CAT_LABELS,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -681,7 +686,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => self::FEED_STARRED,
|
'id' => self::FEED_STARRED,
|
||||||
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Starred"),
|
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Starred"),
|
||||||
'unread' => $starred,
|
'unread' => (string) $starred, // output is a string in TTRSS
|
||||||
'cat_id' => self::CAT_SPECIAL,
|
'cat_id' => self::CAT_SPECIAL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -689,7 +694,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => self::FEED_PUBLISHED,
|
'id' => self::FEED_PUBLISHED,
|
||||||
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Published"),
|
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Published"),
|
||||||
'unread' => $published,
|
'unread' => (string) $published, // output is a string in TTRSS
|
||||||
'cat_id' => self::CAT_SPECIAL,
|
'cat_id' => self::CAT_SPECIAL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -697,7 +702,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => self::FEED_FRESH,
|
'id' => self::FEED_FRESH,
|
||||||
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Fresh"),
|
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Fresh"),
|
||||||
'unread' => $fresh,
|
'unread' => (string) $fresh, // output is a string in TTRSS
|
||||||
'cat_id' => self::CAT_SPECIAL,
|
'cat_id' => self::CAT_SPECIAL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -705,7 +710,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => self::FEED_ALL,
|
'id' => self::FEED_ALL,
|
||||||
'title' => Arsse::$lang->msg("API.TTRSS.Feed.All"),
|
'title' => Arsse::$lang->msg("API.TTRSS.Feed.All"),
|
||||||
'unread' => $global,
|
'unread' => (string) $global, // output is a string in TTRSS
|
||||||
'cat_id' => self::CAT_SPECIAL,
|
'cat_id' => self::CAT_SPECIAL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -713,7 +718,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => self::FEED_READ,
|
'id' => self::FEED_READ,
|
||||||
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Read"),
|
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Read"),
|
||||||
'unread' => 0, // zero by definition
|
'unread' => 0, // zero by definition; this one is -NOT- a string in TTRSS
|
||||||
'cat_id' => self::CAT_SPECIAL,
|
'cat_id' => self::CAT_SPECIAL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -721,7 +726,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => self::FEED_ARCHIVED,
|
'id' => self::FEED_ARCHIVED,
|
||||||
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Archived"),
|
'title' => Arsse::$lang->msg("API.TTRSS.Feed.Archived"),
|
||||||
'unread' => $archived,
|
'unread' => (string) $archived, // output is a string in TTRSS
|
||||||
'cat_id' => self::CAT_SPECIAL,
|
'cat_id' => self::CAT_SPECIAL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1170,7 +1175,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out = [];
|
$out = [];
|
||||||
foreach (Arsse::$db->articleList(Arsse::$user->id, (new Context)->articles($articles)) as $article) {
|
foreach (Arsse::$db->articleList(Arsse::$user->id, (new Context)->articles($articles)) as $article) {
|
||||||
$out[] = [
|
$out[] = [
|
||||||
'id' => $article['id'],
|
'id' => (string) $article['id'], // string cast to be consistent with TTRSS
|
||||||
'guid' => $article['guid'] ? "SHA256:".$article['guid'] : null,
|
'guid' => $article['guid'] ? "SHA256:".$article['guid'] : null,
|
||||||
'title' => $article['title'],
|
'title' => $article['title'],
|
||||||
'link' => $article['url'],
|
'link' => $article['url'],
|
||||||
|
@ -1181,16 +1186,17 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'comments' => "", // FIXME: What is this?
|
'comments' => "", // FIXME: What is this?
|
||||||
'author' => $article['author'],
|
'author' => $article['author'],
|
||||||
'updated' => Date::transform($article['edited_date'], "unix", "sql"),
|
'updated' => Date::transform($article['edited_date'], "unix", "sql"),
|
||||||
'feed_id' => $article['subscription'],
|
'feed_id' => (string) $article['subscription'], // string cast to be consistent with TTRSS
|
||||||
'feed_title' => $article['subscription_title'],
|
'feed_title' => $article['subscription_title'],
|
||||||
'attachments' => $article['media_url'] ? [[
|
'attachments' => $article['media_url'] ? [[
|
||||||
|
'id' => (string) 0, // string cast to be consistent with TTRSS; nonsense ID because we don't use them for enclosures
|
||||||
'content_url' => $article['media_url'],
|
'content_url' => $article['media_url'],
|
||||||
'content_type' => $article['media_type'],
|
'content_type' => $article['media_type'],
|
||||||
'title' => "",
|
'title' => "",
|
||||||
'duration' => "",
|
'duration' => "",
|
||||||
'width' => "",
|
'width' => "",
|
||||||
'height' => "",
|
'height' => "",
|
||||||
'post_id' => $article['id'],
|
'post_id' => (string) $article['id'], // string cast to be consistent with TTRSS
|
||||||
]] : [], // TODO: We need to support multiple enclosures
|
]] : [], // TODO: We need to support multiple enclosures
|
||||||
'score' => 0, // score is not implemented as it is not modifiable from the TTRSS API
|
'score' => 0, // score is not implemented as it is not modifiable from the TTRSS API
|
||||||
'note' => strlen((string) $article['note']) ? $article['note'] : null,
|
'note' => strlen((string) $article['note']) ? $article['note'] : null,
|
||||||
|
@ -1264,7 +1270,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'author' => $article['author'],
|
'author' => $article['author'],
|
||||||
'updated' => Date::transform($article['edited_date'], "unix", "sql"),
|
'updated' => Date::transform($article['edited_date'], "unix", "sql"),
|
||||||
'is_updated' => ($article['published_date'] < $article['edited_date']),
|
'is_updated' => ($article['published_date'] < $article['edited_date']),
|
||||||
'feed_id' => $article['subscription'],
|
'feed_id' => (string) $article['subscription'], // string cast to be consistent with TTRSS
|
||||||
'feed_title' => $article['subscription_title'],
|
'feed_title' => $article['subscription_title'],
|
||||||
'score' => 0, // score is not implemented as it is not modifiable from the TTRSS API
|
'score' => 0, // score is not implemented as it is not modifiable from the TTRSS API
|
||||||
'note' => strlen((string) $article['note']) ? $article['note'] : null,
|
'note' => strlen((string) $article['note']) ? $article['note'] : null,
|
||||||
|
@ -1286,13 +1292,14 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
}
|
}
|
||||||
if ($data['include_attachments']) {
|
if ($data['include_attachments']) {
|
||||||
$row['attachments'] = $article['media_url'] ? [[
|
$row['attachments'] = $article['media_url'] ? [[
|
||||||
|
'id' => (string) 0, // string cast to be consistent with TTRSS; nonsense ID because we don't use them for enclosures
|
||||||
'content_url' => $article['media_url'],
|
'content_url' => $article['media_url'],
|
||||||
'content_type' => $article['media_type'],
|
'content_type' => $article['media_type'],
|
||||||
'title' => "",
|
'title' => "",
|
||||||
'duration' => "",
|
'duration' => "",
|
||||||
'width' => "",
|
'width' => "",
|
||||||
'height' => "",
|
'height' => "",
|
||||||
'post_id' => $article['id'],
|
'post_id' => (string) $article['id'], // string cast to be consistent with TTRSS
|
||||||
]] : []; // TODO: We need to support multiple enclosures
|
]] : []; // TODO: We need to support multiple enclosures
|
||||||
}
|
}
|
||||||
$out[] = $row;
|
$out[] = $row;
|
||||||
|
|
|
@ -311,14 +311,14 @@ LONG_STRING;
|
||||||
Phake::when(Arsse::$db)->folderAdd(Arsse::$user->id, ['name' => "", 'parent' => null])->thenThrow(new ExceptionInput("missing"));
|
Phake::when(Arsse::$db)->folderAdd(Arsse::$user->id, ['name' => "", 'parent' => null])->thenThrow(new ExceptionInput("missing"));
|
||||||
Phake::when(Arsse::$db)->folderAdd(Arsse::$user->id, ['name' => " ", 'parent' => null])->thenThrow(new ExceptionInput("whitespace"));
|
Phake::when(Arsse::$db)->folderAdd(Arsse::$user->id, ['name' => " ", 'parent' => null])->thenThrow(new ExceptionInput("whitespace"));
|
||||||
// correctly add two folders
|
// correctly add two folders
|
||||||
$exp = $this->respGood(2);
|
$exp = $this->respGood("2");
|
||||||
$this->assertResponse($exp, $this->req($in[0]));
|
$this->assertResponse($exp, $this->req($in[0]));
|
||||||
$exp = $this->respGood(3);
|
$exp = $this->respGood("3");
|
||||||
$this->assertResponse($exp, $this->req($in[1]));
|
$this->assertResponse($exp, $this->req($in[1]));
|
||||||
// attempt to add the two folders again
|
// attempt to add the two folders again
|
||||||
$exp = $this->respGood(2);
|
$exp = $this->respGood("2");
|
||||||
$this->assertResponse($exp, $this->req($in[0]));
|
$this->assertResponse($exp, $this->req($in[0]));
|
||||||
$exp = $this->respGood(3);
|
$exp = $this->respGood("3");
|
||||||
$this->assertResponse($exp, $this->req($in[1]));
|
$this->assertResponse($exp, $this->req($in[1]));
|
||||||
Phake::verify(Arsse::$db)->folderList(Arsse::$user->id, null, false);
|
Phake::verify(Arsse::$db)->folderList(Arsse::$user->id, null, false);
|
||||||
Phake::verify(Arsse::$db)->folderList(Arsse::$user->id, 1, false);
|
Phake::verify(Arsse::$db)->folderList(Arsse::$user->id, 1, false);
|
||||||
|
@ -633,7 +633,7 @@ LONG_STRING;
|
||||||
['id' => 2, 'unread' => 42],
|
['id' => 2, 'unread' => 42],
|
||||||
['id' => 3, 'unread' => 47],
|
['id' => 3, 'unread' => 47],
|
||||||
]));
|
]));
|
||||||
$exp = $this->respGood(['unread' => (2112 + 42 + 47)]);
|
$exp = $this->respGood(['unread' => (string) (2112 + 42 + 47)]);
|
||||||
$this->assertResponse($exp, $this->req($in));
|
$this->assertResponse($exp, $this->req($in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,54 +808,54 @@ LONG_STRING;
|
||||||
Phake::when(Arsse::$db)->articleStarred($this->anything())->thenReturn($this->starred);
|
Phake::when(Arsse::$db)->articleStarred($this->anything())->thenReturn($this->starred);
|
||||||
$exp = [
|
$exp = [
|
||||||
[
|
[
|
||||||
['id' => 5, 'title' => "Local", 'unread' => 10, 'order_id' => 1],
|
['id' => "5", 'title' => "Local", 'unread' => 10, 'order_id' => 1],
|
||||||
['id' => 6, 'title' => "National", 'unread' => 18, 'order_id' => 2],
|
['id' => "6", 'title' => "National", 'unread' => 18, 'order_id' => 2],
|
||||||
['id' => 4, 'title' => "Photography", 'unread' => 0, 'order_id' => 3],
|
['id' => "4", 'title' => "Photography", 'unread' => 0, 'order_id' => 3],
|
||||||
['id' => 3, 'title' => "Politics", 'unread' => 0, 'order_id' => 4],
|
['id' => "3", 'title' => "Politics", 'unread' => 0, 'order_id' => 4],
|
||||||
['id' => 2, 'title' => "Rocketry", 'unread' => 5, 'order_id' => 5],
|
['id' => "2", 'title' => "Rocketry", 'unread' => 5, 'order_id' => 5],
|
||||||
['id' => 1, 'title' => "Science", 'unread' => 2, 'order_id' => 6],
|
['id' => "1", 'title' => "Science", 'unread' => 2, 'order_id' => 6],
|
||||||
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
||||||
['id' => -1, 'title' => "Special", 'unread' => 11],
|
['id' => -1, 'title' => "Special", 'unread' => 11],
|
||||||
['id' => -2, 'title' => "Labels", 'unread' => 6],
|
['id' => -2, 'title' => "Labels", 'unread' => "6"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => 5, 'title' => "Local", 'unread' => 10, 'order_id' => 1],
|
['id' => "5", 'title' => "Local", 'unread' => 10, 'order_id' => 1],
|
||||||
['id' => 6, 'title' => "National", 'unread' => 18, 'order_id' => 2],
|
['id' => "6", 'title' => "National", 'unread' => 18, 'order_id' => 2],
|
||||||
['id' => 3, 'title' => "Politics", 'unread' => 0, 'order_id' => 4],
|
['id' => "3", 'title' => "Politics", 'unread' => 0, 'order_id' => 4],
|
||||||
['id' => 2, 'title' => "Rocketry", 'unread' => 5, 'order_id' => 5],
|
['id' => "2", 'title' => "Rocketry", 'unread' => 5, 'order_id' => 5],
|
||||||
['id' => 1, 'title' => "Science", 'unread' => 2, 'order_id' => 6],
|
['id' => "1", 'title' => "Science", 'unread' => 2, 'order_id' => 6],
|
||||||
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
||||||
['id' => -1, 'title' => "Special", 'unread' => 11],
|
['id' => -1, 'title' => "Special", 'unread' => 11],
|
||||||
['id' => -2, 'title' => "Labels", 'unread' => 6],
|
['id' => -2, 'title' => "Labels", 'unread' => "6"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => 5, 'title' => "Local", 'unread' => 10, 'order_id' => 1],
|
['id' => "5", 'title' => "Local", 'unread' => 10, 'order_id' => 1],
|
||||||
['id' => 6, 'title' => "National", 'unread' => 18, 'order_id' => 2],
|
['id' => "6", 'title' => "National", 'unread' => 18, 'order_id' => 2],
|
||||||
['id' => 2, 'title' => "Rocketry", 'unread' => 5, 'order_id' => 5],
|
['id' => "2", 'title' => "Rocketry", 'unread' => 5, 'order_id' => 5],
|
||||||
['id' => 1, 'title' => "Science", 'unread' => 2, 'order_id' => 6],
|
['id' => "1", 'title' => "Science", 'unread' => 2, 'order_id' => 6],
|
||||||
['id' => -1, 'title' => "Special", 'unread' => 11],
|
['id' => -1, 'title' => "Special", 'unread' => 11],
|
||||||
['id' => -2, 'title' => "Labels", 'unread' => 6],
|
['id' => -2, 'title' => "Labels", 'unread' => "6"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => 4, 'title' => "Photography", 'unread' => 0, 'order_id' => 1],
|
['id' => "4", 'title' => "Photography", 'unread' => 0, 'order_id' => 1],
|
||||||
['id' => 3, 'title' => "Politics", 'unread' => 28, 'order_id' => 2],
|
['id' => "3", 'title' => "Politics", 'unread' => 28, 'order_id' => 2],
|
||||||
['id' => 1, 'title' => "Science", 'unread' => 7, 'order_id' => 3],
|
['id' => "1", 'title' => "Science", 'unread' => 7, 'order_id' => 3],
|
||||||
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
||||||
['id' => -1, 'title' => "Special", 'unread' => 11],
|
['id' => -1, 'title' => "Special", 'unread' => 11],
|
||||||
['id' => -2, 'title' => "Labels", 'unread' => 6],
|
['id' => -2, 'title' => "Labels", 'unread' => "6"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => 3, 'title' => "Politics", 'unread' => 28, 'order_id' => 2],
|
['id' => "3", 'title' => "Politics", 'unread' => 28, 'order_id' => 2],
|
||||||
['id' => 1, 'title' => "Science", 'unread' => 7, 'order_id' => 3],
|
['id' => "1", 'title' => "Science", 'unread' => 7, 'order_id' => 3],
|
||||||
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
['id' => 0, 'title' => "Uncategorized", 'unread' => 0],
|
||||||
['id' => -1, 'title' => "Special", 'unread' => 11],
|
['id' => -1, 'title' => "Special", 'unread' => 11],
|
||||||
['id' => -2, 'title' => "Labels", 'unread' => 6],
|
['id' => -2, 'title' => "Labels", 'unread' => "6"],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => 3, 'title' => "Politics", 'unread' => 28, 'order_id' => 2],
|
['id' => "3", 'title' => "Politics", 'unread' => 28, 'order_id' => 2],
|
||||||
['id' => 1, 'title' => "Science", 'unread' => 7, 'order_id' => 3],
|
['id' => "1", 'title' => "Science", 'unread' => 7, 'order_id' => 3],
|
||||||
['id' => -1, 'title' => "Special", 'unread' => 11],
|
['id' => -1, 'title' => "Special", 'unread' => 11],
|
||||||
['id' => -2, 'title' => "Labels", 'unread' => 6],
|
['id' => -2, 'title' => "Labels", 'unread' => "6"],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
for ($a = 0; $a < sizeof($in); $a++) {
|
for ($a = 0; $a < sizeof($in); $a++) {
|
||||||
|
@ -880,11 +880,11 @@ LONG_STRING;
|
||||||
['id' => -4, 'counter' => 35, 'auxcounter' => 0],
|
['id' => -4, 'counter' => 35, 'auxcounter' => 0],
|
||||||
['id' => -1027, 'counter' => 6, 'auxcounter' => 100],
|
['id' => -1027, 'counter' => 6, 'auxcounter' => 100],
|
||||||
['id' => -1025, 'counter' => 0, 'auxcounter' => 2],
|
['id' => -1025, 'counter' => 0, 'auxcounter' => 2],
|
||||||
['id' => 3, 'updated' => "2016-05-23T06:40:02", 'counter' => 2, 'has_img' => 1],
|
['id' => "3", 'updated' => "2016-05-23T06:40:02", 'counter' => 2, 'has_img' => 1],
|
||||||
['id' => 4, 'updated' => "2017-10-09T15:58:34", 'counter' => 6, 'has_img' => 1],
|
['id' => "4", 'updated' => "2017-10-09T15:58:34", 'counter' => 6, 'has_img' => 1],
|
||||||
['id' => 1, 'updated' => "2017-09-15T22:54:16", 'counter' => 5, 'has_img' => 0],
|
['id' => "1", 'updated' => "2017-09-15T22:54:16", 'counter' => 5, 'has_img' => 0],
|
||||||
['id' => 5, 'updated' => "2017-07-07T17:07:17", 'counter' => 12, 'has_img' => 0],
|
['id' => "5", 'updated' => "2017-07-07T17:07:17", 'counter' => 12, 'has_img' => 0],
|
||||||
['id' => 2, 'updated' => "2011-11-11T11:11:11", 'counter' => 10, 'has_img' => 1],
|
['id' => "2", 'updated' => "2011-11-11T11:11:11", 'counter' => 10, 'has_img' => 1],
|
||||||
['id' => 5, 'kind' => "cat", 'counter' => 10],
|
['id' => 5, 'kind' => "cat", 'counter' => 10],
|
||||||
['id' => 6, 'kind' => "cat", 'counter' => 18],
|
['id' => 6, 'kind' => "cat", 'counter' => 18],
|
||||||
['id' => 3, 'kind' => "cat", 'counter' => 28],
|
['id' => 3, 'kind' => "cat", 'counter' => 28],
|
||||||
|
@ -1096,24 +1096,24 @@ LONG_STRING;
|
||||||
['id' => 6, 'title' => 'Eurogamer', 'unread' => 0, 'cat_id' => 0, 'feed_url' => " http://example.com/6", 'has_icon' => true, 'last_updated' => 1266005327, 'order_id' => 1],
|
['id' => 6, 'title' => 'Eurogamer', 'unread' => 0, 'cat_id' => 0, 'feed_url' => " http://example.com/6", 'has_icon' => true, 'last_updated' => 1266005327, 'order_id' => 1],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => -1, 'title' => "Starred articles", 'unread' => 4, 'cat_id' => -1],
|
['id' => -1, 'title' => "Starred articles", 'unread' => "4", 'cat_id' => -1],
|
||||||
['id' => -2, 'title' => "Published articles", 'unread' => 0, 'cat_id' => -1],
|
['id' => -2, 'title' => "Published articles", 'unread' => "0", 'cat_id' => -1],
|
||||||
['id' => -3, 'title' => "Fresh articles", 'unread' => 7, 'cat_id' => -1],
|
['id' => -3, 'title' => "Fresh articles", 'unread' => "7", 'cat_id' => -1],
|
||||||
['id' => -4, 'title' => "All articles", 'unread' => 35, 'cat_id' => -1],
|
['id' => -4, 'title' => "All articles", 'unread' => "35", 'cat_id' => -1],
|
||||||
['id' => -6, 'title' => "Recently read", 'unread' => 0, 'cat_id' => -1],
|
['id' => -6, 'title' => "Recently read", 'unread' => 0, 'cat_id' => -1],
|
||||||
['id' => 0, 'title' => "Archived articles", 'unread' => 0, 'cat_id' => -1],
|
['id' => 0, 'title' => "Archived articles", 'unread' => "0", 'cat_id' => -1],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => -1, 'title' => "Starred articles", 'unread' => 4, 'cat_id' => -1],
|
['id' => -1, 'title' => "Starred articles", 'unread' => "4", 'cat_id' => -1],
|
||||||
['id' => -3, 'title' => "Fresh articles", 'unread' => 7, 'cat_id' => -1],
|
['id' => -3, 'title' => "Fresh articles", 'unread' => "7", 'cat_id' => -1],
|
||||||
['id' => -4, 'title' => "All articles", 'unread' => 35, 'cat_id' => -1],
|
['id' => -4, 'title' => "All articles", 'unread' => "35", 'cat_id' => -1],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => -1027, 'title' => "Fascinating", 'unread' => 6, 'cat_id' => -2],
|
['id' => -1027, 'title' => "Fascinating", 'unread' => "6", 'cat_id' => -2],
|
||||||
['id' => -1025, 'title' => "Logical", 'unread' => 0, 'cat_id' => -2],
|
['id' => -1025, 'title' => "Logical", 'unread' => "0", 'cat_id' => -2],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => -1027, 'title' => "Fascinating", 'unread' => 6, 'cat_id' => -2],
|
['id' => -1027, 'title' => "Fascinating", 'unread' => "6", 'cat_id' => -2],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => 3, 'title' => 'Ars Technica', 'unread' => 2, 'cat_id' => 1, 'feed_url' => " http://example.com/3", 'has_icon' => true, 'last_updated' => 1463985602, 'order_id' => 1],
|
['id' => 3, 'title' => 'Ars Technica', 'unread' => 2, 'cat_id' => 1, 'feed_url' => " http://example.com/3", 'has_icon' => true, 'last_updated' => 1463985602, 'order_id' => 1],
|
||||||
|
@ -1131,14 +1131,14 @@ LONG_STRING;
|
||||||
['id' => 2, 'title' => 'Toronto Star', 'unread' => 10, 'cat_id' => 5, 'feed_url' => " http://example.com/2", 'has_icon' => true, 'last_updated' => 1321009871, 'order_id' => 6],
|
['id' => 2, 'title' => 'Toronto Star', 'unread' => 10, 'cat_id' => 5, 'feed_url' => " http://example.com/2", 'has_icon' => true, 'last_updated' => 1321009871, 'order_id' => 6],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => -1027, 'title' => "Fascinating", 'unread' => 6, 'cat_id' => -2],
|
['id' => -1027, 'title' => "Fascinating", 'unread' => "6", 'cat_id' => -2],
|
||||||
['id' => -1025, 'title' => "Logical", 'unread' => 0, 'cat_id' => -2],
|
['id' => -1025, 'title' => "Logical", 'unread' => "0", 'cat_id' => -2],
|
||||||
['id' => -1, 'title' => "Starred articles", 'unread' => 4, 'cat_id' => -1],
|
['id' => -1, 'title' => "Starred articles", 'unread' => "4", 'cat_id' => -1],
|
||||||
['id' => -2, 'title' => "Published articles", 'unread' => 0, 'cat_id' => -1],
|
['id' => -2, 'title' => "Published articles", 'unread' => "0", 'cat_id' => -1],
|
||||||
['id' => -3, 'title' => "Fresh articles", 'unread' => 7, 'cat_id' => -1],
|
['id' => -3, 'title' => "Fresh articles", 'unread' => "7", 'cat_id' => -1],
|
||||||
['id' => -4, 'title' => "All articles", 'unread' => 35, 'cat_id' => -1],
|
['id' => -4, 'title' => "All articles", 'unread' => "35", 'cat_id' => -1],
|
||||||
['id' => -6, 'title' => "Recently read", 'unread' => 0, 'cat_id' => -1],
|
['id' => -6, 'title' => "Recently read", 'unread' => 0, 'cat_id' => -1],
|
||||||
['id' => 0, 'title' => "Archived articles", 'unread' => 0, 'cat_id' => -1],
|
['id' => 0, 'title' => "Archived articles", 'unread' => "0", 'cat_id' => -1],
|
||||||
['id' => 3, 'title' => 'Ars Technica', 'unread' => 2, 'cat_id' => 1, 'feed_url' => " http://example.com/3", 'has_icon' => true, 'last_updated' => 1463985602, 'order_id' => 1],
|
['id' => 3, 'title' => 'Ars Technica', 'unread' => 2, 'cat_id' => 1, 'feed_url' => " http://example.com/3", 'has_icon' => true, 'last_updated' => 1463985602, 'order_id' => 1],
|
||||||
['id' => 4, 'title' => 'CBC News', 'unread' => 6, 'cat_id' => 6, 'feed_url' => " http://example.com/4", 'has_icon' => true, 'last_updated' => 1507564714, 'order_id' => 2],
|
['id' => 4, 'title' => 'CBC News', 'unread' => 6, 'cat_id' => 6, 'feed_url' => " http://example.com/4", 'has_icon' => true, 'last_updated' => 1507564714, 'order_id' => 2],
|
||||||
['id' => 6, 'title' => 'Eurogamer', 'unread' => 0, 'cat_id' => 0, 'feed_url' => " http://example.com/6", 'has_icon' => true, 'last_updated' => 1266005327, 'order_id' => 3],
|
['id' => 6, 'title' => 'Eurogamer', 'unread' => 0, 'cat_id' => 0, 'feed_url' => " http://example.com/6", 'has_icon' => true, 'last_updated' => 1266005327, 'order_id' => 3],
|
||||||
|
@ -1147,10 +1147,10 @@ LONG_STRING;
|
||||||
['id' => 2, 'title' => 'Toronto Star', 'unread' => 10, 'cat_id' => 5, 'feed_url' => " http://example.com/2", 'has_icon' => true, 'last_updated' => 1321009871, 'order_id' => 6],
|
['id' => 2, 'title' => 'Toronto Star', 'unread' => 10, 'cat_id' => 5, 'feed_url' => " http://example.com/2", 'has_icon' => true, 'last_updated' => 1321009871, 'order_id' => 6],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
['id' => -1027, 'title' => "Fascinating", 'unread' => 6, 'cat_id' => -2],
|
['id' => -1027, 'title' => "Fascinating", 'unread' => "6", 'cat_id' => -2],
|
||||||
['id' => -1, 'title' => "Starred articles", 'unread' => 4, 'cat_id' => -1],
|
['id' => -1, 'title' => "Starred articles", 'unread' => "4", 'cat_id' => -1],
|
||||||
['id' => -3, 'title' => "Fresh articles", 'unread' => 7, 'cat_id' => -1],
|
['id' => -3, 'title' => "Fresh articles", 'unread' => "7", 'cat_id' => -1],
|
||||||
['id' => -4, 'title' => "All articles", 'unread' => 35, 'cat_id' => -1],
|
['id' => -4, 'title' => "All articles", 'unread' => "35", 'cat_id' => -1],
|
||||||
['id' => 3, 'title' => 'Ars Technica', 'unread' => 2, 'cat_id' => 1, 'feed_url' => " http://example.com/3", 'has_icon' => true, 'last_updated' => 1463985602, 'order_id' => 1],
|
['id' => 3, 'title' => 'Ars Technica', 'unread' => 2, 'cat_id' => 1, 'feed_url' => " http://example.com/3", 'has_icon' => true, 'last_updated' => 1463985602, 'order_id' => 1],
|
||||||
['id' => 4, 'title' => 'CBC News', 'unread' => 6, 'cat_id' => 6, 'feed_url' => " http://example.com/4", 'has_icon' => true, 'last_updated' => 1507564714, 'order_id' => 2],
|
['id' => 4, 'title' => 'CBC News', 'unread' => 6, 'cat_id' => 6, 'feed_url' => " http://example.com/4", 'has_icon' => true, 'last_updated' => 1507564714, 'order_id' => 2],
|
||||||
['id' => 1, 'title' => 'NASA JPL', 'unread' => 5, 'cat_id' => 2, 'feed_url' => " http://example.com/1", 'has_icon' => false, 'last_updated' => 1505516056, 'order_id' => 4],
|
['id' => 1, 'title' => 'NASA JPL', 'unread' => 5, 'cat_id' => 2, 'feed_url' => " http://example.com/1", 'has_icon' => false, 'last_updated' => 1505516056, 'order_id' => 4],
|
||||||
|
@ -1307,7 +1307,7 @@ LONG_STRING;
|
||||||
$this->assertResponse($exp, $this->req($in[3]));
|
$this->assertResponse($exp, $this->req($in[3]));
|
||||||
$exp = [
|
$exp = [
|
||||||
[
|
[
|
||||||
'id' => 101,
|
'id' => "101",
|
||||||
'guid' => null,
|
'guid' => null,
|
||||||
'title' => 'Article title 1',
|
'title' => 'Article title 1',
|
||||||
'link' => 'http://example.com/1',
|
'link' => 'http://example.com/1',
|
||||||
|
@ -1318,7 +1318,7 @@ LONG_STRING;
|
||||||
'comments' => "",
|
'comments' => "",
|
||||||
'author' => '',
|
'author' => '',
|
||||||
'updated' => strtotime('2000-01-01 00:00:01'),
|
'updated' => strtotime('2000-01-01 00:00:01'),
|
||||||
'feed_id' => 8,
|
'feed_id' => "8",
|
||||||
'feed_title' => "Feed 11",
|
'feed_title' => "Feed 11",
|
||||||
'attachments' => [],
|
'attachments' => [],
|
||||||
'score' => 0,
|
'score' => 0,
|
||||||
|
@ -1327,7 +1327,7 @@ LONG_STRING;
|
||||||
'content' => '<p>Article content 1</p>',
|
'content' => '<p>Article content 1</p>',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => 102,
|
'id' => "102",
|
||||||
'guid' => "SHA256:5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7",
|
'guid' => "SHA256:5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7",
|
||||||
'title' => 'Article title 2',
|
'title' => 'Article title 2',
|
||||||
'link' => 'http://example.com/2',
|
'link' => 'http://example.com/2',
|
||||||
|
@ -1341,17 +1341,18 @@ LONG_STRING;
|
||||||
'comments' => "",
|
'comments' => "",
|
||||||
'author' => "J. King",
|
'author' => "J. King",
|
||||||
'updated' => strtotime('2000-01-02 00:00:02'),
|
'updated' => strtotime('2000-01-02 00:00:02'),
|
||||||
'feed_id' => 8,
|
'feed_id' => "8",
|
||||||
'feed_title' => "Feed 11",
|
'feed_title' => "Feed 11",
|
||||||
'attachments' => [
|
'attachments' => [
|
||||||
[
|
[
|
||||||
|
'id' => "0",
|
||||||
'content_url' => "http://example.com/text",
|
'content_url' => "http://example.com/text",
|
||||||
'content_type' => "text/plain",
|
'content_type' => "text/plain",
|
||||||
'title' => "",
|
'title' => "",
|
||||||
'duration' => "",
|
'duration' => "",
|
||||||
'width' => "",
|
'width' => "",
|
||||||
'height' => "",
|
'height' => "",
|
||||||
'post_id' => 102,
|
'post_id' => "102",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'score' => 0,
|
'score' => 0,
|
||||||
|
@ -1604,13 +1605,14 @@ LONG_STRING;
|
||||||
$test = $this->req($in[2]);
|
$test = $this->req($in[2]);
|
||||||
$exp = [
|
$exp = [
|
||||||
[
|
[
|
||||||
|
'id' => "0",
|
||||||
'content_url' => "http://example.com/text",
|
'content_url' => "http://example.com/text",
|
||||||
'content_type' => "text/plain",
|
'content_type' => "text/plain",
|
||||||
'title' => "",
|
'title' => "",
|
||||||
'duration' => "",
|
'duration' => "",
|
||||||
'width' => "",
|
'width' => "",
|
||||||
'height' => "",
|
'height' => "",
|
||||||
'post_id' => 2112,
|
'post_id' => "2112",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$this->assertArrayHasKey("attachments", $test->payload['content'][0]);
|
$this->assertArrayHasKey("attachments", $test->payload['content'][0]);
|
||||||
|
@ -1742,7 +1744,7 @@ LONG_STRING;
|
||||||
'author' => '',
|
'author' => '',
|
||||||
'updated' => strtotime('2000-01-01 00:00:00'),
|
'updated' => strtotime('2000-01-01 00:00:00'),
|
||||||
'is_updated' => false,
|
'is_updated' => false,
|
||||||
'feed_id' => 12,
|
'feed_id' => "12",
|
||||||
'feed_title' => "Feed 2112",
|
'feed_title' => "Feed 2112",
|
||||||
'score' => 0,
|
'score' => 0,
|
||||||
'note' => null,
|
'note' => null,
|
||||||
|
@ -1766,7 +1768,7 @@ LONG_STRING;
|
||||||
'author' => "J. King",
|
'author' => "J. King",
|
||||||
'updated' => strtotime('2000-01-02 00:00:02'),
|
'updated' => strtotime('2000-01-02 00:00:02'),
|
||||||
'is_updated' => true,
|
'is_updated' => true,
|
||||||
'feed_id' => 8,
|
'feed_id' => "8",
|
||||||
'feed_title' => "Feed 11",
|
'feed_title' => "Feed 11",
|
||||||
'score' => 0,
|
'score' => 0,
|
||||||
'note' => "Note 2",
|
'note' => "Note 2",
|
||||||
|
|
Loading…
Reference in a new issue