1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00

Fix rest of import tests

This commit is contained in:
J. King 2023-02-25 18:08:54 -05:00
parent 91ac7b568b
commit 4762084102
2 changed files with 16 additions and 13 deletions

View file

@ -87,7 +87,7 @@ abstract class AbstractImportExport {
$new = true; $new = true;
Arsse::$db->subscriptionReveal($user, $feedMap[$k]); Arsse::$db->subscriptionReveal($user, $feedMap[$k]);
} }
if (!$new || $replace) { if ($new || $replace) {
// set the subscription's properties, if this is a new feed or we're doing a full replacement // set the subscription's properties, if this is a new feed or we're doing a full replacement
Arsse::$db->subscriptionPropertiesSet($user, $feedMap[$k], ['title' => $title, 'folder' => $folder]); Arsse::$db->subscriptionPropertiesSet($user, $feedMap[$k], ['title' => $title, 'folder' => $folder]);
// compile the set of used tags, if this is a new feed or we're doing a full replacement // compile the set of used tags, if this is a new feed or we're doing a full replacement

View file

@ -19,7 +19,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
protected $primed; protected $primed;
protected $checkTables = [ protected $checkTables = [
'arsse_folders' => ["id", "owner", "parent", "name"], 'arsse_folders' => ["id", "owner", "parent", "name"],
'arsse_subscriptions' => ["id", "owner", "folder", "feed_title", "title", "url"], 'arsse_subscriptions' => ["id", "owner", "folder", "feed_title", "title", "url", "deleted"],
'arsse_tags' => ["id", "owner", "name"], 'arsse_tags' => ["id", "owner", "name"],
'arsse_tag_members' => ["tag", "subscription", "assigned"], 'arsse_tag_members' => ["tag", "subscription", "assigned"],
]; ];
@ -60,14 +60,14 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
], ],
], ],
'arsse_subscriptions' => [ 'arsse_subscriptions' => [
'columns' => ["id", "owner", "folder", "feed_title", "title", "url"], 'columns' => ["id", "owner", "folder", "feed_title", "title", "url", "deleted"],
'rows' => [ 'rows' => [
[1, "john.doe@example.com", 2, "NASA JPL", "NASA JPL", "http://localhost:8000/Import/nasa-jpl"], [1, "john.doe@example.com", 2, "NASA JPL", "NASA JPL", "http://localhost:8000/Import/nasa-jpl", 0],
[2, "john.doe@example.com", 5, "Toronto Star", "Toronto Star", "http://localhost:8000/Import/torstar"], [2, "john.doe@example.com", 5, "Toronto Star", "Toronto Star", "http://localhost:8000/Import/torstar", 0],
[3, "john.doe@example.com", 1, "Ars Technica", "Ars Technica", "http://localhost:8000/Import/ars"], [3, "john.doe@example.com", 1, "Ars Technica", "Ars Technica", "http://localhost:8000/Import/ars", 0],
[4, "john.doe@example.com", 6, "CBC News", "CBC News", "http://localhost:8000/Import/cbc"], [4, "john.doe@example.com", 6, "CBC News", "CBC News", "http://localhost:8000/Import/cbc", 0],
[5, "john.doe@example.com", 6, "Ottawa Citizen", "Ottawa Citizen", "http://localhost:8000/Import/citizen"], [5, "john.doe@example.com", 6, "Ottawa Citizen", "Ottawa Citizen", "http://localhost:8000/Import/citizen", 0],
[6, "john.doe@example.com", null, "Eurogamer", "Eurogamer", "http://localhost:8000/Import/eurogamer"], [6, "john.doe@example.com", null, "Eurogamer", "Eurogamer", "http://localhost:8000/Import/eurogamer", 0],
], ],
], ],
'arsse_tags' => [ 'arsse_tags' => [
@ -178,7 +178,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
$this->proc->parse->returns($in); $this->proc->parse->returns($in);
$this->proc->get()->import("john.doe@example.com", "", false, true); $this->proc->get()->import("john.doe@example.com", "", false, true);
$exp = $this->primeExpectations($this->data, $this->checkTables); $exp = $this->primeExpectations($this->data, $this->checkTables);
$exp['arsse_subscriptions']['rows'][3] = [4, "john.doe@example.com", null, "CBC News", "CBC", "http://localhost:8000/Import/cbc"]; $exp['arsse_subscriptions']['rows'][3] = [4, "john.doe@example.com", null, "CBC News", "CBC", "http://localhost:8000/Import/cbc", 0];
$exp['arsse_folders']['rows'][] = [7, "john.doe@example.com", null, "Nature"]; $exp['arsse_folders']['rows'][] = [7, "john.doe@example.com", null, "Nature"];
$this->compareExpectations($this->drv, $exp); $this->compareExpectations($this->drv, $exp);
} }
@ -190,7 +190,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
$this->proc->parse->returns($in); $this->proc->parse->returns($in);
$this->proc->get()->import("john.doe@example.com", "", false, false); $this->proc->get()->import("john.doe@example.com", "", false, false);
$exp = $this->primeExpectations($this->data, $this->checkTables); $exp = $this->primeExpectations($this->data, $this->checkTables);
$exp['arsse_subscriptions']['rows'][] = [7, "john.doe@example.com", null, "Some feed", "Some Feed", "http://localhost:8000/Import/some-feed"]; $exp['arsse_subscriptions']['rows'][] = [7, "john.doe@example.com", null, "Some feed", "Some Feed", "http://localhost:8000/Import/some-feed", 0];
$exp['arsse_tags']['rows'][] = [7, "john.doe@example.com", "cryptic"]; $exp['arsse_tags']['rows'][] = [7, "john.doe@example.com", "cryptic"];
$exp['arsse_tag_members']['rows'][] = [2, 7, 1]; $exp['arsse_tag_members']['rows'][] = [2, 7, 1];
$exp['arsse_tag_members']['rows'][] = [7, 7, 1]; $exp['arsse_tag_members']['rows'][] = [7, 7, 1];
@ -215,9 +215,12 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
$this->proc->parse->returns($in); $this->proc->parse->returns($in);
$this->proc->get()->import("john.doe@example.com", "", false, true); $this->proc->get()->import("john.doe@example.com", "", false, true);
$exp = $this->primeExpectations($this->data, $this->checkTables); $exp = $this->primeExpectations($this->data, $this->checkTables);
$exp['arsse_subscriptions']['rows'] = [[7, "john.doe@example.com", 4, "Some feed", "Some Feed", "http://localhost:8000/Import/some-feed"]]; $exp['arsse_subscriptions']['rows'] = [
[7, "john.doe@example.com", 4, "Some feed", "Some Feed", "http://localhost:8000/Import/some-feed", 0],
[6, "john.doe@example.com", null, "Eurogamer", "Eurogamer", "http://localhost:8000/Import/eurogamer", 1],
];
$exp['arsse_tags']['rows'] = [[2, "john.doe@example.com", "frequent"], [7, "john.doe@example.com", "cryptic"]]; $exp['arsse_tags']['rows'] = [[2, "john.doe@example.com", "frequent"], [7, "john.doe@example.com", "cryptic"]];
$exp['arsse_tag_members']['rows'] = [[2, 7, 1], [7, 7, 1]]; $exp['arsse_tag_members']['rows'] = [[2, 7, 1], [7, 7, 1], [2, 6, 0]];
$exp['arsse_folders']['rows'] = [[4, "john.doe@example.com", null, "Photography"]]; $exp['arsse_folders']['rows'] = [[4, "john.doe@example.com", null, "Photography"]];
$this->compareExpectations($this->drv, $exp); $this->compareExpectations($this->drv, $exp);
} }