mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Implement TTRSS operation updateArticle; fixes #83
This required adding the "notes" column to the arsse_marks table and adding same as a target value in Database::articleMark() The Context class was also adjusted to remove the possibility of false positives in some tests
This commit is contained in:
parent
6b1cd3816d
commit
ea986f5032
7 changed files with 238 additions and 59 deletions
|
@ -1017,6 +1017,7 @@ class Database {
|
||||||
$values = [
|
$values = [
|
||||||
isset($data['read']) ? $data['read'] : null,
|
isset($data['read']) ? $data['read'] : null,
|
||||||
isset($data['starred']) ? $data['starred'] : null,
|
isset($data['starred']) ? $data['starred'] : null,
|
||||||
|
isset($data['note']) ? $data['note'] : null,
|
||||||
];
|
];
|
||||||
// the two queries we want to execute to make the requested changes
|
// the two queries we want to execute to make the requested changes
|
||||||
$queries = [
|
$queries = [
|
||||||
|
@ -1024,17 +1025,19 @@ class Database {
|
||||||
set
|
set
|
||||||
read = case when (select honour_read from target_articles where target_articles.id is article) is 1 then (select read from target_values) else read end,
|
read = case when (select honour_read from target_articles where target_articles.id is article) is 1 then (select read from target_values) else read end,
|
||||||
starred = coalesce((select starred from target_values),starred),
|
starred = coalesce((select starred from target_values),starred),
|
||||||
|
note = coalesce((select note from target_values),note),
|
||||||
modified = CURRENT_TIMESTAMP
|
modified = CURRENT_TIMESTAMP
|
||||||
WHERE
|
WHERE
|
||||||
subscription in (select sub from subscribed_feeds)
|
subscription in (select sub from subscribed_feeds)
|
||||||
and article in (select id from target_articles where to_insert is 0 and (honour_read is 1 or honour_star is 1))",
|
and article in (select id from target_articles where to_insert is 0 and (honour_read is 1 or honour_star is 1 or (select note from target_values) is not null))",
|
||||||
"INSERT INTO arsse_marks(subscription,article,read,starred)
|
"INSERT INTO arsse_marks(subscription,article,read,starred,note)
|
||||||
select
|
select
|
||||||
(select id from arsse_subscriptions join user on user is owner where arsse_subscriptions.feed is target_articles.feed),
|
(select id from arsse_subscriptions join user on user is owner where arsse_subscriptions.feed is target_articles.feed),
|
||||||
id,
|
id,
|
||||||
coalesce((select read from target_values) * honour_read,0),
|
coalesce((select read from target_values) * honour_read,0),
|
||||||
coalesce((select starred from target_values),0)
|
coalesce((select starred from target_values),0),
|
||||||
from target_articles where to_insert is 1 and (honour_read is 1 or honour_star is 1)"
|
coalesce((select note from target_values),'')
|
||||||
|
from target_articles where to_insert is 1 and (honour_read is 1 or honour_star is 1 or coalesce((select note from target_values),'') <> '')"
|
||||||
];
|
];
|
||||||
$out = 0;
|
$out = 0;
|
||||||
// wrap this UPDATE and INSERT together into a transaction
|
// wrap this UPDATE and INSERT together into a transaction
|
||||||
|
@ -1060,7 +1063,7 @@ class Database {
|
||||||
"((select starred from target_values) is not null and (select starred from target_values) is not (coalesce((select starred from arsse_marks where article is arsse_articles.id and subscription in (select sub from subscribed_feeds)),0))) as honour_star",
|
"((select starred from target_values) is not null and (select starred from target_values) is not (coalesce((select starred from arsse_marks where article is arsse_articles.id and subscription in (select sub from subscribed_feeds)),0))) as honour_star",
|
||||||
]);
|
]);
|
||||||
// common table expression with the values to set
|
// common table expression with the values to set
|
||||||
$q->setCTE("target_values(read,starred)", "SELECT ?,?", ["bool","bool"], $values);
|
$q->setCTE("target_values(read,starred,note)", "SELECT ?,?,?", ["bool","bool","str"], $values);
|
||||||
// push the current query onto the CTE stack and execute the query we're actually interested in
|
// push the current query onto the CTE stack and execute the query we're actually interested in
|
||||||
$q->pushCTE("target_articles");
|
$q->pushCTE("target_articles");
|
||||||
$q->setBody($query);
|
$q->setBody($query);
|
||||||
|
|
|
@ -13,8 +13,8 @@ class Context {
|
||||||
public $subscription;
|
public $subscription;
|
||||||
public $oldestEdition;
|
public $oldestEdition;
|
||||||
public $latestEdition;
|
public $latestEdition;
|
||||||
public $unread = false;
|
public $unread = null;
|
||||||
public $starred = false;
|
public $starred = null;
|
||||||
public $modifiedSince;
|
public $modifiedSince;
|
||||||
public $notModifiedSince;
|
public $notModifiedSince;
|
||||||
public $edition;
|
public $edition;
|
||||||
|
|
|
@ -1109,4 +1109,64 @@ class API extends \JKingWeb\Arsse\REST\AbstractHandler {
|
||||||
// return boilerplate output
|
// return boilerplate output
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function opUpdateArticle(array $data): array {
|
||||||
|
// normalize input
|
||||||
|
$articles = array_filter(ValueInfo::normalize(explode(",", (string) $data['article_ids']), ValueInfo::T_INT | ValueInfo::M_ARRAY), [ValueInfo::class, "id"]);
|
||||||
|
if (!$articles) {
|
||||||
|
// if there are no valid articles this is an error
|
||||||
|
throw new Exception("INCORRECT_USAGE");
|
||||||
|
}
|
||||||
|
$out = 0;
|
||||||
|
$tr = Arsse::$db->begin();
|
||||||
|
switch ($data['field']) {
|
||||||
|
case 0: // starred
|
||||||
|
switch ($data['mode']) {
|
||||||
|
case 0: // set false
|
||||||
|
case 1: // set true
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['starred' => (bool) $data['mode']], (new Context)->articles($articles));
|
||||||
|
break;
|
||||||
|
case 2: //toggle
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['starred' => true], (new Context)->articles($articles)->starred(false));
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['starred' => false], (new Context)->articles($articles)->starred(true));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("INCORRECT_USAGE");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1: // published
|
||||||
|
switch ($data['mode']) {
|
||||||
|
case 0: // set false
|
||||||
|
case 1: // set true
|
||||||
|
case 2: //toggle
|
||||||
|
// TODO: the Published feed is not yet implemeted; once it is the updateArticle operation must be amended accordingly
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("INCORRECT_USAGE");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: // unread
|
||||||
|
// NOTE: we use a "read" flag rather than "unread", so the booleans are swapped
|
||||||
|
switch ($data['mode']) {
|
||||||
|
case 0: // set false
|
||||||
|
case 1: // set true
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['read' => !$data['mode']], (new Context)->articles($articles));
|
||||||
|
break;
|
||||||
|
case 2: //toggle
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['read' => true], (new Context)->articles($articles)->unread(true));
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['read' => false], (new Context)->articles($articles)->unread(false));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("INCORRECT_USAGE");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3: // article note
|
||||||
|
$out += Arsse::$db->articleMark(Arsse::$user->id, ['note' => (string) $data['data']], (new Context)->articles($articles));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("INCORRECT_USAGE");
|
||||||
|
}
|
||||||
|
$tr->commit();
|
||||||
|
return ['status' => "OK", 'updated' => $out];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,20 @@ create table arsse_label_members (
|
||||||
primary key(label,article)
|
primary key(label,article)
|
||||||
) without rowid;
|
) without rowid;
|
||||||
|
|
||||||
|
-- alter marks table to add Tiny Tiny RSS' notes
|
||||||
|
alter table arsse_marks rename to arsse_marks_old;
|
||||||
|
create table arsse_marks(
|
||||||
|
article integer not null references arsse_articles(id) on delete cascade,
|
||||||
|
subscription integer not null references arsse_subscriptions(id) on delete cascade on update cascade,
|
||||||
|
read boolean not null default 0,
|
||||||
|
starred boolean not null default 0,
|
||||||
|
modified text not null default CURRENT_TIMESTAMP,
|
||||||
|
note text not null default '',
|
||||||
|
primary key(article,subscription)
|
||||||
|
);
|
||||||
|
insert into arsse_marks(article,subscription,read,starred,modified) select article,subscription,read,starred,modified from arsse_marks_old;
|
||||||
|
drop table arsse_marks_old;
|
||||||
|
|
||||||
-- set version marker
|
-- set version marker
|
||||||
pragma user_version = 2;
|
pragma user_version = 2;
|
||||||
update arsse_meta set value = '2' where key is 'schema_version';
|
update arsse_meta set value = '2' where key is 'schema_version';
|
|
@ -79,6 +79,7 @@ class TestValueInfo extends Test\AbstractTest {
|
||||||
[0.5, I::FLOAT],
|
[0.5, I::FLOAT],
|
||||||
["2.5", I::FLOAT],
|
["2.5", I::FLOAT],
|
||||||
["0.5", I::FLOAT],
|
["0.5", I::FLOAT],
|
||||||
|
[" 1 ", I::VALID],
|
||||||
];
|
];
|
||||||
foreach ($tests as $test) {
|
foreach ($tests as $test) {
|
||||||
list($value, $exp) = $test;
|
list($value, $exp) = $test;
|
||||||
|
|
|
@ -1101,4 +1101,85 @@ class TestTinyTinyAPI extends Test\AbstractTest {
|
||||||
$out += array_reduce(array_filter($this->subscriptions, function($value) use ($id) {return $value['folder']==$id;}), function($sum, $value) {return $sum + $value['unread'];}, 0);
|
$out += array_reduce(array_filter($this->subscriptions, function($value) use ($id) {return $value['folder']==$id;}), function($sum, $value) {return $sum + $value['unread'];}, 0);
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testChangeArticles() {
|
||||||
|
$in = [
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx"],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1"],
|
||||||
|
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 0],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 0],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 1],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 2],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 0, 'mode' => 3], // invalid mode
|
||||||
|
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 1], // Published feed' no-op
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 0],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 1],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 2],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 1, 'mode' => 3], // invalid mode
|
||||||
|
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 2],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 0],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 1],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 2],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 2, 'mode' => 3], // invalid mode
|
||||||
|
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 3],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 0],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 1],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 2],
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 3, 'mode' => 3], // invalid mode
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 3, 'data' => "eh"],
|
||||||
|
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "42, 2112, -1", 'field' => 4], // invalid field
|
||||||
|
['op' => "updateArticle", 'sid' => "PriestsOfSyrinx", 'article_ids' => "0, -1", 'field' => 4], // no valid IDs
|
||||||
|
];
|
||||||
|
Phake::when(Arsse::$db)->articleMark->thenReturn(1);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['starred' => false], (new Context)->articles([42, 2112]))->thenReturn(2);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['starred' => true], (new Context)->articles([42, 2112]))->thenReturn(4);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['starred' => false], (new Context)->articles([42, 2112])->starred(true))->thenReturn(8);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['starred' => true], (new Context)->articles([42, 2112])->starred(false))->thenReturn(16);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['read' => true], (new Context)->articles([42, 2112]))->thenReturn(32); // false is read for TT-RSS
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['read' => false], (new Context)->articles([42, 2112]))->thenReturn(64);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['read' => true], (new Context)->articles([42, 2112])->unread(true))->thenReturn(128);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['read' => false], (new Context)->articles([42, 2112])->unread(false))->thenReturn(256);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['note' => ""], (new Context)->articles([42, 2112]))->thenReturn(512);
|
||||||
|
Phake::when(Arsse::$db)->articleMark($this->anything(), ['note' => "eh"], (new Context)->articles([42, 2112]))->thenReturn(1024);
|
||||||
|
$out = [
|
||||||
|
$this->respErr("INCORRECT_USAGE"),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 2]),
|
||||||
|
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 2]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 2]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 4]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 24]),
|
||||||
|
$this->respErr("INCORRECT_USAGE"),
|
||||||
|
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 0]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 0]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 0]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 0]),
|
||||||
|
$this->respErr("INCORRECT_USAGE"),
|
||||||
|
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 32]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 32]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 64]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 384]),
|
||||||
|
$this->respErr("INCORRECT_USAGE"),
|
||||||
|
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 512]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 512]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 512]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 512]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 512]),
|
||||||
|
$this->respGood(['status' => "OK", 'updated' => 1024]),
|
||||||
|
|
||||||
|
$this->respErr("INCORRECT_USAGE"),
|
||||||
|
$this->respErr("INCORRECT_USAGE"),
|
||||||
|
];
|
||||||
|
for ($a = 0; $a < sizeof($in); $a++) {
|
||||||
|
$this->assertEquals($out[$a], $this->h->dispatch(new Request("POST", "", json_encode($in[$a]))), "Test $a failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,21 +190,22 @@ trait SeriesArticle {
|
||||||
'article' => "int",
|
'article' => "int",
|
||||||
'read' => "bool",
|
'read' => "bool",
|
||||||
'starred' => "bool",
|
'starred' => "bool",
|
||||||
'modified' => "datetime"
|
'modified' => "datetime",
|
||||||
|
'note' => "str",
|
||||||
],
|
],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, 1,1,1,'2000-01-01 00:00:00'],
|
[1, 1,1,1,'2000-01-01 00:00:00',''],
|
||||||
[5, 19,1,0,'2000-01-01 00:00:00'],
|
[5, 19,1,0,'2000-01-01 00:00:00',''],
|
||||||
[5, 20,0,1,'2010-01-01 00:00:00'],
|
[5, 20,0,1,'2010-01-01 00:00:00',''],
|
||||||
[7, 20,1,0,'2010-01-01 00:00:00'],
|
[7, 20,1,0,'2010-01-01 00:00:00',''],
|
||||||
[8, 102,1,0,'2000-01-02 02:00:00'],
|
[8, 102,1,0,'2000-01-02 02:00:00',''],
|
||||||
[9, 103,0,1,'2000-01-03 03:00:00'],
|
[9, 103,0,1,'2000-01-03 03:00:00',''],
|
||||||
[9, 104,1,1,'2000-01-04 04:00:00'],
|
[9, 104,1,1,'2000-01-04 04:00:00',''],
|
||||||
[10,105,0,0,'2000-01-05 05:00:00'],
|
[10,105,0,0,'2000-01-05 05:00:00',''],
|
||||||
[11, 19,0,0,'2017-01-01 00:00:00'],
|
[11, 19,0,0,'2017-01-01 00:00:00','ook'],
|
||||||
[11, 20,1,0,'2017-01-01 00:00:00'],
|
[11, 20,1,0,'2017-01-01 00:00:00','eek'],
|
||||||
[12, 3,0,1,'2017-01-01 00:00:00'],
|
[12, 3,0,1,'2017-01-01 00:00:00','ack'],
|
||||||
[12, 4,1,1,'2017-01-01 00:00:00'],
|
[12, 4,1,1,'2017-01-01 00:00:00','ach'],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'arsse_labels' => [
|
'arsse_labels' => [
|
||||||
|
@ -331,7 +332,7 @@ trait SeriesArticle {
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setUpSeries() {
|
public function setUpSeries() {
|
||||||
$this->checkTables = ['arsse_marks' => ["subscription","article","read","starred","modified"],];
|
$this->checkTables = ['arsse_marks' => ["subscription","article","read","starred","modified","note"],];
|
||||||
$this->user = "john.doe@example.net";
|
$this->user = "john.doe@example.net";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,10 +435,10 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][8][4] = $now;
|
$state['arsse_marks']['rows'][8][4] = $now;
|
||||||
$state['arsse_marks']['rows'][10][2] = 1;
|
$state['arsse_marks']['rows'][10][2] = 1;
|
||||||
$state['arsse_marks']['rows'][10][4] = $now;
|
$state['arsse_marks']['rows'][10][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [13,5,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,5,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,6,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,1,0,$now];
|
$state['arsse_marks']['rows'][] = [14,7,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,1,0,$now];
|
$state['arsse_marks']['rows'][] = [14,8,1,0,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,10 +461,10 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][8][4] = $now;
|
$state['arsse_marks']['rows'][8][4] = $now;
|
||||||
$state['arsse_marks']['rows'][9][3] = 1;
|
$state['arsse_marks']['rows'][9][3] = 1;
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [13,5,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,5,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,6,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,8,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,10 +493,10 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][10][2] = 1;
|
$state['arsse_marks']['rows'][10][2] = 1;
|
||||||
$state['arsse_marks']['rows'][10][4] = $now;
|
$state['arsse_marks']['rows'][10][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [13,5,1,1,$now];
|
$state['arsse_marks']['rows'][] = [13,5,1,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,1,1,$now];
|
$state['arsse_marks']['rows'][] = [13,6,1,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,1,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,1,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,1,1,$now];
|
$state['arsse_marks']['rows'][] = [14,8,1,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,10 +511,10 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][11][2] = 0;
|
$state['arsse_marks']['rows'][11][2] = 0;
|
||||||
$state['arsse_marks']['rows'][11][4] = $now;
|
$state['arsse_marks']['rows'][11][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [13,5,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,5,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,6,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,8,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,10 +529,29 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][10][4] = $now;
|
$state['arsse_marks']['rows'][10][4] = $now;
|
||||||
$state['arsse_marks']['rows'][11][3] = 0;
|
$state['arsse_marks']['rows'][11][3] = 0;
|
||||||
$state['arsse_marks']['rows'][11][4] = $now;
|
$state['arsse_marks']['rows'][11][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [13,5,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,5,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,6,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,1,0,$now];
|
$state['arsse_marks']['rows'][] = [14,7,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,1,0,$now];
|
$state['arsse_marks']['rows'][] = [14,8,1,0,$now,''];
|
||||||
|
$this->compareExpectations($state);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSetNoteForAllArticles() {
|
||||||
|
Arsse::$db->articleMark($this->user, ['note'=>"New note"]);
|
||||||
|
$now = Date::transform(time(), "sql");
|
||||||
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
|
$state['arsse_marks']['rows'][8][5] = "New note";
|
||||||
|
$state['arsse_marks']['rows'][8][4] = $now;
|
||||||
|
$state['arsse_marks']['rows'][9][5] = "New note";
|
||||||
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
|
$state['arsse_marks']['rows'][10][5] = "New note";
|
||||||
|
$state['arsse_marks']['rows'][10][4] = $now;
|
||||||
|
$state['arsse_marks']['rows'][11][5] = "New note";
|
||||||
|
$state['arsse_marks']['rows'][11][4] = $now;
|
||||||
|
$state['arsse_marks']['rows'][] = [13,5,0,0,$now,'New note'];
|
||||||
|
$state['arsse_marks']['rows'][] = [13,6,0,0,$now,'New note'];
|
||||||
|
$state['arsse_marks']['rows'][] = [14,7,0,0,$now,'New note'];
|
||||||
|
$state['arsse_marks']['rows'][] = [14,8,0,0,$now,'New note'];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,10 +559,10 @@ trait SeriesArticle {
|
||||||
Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(7));
|
Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(7));
|
||||||
$now = Date::transform(time(), "sql");
|
$now = Date::transform(time(), "sql");
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][] = [13,5,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,5,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,6,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,1,0,$now];
|
$state['arsse_marks']['rows'][] = [14,7,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,1,0,$now];
|
$state['arsse_marks']['rows'][] = [14,8,1,0,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,8 +570,8 @@ trait SeriesArticle {
|
||||||
Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(8));
|
Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->folder(8));
|
||||||
$now = Date::transform(time(), "sql");
|
$now = Date::transform(time(), "sql");
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][] = [13,5,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,5,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,6,1,0,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,8 +584,8 @@ trait SeriesArticle {
|
||||||
Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->subscription(13));
|
Arsse::$db->articleMark($this->user, ['read'=>true], (new Context)->subscription(13));
|
||||||
$now = Date::transform(time(), "sql");
|
$now = Date::transform(time(), "sql");
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][] = [13,5,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,5,1,0,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,1,0,$now];
|
$state['arsse_marks']['rows'][] = [13,6,1,0,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,7 +609,7 @@ trait SeriesArticle {
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][9][3] = 1;
|
$state['arsse_marks']['rows'][9][3] = 1;
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,7 +622,7 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][11][2] = 0;
|
$state['arsse_marks']['rows'][11][2] = 0;
|
||||||
$state['arsse_marks']['rows'][11][4] = $now;
|
$state['arsse_marks']['rows'][11][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,7 +655,7 @@ trait SeriesArticle {
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][9][3] = 1;
|
$state['arsse_marks']['rows'][9][3] = 1;
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,7 +687,7 @@ trait SeriesArticle {
|
||||||
$state['arsse_marks']['rows'][9][4] = $now;
|
$state['arsse_marks']['rows'][9][4] = $now;
|
||||||
$state['arsse_marks']['rows'][11][2] = 0;
|
$state['arsse_marks']['rows'][11][2] = 0;
|
||||||
$state['arsse_marks']['rows'][11][4] = $now;
|
$state['arsse_marks']['rows'][11][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,10 +752,10 @@ trait SeriesArticle {
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][8][3] = 1;
|
$state['arsse_marks']['rows'][8][3] = 1;
|
||||||
$state['arsse_marks']['rows'][8][4] = $now;
|
$state['arsse_marks']['rows'][8][4] = $now;
|
||||||
$state['arsse_marks']['rows'][] = [13,5,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,5,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [13,6,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,6,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,8,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,8,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,8 +774,8 @@ trait SeriesArticle {
|
||||||
Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->notModifiedSince('2000-01-01T00:00:00Z'));
|
Arsse::$db->articleMark($this->user, ['starred'=>true], (new Context)->notModifiedSince('2000-01-01T00:00:00Z'));
|
||||||
$now = Date::transform(time(), "sql");
|
$now = Date::transform(time(), "sql");
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$state['arsse_marks']['rows'][] = [13,5,0,1,$now];
|
$state['arsse_marks']['rows'][] = [13,5,0,1,$now,''];
|
||||||
$state['arsse_marks']['rows'][] = [14,7,0,1,$now];
|
$state['arsse_marks']['rows'][] = [14,7,0,1,$now,''];
|
||||||
$this->compareExpectations($state);
|
$this->compareExpectations($state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue