mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Start on rewriting cleanup tests
This commit is contained in:
parent
02301b0dd9
commit
c139f52ebc
2 changed files with 19 additions and 12 deletions
|
@ -2049,10 +2049,10 @@ class Database {
|
||||||
arsse_articles
|
arsse_articles
|
||||||
where
|
where
|
||||||
subscription = ?
|
subscription = ?
|
||||||
and starred = 0
|
and (starred = 0 or hidden = 1)
|
||||||
and (
|
and (
|
||||||
coalesce(marked,modified) <= ?
|
coalesce(marked,modified) <= ?
|
||||||
or (\"read\" = 1 and coalesce(marked,modified) <= ?)
|
or (coalesce(marked,modified) <= ? and (\"read\" = 1 or hidden = 1))
|
||||||
)
|
)
|
||||||
and id not in (select id from exempt_articles)",
|
and id not in (select id from exempt_articles)",
|
||||||
["int", "int", "int", "datetime", "datetime"]
|
["int", "int", "int", "datetime", "datetime"]
|
||||||
|
|
|
@ -72,16 +72,18 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => ["id", "owner", "feed"],
|
'columns' => ["id", "owner", "url", "size", "icon", "deleted", "modified"],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
// one feed previously marked for deletion has a subscription again, and so should not be deleted
|
// first two subscriptions are used for article cleanup tests: the latest two articles should be kept
|
||||||
[1,'jane.doe@example.com',1],
|
[1,'jane.doe@example.com',"http://example.com/1",2,null,0,$daybefore],
|
||||||
// other subscriptions exist for article cleanup tests
|
[2,'john.doe@example.com',"http://example.com/1",2,null,0,$daybefore],
|
||||||
[2,'john.doe@example.com',1],
|
// the other subscriptions are used for subscription cleanup
|
||||||
|
[3,'jane.doe@example.com',"http://example.com/2",0, 2,1,$yesterday],
|
||||||
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_articles' => [
|
'arsse_articles' => [
|
||||||
'columns' => ["id", "feed", "url_title_hash", "url_content_hash", "title_content_hash", "modified"],
|
'columns' => ["id", "subscription", "url_title_hash", "url_content_hash", "title_content_hash", "modified"],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,"","","",$weeksago], // is the latest article, thus is kept
|
[1,1,"","","",$weeksago], // is the latest article, thus is kept
|
||||||
[2,1,"","","",$weeksago], // is the second latest article, thus is kept
|
[2,1,"","","",$weeksago], // is the second latest article, thus is kept
|
||||||
|
@ -101,6 +103,11 @@ trait SeriesCleanup {
|
||||||
[2,2],
|
[2,2],
|
||||||
[3,3],
|
[3,3],
|
||||||
[4,4],
|
[4,4],
|
||||||
|
[5,5],
|
||||||
|
[6,6],
|
||||||
|
[7,7],
|
||||||
|
[8,8],
|
||||||
|
[9,9],
|
||||||
[201,1],
|
[201,1],
|
||||||
[102,2],
|
[102,2],
|
||||||
],
|
],
|
||||||
|
@ -125,8 +132,8 @@ trait SeriesCleanup {
|
||||||
unset($this->data);
|
unset($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCleanUpOrphanedFeeds(): void {
|
public function testCleanUpDeletedSubscriptions(): void {
|
||||||
Arsse::$db->feedCleanup();
|
Arsse::$db->subscriptionCleanup();
|
||||||
$now = gmdate("Y-m-d H:i:s");
|
$now = gmdate("Y-m-d H:i:s");
|
||||||
$state = $this->primeExpectations($this->data, [
|
$state = $this->primeExpectations($this->data, [
|
||||||
'arsse_feeds' => ["id","orphaned"],
|
'arsse_feeds' => ["id","orphaned"],
|
||||||
|
@ -137,11 +144,11 @@ trait SeriesCleanup {
|
||||||
$this->compareExpectations(static::$drv, $state);
|
$this->compareExpectations(static::$drv, $state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCleanUpOrphanedFeedsWithUnlimitedRetention(): void {
|
public function testCleanUpDeletedSubscriptionsWithUnlimitedRetention(): void {
|
||||||
Arsse::$conf->import([
|
Arsse::$conf->import([
|
||||||
'purgeFeeds' => null,
|
'purgeFeeds' => null,
|
||||||
]);
|
]);
|
||||||
Arsse::$db->feedCleanup();
|
Arsse::$db->subscriptionCleanup();
|
||||||
$now = gmdate("Y-m-d H:i:s");
|
$now = gmdate("Y-m-d H:i:s");
|
||||||
$state = $this->primeExpectations($this->data, [
|
$state = $this->primeExpectations($this->data, [
|
||||||
'arsse_feeds' => ["id","orphaned"],
|
'arsse_feeds' => ["id","orphaned"],
|
||||||
|
|
Loading…
Reference in a new issue