Browse Source

Fix remaining tests

Two MySQL-specific failures remain
redup
J. King 1 year ago
parent
commit
eed42ddf19
  1. 30
      tests/cases/Database/SeriesCleanup.php
  2. 8
      tests/cases/Database/SeriesSubscription.php

30
tests/cases/Database/SeriesCleanup.php

@ -67,10 +67,10 @@ trait SeriesCleanup {
'rows' => [ 'rows' => [
// first two subscriptions are used for article cleanup tests: the latest two articles should be kept // first two subscriptions are used for article cleanup tests: the latest two articles should be kept
[1,'jane.doe@example.com',"http://example.com/1",2,null,0,$daybefore], [1,'jane.doe@example.com',"http://example.com/1",2,null,0,$daybefore],
[2,'john.doe@example.com',"http://example.com/1",2,null,0,$daybefore], [2,'john.doe@example.com',"http://example.com/1",2, 1,0,$daybefore],
// the other subscriptions are used for subscription cleanup // the other subscriptions are used for subscription cleanup
[3,'jane.doe@example.com',"http://example.com/2",0, 2,1,$yesterday], [3,'jane.doe@example.com',"http://example.com/2",0, 2,1,$yesterday],
[4,'jane.doe@example.com',"http://example.com/4",0, 1,1,$nowish], [4,'jane.doe@example.com',"http://example.com/4",0,null,1,$nowish],
], ],
], ],
@ -80,7 +80,7 @@ trait SeriesCleanup {
[ 1,1,"","","",$weeksago,0,0,0,null], // is the latest article, thus is kept [ 1,1,"","","",$weeksago,0,0,0,null], // is the latest article, thus is kept
[ 2,1,"","","",$weeksago,0,0,0,null], // is the second latest article, thus is kept [ 2,1,"","","",$weeksago,0,0,0,null], // is the second latest article, thus is kept
[ 3,1,"","","",$weeksago,0,1,0,$weeksago], // is starred by the user, thus is kept [ 3,1,"","","",$weeksago,0,1,0,$weeksago], // is starred by the user, thus is kept
[ 4,1,"","","",$weeksago,1,0,0,$daysago], // does not meet the unread threshold due to a recent mark, thus is kept [ 4,1,"","","",$weeksago,1,0,0,$yesterday], // does not meet the unread threshold due to a recent mark, thus is kept
[ 5,1,"","","",$daysago, 0,0,0,null], // does not meet the unread threshold due to age, thus is kept [ 5,1,"","","",$daysago, 0,0,0,null], // does not meet the unread threshold due to age, thus is kept
[ 6,1,"","","",$weeksago,1,0,0,$nowish], // does not meet the read threshold due to a recent mark, thus is kept [ 6,1,"","","",$weeksago,1,0,0,$nowish], // does not meet the read threshold due to a recent mark, thus is kept
[ 7,1,"","","",$weeksago,0,0,0,null], // meets the unread threshold without marks, thus is deleted [ 7,1,"","","",$weeksago,0,0,0,null], // meets the unread threshold without marks, thus is deleted
@ -182,8 +182,12 @@ trait SeriesCleanup {
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
'arsse_articles' => ["id"], 'arsse_articles' => ["id"],
]); ]);
foreach ([7,8,9] as $id) { $deleted = [7, 8, 9, 1003, 1004, 1006, 1007, 1008, 1009];
unset($state['arsse_articles']['rows'][$id - 1]); $stop = sizeof($state['arsse_articles']['rows']);
for ($a = 0; $a < $stop; $a++) {
if (in_array($state['arsse_articles']['rows'][$a][0], $deleted)) {
unset($state['arsse_articles']['rows'][$a]);
}
} }
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
@ -196,8 +200,12 @@ trait SeriesCleanup {
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
'arsse_articles' => ["id"], 'arsse_articles' => ["id"],
]); ]);
foreach ([7,8] as $id) { $deleted = [7, 8, 1003, 1004, 1006, 1007, 1008];
unset($state['arsse_articles']['rows'][$id - 1]); $stop = sizeof($state['arsse_articles']['rows']);
for ($a = 0; $a < $stop; $a++) {
if (in_array($state['arsse_articles']['rows'][$a][0], $deleted)) {
unset($state['arsse_articles']['rows'][$a]);
}
} }
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
@ -210,8 +218,12 @@ trait SeriesCleanup {
$state = $this->primeExpectations($this->data, [ $state = $this->primeExpectations($this->data, [
'arsse_articles' => ["id"], 'arsse_articles' => ["id"],
]); ]);
foreach ([9] as $id) { $deleted = [8, 9, 1006, 1007, 1009];
unset($state['arsse_articles']['rows'][$id - 1]); $stop = sizeof($state['arsse_articles']['rows']);
for ($a = 0; $a < $stop; $a++) {
if (in_array($state['arsse_articles']['rows'][$a][0], $deleted)) {
unset($state['arsse_articles']['rows'][$a]);
}
} }
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }

8
tests/cases/Database/SeriesSubscription.php

@ -401,7 +401,6 @@ trait SeriesSubscription {
} }
public function testSetThePropertiesOfASubscription(): void { public function testSetThePropertiesOfASubscription(): void {
$this->markTestIncomplete();
Arsse::$db->subscriptionPropertiesSet($this->user, 1, [ Arsse::$db->subscriptionPropertiesSet($this->user, 1, [
'title' => "Ook Ook", 'title' => "Ook Ook",
'folder' => 3, 'folder' => 3,
@ -535,11 +534,10 @@ trait SeriesSubscription {
} }
public function testSetTheFilterRulesOfASubscriptionCheckingMarks(): void { public function testSetTheFilterRulesOfASubscriptionCheckingMarks(): void {
$this->markTestIncomplete();
Arsse::$db->subscriptionPropertiesSet("jack.doe@example.com", 5, ['keep_rule' => "1|B|3|D", 'block_rule' => "4"]); Arsse::$db->subscriptionPropertiesSet("jack.doe@example.com", 5, ['keep_rule' => "1|B|3|D", 'block_rule' => "4"]);
$state = $this->primeExpectations($this->data, ['arsse_marks' => ['article', 'subscription', 'hidden']]); $state = $this->primeExpectations($this->data, ['arsse_articles' => ['id', 'hidden']]);
$state['arsse_marks']['rows'][9][2] = 0; $state['arsse_articles']['rows'][17][1] = 0;
$state['arsse_marks']['rows'][10][2] = 1; $state['arsse_articles']['rows'][18][1] = 1;
$this->compareExpectations(static::$drv, $state); $this->compareExpectations(static::$drv, $state);
} }
} }

Loading…
Cancel
Save