mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Style fixes
This commit is contained in:
parent
a7f69c845f
commit
bc53a2d24a
89 changed files with 1638 additions and 1664 deletions
|
@ -3,6 +3,7 @@
|
|||
* Copyright 2017 J. King, Dustin Wilson et al.
|
||||
* See LICENSE and AUTHORS files for details */
|
||||
|
||||
declare(strict_types=1);
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
const BASE = __DIR__.DIRECTORY_SEPARATOR;
|
||||
|
@ -13,7 +14,6 @@ ignore_user_abort(true);
|
|||
ini_set("memory_limit", "-1");
|
||||
ini_set("max_execution_time", "0");
|
||||
|
||||
|
||||
if (\PHP_SAPI === "cli") {
|
||||
// initialize the CLI; this automatically handles --help and --version
|
||||
$cli = new CLI;
|
||||
|
|
|
@ -379,7 +379,7 @@ class Database {
|
|||
$max = Date::add(Arsse::$conf->userSessionTimeout, $now)->getTimestamp();
|
||||
$diff = intdiv($max - $now, 2);
|
||||
// determine if the expiry time is less than half the session timeout into the future
|
||||
return (($now + $diff) >= $expiry->getTimestamp());
|
||||
return ($now + $diff) >= $expiry->getTimestamp();
|
||||
}
|
||||
|
||||
/** Creates a new token for the given user in the given class
|
||||
|
@ -587,7 +587,7 @@ class Database {
|
|||
'name' => "str",
|
||||
'parent' => "int",
|
||||
];
|
||||
list($setClause, $setTypes, $setValues) = $this->generateSet($in, $valid);
|
||||
[$setClause, $setTypes, $setValues] = $this->generateSet($in, $valid);
|
||||
return (bool) $this->db->prepare("UPDATE arsse_folders set $setClause, modified = CURRENT_TIMESTAMP where owner = ? and id = ?", $setTypes, "str", "int")->run($setValues, $user, $id)->changes();
|
||||
}
|
||||
|
||||
|
@ -881,7 +881,7 @@ class Database {
|
|||
'order_type' => "strict int",
|
||||
'pinned' => "strict bool",
|
||||
];
|
||||
list($setClause, $setTypes, $setValues) = $this->generateSet($data, $valid);
|
||||
[$setClause, $setTypes, $setValues] = $this->generateSet($data, $valid);
|
||||
if (!$setClause) {
|
||||
// if no changes would actually be applied, just return
|
||||
return false;
|
||||
|
@ -1220,10 +1220,10 @@ class Database {
|
|||
*/
|
||||
public function feedMatchIds(int $feedID, array $ids = [], array $hashesUT = [], array $hashesUC = [], array $hashesTC = []): Db\Result {
|
||||
// compile SQL IN() clauses and necessary type bindings for the four identifier lists
|
||||
list($cId, $tId, $vId) = $this->generateIn($ids, "str");
|
||||
list($cHashUT, $tHashUT, $vHashUT) = $this->generateIn($hashesUT, "str");
|
||||
list($cHashUC, $tHashUC, $vHashUC) = $this->generateIn($hashesUC, "str");
|
||||
list($cHashTC, $tHashTC, $vHashTC) = $this->generateIn($hashesTC, "str");
|
||||
[$cId, $tId, $vId] = $this->generateIn($ids, "str");
|
||||
[$cHashUT, $tHashUT, $vHashUT] = $this->generateIn($hashesUT, "str");
|
||||
[$cHashUC, $tHashUC, $vHashUC] = $this->generateIn($hashesUC, "str");
|
||||
[$cHashTC, $tHashTC, $vHashTC] = $this->generateIn($hashesTC, "str");
|
||||
// perform the query
|
||||
return $articles = $this->db->prepare(
|
||||
"SELECT id, edited, guid, url_title_hash, url_content_hash, title_content_hash FROM arsse_articles WHERE feed = ? and (guid in($cId) or url_title_hash in($cHashUT) or url_content_hash in($cHashUC) or title_content_hash in($cHashTC))",
|
||||
|
@ -1359,7 +1359,7 @@ class Database {
|
|||
"unread" => ["unread", "=", "bool", ""],
|
||||
"starred" => ["starred", "=", "bool", ""],
|
||||
];
|
||||
foreach ($options as $m => list($col, $op, $type, $pair)) {
|
||||
foreach ($options as $m => [$col, $op, $type, $pair]) {
|
||||
if (!$context->$m()) {
|
||||
// context is not being used
|
||||
continue;
|
||||
|
@ -1368,7 +1368,7 @@ class Database {
|
|||
if (!$context->$m) {
|
||||
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]); // must have at least one array element
|
||||
}
|
||||
list($clause, $types, $values) = $this->generateIn($context->$m, $type);
|
||||
[$clause, $types, $values] = $this->generateIn($context->$m, $type);
|
||||
$q->setWhere("{$colDefs[$col]} $op ($clause)", $types, $values);
|
||||
} elseif ($pair && $context->$pair()) {
|
||||
// option is paired with another which is also being used
|
||||
|
@ -1383,7 +1383,7 @@ class Database {
|
|||
}
|
||||
}
|
||||
// further handle exclusionary options if specified
|
||||
foreach ($options as $m => list($col, $op, $type, $pair)) {
|
||||
foreach ($options as $m => [$col, $op, $type, $pair]) {
|
||||
if (!method_exists($context->not, $m) || !$context->not->$m()) {
|
||||
// context option is not being used
|
||||
continue;
|
||||
|
@ -1392,7 +1392,7 @@ class Database {
|
|||
// for exclusions we don't care if the array is empty
|
||||
continue;
|
||||
}
|
||||
list($clause, $types, $values) = $this->generateIn($context->not->$m, $type);
|
||||
[$clause, $types, $values] = $this->generateIn($context->not->$m, $type);
|
||||
$q->setWhereNot("{$colDefs[$col]} $op ($clause)", $types, $values);
|
||||
} elseif ($pair && $context->not->$pair()) {
|
||||
// option is paired with another which is also being used
|
||||
|
@ -1452,7 +1452,7 @@ class Database {
|
|||
throw new Db\ExceptionInput("tooShort", ['field' => $m, 'action' => $this->caller(), 'min' => 1]); // must have at least one array element
|
||||
}
|
||||
if ($multi) {
|
||||
list($test, $types, $values) = $this->generateIn($context->$m, $named ? "str" : "int");
|
||||
[$test, $types, $values] = $this->generateIn($context->$m, $named ? "str" : "int");
|
||||
$test = "in ($test)";
|
||||
} else {
|
||||
$test = "= ?";
|
||||
|
@ -1464,7 +1464,7 @@ class Database {
|
|||
if ($context->not->$m()) {
|
||||
$seen = true;
|
||||
if ($multi) {
|
||||
list($test, $types, $values) = $this->generateIn($context->not->$m, $named ? "str" : "int");
|
||||
[$test, $types, $values] = $this->generateIn($context->not->$m, $named ? "str" : "int");
|
||||
$test = "in ($test)";
|
||||
} else {
|
||||
$test = "= ?";
|
||||
|
@ -1496,7 +1496,7 @@ class Database {
|
|||
$q->setWhere("coalesce(arsse_subscriptions.folder,0) in (select folder from folders)");
|
||||
}
|
||||
if ($context->folders()) {
|
||||
list($inClause, $inTypes, $inValues) = $this->generateIn($context->folders, "int");
|
||||
[$inClause, $inTypes, $inValues] = $this->generateIn($context->folders, "int");
|
||||
// add a common table expression to list the folders and their children so that we select from the entire subtree
|
||||
$q->setCTE("folders_multi(folder)", "SELECT id as folder from (select id from (select 0 as id union select id from arsse_folders where owner = ?) as f where id in ($inClause)) as folders_multi union select id from arsse_folders join folders_multi on coalesce(parent,0) = folder", ["str", $inTypes], [$user, $inValues]);
|
||||
// limit subscriptions to the listed folders
|
||||
|
@ -1509,7 +1509,7 @@ class Database {
|
|||
$q->setWhereNot("coalesce(arsse_subscriptions.folder,0) in (select folder from folders_excluded)");
|
||||
}
|
||||
if ($context->not->folders()) {
|
||||
list($inClause, $inTypes, $inValues) = $this->generateIn($context->not->folders, "int");
|
||||
[$inClause, $inTypes, $inValues] = $this->generateIn($context->not->folders, "int");
|
||||
// add a common table expression to list the folders and their children so that we select from the entire subtree
|
||||
$q->setCTE("folders_multi_excluded(folder)", "SELECT id as folder from (select id from (select 0 as id union select id from arsse_folders where owner = ?) as f where id in ($inClause)) as folders_multi_excluded union select id from arsse_folders join folders_multi_excluded on coalesce(parent,0) = folder", ["str", $inTypes], [$user, $inValues]);
|
||||
// limit subscriptions to the listed folders
|
||||
|
@ -1664,7 +1664,7 @@ class Database {
|
|||
$data = array_filter($data, function($v) {
|
||||
return isset($v);
|
||||
});
|
||||
list($set, $setTypes, $setValues) = $this->generateSet($data, ['starred' => "bool", 'note' => "str"]);
|
||||
[$set, $setTypes, $setValues] = $this->generateSet($data, ['starred' => "bool", 'note' => "str"]);
|
||||
$q->setBody("UPDATE arsse_marks set touched = 1, $set where article in(select article from target_articles) and subscription in(select distinct subscription from target_articles)", $setTypes, $setValues);
|
||||
$this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());
|
||||
}
|
||||
|
@ -1688,7 +1688,7 @@ class Database {
|
|||
$data = array_filter($data, function($v) {
|
||||
return isset($v);
|
||||
});
|
||||
list($set, $setTypes, $setValues) = $this->generateSet($data, ['read' => "bool", 'starred' => "bool", 'note' => "str"]);
|
||||
[$set, $setTypes, $setValues] = $this->generateSet($data, ['read' => "bool", 'starred' => "bool", 'note' => "str"]);
|
||||
$q->setBody("UPDATE arsse_marks set $set, modified = CURRENT_TIMESTAMP where article in(select article from target_articles) and subscription in(select distinct subscription from target_articles)", $setTypes, $setValues);
|
||||
$out = $this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues())->changes();
|
||||
}
|
||||
|
@ -1860,7 +1860,7 @@ class Database {
|
|||
public function editionArticle(int ...$edition): array {
|
||||
$out = [];
|
||||
$context = (new Context)->editions($edition);
|
||||
list($in, $inTypes, $inValues) = $this->generateIn($context->editions, "int");
|
||||
[$in, $inTypes, $inValues] = $this->generateIn($context->editions, "int");
|
||||
$out = $this->db->prepare("SELECT id as edition, article from arsse_editions where id in($in)", $inTypes)->run($inValues)->getAll();
|
||||
return $out ? array_combine(array_column($out, "edition"), array_column($out, "article")) : [];
|
||||
}
|
||||
|
@ -2018,7 +2018,7 @@ class Database {
|
|||
$valid = [
|
||||
'name' => "str",
|
||||
];
|
||||
list($setClause, $setTypes, $setValues) = $this->generateSet($data, $valid);
|
||||
[$setClause, $setTypes, $setValues] = $this->generateSet($data, $valid);
|
||||
if (!$setClause) {
|
||||
// if no changes would actually be applied, just return
|
||||
return false;
|
||||
|
@ -2086,7 +2086,7 @@ class Database {
|
|||
$articles = array_column($articles, "id");
|
||||
}
|
||||
// prepare up to three queries: removing requires one, adding two, and replacing three
|
||||
list($inClause, $inTypes, $inValues) = $this->generateIn($articles, "int");
|
||||
[$inClause, $inTypes, $inValues] = $this->generateIn($articles, "int");
|
||||
$updateQ = "UPDATE arsse_label_members set assigned = ?, modified = CURRENT_TIMESTAMP where label = ? and assigned <> ? and article %in% ($inClause)";
|
||||
$updateT = ["bool", "int", "bool", $inTypes];
|
||||
$insertQ = "INSERT INTO arsse_label_members(label,article,subscription) SELECT ?,a.id,s.id from arsse_articles as a join arsse_subscriptions as s on a.feed = s.feed where s.owner = ? and a.id not in (select article from arsse_label_members where label = ?) and a.id in ($inClause)";
|
||||
|
@ -2112,7 +2112,7 @@ class Database {
|
|||
// execute them in a transaction
|
||||
$out = 0;
|
||||
$tr = $this->begin();
|
||||
foreach ($qList as list($q, $t, $v)) {
|
||||
foreach ($qList as [$q, $t, $v]) {
|
||||
$out += $this->db->prepare($q, ...$t)->run(...$v)->changes();
|
||||
}
|
||||
$tr->commit();
|
||||
|
@ -2321,7 +2321,7 @@ class Database {
|
|||
$valid = [
|
||||
'name' => "str",
|
||||
];
|
||||
list($setClause, $setTypes, $setValues) = $this->generateSet($data, $valid);
|
||||
[$setClause, $setTypes, $setValues] = $this->generateSet($data, $valid);
|
||||
if (!$setClause) {
|
||||
// if no changes would actually be applied, just return
|
||||
return false;
|
||||
|
@ -2385,7 +2385,7 @@ class Database {
|
|||
}
|
||||
}
|
||||
// prepare up to three queries: removing requires one, adding two, and replacing three
|
||||
list($inClause, $inTypes, $inValues) = $this->generateIn($subscriptions, "int");
|
||||
[$inClause, $inTypes, $inValues] = $this->generateIn($subscriptions, "int");
|
||||
$updateQ = "UPDATE arsse_tag_members set assigned = ?, modified = CURRENT_TIMESTAMP where tag = ? and assigned <> ? and subscription in (select id from arsse_subscriptions where owner = ? and id %in% ($inClause))";
|
||||
$updateT = ["bool", "int", "bool", "str", $inTypes];
|
||||
$insertQ = "INSERT INTO arsse_tag_members(tag,subscription) SELECT ?,id from arsse_subscriptions where id not in (select subscription from arsse_tag_members where tag = ?) and owner = ? and id in ($inClause)";
|
||||
|
@ -2411,7 +2411,7 @@ class Database {
|
|||
// execute them in a transaction
|
||||
$out = 0;
|
||||
$tr = $this->begin();
|
||||
foreach ($qList as list($q, $t, $v)) {
|
||||
foreach ($qList as [$q, $t, $v]) {
|
||||
$out += $this->db->prepare($q, ...$t)->run(...$v)->changes();
|
||||
}
|
||||
$tr->commit();
|
||||
|
|
|
@ -163,7 +163,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
$this->db->options(\MYSQLI_OPT_CONNECT_TIMEOUT, ceil(Arsse::$conf->dbTimeoutConnect));
|
||||
@$this->db->real_connect($host, $user, $password, $db, $port, $socket);
|
||||
if ($this->db->connect_errno) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildConnectionException($this->db->connect_errno, $this->db->connect_error);
|
||||
[$excClass, $excMsg, $excData] = $this->buildConnectionException($this->db->connect_errno, $this->db->connect_error);
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
$this->db->set_charset("utf8mb4");
|
||||
|
@ -184,9 +184,9 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
do {
|
||||
if ($this->db->sqlstate !== "00000") {
|
||||
if ($this->db->sqlstate === "HY000") {
|
||||
list($excClass, $excMsg, $excData) = $this->buildEngineException($this->db->errno, $this->db->error);
|
||||
[$excClass, $excMsg, $excData] = $this->buildEngineException($this->db->errno, $this->db->error);
|
||||
} else {
|
||||
list($excClass, $excMsg, $excData) = $this->buildStandardException($this->db->sqlstate, $this->db->error);
|
||||
[$excClass, $excMsg, $excData] = $this->buildStandardException($this->db->sqlstate, $this->db->error);
|
||||
}
|
||||
$e = new $excClass($excMsg, $excData, $e);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class PDODriver extends Driver {
|
|||
$msg = $e->getMessage();
|
||||
$code = (int) substr($msg, 17, 4);
|
||||
$msg = substr($msg, 23);
|
||||
list($excClass, $excMsg, $excData) = $this->buildConnectionException($code, $msg);
|
||||
[$excClass, $excMsg, $excData] = $this->buildConnectionException($code, $msg);
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,6 +44,6 @@ class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
|||
|
||||
public function valid() {
|
||||
$this->cur = $this->set ? $this->set->fetch_assoc() : null;
|
||||
return ($this->cur !== null);
|
||||
return $this->cur !== null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
|||
protected function prepare(string $query): bool {
|
||||
$this->st = $this->db->prepare($query);
|
||||
if (!$this->st) { // @codeCoverageIgnore
|
||||
list($excClass, $excMsg, $excData) = $this->buildEngineException($this->db->errno, $this->db->error); // @codeCoverageIgnore
|
||||
[$excClass, $excMsg, $excData] = $this->buildEngineException($this->db->errno, $this->db->error); // @codeCoverageIgnore
|
||||
throw new $excClass($excMsg, $excData); // @codeCoverageIgnore
|
||||
}
|
||||
return true;
|
||||
|
@ -76,9 +76,9 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
|||
// check for errors
|
||||
if ($this->st->sqlstate !== "00000") {
|
||||
if ($this->st->sqlstate === "HY000") {
|
||||
list($excClass, $excMsg, $excData) = $this->buildEngineException($this->st->errno, $this->st->error);
|
||||
[$excClass, $excMsg, $excData] = $this->buildEngineException($this->st->errno, $this->st->error);
|
||||
} else {
|
||||
list($excClass, $excMsg, $excData) = $this->buildStandardException($this->st->sqlstate, $this->st->error);
|
||||
[$excClass, $excMsg, $excData] = $this->buildStandardException($this->st->sqlstate, $this->st->error);
|
||||
}
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ trait PDODriver {
|
|||
$this->db->exec($query);
|
||||
return true;
|
||||
} catch (\PDOException $e) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildPDOException();
|
||||
[$excClass, $excMsg, $excData] = $this->buildPDOException();
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ trait PDODriver {
|
|||
try {
|
||||
$r = $this->db->query($query);
|
||||
} catch (\PDOException $e) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildPDOException();
|
||||
[$excClass, $excMsg, $excData] = $this->buildPDOException();
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
return new PDOResult($this->db, $r);
|
||||
|
|
|
@ -45,6 +45,6 @@ class PDOResult extends AbstractResult {
|
|||
|
||||
public function valid() {
|
||||
$this->cur = $this->set->fetch(\PDO::FETCH_ASSOC);
|
||||
return ($this->cur !== false);
|
||||
return $this->cur !== false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ abstract class PDOStatement extends AbstractStatement {
|
|||
$this->st = $this->db->prepare($query);
|
||||
return true;
|
||||
} catch (\PDOException $e) { // @codeCoverageIgnore
|
||||
list($excClass, $excMsg, $excData) = $this->buildPDOException(); // @codeCoverageIgnore
|
||||
[$excClass, $excMsg, $excData] = $this->buildPDOException(); // @codeCoverageIgnore
|
||||
throw new $excClass($excMsg, $excData); // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ abstract class PDOStatement extends AbstractStatement {
|
|||
try {
|
||||
$this->st->execute();
|
||||
} catch (\PDOException $e) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildPDOException(true);
|
||||
[$excClass, $excMsg, $excData] = $this->buildPDOException(true);
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
return new PDOResult($this->db, $this->st);
|
||||
|
|
|
@ -198,7 +198,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
pg_send_query($this->db, $query);
|
||||
while ($result = pg_get_result($this->db)) {
|
||||
if (($code = pg_result_error_field($result, \PGSQL_DIAG_SQLSTATE)) && isset($code) && $code) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildStandardException($code, pg_result_error($result));
|
||||
[$excClass, $excMsg, $excData] = $this->buildStandardException($code, pg_result_error($result));
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
if (is_resource($r)) {
|
||||
return new Result($this->db, $r);
|
||||
} else {
|
||||
list($excClass, $excMsg, $excData) = $r;
|
||||
[$excClass, $excMsg, $excData] = $r;
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ class PDODriver extends Driver {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static function driverName(): string {
|
||||
return Arsse::$lang->msg("Driver.Db.PostgreSQLPDO.Name");
|
||||
}
|
||||
|
|
|
@ -41,6 +41,6 @@ class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
|||
|
||||
public function valid() {
|
||||
$this->cur = pg_fetch_row($this->r, null, \PGSQL_ASSOC);
|
||||
return ($this->cur !== false);
|
||||
return $this->cur !== false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
|||
if (is_resource($r)) {
|
||||
return new Result($this->db, $r);
|
||||
} else {
|
||||
list($excClass, $excMsg, $excData) = $r;
|
||||
[$excClass, $excMsg, $excData] = $r;
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
declare(strict_types=1);
|
||||
namespace JKingWeb\Arsse\Db;
|
||||
|
||||
use JKingWeb\Arsse\Db\Exception;
|
||||
use JKingWeb\Arsse\Db\ExceptionInput;
|
||||
use JKingWeb\Arsse\Db\ExceptionTimeout;
|
||||
|
||||
trait SQLState {
|
||||
protected static function buildStandardException(string $code, string $msg): array {
|
||||
switch ($code) {
|
||||
|
|
|
@ -98,7 +98,6 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static function driverName(): string {
|
||||
return Arsse::$lang->msg("Driver.Db.SQLite3.Name");
|
||||
}
|
||||
|
@ -146,7 +145,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
try {
|
||||
return (bool) $this->db->exec($query);
|
||||
} catch (\Exception $e) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildException();
|
||||
[$excClass, $excMsg, $excData] = $this->buildException();
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +154,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
try {
|
||||
$r = $this->db->query($query);
|
||||
} catch (\Exception $e) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildException();
|
||||
[$excClass, $excMsg, $excData] = $this->buildException();
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
$changes = $this->db->changes();
|
||||
|
|
|
@ -37,7 +37,6 @@ class PDODriver extends AbstractPDODriver {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static function driverName(): string {
|
||||
return Arsse::$lang->msg("Driver.Db.SQLite3PDO.Name");
|
||||
}
|
||||
|
|
|
@ -44,6 +44,6 @@ class Result extends \JKingWeb\Arsse\Db\AbstractResult {
|
|||
|
||||
public function valid() {
|
||||
$this->cur = $this->set->fetchArray(\SQLITE3_ASSOC);
|
||||
return ($this->cur !== false);
|
||||
return $this->cur !== false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
|||
$this->st = $this->db->prepare($query);
|
||||
return true;
|
||||
} catch (\Exception $e) { // @codeCoverageIgnore
|
||||
list($excClass, $excMsg, $excData) = $this->buildException(); // @codeCoverageIgnore
|
||||
[$excClass, $excMsg, $excData] = $this->buildException(); // @codeCoverageIgnore
|
||||
throw new $excClass($excMsg, $excData); // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
|||
try {
|
||||
$r = $this->st->execute();
|
||||
} catch (\Exception $e) {
|
||||
list($excClass, $excMsg, $excData) = $this->buildException();
|
||||
[$excClass, $excMsg, $excData] = $this->buildException();
|
||||
throw new $excClass($excMsg, $excData);
|
||||
}
|
||||
$changes = $this->db->changes();
|
||||
|
|
|
@ -259,7 +259,7 @@ class Feed {
|
|||
// get as many of the latest articles in the database as there are in the feed
|
||||
$articles = Arsse::$db->feedMatchLatest($feedID, sizeof($items))->getAll();
|
||||
// perform a first pass matching the latest articles against items in the feed
|
||||
list($this->newItems, $this->changedItems) = $this->matchItems($items, $articles);
|
||||
[$this->newItems, $this->changedItems] = $this->matchItems($items, $articles);
|
||||
if (sizeof($this->newItems) && sizeof($items) <= sizeof($articles)) {
|
||||
// if we need to, perform a second pass on the database looking specifically for IDs and hashes of the new items
|
||||
$ids = $hashesUT = $hashesUC = $hashesTC = [];
|
||||
|
@ -278,7 +278,7 @@ class Feed {
|
|||
}
|
||||
}
|
||||
$articles = Arsse::$db->feedMatchIds($feedID, $ids, $hashesUT, $hashesUC, $hashesTC)->getAll();
|
||||
list($this->newItems, $changed) = $this->matchItems($this->newItems, $articles);
|
||||
[$this->newItems, $changed] = $this->matchItems($this->newItems, $articles);
|
||||
// merge the two change-lists, preserving keys
|
||||
$this->changedItems = array_combine(array_merge(array_keys($this->changedItems), array_keys($changed)), array_merge($this->changedItems, $changed));
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ abstract class AbstractImportExport {
|
|||
throw new UserException("doesNotExist", ["action" => __FUNCTION__, "user" => $user]);
|
||||
}
|
||||
// first extract useful information from the input
|
||||
list($feeds, $folders) = $this->parse($data, $flat);
|
||||
[$feeds, $folders] = $this->parse($data, $flat);
|
||||
$folderMap = [];
|
||||
foreach ($folders as $f) {
|
||||
// check to make sure folder names are all valid
|
||||
|
|
|
@ -24,7 +24,6 @@ class Query {
|
|||
protected $limit = 0;
|
||||
protected $offset = 0;
|
||||
|
||||
|
||||
public function __construct(string $body = "", $types = null, $values = null) {
|
||||
$this->setBody($body, $types, $values);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
declare(strict_types=1);
|
||||
namespace JKingWeb\Arsse;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
use JKingWeb\Arsse\Misc\URL;
|
||||
use Psr\Http\Message\RequestInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
@ -71,7 +70,7 @@ class REST {
|
|||
$req = $req ?? ServerRequestFactory::fromGlobals();
|
||||
// find the API to handle
|
||||
try {
|
||||
list($api, $target, $class) = $this->apiMatch($req->getRequestTarget(), $this->apis);
|
||||
[$api, $target, $class] = $this->apiMatch($req->getRequestTarget(), $this->apis);
|
||||
// authenticate the request pre-emptively
|
||||
$req = $this->authenticateRequest($req);
|
||||
// modify the request to have an uppercase method and a stripped target
|
||||
|
|
|
@ -688,7 +688,7 @@ class V1_2 extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
'warnings' => [
|
||||
'improperlyConfiguredCron' => !Service::hasCheckedIn(),
|
||||
'incorrectDbCharset' => !Arsse::$db->driverCharsetAcceptable(),
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class Versions implements \JKingWeb\Arsse\REST\Handler {
|
|||
$out = [
|
||||
'apiLevels' => [
|
||||
'v1-2',
|
||||
]
|
||||
],
|
||||
];
|
||||
return new Response($out);
|
||||
default:
|
||||
|
|
|
@ -199,7 +199,7 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
}
|
||||
return [
|
||||
'session_id' => $id,
|
||||
'api_level' => self::LEVEL
|
||||
'api_level' => self::LEVEL,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -940,11 +940,11 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
return (abs($id) - self::LABEL_OFFSET);
|
||||
return abs($id) - self::LABEL_OFFSET;
|
||||
}
|
||||
|
||||
protected function labelOut($id): int {
|
||||
return ((int) $id * -1 - self::LABEL_OFFSET);
|
||||
return (int) $id * -1 - self::LABEL_OFFSET;
|
||||
}
|
||||
|
||||
public function opGetLabels(array $data): array {
|
||||
|
|
|
@ -66,7 +66,7 @@ class Service {
|
|||
$limit->sub($int);
|
||||
$limit->sub($int);
|
||||
// return whether the check-in time is within the acceptable limit
|
||||
return ($checkin >= $limit);
|
||||
return $checkin >= $limit;
|
||||
}
|
||||
|
||||
public static function cleanupPre(): bool {
|
||||
|
|
|
@ -15,9 +15,7 @@ class User {
|
|||
|
||||
public $id = null;
|
||||
|
||||
/**
|
||||
* @var User\Driver
|
||||
*/
|
||||
/** @var User\Driver */
|
||||
protected $u;
|
||||
|
||||
public function __construct(\JKingWeb\Arsse\User\Driver $driver = null) {
|
||||
|
|
|
@ -163,10 +163,10 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead
|
||||
Arsse::$user = $this->createMock(User::class);
|
||||
Arsse::$user->method("auth")->will($this->returnCallback(function($user, $pass) {
|
||||
return (
|
||||
return
|
||||
($user === "john.doe@example.com" && $pass === "secret") ||
|
||||
($user === "jane.doe@example.com" && $pass === "superman")
|
||||
);
|
||||
;
|
||||
}));
|
||||
$fever = \Phake::mock(FeverUser::class);
|
||||
\Phake::when($fever)->authenticate->thenReturn(false);
|
||||
|
|
|
@ -47,7 +47,7 @@ trait SeriesArticle {
|
|||
[11,"http://example.com/11", "Feed 11"],
|
||||
[12,"http://example.com/12", "Feed 12"],
|
||||
[13,"http://example.com/13", "Feed 13"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_folders' => [
|
||||
'columns' => [
|
||||
|
@ -66,7 +66,7 @@ trait SeriesArticle {
|
|||
[7, "john.doe@example.net", null, "Technology"],
|
||||
[8, "john.doe@example.net", 7, "Software"],
|
||||
[9, "john.doe@example.net", null, "Politics"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_tags' => [
|
||||
'columns' => [
|
||||
|
@ -83,7 +83,7 @@ trait SeriesArticle {
|
|||
[6, "john.doe@example.net", "Technology"],
|
||||
[7, "john.doe@example.net", "Software"],
|
||||
[8, "john.doe@example.net", "Politics"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -108,7 +108,7 @@ trait SeriesArticle {
|
|||
[12,"john.doe@example.net",2, 9,null],
|
||||
[13,"john.doe@example.net",3, 8,"Subscription 13"],
|
||||
[14,"john.doe@example.net",4, 7,null],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_tag_members' => [
|
||||
'columns' => [
|
||||
|
@ -171,7 +171,7 @@ trait SeriesArticle {
|
|||
[103,12,'http://example.com/3','Article title 3','','2000-01-03 00:00:00','2000-01-03 00:00:03','<p>Article content 3</p>','31a6594500a48b59fcc8a075ce82b946c9c3c782460d088bd7b8ef3ede97ad92','f74b06b240bd08abf4d3fdfc20dba6a6f6eb8b4f1a00e9a617efd63a87180a4b','b278380e984cefe63f0e412b88ffc9cb0befdfa06fdc00bace1da99a8daff406','ad622b31e739cd3a3f3c788991082cf4d2f7a8773773008e75f0572e58cd373b','2000-01-03 03:00:00'],
|
||||
[104,12,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:04','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9','2000-01-04 04:00:00'],
|
||||
[105,13,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:05','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba','2000-01-05 05:00:00'],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_enclosures' => [
|
||||
'columns' => [
|
||||
|
@ -185,7 +185,7 @@ trait SeriesArticle {
|
|||
[104,"http://example.com/image","image/svg+xml"],
|
||||
[105,"http://example.com/audio","audio/ogg"],
|
||||
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_editions' => [
|
||||
'columns' => [
|
||||
|
@ -224,7 +224,7 @@ trait SeriesArticle {
|
|||
[205,105],
|
||||
[305,105],
|
||||
[1001,20],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_marks' => [
|
||||
'columns' => [
|
||||
|
@ -249,7 +249,7 @@ trait SeriesArticle {
|
|||
[12, 3,0,1,'2017-01-01 00:00:00','ack'],
|
||||
[12, 4,1,1,'2017-01-01 00:00:00','ach'],
|
||||
[1, 2,0,0,'2010-01-01 00:00:00','Some Note'],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_categories' => [ // author-supplied categories
|
||||
'columns' => [
|
||||
|
@ -404,7 +404,7 @@ trait SeriesArticle {
|
|||
"content", "media_url", "media_type",
|
||||
"note",
|
||||
];
|
||||
$this->checkTables = ['arsse_marks' => ["subscription","article","read","starred","modified","note"],];
|
||||
$this->checkTables = ['arsse_marks' => ["subscription","article","read","starred","modified","note"]];
|
||||
$this->user = "john.doe@example.net";
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ trait SeriesCleanup {
|
|||
[2,"http://example.com/2","",$yesterday,0],
|
||||
[3,"http://example.com/3","",null,0],
|
||||
[4,"http://example.com/4","",$nowish,0],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -89,7 +89,7 @@ trait SeriesCleanup {
|
|||
[1,'jane.doe@example.com',1],
|
||||
// other subscriptions exist for article cleanup tests
|
||||
[2,'john.doe@example.com',1],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_articles' => [
|
||||
'columns' => [
|
||||
|
@ -110,7 +110,7 @@ trait SeriesCleanup {
|
|||
[7,1,"","","",$weeksago], // meets the unread threshold without marks, thus is deleted
|
||||
[8,1,"","","",$weeksago], // meets the unread threshold even with marks, thus is deleted
|
||||
[9,1,"","","",$weeksago], // meets the read threshold, thus is deleted
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_editions' => [
|
||||
'columns' => [
|
||||
|
@ -124,7 +124,7 @@ trait SeriesCleanup {
|
|||
[4,4],
|
||||
[201,1],
|
||||
[102,2],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_marks' => [
|
||||
'columns' => [
|
||||
|
@ -142,7 +142,7 @@ trait SeriesCleanup {
|
|||
[8,1,1,0,$weeksago],
|
||||
[9,1,1,0,$daysago],
|
||||
[9,2,1,0,$daysago],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ trait SeriesCleanup {
|
|||
Arsse::$db->feedCleanup();
|
||||
$now = gmdate("Y-m-d H:i:s");
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_feeds' => ["id","orphaned"]
|
||||
'arsse_feeds' => ["id","orphaned"],
|
||||
]);
|
||||
$state['arsse_feeds']['rows'][0][1] = null;
|
||||
unset($state['arsse_feeds']['rows'][1]);
|
||||
|
@ -170,7 +170,7 @@ trait SeriesCleanup {
|
|||
Arsse::$db->feedCleanup();
|
||||
$now = gmdate("Y-m-d H:i:s");
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_feeds' => ["id","orphaned"]
|
||||
'arsse_feeds' => ["id","orphaned"],
|
||||
]);
|
||||
$state['arsse_feeds']['rows'][0][1] = null;
|
||||
$state['arsse_feeds']['rows'][2][1] = $now;
|
||||
|
@ -180,7 +180,7 @@ trait SeriesCleanup {
|
|||
public function testCleanUpOldArticlesWithStandardRetention(): void {
|
||||
Arsse::$db->articleCleanup();
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_articles' => ["id"]
|
||||
'arsse_articles' => ["id"],
|
||||
]);
|
||||
foreach ([7,8,9] as $id) {
|
||||
unset($state['arsse_articles']['rows'][$id - 1]);
|
||||
|
@ -194,7 +194,7 @@ trait SeriesCleanup {
|
|||
]);
|
||||
Arsse::$db->articleCleanup();
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_articles' => ["id"]
|
||||
'arsse_articles' => ["id"],
|
||||
]);
|
||||
foreach ([7,8] as $id) {
|
||||
unset($state['arsse_articles']['rows'][$id - 1]);
|
||||
|
@ -208,7 +208,7 @@ trait SeriesCleanup {
|
|||
]);
|
||||
Arsse::$db->articleCleanup();
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_articles' => ["id"]
|
||||
'arsse_articles' => ["id"],
|
||||
]);
|
||||
foreach ([9] as $id) {
|
||||
unset($state['arsse_articles']['rows'][$id - 1]);
|
||||
|
@ -223,7 +223,7 @@ trait SeriesCleanup {
|
|||
]);
|
||||
Arsse::$db->articleCleanup();
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_articles' => ["id"]
|
||||
'arsse_articles' => ["id"],
|
||||
]);
|
||||
$this->compareExpectations(static::$drv, $state);
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ trait SeriesCleanup {
|
|||
public function testCleanUpExpiredSessions(): void {
|
||||
Arsse::$db->sessionCleanup();
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_sessions' => ["id"]
|
||||
'arsse_sessions' => ["id"],
|
||||
]);
|
||||
foreach ([3,4,5] as $id) {
|
||||
unset($state['arsse_sessions']['rows'][$id - 1]);
|
||||
|
@ -242,7 +242,7 @@ trait SeriesCleanup {
|
|||
public function testCleanUpExpiredTokens(): void {
|
||||
Arsse::$db->tokenCleanup();
|
||||
$state = $this->primeExpectations($this->data, [
|
||||
'arsse_tokens' => ["id", "class"]
|
||||
'arsse_tokens' => ["id", "class"],
|
||||
]);
|
||||
foreach ([2] as $id) {
|
||||
unset($state['arsse_tokens']['rows'][$id - 1]);
|
||||
|
|
|
@ -42,7 +42,7 @@ trait SeriesFeed {
|
|||
[3,"http://localhost:8000/Feed/Fetching/Error?code=404","Ack",0,"",$past,$now,0],
|
||||
[4,"http://localhost:8000/Feed/NextFetch/NotModified?t=".time(),"Ooook",0,"",$past,$past,0],
|
||||
[5,"http://localhost:8000/Feed/Parsing/Valid","Ooook",0,"",$past,$future,0],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -57,7 +57,7 @@ trait SeriesFeed {
|
|||
[4,'john.doe@example.com',4],
|
||||
[5,'john.doe@example.com',5],
|
||||
[6,'jane.doe@example.com',1],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_articles' => [
|
||||
'columns' => [
|
||||
|
@ -83,7 +83,7 @@ trait SeriesFeed {
|
|||
[5,1,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:00','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba',$past],
|
||||
[6,2,'http://example.com/1','Article title 1','','2000-01-01 00:00:00','2000-01-01 00:00:00','<p>Article content 1</p>','e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda','f5cb8bfc1c7396dc9816af212a3e2ac5221585c2a00bf7ccb6aabd95dcfcd6a6','fb0bc8f8cb08913dc5a497db700e327f1d34e4987402687d494a5891f24714d4','18fdd4fa93d693128c43b004399e5c9cea6c261ddfa002518d3669f55d8c2207',$past],
|
||||
[7,5,'', '', '','2000-01-01 00:00:00','2000-01-01 00:00:00','', '205e986f4f8b3acfa281227beadb14f5e8c32c8dae4737f888c94c0df49c56f8','', '', '', $past],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_editions' => [
|
||||
'columns' => [
|
||||
|
@ -97,7 +97,7 @@ trait SeriesFeed {
|
|||
[3,3,$past],
|
||||
[4,4,$past],
|
||||
[5,5,$past],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_marks' => [
|
||||
'columns' => [
|
||||
|
@ -118,7 +118,7 @@ trait SeriesFeed {
|
|||
[1,1,1,0,$past],
|
||||
[3,1,1,0,$past],
|
||||
[4,1,0,1,$past],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_enclosures' => [
|
||||
'columns' => [
|
||||
|
@ -128,7 +128,7 @@ trait SeriesFeed {
|
|||
],
|
||||
'rows' => [
|
||||
[7,'http://example.com/png','image/png'],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_categories' => [
|
||||
'columns' => [
|
||||
|
@ -136,8 +136,8 @@ trait SeriesFeed {
|
|||
'name' => "str",
|
||||
],
|
||||
'rows' => [
|
||||
[7,'Syrinx']
|
||||
]
|
||||
[7,'Syrinx'],
|
||||
],
|
||||
],
|
||||
];
|
||||
$this->matches = [
|
||||
|
|
|
@ -45,7 +45,7 @@ trait SeriesFolder {
|
|||
[4, "jane.doe@example.com", null, "Politics"],
|
||||
[5, "john.doe@example.com", null, "Politics"],
|
||||
[6, "john.doe@example.com", 2, "Politics"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_feeds' => [
|
||||
'columns' => [
|
||||
|
@ -67,7 +67,7 @@ trait SeriesFolder {
|
|||
[11,"http://example.com/11", "Feed 11"],
|
||||
[12,"http://example.com/12", "Feed 12"],
|
||||
[13,"http://example.com/13", "Feed 13"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -88,7 +88,7 @@ trait SeriesFolder {
|
|||
[9, "jane.doe@example.com",2, 4],
|
||||
[10,"jane.doe@example.com",3, 4],
|
||||
[11,"jane.doe@example.com",4, 4],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ trait SeriesLabel {
|
|||
[7, "john.doe@example.net", null, "Technology"],
|
||||
[8, "john.doe@example.net", 7, "Software"],
|
||||
[9, "john.doe@example.net", null, "Politics"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_feeds' => [
|
||||
'columns' => [
|
||||
|
@ -63,7 +63,7 @@ trait SeriesLabel {
|
|||
[11,"http://example.com/11"],
|
||||
[12,"http://example.com/12"],
|
||||
[13,"http://example.com/13"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -87,7 +87,7 @@ trait SeriesLabel {
|
|||
[12,"john.doe@example.net",2,9],
|
||||
[13,"john.doe@example.net",3,8],
|
||||
[14,"john.doe@example.net",4,7],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_articles' => [
|
||||
'columns' => [
|
||||
|
@ -131,7 +131,7 @@ trait SeriesLabel {
|
|||
[103,12,'http://example.com/3','Article title 3','','2000-01-03 00:00:00','2000-01-03 00:00:03','<p>Article content 3</p>','31a6594500a48b59fcc8a075ce82b946c9c3c782460d088bd7b8ef3ede97ad92','f74b06b240bd08abf4d3fdfc20dba6a6f6eb8b4f1a00e9a617efd63a87180a4b','b278380e984cefe63f0e412b88ffc9cb0befdfa06fdc00bace1da99a8daff406','ad622b31e739cd3a3f3c788991082cf4d2f7a8773773008e75f0572e58cd373b','2000-01-03 03:00:00'],
|
||||
[104,12,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:04','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9','2000-01-04 04:00:00'],
|
||||
[105,13,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:05','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba','2000-01-05 05:00:00'],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_enclosures' => [
|
||||
'columns' => [
|
||||
|
@ -145,7 +145,7 @@ trait SeriesLabel {
|
|||
[104,"http://example.com/image","image/svg+xml"],
|
||||
[105,"http://example.com/audio","audio/ogg"],
|
||||
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_editions' => [
|
||||
'columns' => [
|
||||
|
@ -184,7 +184,7 @@ trait SeriesLabel {
|
|||
[205,105],
|
||||
[305,105],
|
||||
[1001,20],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_marks' => [
|
||||
'columns' => [
|
||||
|
@ -192,7 +192,7 @@ trait SeriesLabel {
|
|||
'article' => "int",
|
||||
'read' => "bool",
|
||||
'starred' => "bool",
|
||||
'modified' => "datetime"
|
||||
'modified' => "datetime",
|
||||
],
|
||||
'rows' => [
|
||||
[1, 1,1,1,'2000-01-01 00:00:00'],
|
||||
|
@ -207,7 +207,7 @@ trait SeriesLabel {
|
|||
[11, 20,1,0,'2017-01-01 00:00:00'],
|
||||
[12, 3,0,1,'2017-01-01 00:00:00'],
|
||||
[12, 4,1,1,'2017-01-01 00:00:00'],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_labels' => [
|
||||
'columns' => [
|
||||
|
|
|
@ -56,11 +56,11 @@ trait SeriesSession {
|
|||
public function testResumeAValidSession(): void {
|
||||
$exp1 = [
|
||||
'id' => "80fa94c1a11f11e78667001e673b2560",
|
||||
'user' => "jane.doe@example.com"
|
||||
'user' => "jane.doe@example.com",
|
||||
];
|
||||
$exp2 = [
|
||||
'id' => "da772f8fa13c11e78667001e673b2560",
|
||||
'user' => "john.doe@example.com"
|
||||
'user' => "john.doe@example.com",
|
||||
];
|
||||
$this->assertArraySubset($exp1, Arsse::$db->sessionResume("80fa94c1a11f11e78667001e673b2560"));
|
||||
$this->assertArraySubset($exp2, Arsse::$db->sessionResume("da772f8fa13c11e78667001e673b2560"));
|
||||
|
|
|
@ -38,7 +38,7 @@ trait SeriesSubscription {
|
|||
[4, "jane.doe@example.com", null, "Politics"],
|
||||
[5, "john.doe@example.com", null, "Politics"],
|
||||
[6, "john.doe@example.com", 2, "Politics"],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_feeds' => [
|
||||
'columns' => [
|
||||
|
@ -51,7 +51,7 @@ trait SeriesSubscription {
|
|||
'next_fetch' => "datetime",
|
||||
'favicon' => "str",
|
||||
],
|
||||
'rows' => [] // filled in the series setup
|
||||
'rows' => [], // filled in the series setup
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -67,7 +67,7 @@ trait SeriesSubscription {
|
|||
[1,"john.doe@example.com",2,null,null,1,2],
|
||||
[2,"jane.doe@example.com",2,null,null,0,0],
|
||||
[3,"john.doe@example.com",3,"Ook",2,0,1],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_tags' => [
|
||||
'columns' => [
|
||||
|
@ -113,7 +113,7 @@ trait SeriesSubscription {
|
|||
[6,3,"","",""],
|
||||
[7,3,"","",""],
|
||||
[8,3,"","",""],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_marks' => [
|
||||
'columns' => [
|
||||
|
@ -131,7 +131,7 @@ trait SeriesSubscription {
|
|||
[1,1,1,0],
|
||||
[7,3,1,0],
|
||||
[8,3,0,0],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
$this->data['arsse_feeds']['rows'] = [
|
||||
|
|
|
@ -44,7 +44,7 @@ trait SeriesTag {
|
|||
[11,"http://example.com/11",""],
|
||||
[12,"http://example.com/12",""],
|
||||
[13,"http://example.com/13",""],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_subscriptions' => [
|
||||
'columns' => [
|
||||
|
@ -68,7 +68,7 @@ trait SeriesTag {
|
|||
[12,"john.doe@example.net", 2,null],
|
||||
[13,"john.doe@example.net", 3,null],
|
||||
[14,"john.doe@example.net", 4,null],
|
||||
]
|
||||
],
|
||||
],
|
||||
'arsse_tags' => [
|
||||
'columns' => [
|
||||
|
|
|
@ -51,17 +51,17 @@ trait SeriesToken {
|
|||
$exp1 = [
|
||||
'id' => "80fa94c1a11f11e78667001e673b2560",
|
||||
'class' => "fever.login",
|
||||
'user' => "jane.doe@example.com"
|
||||
'user' => "jane.doe@example.com",
|
||||
];
|
||||
$exp2 = [
|
||||
'id' => "da772f8fa13c11e78667001e673b2560",
|
||||
'class' => "class.class",
|
||||
'user' => "john.doe@example.com"
|
||||
'user' => "john.doe@example.com",
|
||||
];
|
||||
$exp3 = [
|
||||
'id' => "ab3b3eb8a13311e78667001e673b2560",
|
||||
'class' => "class.class",
|
||||
'user' => "jane.doe@example.com"
|
||||
'user' => "jane.doe@example.com",
|
||||
];
|
||||
$this->assertArraySubset($exp1, Arsse::$db->tokenLookup("fever.login", "80fa94c1a11f11e78667001e673b2560"));
|
||||
$this->assertArraySubset($exp2, Arsse::$db->tokenLookup("class.class", "da772f8fa13c11e78667001e673b2560"));
|
||||
|
|
|
@ -265,7 +265,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
'DateTimeImmutable as strict datetime' => [$dateImmutable, "strict datetime", "'".$dateUTC->format("Y-m-d H:i:s")."'"],
|
||||
'DateTimeImmutable as strict boolean' => [$dateImmutable, "strict boolean", "1"],
|
||||
];
|
||||
foreach ($tests as $index => list($value, $type, $exp)) {
|
||||
foreach ($tests as $index => [$value, $type, $exp]) {
|
||||
$t = preg_replace("<^strict >", "", $type);
|
||||
$exp = ($exp === "null") ? $exp : $this->decorateTypeSyntax($exp, $t);
|
||||
yield $index => [$value, $type, $exp];
|
||||
|
@ -316,7 +316,7 @@ abstract class BaseStatement extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
'DateTimeImmutable as binary' => [$dateImmutable, "binary", "x'".bin2hex($dateUTC->format("Y-m-d H:i:s"))."'"],
|
||||
'DateTimeImmutable as strict binary' => [$dateImmutable, "strict binary", "x'".bin2hex($dateUTC->format("Y-m-d H:i:s"))."'"],
|
||||
];
|
||||
foreach ($tests as $index => list($value, $type, $exp)) {
|
||||
foreach ($tests as $index => [$value, $type, $exp]) {
|
||||
$t = preg_replace("<^strict >", "", $type);
|
||||
$exp = ($exp === "null") ? $exp : $this->decorateTypeSyntax($exp, $t);
|
||||
yield $index => [$value, $type, $exp];
|
||||
|
|
|
@ -130,7 +130,7 @@ class TestException extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
408 => "timeout",
|
||||
410 => "invalidUrl",
|
||||
414 => "invalidUrl",
|
||||
451 => "invalidUrl"
|
||||
451 => "invalidUrl",
|
||||
];
|
||||
$out = array_fill(400, (600 - 400), "transmissionError");
|
||||
foreach ($specials as $k => $t) {
|
||||
|
|
|
@ -7,7 +7,6 @@ declare(strict_types=1);
|
|||
namespace JKingWeb\Arsse\TestCase\Misc;
|
||||
|
||||
use JKingWeb\Arsse\Misc\HTTP;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/** @covers \JKingWeb\Arsse\Misc\HTTP */
|
||||
class TestHTTP extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
|
|
|
@ -7,7 +7,6 @@ declare(strict_types=1);
|
|||
namespace JKingWeb\Arsse\TestCase\Misc;
|
||||
|
||||
use JKingWeb\Arsse\Misc\Query;
|
||||
use JKingWeb\Arsse\Misc\ValueInfo;
|
||||
|
||||
/** @covers \JKingWeb\Arsse\Misc\Query */
|
||||
class TestQuery extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
|
|
|
@ -87,7 +87,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[" 1 ", I::VALID],
|
||||
];
|
||||
foreach ($tests as $test) {
|
||||
list($value, $exp) = $test;
|
||||
[$value, $exp] = $test;
|
||||
$this->assertSame($exp, I::int($value), "Test returned ".decbin(I::int($value))." for value: ".var_export($value, true));
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[new StrClass(" "), I::VALID | I::WHITE],
|
||||
];
|
||||
foreach ($tests as $test) {
|
||||
list($value, $exp) = $test;
|
||||
[$value, $exp] = $test;
|
||||
$this->assertSame($exp, I::str($value), "Test returned ".decbin(I::str($value))." for value: ".var_export($value, true));
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[new StrClass(" "), false, false],
|
||||
];
|
||||
foreach ($tests as $test) {
|
||||
list($value, $exp, $expNull) = $test;
|
||||
[$value, $exp, $expNull] = $test;
|
||||
$this->assertSame($exp, I::id($value), "Non-null test failed for value: ".var_export($value, true));
|
||||
$this->assertSame($expNull, I::id($value, true), "Null test failed for value: ".var_export($value, true));
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[new StrClass(" "), null],
|
||||
];
|
||||
foreach ($tests as $test) {
|
||||
list($value, $exp) = $test;
|
||||
[$value, $exp] = $test;
|
||||
$this->assertSame($exp, I::bool($value), "Null Test failed for value: ".var_export($value, true));
|
||||
if (is_null($exp)) {
|
||||
$this->assertTrue(I::bool($value, true), "True Test failed for value: ".var_export($value, true));
|
||||
|
@ -407,7 +407,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[I::T_STRING | I::M_STRICT, "Bare string", ["Bare string"]],
|
||||
];
|
||||
foreach ($tests as $index => $test) {
|
||||
list($type, $value, $exp) = $test;
|
||||
[$type, $value, $exp] = $test;
|
||||
$this->assertEquals($exp, I::normalize($value, $type | I::M_ARRAY, "iso8601"), "Failed test #$index");
|
||||
}
|
||||
// Date-to-string format tests
|
||||
|
@ -525,7 +525,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[$this->d("2010-01-01T00:00:00", 0, 1), [null,true], [true, false], [1262304000, false], [1262304000.0, false], ["2010-01-01T00:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 0, 1)],false], [null, false]],
|
||||
[$this->d("2010-01-01T00:00:00", 1, 0), [null,true], [true, false], [1262322000, false], [1262322000.0, false], ["2010-01-01T05:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 1, 0)],false], [null, false]],
|
||||
[$this->d("2010-01-01T00:00:00", 1, 1), [null,true], [true, false], [1262322000, false], [1262322000.0, false], ["2010-01-01T05:00:00Z",true], [[$this->d("2010-01-01T00:00:00", 1, 1)],false], [null, false]],
|
||||
[1e14, [null,true], [true, false], [pow(10, 14), true], [1e14, true], ["100000000000000", true], [[1e14], false], [$this->i("P1157407407DT9H46M40S"), false]],
|
||||
[1e14, [null,true], [true, false], [10 ** 14, true], [1e14, true], ["100000000000000", true], [[1e14], false], [$this->i("P1157407407DT9H46M40S"), false]],
|
||||
[1e-6, [null,true], [true, false], [0, false], [1e-6, true], ["0.000001", true], [[1e-6], false], [$this->i("PT0S", 1e-6), false]],
|
||||
[[1,2,3], [null,true], [true, false], [0, false], [0.0, false], ["", false], [[1,2,3], true], [null, false]],
|
||||
[['a' => 1,'b' => 2], [null,true], [true, false], [0, false], [0.0, false], ["", false], [['a' => 1,'b' => 2], true], [null, false]],
|
||||
|
@ -542,14 +542,14 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
// shift a mixed-type passthrough test onto the set
|
||||
array_unshift($set, [$input, true]);
|
||||
// generate a set of tests for each target data type
|
||||
foreach ($set as $type => list($exp, $pass)) {
|
||||
foreach ($set as $type => [$exp, $pass]) {
|
||||
// emit one test each for loose mode, strict mode, drop mode, and strict+drop mode
|
||||
foreach ([
|
||||
[false, false],
|
||||
[true, false],
|
||||
[false, true],
|
||||
[true, true],
|
||||
] as list($strict, $drop)) {
|
||||
] as [$strict, $drop]) {
|
||||
yield [$input, $types[$type], $exp, $pass, $strict, $drop];
|
||||
}
|
||||
}
|
||||
|
@ -572,37 +572,37 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
];
|
||||
foreach ([
|
||||
/* Input value microtime iso8601 iso8601m http sql date time unix float '!M j, Y (D)' *strtotime* (null) */
|
||||
[null, null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
[INF, null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
[NAN, null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
[$this->d("2010-01-01T00:00:00", 0, 0), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), ],
|
||||
[$this->d("2010-01-01T00:00:00", 0, 1), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), ],
|
||||
[$this->d("2010-01-01T00:00:00", 1, 0), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), ],
|
||||
[$this->d("2010-01-01T00:00:00", 1, 1), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), ],
|
||||
[1262304000, $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), ],
|
||||
[1262304000.123456, $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), ],
|
||||
[1262304000.42, $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), ],
|
||||
["0.12345600 1262304000", $this->t(1262304000.123456), null, null, null, null, null, null, null, null, null, null, ],
|
||||
["0.42 1262304000", null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
["2010-01-01T00:00:00", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01T00:00:00Z", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01T00:00:00+0000", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01T00:00:00-0000", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01T00:00:00+00:00", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01T00:00:00-05:00", null, $this->t(1262322000), $this->t(1262322000), null, null, null, null, null, null, null, $this->t(1262322000), ],
|
||||
["2010-01-01T00:00:00.123456Z", null, null, $this->t(1262304000.123456), null, null, null, null, null, null, null, $this->t(1262304000.123456), ],
|
||||
["Fri, 01 Jan 2010 00:00:00 GMT", null, null, null, $this->t(1262304000), null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01 00:00:00", null, null, null, null, $this->t(1262304000), null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01", null, null, null, null, null, $this->t(1262304000), null, null, null, null, $this->t(1262304000), ],
|
||||
["12:34:56", null, null, null, null, null, null, $this->t(45296), null, null, null, $this->t(date_create("today", new \DateTimezone("UTC"))->getTimestamp()+45296), ],
|
||||
["1262304000", null, null, null, null, null, null, null, $this->t(1262304000), null, null, null, ],
|
||||
["1262304000.123456", null, null, null, null, null, null, null, null, $this->t(1262304000.123456), null, null, ],
|
||||
["1262304000.42", null, null, null, null, null, null, null, null, $this->t(1262304000.42), null, null, ],
|
||||
["Jan 1, 2010 (Fri)", null, null, null, null, null, null, null, null, null, $this->t(1262304000), null, ],
|
||||
["First day of Jan 2010 12AM", null, null, null, null, null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
[[], null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
[$this->i("P1Y2D"), null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
["P1Y2D", null, null, null, null, null, null, null, null, null, null, null, ],
|
||||
[null, null, null, null, null, null, null, null, null, null, null, null],
|
||||
[INF, null, null, null, null, null, null, null, null, null, null, null],
|
||||
[NAN, null, null, null, null, null, null, null, null, null, null, null],
|
||||
[$this->d("2010-01-01T00:00:00", 0, 0), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000)],
|
||||
[$this->d("2010-01-01T00:00:00", 0, 1), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000)],
|
||||
[$this->d("2010-01-01T00:00:00", 1, 0), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000)],
|
||||
[$this->d("2010-01-01T00:00:00", 1, 1), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000), $this->t(1262322000)],
|
||||
[1262304000, $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000), $this->t(1262304000)],
|
||||
[1262304000.123456, $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456), $this->t(1262304000.123456)],
|
||||
[1262304000.42, $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42), $this->t(1262304000.42)],
|
||||
["0.12345600 1262304000", $this->t(1262304000.123456), null, null, null, null, null, null, null, null, null, null],
|
||||
["0.42 1262304000", null, null, null, null, null, null, null, null, null, null, null],
|
||||
["2010-01-01T00:00:00", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01T00:00:00Z", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01T00:00:00+0000", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01T00:00:00-0000", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01T00:00:00+00:00", null, $this->t(1262304000), $this->t(1262304000), null, null, null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01T00:00:00-05:00", null, $this->t(1262322000), $this->t(1262322000), null, null, null, null, null, null, null, $this->t(1262322000)],
|
||||
["2010-01-01T00:00:00.123456Z", null, null, $this->t(1262304000.123456), null, null, null, null, null, null, null, $this->t(1262304000.123456)],
|
||||
["Fri, 01 Jan 2010 00:00:00 GMT", null, null, null, $this->t(1262304000), null, null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01 00:00:00", null, null, null, null, $this->t(1262304000), null, null, null, null, null, $this->t(1262304000)],
|
||||
["2010-01-01", null, null, null, null, null, $this->t(1262304000), null, null, null, null, $this->t(1262304000)],
|
||||
["12:34:56", null, null, null, null, null, null, $this->t(45296), null, null, null, $this->t(date_create("today", new \DateTimezone("UTC"))->getTimestamp() + 45296)],
|
||||
["1262304000", null, null, null, null, null, null, null, $this->t(1262304000), null, null, null],
|
||||
["1262304000.123456", null, null, null, null, null, null, null, null, $this->t(1262304000.123456), null, null],
|
||||
["1262304000.42", null, null, null, null, null, null, null, null, $this->t(1262304000.42), null, null],
|
||||
["Jan 1, 2010 (Fri)", null, null, null, null, null, null, null, null, null, $this->t(1262304000), null],
|
||||
["First day of Jan 2010 12AM", null, null, null, null, null, null, null, null, null, null, $this->t(1262304000)],
|
||||
[[], null, null, null, null, null, null, null, null, null, null, null],
|
||||
[$this->i("P1Y2D"), null, null, null, null, null, null, null, null, null, null, null],
|
||||
["P1Y2D", null, null, null, null, null, null, null, null, null, null, null],
|
||||
] as $set) {
|
||||
// shift the input value off the set
|
||||
$input = array_shift($set);
|
||||
|
@ -614,7 +614,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[true, false],
|
||||
[false, true],
|
||||
[true, true],
|
||||
] as list($strict, $drop)) {
|
||||
] as [$strict, $drop]) {
|
||||
yield [$input, $formats[$format], $exp, $strict, $drop];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,21 +334,15 @@ class TestAPI extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
$unread = [['id' => 4],['id' => 5],['id' => 6]];
|
||||
\Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->starred(true))->thenReturn(new Result($saved));
|
||||
\Phake::when(Arsse::$db)->articleList(Arsse::$user->id, (new Context)->unread(true))->thenReturn(new Result($unread));
|
||||
$exp = new JsonResponse([
|
||||
'saved_item_ids' => "1,2,3"
|
||||
]);
|
||||
$exp = new JsonResponse(['saved_item_ids' => "1,2,3"]);
|
||||
$this->assertMessage($exp, $this->h->dispatch($this->req("api&saved_item_ids")));
|
||||
$exp = new JsonResponse([
|
||||
'unread_item_ids' => "4,5,6"
|
||||
]);
|
||||
$exp = new JsonResponse(['unread_item_ids' => "4,5,6"]);
|
||||
$this->assertMessage($exp, $this->h->dispatch($this->req("api&unread_item_ids")));
|
||||
}
|
||||
|
||||
public function testListHotLinks(): void {
|
||||
// hot links are not actually implemented, so an empty array should be all we get
|
||||
$exp = new JsonResponse([
|
||||
'links' => []
|
||||
]);
|
||||
$exp = new JsonResponse(['links' => []]);
|
||||
$this->assertMessage($exp, $this->h->dispatch($this->req("api&links")));
|
||||
}
|
||||
|
||||
|
|
|
@ -839,7 +839,7 @@ class TestV1_2 extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
'warnings' => [
|
||||
'improperlyConfiguredCron' => false,
|
||||
'incorrectDbCharset' => false,
|
||||
]
|
||||
],
|
||||
];
|
||||
$arr2['warnings']['improperlyConfiguredCron'] = true;
|
||||
$arr2['warnings']['incorrectDbCharset'] = true;
|
||||
|
|
|
@ -8,7 +8,6 @@ namespace JKingWeb\Arsse\TestCase\REST\NextcloudNews;
|
|||
|
||||
use JKingWeb\Arsse\REST\NextcloudNews\Versions;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Laminas\Diactoros\ServerRequest;
|
||||
use Laminas\Diactoros\Response\JsonResponse as Response;
|
||||
use Laminas\Diactoros\Response\EmptyResponse;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ use JKingWeb\Arsse\Db\ExceptionInput;
|
|||
use JKingWeb\Arsse\Db\Transaction;
|
||||
use JKingWeb\Arsse\REST\TinyTinyRSS\API;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Laminas\Diactoros\ServerRequest;
|
||||
use Laminas\Diactoros\Response\JsonResponse as Response;
|
||||
use Laminas\Diactoros\Response\EmptyResponse;
|
||||
|
||||
|
@ -984,7 +983,7 @@ LONG_STRING;
|
|||
public function testAddALabel(): void {
|
||||
$in = [
|
||||
['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Software"],
|
||||
['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Hardware",],
|
||||
['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => "Hardware"],
|
||||
['op' => "addLabel", 'sid' => "PriestsOfSyrinx"],
|
||||
['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => ""],
|
||||
['op' => "addLabel", 'sid' => "PriestsOfSyrinx", 'caption' => " "],
|
||||
|
@ -1301,9 +1300,9 @@ LONG_STRING;
|
|||
\Phake::when(Arsse::$db)->articleCount($this->anything(), $this->equalTo((new Context)->unread(true)->modifiedSince(Date::sub("PT24H")), 2))->thenReturn(7);
|
||||
\Phake::when(Arsse::$db)->articleStarred($this->anything())->thenReturn($this->v($this->starred));
|
||||
// the expectations are packed tightly since they're very verbose; one can use var_export() (or convert to JSON) to pretty-print them
|
||||
$exp = ['categories'=>['identifier'=>'id','label'=>'name','items'=>[['name'=>'Special','id'=>'CAT:-1','bare_id'=>-1,'type'=>'category','unread'=>0,'items'=>[['name'=>'All articles','id'=>'FEED:-4','bare_id'=>-4,'icon'=>'images/folder.png','unread'=>35,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Fresh articles','id'=>'FEED:-3','bare_id'=>-3,'icon'=>'images/fresh.png','unread'=>7,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Starred articles','id'=>'FEED:-1','bare_id'=>-1,'icon'=>'images/star.png','unread'=>4,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Published articles','id'=>'FEED:-2','bare_id'=>-2,'icon'=>'images/feed.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Archived articles','id'=>'FEED:0','bare_id'=>0,'icon'=>'images/archive.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Recently read','id'=>'FEED:-6','bare_id'=>-6,'icon'=>'images/time.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],],],['name'=>'Labels','id'=>'CAT:-2','bare_id'=>-2,'type'=>'category','unread'=>6,'items'=>[['name'=>'Fascinating','id'=>'FEED:-1027','bare_id'=>-1027,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Interesting','id'=>'FEED:-1029','bare_id'=>-1029,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Logical','id'=>'FEED:-1025','bare_id'=>-1025,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],],],['name'=>'Photography','id'=>'CAT:4','bare_id'=>4,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(0 feeds)','items'=>[],],['name'=>'Politics','id'=>'CAT:3','bare_id'=>3,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(3 feeds)','items'=>[['name'=>'Local','id'=>'CAT:5','bare_id'=>5,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'Toronto Star','id'=>'FEED:2','bare_id'=>2,'icon'=>'feed-icons/2.ico','error'=>'oops','param'=>'2011-11-11T11:11:11Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'National','id'=>'CAT:6','bare_id'=>6,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'CBC News','id'=>'FEED:4','bare_id'=>4,'icon'=>'feed-icons/4.ico','error'=>'','param'=>'2017-10-09T15:58:34Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],['name'=>'Ottawa Citizen','id'=>'FEED:5','bare_id'=>5,'icon'=>false,'error'=>'','param'=>'2017-07-07T17:07:17Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],['name'=>'Science','id'=>'CAT:1','bare_id'=>1,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'Rocketry','id'=>'CAT:2','bare_id'=>2,'parent_id'=>1,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'NASA JPL','id'=>'FEED:1','bare_id'=>1,'icon'=>false,'error'=>'','param'=>'2017-09-15T22:54:16Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Ars Technica','id'=>'FEED:3','bare_id'=>3,'icon'=>'feed-icons/3.ico','error'=>'argh','param'=>'2016-05-23T06:40:02Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Uncategorized','id'=>'CAT:0','bare_id'=>0,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'parent_id'=>null,'param'=>'(1 feed)','items'=>[['name'=>'Eurogamer','id'=>'FEED:6','bare_id'=>6,'icon'=>'feed-icons/6.ico','error'=>'','param'=>'2010-02-12T20:08:47Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],];
|
||||
$exp = ['categories' => ['identifier' => 'id','label' => 'name','items' => [['name' => 'Special','id' => 'CAT:-1','bare_id' => -1,'type' => 'category','unread' => 0,'items' => [['name' => 'All articles','id' => 'FEED:-4','bare_id' => -4,'icon' => 'images/folder.png','unread' => 35,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Fresh articles','id' => 'FEED:-3','bare_id' => -3,'icon' => 'images/fresh.png','unread' => 7,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Starred articles','id' => 'FEED:-1','bare_id' => -1,'icon' => 'images/star.png','unread' => 4,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Published articles','id' => 'FEED:-2','bare_id' => -2,'icon' => 'images/feed.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Archived articles','id' => 'FEED:0','bare_id' => 0,'icon' => 'images/archive.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Recently read','id' => 'FEED:-6','bare_id' => -6,'icon' => 'images/time.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => '']]],['name' => 'Labels','id' => 'CAT:-2','bare_id' => -2,'type' => 'category','unread' => 6,'items' => [['name' => 'Fascinating','id' => 'FEED:-1027','bare_id' => -1027,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Interesting','id' => 'FEED:-1029','bare_id' => -1029,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Logical','id' => 'FEED:-1025','bare_id' => -1025,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => '']]],['name' => 'Photography','id' => 'CAT:4','bare_id' => 4,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(0 feeds)','items' => []],['name' => 'Politics','id' => 'CAT:3','bare_id' => 3,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(3 feeds)','items' => [['name' => 'Local','id' => 'CAT:5','bare_id' => 5,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'Toronto Star','id' => 'FEED:2','bare_id' => 2,'icon' => 'feed-icons/2.ico','error' => 'oops','param' => '2011-11-11T11:11:11Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'National','id' => 'CAT:6','bare_id' => 6,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'CBC News','id' => 'FEED:4','bare_id' => 4,'icon' => 'feed-icons/4.ico','error' => '','param' => '2017-10-09T15:58:34Z','unread' => 0,'auxcounter' => 0,'checkbox' => false],['name' => 'Ottawa Citizen','id' => 'FEED:5','bare_id' => 5,'icon' => false,'error' => '','param' => '2017-07-07T17:07:17Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]],['name' => 'Science','id' => 'CAT:1','bare_id' => 1,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'Rocketry','id' => 'CAT:2','bare_id' => 2,'parent_id' => 1,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'NASA JPL','id' => 'FEED:1','bare_id' => 1,'icon' => false,'error' => '','param' => '2017-09-15T22:54:16Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Ars Technica','id' => 'FEED:3','bare_id' => 3,'icon' => 'feed-icons/3.ico','error' => 'argh','param' => '2016-05-23T06:40:02Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Uncategorized','id' => 'CAT:0','bare_id' => 0,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'parent_id' => null,'param' => '(1 feed)','items' => [['name' => 'Eurogamer','id' => 'FEED:6','bare_id' => 6,'icon' => 'feed-icons/6.ico','error' => '','param' => '2010-02-12T20:08:47Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]]];
|
||||
$this->assertMessage($this->respGood($exp), $this->req($in[0]));
|
||||
$exp = ['categories'=>['identifier'=>'id','label'=>'name','items'=>[['name'=>'Special','id'=>'CAT:-1','bare_id'=>-1,'type'=>'category','unread'=>0,'items'=>[['name'=>'All articles','id'=>'FEED:-4','bare_id'=>-4,'icon'=>'images/folder.png','unread'=>35,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Fresh articles','id'=>'FEED:-3','bare_id'=>-3,'icon'=>'images/fresh.png','unread'=>7,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Starred articles','id'=>'FEED:-1','bare_id'=>-1,'icon'=>'images/star.png','unread'=>4,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Published articles','id'=>'FEED:-2','bare_id'=>-2,'icon'=>'images/feed.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Archived articles','id'=>'FEED:0','bare_id'=>0,'icon'=>'images/archive.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],['name'=>'Recently read','id'=>'FEED:-6','bare_id'=>-6,'icon'=>'images/time.png','unread'=>0,'type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'',],],],['name'=>'Labels','id'=>'CAT:-2','bare_id'=>-2,'type'=>'category','unread'=>6,'items'=>[['name'=>'Fascinating','id'=>'FEED:-1027','bare_id'=>-1027,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Interesting','id'=>'FEED:-1029','bare_id'=>-1029,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],['name'=>'Logical','id'=>'FEED:-1025','bare_id'=>-1025,'unread'=>0,'icon'=>'images/label.png','type'=>'feed','auxcounter'=>0,'error'=>'','updated'=>'','fg_color'=>'','bg_color'=>'',],],],['name'=>'Politics','id'=>'CAT:3','bare_id'=>3,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(3 feeds)','items'=>[['name'=>'Local','id'=>'CAT:5','bare_id'=>5,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'Toronto Star','id'=>'FEED:2','bare_id'=>2,'icon'=>'feed-icons/2.ico','error'=>'oops','param'=>'2011-11-11T11:11:11Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'National','id'=>'CAT:6','bare_id'=>6,'parent_id'=>3,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'CBC News','id'=>'FEED:4','bare_id'=>4,'icon'=>'feed-icons/4.ico','error'=>'','param'=>'2017-10-09T15:58:34Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],['name'=>'Ottawa Citizen','id'=>'FEED:5','bare_id'=>5,'icon'=>false,'error'=>'','param'=>'2017-07-07T17:07:17Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],['name'=>'Science','id'=>'CAT:1','bare_id'=>1,'parent_id'=>null,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(2 feeds)','items'=>[['name'=>'Rocketry','id'=>'CAT:2','bare_id'=>2,'parent_id'=>1,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'param'=>'(1 feed)','items'=>[['name'=>'NASA JPL','id'=>'FEED:1','bare_id'=>1,'icon'=>false,'error'=>'','param'=>'2017-09-15T22:54:16Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Ars Technica','id'=>'FEED:3','bare_id'=>3,'icon'=>'feed-icons/3.ico','error'=>'argh','param'=>'2016-05-23T06:40:02Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],['name'=>'Uncategorized','id'=>'CAT:0','bare_id'=>0,'type'=>'category','auxcounter'=>0,'unread'=>0,'child_unread'=>0,'checkbox'=>false,'parent_id'=>null,'param'=>'(1 feed)','items'=>[['name'=>'Eurogamer','id'=>'FEED:6','bare_id'=>6,'icon'=>'feed-icons/6.ico','error'=>'','param'=>'2010-02-12T20:08:47Z','unread'=>0,'auxcounter'=>0,'checkbox'=>false,],],],],],];
|
||||
$exp = ['categories' => ['identifier' => 'id','label' => 'name','items' => [['name' => 'Special','id' => 'CAT:-1','bare_id' => -1,'type' => 'category','unread' => 0,'items' => [['name' => 'All articles','id' => 'FEED:-4','bare_id' => -4,'icon' => 'images/folder.png','unread' => 35,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Fresh articles','id' => 'FEED:-3','bare_id' => -3,'icon' => 'images/fresh.png','unread' => 7,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Starred articles','id' => 'FEED:-1','bare_id' => -1,'icon' => 'images/star.png','unread' => 4,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Published articles','id' => 'FEED:-2','bare_id' => -2,'icon' => 'images/feed.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Archived articles','id' => 'FEED:0','bare_id' => 0,'icon' => 'images/archive.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => ''],['name' => 'Recently read','id' => 'FEED:-6','bare_id' => -6,'icon' => 'images/time.png','unread' => 0,'type' => 'feed','auxcounter' => 0,'error' => '','updated' => '']]],['name' => 'Labels','id' => 'CAT:-2','bare_id' => -2,'type' => 'category','unread' => 6,'items' => [['name' => 'Fascinating','id' => 'FEED:-1027','bare_id' => -1027,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Interesting','id' => 'FEED:-1029','bare_id' => -1029,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => ''],['name' => 'Logical','id' => 'FEED:-1025','bare_id' => -1025,'unread' => 0,'icon' => 'images/label.png','type' => 'feed','auxcounter' => 0,'error' => '','updated' => '','fg_color' => '','bg_color' => '']]],['name' => 'Politics','id' => 'CAT:3','bare_id' => 3,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(3 feeds)','items' => [['name' => 'Local','id' => 'CAT:5','bare_id' => 5,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'Toronto Star','id' => 'FEED:2','bare_id' => 2,'icon' => 'feed-icons/2.ico','error' => 'oops','param' => '2011-11-11T11:11:11Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'National','id' => 'CAT:6','bare_id' => 6,'parent_id' => 3,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'CBC News','id' => 'FEED:4','bare_id' => 4,'icon' => 'feed-icons/4.ico','error' => '','param' => '2017-10-09T15:58:34Z','unread' => 0,'auxcounter' => 0,'checkbox' => false],['name' => 'Ottawa Citizen','id' => 'FEED:5','bare_id' => 5,'icon' => false,'error' => '','param' => '2017-07-07T17:07:17Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]],['name' => 'Science','id' => 'CAT:1','bare_id' => 1,'parent_id' => null,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(2 feeds)','items' => [['name' => 'Rocketry','id' => 'CAT:2','bare_id' => 2,'parent_id' => 1,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'param' => '(1 feed)','items' => [['name' => 'NASA JPL','id' => 'FEED:1','bare_id' => 1,'icon' => false,'error' => '','param' => '2017-09-15T22:54:16Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Ars Technica','id' => 'FEED:3','bare_id' => 3,'icon' => 'feed-icons/3.ico','error' => 'argh','param' => '2016-05-23T06:40:02Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]],['name' => 'Uncategorized','id' => 'CAT:0','bare_id' => 0,'type' => 'category','auxcounter' => 0,'unread' => 0,'child_unread' => 0,'checkbox' => false,'parent_id' => null,'param' => '(1 feed)','items' => [['name' => 'Eurogamer','id' => 'FEED:6','bare_id' => 6,'icon' => 'feed-icons/6.ico','error' => '','param' => '2010-02-12T20:08:47Z','unread' => 0,'auxcounter' => 0,'checkbox' => false]]]]]];
|
||||
$this->assertMessage($this->respGood($exp), $this->req($in[1]));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use JKingWeb\Arsse\User;
|
|||
use JKingWeb\Arsse\Database;
|
||||
use JKingWeb\Arsse\REST\TinyTinyRSS\Icon;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Laminas\Diactoros\ServerRequest;
|
||||
use Laminas\Diactoros\Response\EmptyResponse as Response;
|
||||
|
||||
/** @covers \JKingWeb\Arsse\REST\TinyTinyRSS\Icon<extended> */
|
||||
|
|
|
@ -7,7 +7,6 @@ declare(strict_types=1);
|
|||
namespace JKingWeb\Arsse\TestCase\Service;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
use JKingWeb\Arsse\Database;
|
||||
use JKingWeb\Arsse\Service\Driver as DriverInterface;
|
||||
use JKingWeb\Arsse\Service\Subprocess\Driver;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ use JKingWeb\Arsse\Conf;
|
|||
use JKingWeb\Arsse\Lang;
|
||||
use JKingWeb\Arsse\User;
|
||||
use JKingWeb\Arsse\Database;
|
||||
use JKingWeb\Arsse\Service;
|
||||
|
||||
/** @covers \JKingWeb\Arsse\Arsse */
|
||||
class TestArsse extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
'cache' => false,
|
||||
'fields' => [
|
||||
'Location: http://localhost:'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI']."0",
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
|
@ -7,7 +7,6 @@ declare(strict_types=1);
|
|||
namespace JKingWeb\Arsse\Test\DatabaseDrivers;
|
||||
|
||||
use JKingWeb\Arsse\Arsse;
|
||||
use JKingWeb\Arsse\Db\Driver;
|
||||
|
||||
trait MySQLPDO {
|
||||
protected static $implementation = "PDO MySQL";
|
||||
|
|
|
@ -29,7 +29,6 @@ which include the following data:
|
|||
|
||||
*/
|
||||
|
||||
|
||||
ignore_user_abort(false);
|
||||
ob_start();
|
||||
$defaults = [ // default values for response
|
||||
|
|
Loading…
Reference in a new issue