mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Style fixes
This commit is contained in:
parent
211cea648e
commit
90034ac1f8
8 changed files with 34 additions and 38 deletions
|
@ -755,7 +755,7 @@ class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Lists a user's subscriptions, returning various data
|
/** Lists a user's subscriptions, returning various data
|
||||||
*
|
*
|
||||||
* Each record has the following keys:
|
* Each record has the following keys:
|
||||||
*
|
*
|
||||||
* - "id": The numeric identifier of the subscription
|
* - "id": The numeric identifier of the subscription
|
||||||
|
@ -993,7 +993,7 @@ class Database {
|
||||||
* - "url": The URL of the icon
|
* - "url": The URL of the icon
|
||||||
* - "type": The Content-Type of the icon e.g. "image/png"
|
* - "type": The Content-Type of the icon e.g. "image/png"
|
||||||
* - "data": The icon itself, as a binary sring; if $withData is false this will be null
|
* - "data": The icon itself, as a binary sring; if $withData is false this will be null
|
||||||
*
|
*
|
||||||
* If the subscription has no icon null is returned instead of an array
|
* If the subscription has no icon null is returned instead of an array
|
||||||
*
|
*
|
||||||
* @param string|null $user The user who owns the subscription being queried; using null here is supported for TT-RSS and SHOULD NOT be used elsewhere as it leaks information
|
* @param string|null $user The user who owns the subscription being queried; using null here is supported for TT-RSS and SHOULD NOT be used elsewhere as it leaks information
|
||||||
|
@ -1031,7 +1031,7 @@ class Database {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Evalutes the filter rules specified for a subscription against every article associated with the subscription's feed
|
/** Evalutes the filter rules specified for a subscription against every article associated with the subscription's feed
|
||||||
*
|
*
|
||||||
* @param string $user The user who owns the subscription
|
* @param string $user The user who owns the subscription
|
||||||
* @param integer $id The identifier of the subscription whose rules are to be evaluated
|
* @param integer $id The identifier of the subscription whose rules are to be evaluated
|
||||||
*/
|
*/
|
||||||
|
@ -1072,7 +1072,6 @@ class Database {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Ensures the specified subscription exists and raises an exception otherwise
|
/** Ensures the specified subscription exists and raises an exception otherwise
|
||||||
*
|
*
|
||||||
* Returns an associative array containing the id of the subscription and the id of the underlying newsfeed
|
* Returns an associative array containing the id of the subscription and the id of the underlying newsfeed
|
||||||
|
@ -1747,7 +1746,7 @@ class Database {
|
||||||
} elseif (!$context->$m) {
|
} elseif (!$context->$m) {
|
||||||
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]); // must have at least one array element
|
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]); // must have at least one array element
|
||||||
}
|
}
|
||||||
$columns = array_map(function ($c) use ($colDefs) {
|
$columns = array_map(function($c) use ($colDefs) {
|
||||||
assert(isset($colDefs[$c]), new Exception("constantUnknown", $c));
|
assert(isset($colDefs[$c]), new Exception("constantUnknown", $c));
|
||||||
return $colDefs[$c];
|
return $colDefs[$c];
|
||||||
}, $columns);
|
}, $columns);
|
||||||
|
@ -1758,7 +1757,7 @@ class Database {
|
||||||
if (!$context->not->$m() || !$context->not->$m) {
|
if (!$context->not->$m() || !$context->not->$m) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$columns = array_map(function ($c) use ($colDefs) {
|
$columns = array_map(function($c) use ($colDefs) {
|
||||||
assert(isset($colDefs[$c]), new Exception("constantUnknown", $c));
|
assert(isset($colDefs[$c]), new Exception("constantUnknown", $c));
|
||||||
return $colDefs[$c];
|
return $colDefs[$c];
|
||||||
}, $columns);
|
}, $columns);
|
||||||
|
|
|
@ -10,4 +10,4 @@ class Factory {
|
||||||
public function get(string $class) {
|
public function get(string $class) {
|
||||||
return new $class;
|
return new $class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,6 @@ class ValueInfo {
|
||||||
'float' => ["U.u", "U.u" ],
|
'float' => ["U.u", "U.u" ],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public static function normalize($value, int $type, string $dateInFormat = null, $dateOutFormat = null) {
|
public static function normalize($value, int $type, string $dateInFormat = null, $dateOutFormat = null) {
|
||||||
$allowNull = ($type & self::M_NULL);
|
$allowNull = ($type & self::M_NULL);
|
||||||
$strict = ($type & (self::M_STRICT | self::M_DROP));
|
$strict = ($type & (self::M_STRICT | self::M_DROP));
|
||||||
|
|
|
@ -55,7 +55,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
];
|
];
|
||||||
protected const VALID_JSON = [
|
protected const VALID_JSON = [
|
||||||
// user properties which map directly to Arsse user metadata are listed separately;
|
// user properties which map directly to Arsse user metadata are listed separately;
|
||||||
// not all these properties are used by our implementation, but they are treated
|
// not all these properties are used by our implementation, but they are treated
|
||||||
// with the same strictness as in Miniflux to ease cross-compatibility
|
// with the same strictness as in Miniflux to ease cross-compatibility
|
||||||
'url' => "string",
|
'url' => "string",
|
||||||
'username' => "string",
|
'username' => "string",
|
||||||
|
@ -90,7 +90,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'stylesheet' => ["stylesheet", ""],
|
'stylesheet' => ["stylesheet", ""],
|
||||||
];
|
];
|
||||||
/** A map between Miniflux's input properties and our input properties when modifiying feeds
|
/** A map between Miniflux's input properties and our input properties when modifiying feeds
|
||||||
*
|
*
|
||||||
* Miniflux also allows changing the following properties:
|
* Miniflux also allows changing the following properties:
|
||||||
*
|
*
|
||||||
* - feed_url
|
* - feed_url
|
||||||
|
@ -107,7 +107,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
* or cannot be changed because feeds are deduplicated and changing
|
* or cannot be changed because feeds are deduplicated and changing
|
||||||
* how they are fetched is not practical with our implementation.
|
* how they are fetched is not practical with our implementation.
|
||||||
* The properties are still checked for type and syntactic validity
|
* The properties are still checked for type and syntactic validity
|
||||||
* where practical, on the assumption Miniflux would also reject
|
* where practical, on the assumption Miniflux would also reject
|
||||||
* invalid values.
|
* invalid values.
|
||||||
*/
|
*/
|
||||||
protected const FEED_META_MAP = [
|
protected const FEED_META_MAP = [
|
||||||
|
@ -118,11 +118,11 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'blocklist_rules' => "block_rule",
|
'blocklist_rules' => "block_rule",
|
||||||
];
|
];
|
||||||
protected const ARTICLE_COLUMNS = [
|
protected const ARTICLE_COLUMNS = [
|
||||||
"id", "url", "title", "subscription",
|
"id", "url", "title", "subscription",
|
||||||
"author", "fingerprint",
|
"author", "fingerprint",
|
||||||
"published_date", "modified_date",
|
"published_date", "modified_date",
|
||||||
"starred", "unread", "hidden",
|
"starred", "unread", "hidden",
|
||||||
"content", "media_url", "media_type"
|
"content", "media_url", "media_type",
|
||||||
];
|
];
|
||||||
protected const CALLS = [ // handler method Admin Path Body Query Required fields
|
protected const CALLS = [ // handler method Admin Path Body Query Required fields
|
||||||
'/categories' => [
|
'/categories' => [
|
||||||
|
@ -291,7 +291,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return $this->$func(...$args);
|
return $this->$func(...$args);
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// if there was a REST exception return 400
|
// if there was a REST exception return 400
|
||||||
return new EmptyResponse(400);
|
return new EmptyResponse(400);
|
||||||
|
@ -348,7 +348,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse(["InvalidInputType", 'field' => $k, 'expected' => $t, 'actual' => gettype($body[$k])], 422);
|
return new ErrorResponse(["InvalidInputType", 'field' => $k, 'expected' => $t, 'actual' => gettype($body[$k])], 422);
|
||||||
} elseif (
|
} elseif (
|
||||||
(in_array($k, ["keeplist_rules", "blocklist_rules"]) && !Rule::validate($body[$k]))
|
(in_array($k, ["keeplist_rules", "blocklist_rules"]) && !Rule::validate($body[$k]))
|
||||||
|| (in_array($k, ["url", "feed_url"]) && !URL::absolute($body[$k]))
|
|| (in_array($k, ["url", "feed_url"]) && !URL::absolute($body[$k]))
|
||||||
|| ($k === "category_id" && $body[$k] < 1)
|
|| ($k === "category_id" && $body[$k] < 1)
|
||||||
|| ($k === "status" && !in_array($body[$k], ["read", "unread", "removed"]))
|
|| ($k === "status" && !in_array($body[$k], ["read", "unread", "removed"]))
|
||||||
) {
|
) {
|
||||||
|
@ -492,7 +492,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
protected function editUser(string $user, array $data): array {
|
protected function editUser(string $user, array $data): array {
|
||||||
// map Miniflux properties to internal metadata properties
|
// map Miniflux properties to internal metadata properties
|
||||||
$in = [];
|
$in = [];
|
||||||
foreach (self::USER_META_MAP as $i => [$o,]) {
|
foreach (self::USER_META_MAP as $i => [$o]) {
|
||||||
if (isset($data[$i])) {
|
if (isset($data[$i])) {
|
||||||
if ($i === "entry_sorting_direction") {
|
if ($i === "entry_sorting_direction") {
|
||||||
$in[$o] = $data[$i] === "asc";
|
$in[$o] = $data[$i] === "asc";
|
||||||
|
@ -640,9 +640,9 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a useful subset of user metadata
|
/** Returns a useful subset of user metadata
|
||||||
*
|
*
|
||||||
* The following keys are included:
|
* The following keys are included:
|
||||||
*
|
*
|
||||||
* - "num": The user's numeric ID,
|
* - "num": The user's numeric ID,
|
||||||
* - "root": The effective name of the root folder
|
* - "root": The effective name of the root folder
|
||||||
*/
|
*/
|
||||||
|
@ -880,8 +880,8 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse("404", 404);
|
return new ErrorResponse("404", 404);
|
||||||
}
|
}
|
||||||
return new Response([
|
return new Response([
|
||||||
'id' => $icon['id'],
|
'id' => $icon['id'],
|
||||||
'data' => $icon['type'].";base64,".base64_encode($icon['data']),
|
'data' => $icon['type'].";base64,".base64_encode($icon['data']),
|
||||||
'mime_type' => $icon['type'],
|
'mime_type' => $icon['type'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -960,7 +960,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
'url' => $entry['media_url'],
|
'url' => $entry['media_url'],
|
||||||
'mime_type' => $entry['media_type'] ?: "application/octet-stream",
|
'mime_type' => $entry['media_type'] ?: "application/octet-stream",
|
||||||
'size' => 0,
|
'size' => 0,
|
||||||
]
|
],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$enclosures = null;
|
$enclosures = null;
|
||||||
|
@ -1030,7 +1030,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
$out['feed'] = $this->transformFeed(Arsse::$db->subscriptionPropertiesGet(Arsse::$user->id, $out['feed_id']), $meta['num'], $meta['root'], $meta['tz']);
|
$out['feed'] = $this->transformFeed(Arsse::$db->subscriptionPropertiesGet(Arsse::$user->id, $out['feed_id']), $meta['num'], $meta['root'], $meta['tz']);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getEntries(array $query): ResponseInterface {
|
protected function getEntries(array $query): ResponseInterface {
|
||||||
try {
|
try {
|
||||||
return new Response($this->listEntries($query, new Context));
|
return new Response($this->listEntries($query, new Context));
|
||||||
|
@ -1038,7 +1038,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse("MissingCategory", 400);
|
return new ErrorResponse("MissingCategory", 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFeedEntries(array $path, array $query): ResponseInterface {
|
protected function getFeedEntries(array $path, array $query): ResponseInterface {
|
||||||
$c = (new Context)->subscription((int) $path[1]);
|
$c = (new Context)->subscription((int) $path[1]);
|
||||||
try {
|
try {
|
||||||
|
@ -1048,7 +1048,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse("404", 404);
|
return new ErrorResponse("404", 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCategoryEntries(array $path, array $query): ResponseInterface {
|
protected function getCategoryEntries(array $path, array $query): ResponseInterface {
|
||||||
$query['category_id'] = (int) $path[1];
|
$query['category_id'] = (int) $path[1];
|
||||||
try {
|
try {
|
||||||
|
@ -1057,7 +1057,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse("404", 404);
|
return new ErrorResponse("404", 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getEntry(array $path): ResponseInterface {
|
protected function getEntry(array $path): ResponseInterface {
|
||||||
try {
|
try {
|
||||||
return new Response($this->findEntry((int) $path[1]));
|
return new Response($this->findEntry((int) $path[1]));
|
||||||
|
@ -1065,7 +1065,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse("404", 404);
|
return new ErrorResponse("404", 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFeedEntry(array $path): ResponseInterface {
|
protected function getFeedEntry(array $path): ResponseInterface {
|
||||||
$c = (new Context)->subscription((int) $path[1]);
|
$c = (new Context)->subscription((int) $path[1]);
|
||||||
try {
|
try {
|
||||||
|
@ -1074,7 +1074,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
return new ErrorResponse("404", 404);
|
return new ErrorResponse("404", 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getCategoryEntry(array $path): ResponseInterface {
|
protected function getCategoryEntry(array $path): ResponseInterface {
|
||||||
$c = new Context;
|
$c = new Context;
|
||||||
if ($path[1] === "1") {
|
if ($path[1] === "1") {
|
||||||
|
|
|
@ -14,4 +14,4 @@ class TestFactory extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
$f = new Factory;
|
$f = new Factory;
|
||||||
$this->assertInstanceOf(\stdClass::class, $f->get(\stdClass::class));
|
$this->assertInstanceOf(\stdClass::class, $f->get(\stdClass::class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ use JKingWeb\Arsse\User;
|
||||||
use JKingWeb\Arsse\Database;
|
use JKingWeb\Arsse\Database;
|
||||||
use JKingWeb\Arsse\Db\Transaction;
|
use JKingWeb\Arsse\Db\Transaction;
|
||||||
use JKingWeb\Arsse\Db\ExceptionInput;
|
use JKingWeb\Arsse\Db\ExceptionInput;
|
||||||
use JKingWeb\Arsse\Misc\Date;
|
|
||||||
use JKingWeb\Arsse\REST\Miniflux\V1;
|
use JKingWeb\Arsse\REST\Miniflux\V1;
|
||||||
use JKingWeb\Arsse\REST\Miniflux\ErrorResponse;
|
use JKingWeb\Arsse\REST\Miniflux\ErrorResponse;
|
||||||
use JKingWeb\Arsse\Feed\Exception as FeedException;
|
use JKingWeb\Arsse\Feed\Exception as FeedException;
|
||||||
|
@ -46,7 +45,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
['id' => 42, 'url' => "http://example.com/42", 'title' => "Title 42", 'subscription' => 55, 'author' => "Thomas Costain", 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 0, 'unread' => 0, 'hidden' => 0, 'content' => "Content 42", 'media_url' => null, 'media_type' => null],
|
['id' => 42, 'url' => "http://example.com/42", 'title' => "Title 42", 'subscription' => 55, 'author' => "Thomas Costain", 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 0, 'unread' => 0, 'hidden' => 0, 'content' => "Content 42", 'media_url' => null, 'media_type' => null],
|
||||||
['id' => 44, 'url' => "http://example.com/44", 'title' => "Title 44", 'subscription' => 55, 'author' => null, 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 1, 'unread' => 1, 'hidden' => 0, 'content' => "Content 44", 'media_url' => "http://example.com/44/enclosure", 'media_type' => null],
|
['id' => 44, 'url' => "http://example.com/44", 'title' => "Title 44", 'subscription' => 55, 'author' => null, 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 1, 'unread' => 1, 'hidden' => 0, 'content' => "Content 44", 'media_url' => "http://example.com/44/enclosure", 'media_type' => null],
|
||||||
['id' => 47, 'url' => "http://example.com/47", 'title' => "Title 47", 'subscription' => 55, 'author' => null, 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 0, 'unread' => 1, 'hidden' => 1, 'content' => "Content 47", 'media_url' => "http://example.com/47/enclosure", 'media_type' => ""],
|
['id' => 47, 'url' => "http://example.com/47", 'title' => "Title 47", 'subscription' => 55, 'author' => null, 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 0, 'unread' => 1, 'hidden' => 1, 'content' => "Content 47", 'media_url' => "http://example.com/47/enclosure", 'media_type' => ""],
|
||||||
['id' => 2112, 'url' => "http://example.com/2112", 'title' => "Title 2112", 'subscription' => 55, 'author' => null, 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 0, 'unread' => 0, 'hidden' => 1, 'content' => "Content 2112", 'media_url' => "http://example.com/2112/enclosure", 'media_type' => "image/png"]
|
['id' => 2112, 'url' => "http://example.com/2112", 'title' => "Title 2112", 'subscription' => 55, 'author' => null, 'fingerprint' => "FINGERPRINT", 'published_date' => "2021-01-22 02:21:12", 'modified_date' => "2021-01-22 13:44:47", 'starred' => 0, 'unread' => 0, 'hidden' => 1, 'content' => "Content 2112", 'media_url' => "http://example.com/2112/enclosure", 'media_type' => "image/png"],
|
||||||
];
|
];
|
||||||
protected const ENTRIES_OUT = [
|
protected const ENTRIES_OUT = [
|
||||||
['id' => 42, 'user_id' => 42, 'feed_id' => 55, 'status' => "read", 'hash' => "FINGERPRINT", 'title' => "Title 42", 'url' => "http://example.com/42", 'comments_url' => "", 'published_at' => "2021-01-22T04:21:12+02:00", 'created_at' => "2021-01-22T15:44:47.000000+02:00", 'content' => "Content 42", 'author' => "Thomas Costain", 'share_code' => "", 'starred' => false, 'reading_time' => 0, 'enclosures' => null, 'feed' => self::FEEDS_OUT[1]],
|
['id' => 42, 'user_id' => 42, 'feed_id' => 55, 'status' => "read", 'hash' => "FINGERPRINT", 'title' => "Title 42", 'url' => "http://example.com/42", 'comments_url' => "", 'published_at' => "2021-01-22T04:21:12+02:00", 'created_at' => "2021-01-22T15:44:47.000000+02:00", 'content' => "Content 42", 'author' => "Thomas Costain", 'share_code' => "", 'starred' => false, 'reading_time' => 0, 'enclosures' => null, 'feed' => self::FEEDS_OUT[1]],
|
||||||
|
@ -663,7 +662,7 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
[['crawler' => false], ['scrape' => false], true, $success],
|
[['crawler' => false], ['scrape' => false], true, $success],
|
||||||
[['keeplist_rules' => ""], ['keep_rule' => ""], true, $success],
|
[['keeplist_rules' => ""], ['keep_rule' => ""], true, $success],
|
||||||
[['blocklist_rules' => "ook"], ['block_rule' => "ook"], true, $success],
|
[['blocklist_rules' => "ook"], ['block_rule' => "ook"], true, $success],
|
||||||
[['title' => "Ook!", 'crawler' => true], ['title' => "Ook!", 'scrape' => true], true, $success]
|
[['title' => "Ook!", 'crawler' => true], ['title' => "Ook!", 'scrape' => true], true, $success],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,8 +856,8 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
[['entry_ids' => 1, 'status' => "read"], null, new ErrorResponse(["InvalidInputType", 'field' => "entry_ids", 'expected' => "array", 'actual' => "integer"], 422)],
|
[['entry_ids' => 1, 'status' => "read"], null, new ErrorResponse(["InvalidInputType", 'field' => "entry_ids", 'expected' => "array", 'actual' => "integer"], 422)],
|
||||||
[['entry_ids' => ["1"], 'status' => "read"], null, new ErrorResponse(["InvalidInputType", 'field' => "entry_ids", 'expected' => "integer", 'actual' => "string"], 422)],
|
[['entry_ids' => ["1"], 'status' => "read"], null, new ErrorResponse(["InvalidInputType", 'field' => "entry_ids", 'expected' => "integer", 'actual' => "string"], 422)],
|
||||||
[['entry_ids' => [1], 'status' => 1], null, new ErrorResponse(["InvalidInputType", 'field' => "status", 'expected' => "string", 'actual' => "integer"], 422)],
|
[['entry_ids' => [1], 'status' => 1], null, new ErrorResponse(["InvalidInputType", 'field' => "status", 'expected' => "string", 'actual' => "integer"], 422)],
|
||||||
[['entry_ids' => [0], 'status' => "read"], null, new ErrorResponse(["InvalidInputValue", 'field' => "entry_ids",], 422)],
|
[['entry_ids' => [0], 'status' => "read"], null, new ErrorResponse(["InvalidInputValue", 'field' => "entry_ids"], 422)],
|
||||||
[['entry_ids' => [1], 'status' => "reread"], null, new ErrorResponse(["InvalidInputValue", 'field' => "status",], 422)],
|
[['entry_ids' => [1], 'status' => "reread"], null, new ErrorResponse(["InvalidInputValue", 'field' => "status"], 422)],
|
||||||
[['entry_ids' => [1, 2], 'status' => "read"], ['read' => true, 'hidden' => false], new EmptyResponse(204)],
|
[['entry_ids' => [1, 2], 'status' => "read"], ['read' => true, 'hidden' => false], new EmptyResponse(204)],
|
||||||
[['entry_ids' => [1, 2], 'status' => "unread"], ['read' => false, 'hidden' => false], new EmptyResponse(204)],
|
[['entry_ids' => [1, 2], 'status' => "unread"], ['read' => false, 'hidden' => false], new EmptyResponse(204)],
|
||||||
[['entry_ids' => [1, 2], 'status' => "removed"], ['read' => true, 'hidden' => true], new EmptyResponse(204)],
|
[['entry_ids' => [1, 2], 'status' => "removed"], ['read' => true, 'hidden' => true], new EmptyResponse(204)],
|
||||||
|
@ -1009,4 +1008,4 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
$this->assertException("doesNotExist", "User", "ExceptionConflict");
|
$this->assertException("doesNotExist", "User", "ExceptionConflict");
|
||||||
V1::tokenList("john.doe@example.com");
|
V1::tokenList("john.doe@example.com");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ namespace JKingWeb\Arsse\TestCase\REST;
|
||||||
use JKingWeb\Arsse\Arsse;
|
use JKingWeb\Arsse\Arsse;
|
||||||
use JKingWeb\Arsse\User;
|
use JKingWeb\Arsse\User;
|
||||||
use JKingWeb\Arsse\REST;
|
use JKingWeb\Arsse\REST;
|
||||||
use JKingWeb\Arsse\REST\Handler;
|
|
||||||
use JKingWeb\Arsse\REST\Exception501;
|
use JKingWeb\Arsse\REST\Exception501;
|
||||||
use JKingWeb\Arsse\REST\NextcloudNews\V1_2 as NCN;
|
use JKingWeb\Arsse\REST\NextcloudNews\V1_2 as NCN;
|
||||||
use JKingWeb\Arsse\REST\TinyTinyRSS\API as TTRSS;
|
use JKingWeb\Arsse\REST\TinyTinyRSS\API as TTRSS;
|
||||||
|
|
|
@ -19,8 +19,8 @@ use JKingWeb\Arsse\REST\TinyTinyRSS\API;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Laminas\Diactoros\Response\JsonResponse as Response;
|
use Laminas\Diactoros\Response\JsonResponse as Response;
|
||||||
use Laminas\Diactoros\Response\EmptyResponse;
|
use Laminas\Diactoros\Response\EmptyResponse;
|
||||||
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
|
|
||||||
|
|
||||||
|
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\API<extended>
|
||||||
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
|
* @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Exception */
|
||||||
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
protected const NOW = "2020-12-21T23:09:17.189065Z";
|
protected const NOW = "2020-12-21T23:09:17.189065Z";
|
||||||
|
@ -1317,7 +1317,7 @@ LONG_STRING;
|
||||||
// create a mock-current time
|
// create a mock-current time
|
||||||
\Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW));
|
\Phake::when(Arsse::$obj)->get(\DateTimeImmutable::class)->thenReturn(new \DateTimeImmutable(self::NOW));
|
||||||
// TT-RSS always responds the same regardless of success or failure
|
// TT-RSS always responds the same regardless of success or failure
|
||||||
$this->assertMessage($this->respGood(['status' => "OK"]), $this->req($in));
|
$this->assertMessage($this->respGood(['status' => "OK"]), $this->req($in));
|
||||||
if (isset($c)) {
|
if (isset($c)) {
|
||||||
\Phake::verify(Arsse::$db)->articleMark(Arsse::$user->id, ['read' => true], $c);
|
\Phake::verify(Arsse::$db)->articleMark(Arsse::$user->id, ['read' => true], $c);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue