mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Remove colukmn types from test data
For some reason this breaks PostgreSQL tests; this will have to be fixed
This commit is contained in:
parent
0f2da754c5
commit
07bac4ead3
14 changed files with 132 additions and 520 deletions
|
@ -18,11 +18,7 @@ trait SeriesArticle {
|
||||||
protected function setUpSeriesArticle(): void {
|
protected function setUpSeriesArticle(): void {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "", 1],
|
["jane.doe@example.com", "", 1],
|
||||||
["john.doe@example.com", "", 2],
|
["john.doe@example.com", "", 2],
|
||||||
|
@ -32,11 +28,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/1", "Feed 1"],
|
[1,"http://example.com/1", "Feed 1"],
|
||||||
[2,"http://example.com/2", "Feed 2"],
|
[2,"http://example.com/2", "Feed 2"],
|
||||||
|
@ -54,12 +46,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_folders' => [
|
'arsse_folders' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "parent", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'parent' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", null, "Technology"],
|
[1, "john.doe@example.com", null, "Technology"],
|
||||||
[2, "john.doe@example.com", 1, "Software"],
|
[2, "john.doe@example.com", 1, "Software"],
|
||||||
|
@ -73,11 +60,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tags' => [
|
'arsse_tags' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", "Technology"],
|
[1, "john.doe@example.com", "Technology"],
|
||||||
[2, "john.doe@example.com", "Software"],
|
[2, "john.doe@example.com", "Software"],
|
||||||
|
@ -90,38 +73,27 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed", "folder", "title", "scrape"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
'folder' => "int",
|
|
||||||
'title' => "str",
|
|
||||||
'scrape' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com",1, null,"Subscription 1",0],
|
[1, "john.doe@example.com",1, null,"Subscription 1", 0],
|
||||||
[2, "john.doe@example.com",2, null,null,0],
|
[2, "john.doe@example.com",2, null,null, 0],
|
||||||
[3, "john.doe@example.com",3, 1,"Subscription 3",0],
|
[3, "john.doe@example.com",3, 1,"Subscription 3", 0],
|
||||||
[4, "john.doe@example.com",4, 6,null,0],
|
[4, "john.doe@example.com",4, 6,null, 0],
|
||||||
[5, "john.doe@example.com",10, 5,"Subscription 5",0],
|
[5, "john.doe@example.com",10, 5,"Subscription 5", 0],
|
||||||
[6, "jane.doe@example.com",1, null,null,0],
|
[6, "jane.doe@example.com",1, null,null, 0],
|
||||||
[7, "jane.doe@example.com",10,null,"Subscription 7",0],
|
[7, "jane.doe@example.com",10,null,"Subscription 7", 0],
|
||||||
[8, "john.doe@example.org",11,null,null,0],
|
[8, "john.doe@example.org",11,null,null, 0],
|
||||||
[9, "john.doe@example.org",12,null,"Subscription 9",0],
|
[9, "john.doe@example.org",12,null,"Subscription 9", 0],
|
||||||
[10,"john.doe@example.org",13,null,null,0],
|
[10,"john.doe@example.org",13,null,null, 0],
|
||||||
[11,"john.doe@example.net",10,null,"Subscription 11",0],
|
[11,"john.doe@example.net",10,null,"Subscription 11",0],
|
||||||
[12,"john.doe@example.net",2, 9,null,0],
|
[12,"john.doe@example.net",2, 9,null, 0],
|
||||||
[13,"john.doe@example.net",3, 8,"Subscription 13",0],
|
[13,"john.doe@example.net",3, 8,"Subscription 13",0],
|
||||||
[14,"john.doe@example.net",4, 7,null,0],
|
[14,"john.doe@example.net",4, 7,null, 0],
|
||||||
[15,"jill.doe@example.com",11,null,null,1],
|
[15,"jill.doe@example.com",11,null,null, 1],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tag_members' => [
|
'arsse_tag_members' => [
|
||||||
'columns' => [
|
'columns' => ["tag", "subscription", "assigned"],
|
||||||
'tag' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'assigned' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,3,1],
|
[1,3,1],
|
||||||
[1,4,1],
|
[1,4,1],
|
||||||
|
@ -137,20 +109,8 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
'arsse_articles' => [
|
'arsse_articles' => [
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'id' => "int",
|
"id", "feed", "url", "title", "author", "published", "edited", "content", "guid",
|
||||||
'feed' => "int",
|
"url_title_hash", "url_content_hash", "title_content_hash", "modified", "content_scraped"
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'author' => "str",
|
|
||||||
'published' => "datetime",
|
|
||||||
'edited' => "datetime",
|
|
||||||
'content' => "str",
|
|
||||||
'guid' => "str",
|
|
||||||
'url_title_hash' => "str",
|
|
||||||
'url_content_hash' => "str",
|
|
||||||
'title_content_hash' => "str",
|
|
||||||
'modified' => "datetime",
|
|
||||||
'content_scraped' => "str",
|
|
||||||
],
|
],
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,null,"Title one", null,null,null,"First article", null,"","","","2000-01-01T00:00:00Z",null],
|
[1,1,null,"Title one", null,null,null,"First article", null,"","","","2000-01-01T00:00:00Z",null],
|
||||||
|
@ -181,11 +141,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_enclosures' => [
|
'arsse_enclosures' => [
|
||||||
'columns' => [
|
'columns' => ["article", "url", "type"],
|
||||||
'article' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'type' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[102,"http://example.com/text","text/plain"],
|
[102,"http://example.com/text","text/plain"],
|
||||||
[103,"http://example.com/video","video/webm"],
|
[103,"http://example.com/video","video/webm"],
|
||||||
|
@ -195,10 +151,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_editions' => [
|
'arsse_editions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "article"],
|
||||||
'id' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1],
|
[1,1],
|
||||||
[2,2],
|
[2,2],
|
||||||
|
@ -234,15 +187,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_marks' => [
|
'arsse_marks' => [
|
||||||
'columns' => [
|
'columns' => ["subscription", "article", "read", "starred", "modified", "note", "hidden"],
|
||||||
'subscription' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
'modified' => "datetime",
|
|
||||||
'note' => "str",
|
|
||||||
'hidden' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, 1,1,1,'2000-01-01 00:00:00','',0],
|
[1, 1,1,1,'2000-01-01 00:00:00','',0],
|
||||||
[5, 19,1,0,'2016-01-01 00:00:00','',0],
|
[5, 19,1,0,'2016-01-01 00:00:00','',0],
|
||||||
|
@ -263,10 +208,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_categories' => [ // author-supplied categories
|
'arsse_categories' => [ // author-supplied categories
|
||||||
'columns' => [
|
'columns' => ["article", "name"],
|
||||||
'article' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[19,"Fascinating"],
|
[19,"Fascinating"],
|
||||||
[19,"Logical"],
|
[19,"Logical"],
|
||||||
|
@ -274,12 +216,8 @@ trait SeriesArticle {
|
||||||
[20,"Logical"],
|
[20,"Logical"],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_labels' => [
|
'arsse_labels' => [ // labels applied to articles
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"john.doe@example.com","Interesting"],
|
[1,"john.doe@example.com","Interesting"],
|
||||||
[2,"john.doe@example.com","Fascinating"],
|
[2,"john.doe@example.com","Fascinating"],
|
||||||
|
@ -288,13 +226,7 @@ trait SeriesArticle {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_label_members' => [
|
'arsse_label_members' => [
|
||||||
'columns' => [
|
'columns' => ["label", "article", "subscription", "assigned", "modified"],
|
||||||
'label' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'assigned' => "bool",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, 1,1,1,'2000-01-01 00:00:00'],
|
[1, 1,1,1,'2000-01-01 00:00:00'],
|
||||||
[2, 1,1,1,'2000-01-01 00:00:00'],
|
[2, 1,1,1,'2000-01-01 00:00:00'],
|
||||||
|
|
|
@ -27,23 +27,14 @@ trait SeriesCleanup {
|
||||||
$faroff = (new Date("now + 1 hour", $tz))->format("Y-m-d H:i:s");
|
$faroff = (new Date("now + 1 hour", $tz))->format("Y-m-d H:i:s");
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_sessions' => [
|
'arsse_sessions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "created", "expires", "user"],
|
||||||
'id' => "str",
|
|
||||||
'created' => "datetime",
|
|
||||||
'expires' => "datetime",
|
|
||||||
'user' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["a", $nowish, $faroff, "jane.doe@example.com"], // not expired and recently created, thus kept
|
["a", $nowish, $faroff, "jane.doe@example.com"], // not expired and recently created, thus kept
|
||||||
["b", $nowish, $soon, "jane.doe@example.com"], // not expired and recently created, thus kept
|
["b", $nowish, $soon, "jane.doe@example.com"], // not expired and recently created, thus kept
|
||||||
|
@ -53,12 +44,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tokens' => [
|
'arsse_tokens' => [
|
||||||
'columns' => [
|
'columns' => ["id", "class", "user", "expires"],
|
||||||
'id' => "str",
|
|
||||||
'class' => "str",
|
|
||||||
'user' => "str",
|
|
||||||
'expires' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["80fa94c1a11f11e78667001e673b2560", "fever.login", "jane.doe@example.com", $faroff],
|
["80fa94c1a11f11e78667001e673b2560", "fever.login", "jane.doe@example.com", $faroff],
|
||||||
["27c6de8da13311e78667001e673b2560", "fever.login", "jane.doe@example.com", $weeksago], // expired
|
["27c6de8da13311e78667001e673b2560", "fever.login", "jane.doe@example.com", $weeksago], // expired
|
||||||
|
@ -67,11 +53,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_icons' => [
|
'arsse_icons' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "orphaned"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'orphaned' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,'http://localhost:8000/Icon/PNG',$daybefore],
|
[1,'http://localhost:8000/Icon/PNG',$daybefore],
|
||||||
[2,'http://localhost:8000/Icon/GIF',$daybefore],
|
[2,'http://localhost:8000/Icon/GIF',$daybefore],
|
||||||
|
@ -79,14 +61,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title", "orphaned", "size", "icon"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'orphaned' => "datetime",
|
|
||||||
'size' => "int",
|
|
||||||
'icon' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/1","",$daybefore,2,null], //latest two articles should be kept
|
[1,"http://example.com/1","",$daybefore,2,null], //latest two articles should be kept
|
||||||
[2,"http://example.com/2","",$yesterday,0,2],
|
[2,"http://example.com/2","",$yesterday,0,2],
|
||||||
|
@ -95,11 +70,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
// one feed previously marked for deletion has a subscription again, and so should not be deleted
|
// one feed previously marked for deletion has a subscription again, and so should not be deleted
|
||||||
[1,'jane.doe@example.com',1],
|
[1,'jane.doe@example.com',1],
|
||||||
|
@ -108,14 +79,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_articles' => [
|
'arsse_articles' => [
|
||||||
'columns' => [
|
'columns' => ["id", "feed", "url_title_hash", "url_content_hash", "title_content_hash", "modified"],
|
||||||
'id' => "int",
|
|
||||||
'feed' => "int",
|
|
||||||
'url_title_hash' => "str",
|
|
||||||
'url_content_hash' => "str",
|
|
||||||
'title_content_hash' => "str",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'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
|
||||||
|
@ -129,10 +93,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_editions' => [
|
'arsse_editions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "article"],
|
||||||
'id' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1],
|
[1,1],
|
||||||
[2,2],
|
[2,2],
|
||||||
|
@ -143,14 +104,7 @@ trait SeriesCleanup {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_marks' => [
|
'arsse_marks' => [
|
||||||
'columns' => [
|
'columns' => ["article", "subscription", "read", "starred", "hidden", "modified"],
|
||||||
'article' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
'hidden' => "bool",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[3,1,0,1,0,$weeksago],
|
[3,1,0,1,0,$weeksago],
|
||||||
[4,1,1,0,0,$daysago],
|
[4,1,1,0,0,$daysago],
|
||||||
|
|
|
@ -17,23 +17,14 @@ trait SeriesFeed {
|
||||||
$now = gmdate("Y-m-d H:i:s", strtotime("now"));
|
$now = gmdate("Y-m-d H:i:s", strtotime("now"));
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_icons' => [
|
'arsse_icons' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "type", "data"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'type' => "str",
|
|
||||||
'data' => "blob",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,'http://localhost:8000/Icon/PNG','image/png',base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")],
|
[1,'http://localhost:8000/Icon/PNG','image/png',base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")],
|
||||||
[2,'http://localhost:8000/Icon/GIF','image/gif',base64_decode("R0lGODlhAQABAIABAAAAAP///yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")],
|
[2,'http://localhost:8000/Icon/GIF','image/gif',base64_decode("R0lGODlhAQABAIABAAAAAP///yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")],
|
||||||
|
@ -42,17 +33,7 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title", "err_count", "err_msg", "modified", "next_fetch", "size", "icon"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'err_count' => "int",
|
|
||||||
'err_msg' => "str",
|
|
||||||
'modified' => "datetime",
|
|
||||||
'next_fetch' => "datetime",
|
|
||||||
'size' => "int",
|
|
||||||
'icon' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://localhost:8000/Feed/Matching/3","Ook",0,"",$past,$past,0,null],
|
[1,"http://localhost:8000/Feed/Matching/3","Ook",0,"",$past,$past,0,null],
|
||||||
[2,"http://localhost:8000/Feed/Matching/1","Eek",5,"There was an error last time",$past,$future,0,null],
|
[2,"http://localhost:8000/Feed/Matching/1","Eek",5,"There was an error last time",$past,$future,0,null],
|
||||||
|
@ -67,13 +48,7 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed", "keep_rule", "block_rule"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
'keep_rule' => "str",
|
|
||||||
'block_rule' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,'john.doe@example.com',1,null,'^Sport$'],
|
[1,'john.doe@example.com',1,null,'^Sport$'],
|
||||||
[2,'john.doe@example.com',2,"",null],
|
[2,'john.doe@example.com',2,"",null],
|
||||||
|
@ -84,21 +59,7 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_articles' => [
|
'arsse_articles' => [
|
||||||
'columns' => [
|
'columns' => ["id", "feed", "url", "title", "author", "published", "edited", "content", "guid", "url_title_hash", "url_content_hash", "title_content_hash", "modified"],
|
||||||
'id' => "int",
|
|
||||||
'feed' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'author' => "str",
|
|
||||||
'published' => "datetime",
|
|
||||||
'edited' => "datetime",
|
|
||||||
'content' => "str",
|
|
||||||
'guid' => "str",
|
|
||||||
'url_title_hash' => "str",
|
|
||||||
'url_content_hash' => "str",
|
|
||||||
'title_content_hash' => "str",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,'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],
|
[1,1,'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],
|
||||||
[2,1,'http://example.com/2','Article title 2','','2000-01-02 00:00:00','2000-01-02 00:00:00','<p>Article content 2</p>','5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7','0e86d2de822a174fe3c44a466953e63ca1f1a58a19cbf475fce0855d4e3d5153','13075894189c47ffcfafd1dfe7fbb539f7c74a69d35a399b3abf8518952714f9','2abd0a8cba83b8214a66c8f0293ba63e467d720540e29ff8ddcdab069d4f1c9e',$past],
|
[2,1,'http://example.com/2','Article title 2','','2000-01-02 00:00:00','2000-01-02 00:00:00','<p>Article content 2</p>','5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7','0e86d2de822a174fe3c44a466953e63ca1f1a58a19cbf475fce0855d4e3d5153','13075894189c47ffcfafd1dfe7fbb539f7c74a69d35a399b3abf8518952714f9','2abd0a8cba83b8214a66c8f0293ba63e467d720540e29ff8ddcdab069d4f1c9e',$past],
|
||||||
|
@ -110,11 +71,7 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_editions' => [
|
'arsse_editions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "article", "modified"],
|
||||||
'id' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,$past],
|
[1,1,$past],
|
||||||
[2,2,$past],
|
[2,2,$past],
|
||||||
|
@ -124,14 +81,7 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_marks' => [
|
'arsse_marks' => [
|
||||||
'columns' => [
|
'columns' => ["article", "subscription", "read", "starred", "hidden", "modified"],
|
||||||
'article' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
'hidden' => "bool",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
// Jane's marks
|
// Jane's marks
|
||||||
[1,6,1,0,0,$past],
|
[1,6,1,0,0,$past],
|
||||||
|
@ -146,20 +96,13 @@ trait SeriesFeed {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_enclosures' => [
|
'arsse_enclosures' => [
|
||||||
'columns' => [
|
'columns' => ["article", "url", "type"],
|
||||||
'article' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'type' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[7,'http://example.com/png','image/png'],
|
[7,'http://example.com/png','image/png'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_categories' => [
|
'arsse_categories' => [
|
||||||
'columns' => [
|
'columns' => ["article", "name"],
|
||||||
'article' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[7,'Syrinx'],
|
[7,'Syrinx'],
|
||||||
],
|
],
|
||||||
|
|
|
@ -12,23 +12,14 @@ trait SeriesFolder {
|
||||||
protected function setUpSeriesFolder(): void {
|
protected function setUpSeriesFolder(): void {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_folders' => [
|
'arsse_folders' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "parent", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'parent' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
/* Layout translates to:
|
/* Layout translates to:
|
||||||
Jane
|
Jane
|
||||||
Politics
|
Politics
|
||||||
|
@ -49,11 +40,7 @@ trait SeriesFolder {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/1", "Feed 1"],
|
[1,"http://example.com/1", "Feed 1"],
|
||||||
[2,"http://example.com/2", "Feed 2"],
|
[2,"http://example.com/2", "Feed 2"],
|
||||||
|
@ -71,12 +58,7 @@ trait SeriesFolder {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed", "folder"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
'folder' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com",1, null],
|
[1, "john.doe@example.com",1, null],
|
||||||
[2, "john.doe@example.com",2, null],
|
[2, "john.doe@example.com",2, null],
|
||||||
|
|
|
@ -16,23 +16,14 @@ trait SeriesIcon {
|
||||||
$now = gmdate("Y-m-d H:i:s", strtotime("now"));
|
$now = gmdate("Y-m-d H:i:s", strtotime("now"));
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_icons' => [
|
'arsse_icons' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "type", "data"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'type' => "str",
|
|
||||||
'data' => "blob",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,'http://localhost:8000/Icon/PNG','image/png',base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")],
|
[1,'http://localhost:8000/Icon/PNG','image/png',base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg==")],
|
||||||
[2,'http://localhost:8000/Icon/GIF','image/gif',base64_decode("R0lGODlhAQABAIABAAAAAP///yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")],
|
[2,'http://localhost:8000/Icon/GIF','image/gif',base64_decode("R0lGODlhAQABAIABAAAAAP///yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")],
|
||||||
|
@ -41,17 +32,7 @@ trait SeriesIcon {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title", "err_count", "err_msg", "modified", "next_fetch", "size", "icon"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'err_count' => "int",
|
|
||||||
'err_msg' => "str",
|
|
||||||
'modified' => "datetime",
|
|
||||||
'next_fetch' => "datetime",
|
|
||||||
'size' => "int",
|
|
||||||
'icon' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://localhost:8000/Feed/Matching/3","Ook",0,"",$past,$past,0,1],
|
[1,"http://localhost:8000/Feed/Matching/3","Ook",0,"",$past,$past,0,1],
|
||||||
[2,"http://localhost:8000/Feed/Matching/1","Eek",5,"There was an error last time",$past,$future,0,2],
|
[2,"http://localhost:8000/Feed/Matching/1","Eek",5,"There was an error last time",$past,$future,0,2],
|
||||||
|
@ -61,11 +42,7 @@ trait SeriesIcon {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,'john.doe@example.com',1],
|
[1,'john.doe@example.com',1],
|
||||||
[2,'john.doe@example.com',2],
|
[2,'john.doe@example.com',2],
|
||||||
|
|
|
@ -14,11 +14,7 @@ trait SeriesLabel {
|
||||||
protected function setUpSeriesLabel(): void {
|
protected function setUpSeriesLabel(): void {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
|
@ -27,12 +23,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_folders' => [
|
'arsse_folders' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "parent", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'parent' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", null, "Technology"],
|
[1, "john.doe@example.com", null, "Technology"],
|
||||||
[2, "john.doe@example.com", 1, "Software"],
|
[2, "john.doe@example.com", 1, "Software"],
|
||||||
|
@ -46,10 +37,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/1"],
|
[1,"http://example.com/1"],
|
||||||
[2,"http://example.com/2"],
|
[2,"http://example.com/2"],
|
||||||
|
@ -67,12 +55,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed", "folder"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
'folder' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"john.doe@example.com",1,null],
|
[1,"john.doe@example.com",1,null],
|
||||||
[2,"john.doe@example.com",2,null],
|
[2,"john.doe@example.com",2,null],
|
||||||
|
@ -91,21 +74,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_articles' => [
|
'arsse_articles' => [
|
||||||
'columns' => [
|
'columns' => ["id", "feed", "url", "title", "author", "published", "edited", "content", "guid", "url_title_hash", "url_content_hash", "title_content_hash", "modified"],
|
||||||
'id' => "int",
|
|
||||||
'feed' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'author' => "str",
|
|
||||||
'published' => "datetime",
|
|
||||||
'edited' => "datetime",
|
|
||||||
'content' => "str",
|
|
||||||
'guid' => "str",
|
|
||||||
'url_title_hash' => "str",
|
|
||||||
'url_content_hash' => "str",
|
|
||||||
'title_content_hash' => "str",
|
|
||||||
'modified' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
[1,1,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
[2,1,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
[2,1,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
@ -135,11 +104,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_enclosures' => [
|
'arsse_enclosures' => [
|
||||||
'columns' => [
|
'columns' => ["article", "url", "type"],
|
||||||
'article' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'type' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[102,"http://example.com/text","text/plain"],
|
[102,"http://example.com/text","text/plain"],
|
||||||
[103,"http://example.com/video","video/webm"],
|
[103,"http://example.com/video","video/webm"],
|
||||||
|
@ -149,10 +114,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_editions' => [
|
'arsse_editions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "article"],
|
||||||
'id' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1],
|
[1,1],
|
||||||
[2,2],
|
[2,2],
|
||||||
|
@ -188,14 +150,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_marks' => [
|
'arsse_marks' => [
|
||||||
'columns' => [
|
'columns' => ["subscription", "article", "read", "starred", "modified", "hidden"],
|
||||||
'subscription' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
'modified' => "datetime",
|
|
||||||
'hidden' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, 1,1,1,'2000-01-01 00:00:00',0],
|
[1, 1,1,1,'2000-01-01 00:00:00',0],
|
||||||
[5, 19,1,0,'2000-01-01 00:00:00',0],
|
[5, 19,1,0,'2000-01-01 00:00:00',0],
|
||||||
|
@ -213,11 +168,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_labels' => [
|
'arsse_labels' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"john.doe@example.com","Interesting"],
|
[1,"john.doe@example.com","Interesting"],
|
||||||
[2,"john.doe@example.com","Fascinating"],
|
[2,"john.doe@example.com","Fascinating"],
|
||||||
|
@ -226,12 +177,7 @@ trait SeriesLabel {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_label_members' => [
|
'arsse_label_members' => [
|
||||||
'columns' => [
|
'columns' => ["label", "article", "subscription", "assigned"],
|
||||||
'label' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'assigned' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, 1,1,1],
|
[1, 1,1,1],
|
||||||
[2, 1,1,1],
|
[2, 1,1,1],
|
||||||
|
|
|
@ -13,13 +13,10 @@ trait SeriesMeta {
|
||||||
protected function setUpSeriesMeta(): void {
|
protected function setUpSeriesMeta(): void {
|
||||||
$dataBare = [
|
$dataBare = [
|
||||||
'arsse_meta' => [
|
'arsse_meta' => [
|
||||||
'columns' => [
|
'columns' => ["key", "value"],
|
||||||
'key' => 'str',
|
|
||||||
'value' => 'str',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
//['schema_version', "".\JKingWeb\Arsse\Database::SCHEMA_VERSION],
|
//['schema_version', "".\JKingWeb\Arsse\Database::SCHEMA_VERSION],
|
||||||
['album',"A Farewell to Kings"],
|
['album',"A Farewell to Kings"],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
|
@ -23,23 +23,14 @@ trait SeriesSession {
|
||||||
$old = gmdate("Y-m-d H:i:s", strtotime("now - 2 days"));
|
$old = gmdate("Y-m-d H:i:s", strtotime("now - 2 days"));
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_sessions' => [
|
'arsse_sessions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "user", "created", "expires"],
|
||||||
'id' => "str",
|
|
||||||
'user' => "str",
|
|
||||||
'created' => "datetime",
|
|
||||||
'expires' => "datetime",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["80fa94c1a11f11e78667001e673b2560", "jane.doe@example.com", $past, $faroff],
|
["80fa94c1a11f11e78667001e673b2560", "jane.doe@example.com", $past, $faroff],
|
||||||
["27c6de8da13311e78667001e673b2560", "jane.doe@example.com", $past, $past], // expired
|
["27c6de8da13311e78667001e673b2560", "jane.doe@example.com", $past, $past], // expired
|
||||||
|
|
|
@ -15,11 +15,7 @@ trait SeriesSubscription {
|
||||||
public function setUpSeriesSubscription(): void {
|
public function setUpSeriesSubscription(): void {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "", 1],
|
["jane.doe@example.com", "", 1],
|
||||||
["john.doe@example.com", "", 2],
|
["john.doe@example.com", "", 2],
|
||||||
|
@ -28,12 +24,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_folders' => [
|
'arsse_folders' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "parent", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'parent' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", null, "Technology"],
|
[1, "john.doe@example.com", null, "Technology"],
|
||||||
[2, "john.doe@example.com", 1, "Software"],
|
[2, "john.doe@example.com", 1, "Software"],
|
||||||
|
@ -44,27 +35,14 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_icons' => [
|
'arsse_icons' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "data"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'data' => "blob",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/favicon.ico", "ICON DATA"],
|
[1,"http://example.com/favicon.ico", "ICON DATA"],
|
||||||
[2,"http://example.net/favicon.ico", null],
|
[2,"http://example.net/favicon.ico", null],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title", "username", "password", "updated", "next_fetch", "icon"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'username' => "str",
|
|
||||||
'password' => "str",
|
|
||||||
'updated' => "datetime",
|
|
||||||
'next_fetch' => "datetime",
|
|
||||||
'icon' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/feed1", "Ook", "", "",strtotime("now"),strtotime("now"),null],
|
[1,"http://example.com/feed1", "Ook", "", "",strtotime("now"),strtotime("now"),null],
|
||||||
[2,"http://example.com/feed2", "eek", "", "",strtotime("now - 1 hour"),strtotime("now - 1 hour"),1],
|
[2,"http://example.com/feed2", "eek", "", "",strtotime("now - 1 hour"),strtotime("now - 1 hour"),1],
|
||||||
|
@ -73,18 +51,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed", "title", "folder", "pinned", "order_type", "keep_rule", "block_rule", "scrape"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
'title' => "str",
|
|
||||||
'folder' => "int",
|
|
||||||
'pinned' => "bool",
|
|
||||||
'order_type' => "int",
|
|
||||||
'keep_rule' => "str",
|
|
||||||
'block_rule' => "str",
|
|
||||||
'scrape' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"john.doe@example.com",2,null,null,1,2,null,null,0],
|
[1,"john.doe@example.com",2,null,null,1,2,null,null,0],
|
||||||
[2,"jane.doe@example.com",2,null,null,0,0,null,null,0],
|
[2,"jane.doe@example.com",2,null,null,0,0,null,null,0],
|
||||||
|
@ -95,11 +62,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tags' => [
|
'arsse_tags' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"john.doe@example.com","Interesting"],
|
[1,"john.doe@example.com","Interesting"],
|
||||||
[2,"john.doe@example.com","Fascinating"],
|
[2,"john.doe@example.com","Fascinating"],
|
||||||
|
@ -108,11 +71,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tag_members' => [
|
'arsse_tag_members' => [
|
||||||
'columns' => [
|
'columns' => ["tag", "subscription", "assigned"],
|
||||||
'tag' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'assigned' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,1],
|
[1,1,1],
|
||||||
[1,3,0],
|
[1,3,0],
|
||||||
|
@ -122,14 +81,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_articles' => [
|
'arsse_articles' => [
|
||||||
'columns' => [
|
'columns' => ["id", "feed", "url_title_hash", "url_content_hash", "title_content_hash", "title"],
|
||||||
'id' => "int",
|
|
||||||
'feed' => "int",
|
|
||||||
'url_title_hash' => "str",
|
|
||||||
'url_content_hash' => "str",
|
|
||||||
'title_content_hash' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,2,"","","","Title 1"],
|
[1,2,"","","","Title 1"],
|
||||||
[2,2,"","","","Title 2"],
|
[2,2,"","","","Title 2"],
|
||||||
|
@ -142,10 +94,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_editions' => [
|
'arsse_editions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "article"],
|
||||||
'id' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1],
|
[1,1],
|
||||||
[2,2],
|
[2,2],
|
||||||
|
@ -158,10 +107,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_categories' => [
|
'arsse_categories' => [
|
||||||
'columns' => [
|
'columns' => ["article", "name"],
|
||||||
'article' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"A"],
|
[1,"A"],
|
||||||
[2,"B"],
|
[2,"B"],
|
||||||
|
@ -173,13 +119,7 @@ trait SeriesSubscription {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_marks' => [
|
'arsse_marks' => [
|
||||||
'columns' => [
|
'columns' => ["article", "subscription", "read", "starred", "hidden"],
|
||||||
'article' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
'hidden' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,2,1,0,0],
|
[1,2,1,0,0],
|
||||||
[2,2,1,0,0],
|
[2,2,1,0,0],
|
||||||
|
|
|
@ -13,11 +13,7 @@ trait SeriesTag {
|
||||||
protected function setUpSeriesTag(): void {
|
protected function setUpSeriesTag(): void {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
|
@ -26,11 +22,7 @@ trait SeriesTag {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"http://example.com/1",""],
|
[1,"http://example.com/1",""],
|
||||||
[2,"http://example.com/2",""],
|
[2,"http://example.com/2",""],
|
||||||
|
@ -48,12 +40,7 @@ trait SeriesTag {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "feed", "title"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'feed' => "int",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", 1,"Lord of Carrots"],
|
[1, "john.doe@example.com", 1,"Lord of Carrots"],
|
||||||
[2, "john.doe@example.com", 2,null],
|
[2, "john.doe@example.com", 2,null],
|
||||||
|
@ -72,11 +59,7 @@ trait SeriesTag {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tags' => [
|
'arsse_tags' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,"john.doe@example.com","Interesting"],
|
[1,"john.doe@example.com","Interesting"],
|
||||||
[2,"john.doe@example.com","Fascinating"],
|
[2,"john.doe@example.com","Fascinating"],
|
||||||
|
@ -85,11 +68,7 @@ trait SeriesTag {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tag_members' => [
|
'arsse_tag_members' => [
|
||||||
'columns' => [
|
'columns' => ["tag", "subscription", "assigned"],
|
||||||
'tag' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'assigned' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1,1,1],
|
[1,1,1],
|
||||||
[1,3,0],
|
[1,3,0],
|
||||||
|
|
|
@ -17,24 +17,14 @@ trait SeriesToken {
|
||||||
$old = gmdate("Y-m-d H:i:s", strtotime("now - 2 days"));
|
$old = gmdate("Y-m-d H:i:s", strtotime("now - 2 days"));
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["jane.doe@example.com", "",1],
|
["jane.doe@example.com", "",1],
|
||||||
["john.doe@example.com", "",2],
|
["john.doe@example.com", "",2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tokens' => [
|
'arsse_tokens' => [
|
||||||
'columns' => [
|
'columns' => ["id", "class", "user", "expires", "data"],
|
||||||
'id' => "str",
|
|
||||||
'class' => "str",
|
|
||||||
'user' => "str",
|
|
||||||
'expires' => "datetime",
|
|
||||||
'data' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["80fa94c1a11f11e78667001e673b2560", "fever.login", "jane.doe@example.com", $faroff, null],
|
["80fa94c1a11f11e78667001e673b2560", "fever.login", "jane.doe@example.com", $faroff, null],
|
||||||
["27c6de8da13311e78667001e673b2560", "fever.login", "jane.doe@example.com", $past, null], // expired
|
["27c6de8da13311e78667001e673b2560", "fever.login", "jane.doe@example.com", $past, null], // expired
|
||||||
|
|
|
@ -12,12 +12,7 @@ trait SeriesUser {
|
||||||
protected function setUpSeriesUser(): void {
|
protected function setUpSeriesUser(): void {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num", "admin"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
'admin' => 'bool',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["admin@example.net", '$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', 1, 1], // password is hash of "secret"
|
["admin@example.net", '$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', 1, 1], // password is hash of "secret"
|
||||||
["jane.doe@example.com", "", 2, 0],
|
["jane.doe@example.com", "", 2, 0],
|
||||||
|
@ -25,11 +20,7 @@ trait SeriesUser {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_user_meta' => [
|
'arsse_user_meta' => [
|
||||||
'columns' => [
|
'columns' => ["owner", "key", "value"],
|
||||||
'owner' => "str",
|
|
||||||
'key' => "str",
|
|
||||||
'value' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["admin@example.net", "lang", "en"],
|
["admin@example.net", "lang", "en"],
|
||||||
["admin@example.net", "tz", "America/Toronto"],
|
["admin@example.net", "tz", "America/Toronto"],
|
||||||
|
|
|
@ -41,23 +41,14 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
Arsse::$db->driverSchemaUpdate();
|
Arsse::$db->driverSchemaUpdate();
|
||||||
$this->data = [
|
$this->data = [
|
||||||
'arsse_users' => [
|
'arsse_users' => [
|
||||||
'columns' => [
|
'columns' => ["id", "password", "num"],
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'num' => 'int',
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
["john.doe@example.com", "", 1],
|
["john.doe@example.com", "", 1],
|
||||||
["jane.doe@example.com", "", 2],
|
["jane.doe@example.com", "", 2],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_folders' => [
|
'arsse_folders' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "parent", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'parent' => "int",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", null, "Science"],
|
[1, "john.doe@example.com", null, "Science"],
|
||||||
[2, "john.doe@example.com", 1, "Rocketry"],
|
[2, "john.doe@example.com", 1, "Rocketry"],
|
||||||
|
@ -68,11 +59,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_feeds' => [
|
'arsse_feeds' => [
|
||||||
'columns' => [
|
'columns' => ["id", "url", "title"],
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "http://localhost:8000/Import/nasa-jpl", "NASA JPL"],
|
[1, "http://localhost:8000/Import/nasa-jpl", "NASA JPL"],
|
||||||
[2, "http://localhost:8000/Import/torstar", "Toronto Star"],
|
[2, "http://localhost:8000/Import/torstar", "Toronto Star"],
|
||||||
|
@ -83,13 +70,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'arsse_subscriptions' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "folder", "feed", "title"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'folder' => "int",
|
|
||||||
'feed' => "int",
|
|
||||||
'title' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", 2, 1, "NASA JPL"],
|
[1, "john.doe@example.com", 2, 1, "NASA JPL"],
|
||||||
[2, "john.doe@example.com", 5, 2, "Toronto Star"],
|
[2, "john.doe@example.com", 5, 2, "Toronto Star"],
|
||||||
|
@ -100,11 +81,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tags' => [
|
'arsse_tags' => [
|
||||||
'columns' => [
|
'columns' => ["id", "owner", "name"],
|
||||||
'id' => "int",
|
|
||||||
'owner' => "str",
|
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, "john.doe@example.com", "canada"],
|
[1, "john.doe@example.com", "canada"],
|
||||||
[2, "john.doe@example.com", "frequent"],
|
[2, "john.doe@example.com", "frequent"],
|
||||||
|
@ -115,11 +92,7 @@ class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arsse_tag_members' => [
|
'arsse_tag_members' => [
|
||||||
'columns' => [
|
'columns' => ["tag", "subscription", "assigned"],
|
||||||
'tag' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'assigned' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
'rows' => [
|
||||||
[1, 2, 1],
|
[1, 2, 1],
|
||||||
[1, 4, 1],
|
[1, 4, 1],
|
||||||
|
|
|
@ -387,14 +387,33 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Inserts into the database test data in the following format:
|
||||||
|
*
|
||||||
|
* ```php
|
||||||
|
* $data = [
|
||||||
|
* 'some_table' => [
|
||||||
|
* 'columns' => ["id", "name"],
|
||||||
|
* 'rows' => [
|
||||||
|
* [1,"Dupond"],
|
||||||
|
* [2,"Dupont"],
|
||||||
|
* ]
|
||||||
|
* ],
|
||||||
|
* 'other_table' => [
|
||||||
|
* ...
|
||||||
|
* ]
|
||||||
|
* ];
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
public function primeDatabase(Driver $drv, array $data): bool {
|
public function primeDatabase(Driver $drv, array $data): bool {
|
||||||
$tr = $drv->begin();
|
$tr = $drv->begin();
|
||||||
foreach ($data as $table => $info) {
|
foreach ($data as $table => $info) {
|
||||||
$cols = array_map(function($v) {
|
$cols = array_map(function($v) {
|
||||||
return '"'.str_replace('"', '""', $v).'"';
|
return '"'.str_replace('"', '""', $v).'"';
|
||||||
}, array_keys($info['columns']));
|
}, $info['columns']);
|
||||||
$cols = implode(",", $cols);
|
$cols = implode(",", $cols);
|
||||||
$bindings = array_values($info['columns']);
|
$bindings = array_map(function($c) use ($table) {
|
||||||
|
return self::COL_DEFS[$table][$c];
|
||||||
|
}, $info['columns']);
|
||||||
$params = implode(",", array_fill(0, sizeof($info['columns']), "?"));
|
$params = implode(",", array_fill(0, sizeof($info['columns']), "?"));
|
||||||
$s = $drv->prepareArray("INSERT INTO $table($cols) values($params)", $bindings);
|
$s = $drv->prepareArray("INSERT INTO $table($cols) values($params)", $bindings);
|
||||||
foreach ($info['rows'] as $row) {
|
foreach ($info['rows'] as $row) {
|
||||||
|
@ -433,16 +452,15 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
||||||
// serialize the rows of the actual output
|
// serialize the rows of the actual output
|
||||||
$cols = implode(",", array_map(function($v) {
|
$cols = implode(",", array_map(function($v) {
|
||||||
return '"'.str_replace('"', '""', $v).'"';
|
return '"'.str_replace('"', '""', $v).'"';
|
||||||
}, array_keys($info['columns'])));
|
}, $info['columns']));
|
||||||
$data = $drv->prepare("SELECT $cols from $table")->run()->getAll();
|
$data = $drv->prepare("SELECT $cols from $table")->run()->getAll();
|
||||||
$types = $info['columns'];
|
|
||||||
$act = [];
|
$act = [];
|
||||||
$extra = [];
|
$extra = [];
|
||||||
foreach ($data as $r) {
|
foreach ($data as $r) {
|
||||||
$row = [];
|
$row = [];
|
||||||
foreach ($r as $c => $v) {
|
foreach ($r as $c => $v) {
|
||||||
// account for dates which might be off by one second
|
// account for dates which might be off by one second
|
||||||
if ($types[$c] === "datetime") {
|
if (self::COL_DEFS[$table][$c] === "datetime") {
|
||||||
if (array_search($v, $dates, true) === false) {
|
if (array_search($v, $dates, true) === false) {
|
||||||
$v = Date::transform(Date::sub("PT1S", $v), "sql");
|
$v = Date::transform(Date::sub("PT1S", $v), "sql");
|
||||||
if (array_search($v, $dates, true) === false) {
|
if (array_search($v, $dates, true) === false) {
|
||||||
|
@ -490,23 +508,22 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
||||||
$out = [];
|
$out = [];
|
||||||
foreach ($tableSpecs as $table => $columns) {
|
foreach ($tableSpecs as $table => $columns) {
|
||||||
// make sure the source has the table we want
|
// make sure the source has the table we want
|
||||||
$this->assertArrayHasKey($table, $source, "Source for expectations does not contain requested table $table.");
|
if (!isset($source[$table])) {
|
||||||
|
throw new Exception("Source for expectations does not contain requested table $table.");
|
||||||
|
}
|
||||||
|
// fill the output, particularly the correct number of (empty) rows
|
||||||
|
$rows = sizeof($source[$table]['rows']);
|
||||||
$out[$table] = [
|
$out[$table] = [
|
||||||
'columns' => [],
|
'columns' => $columns,
|
||||||
'rows' => array_fill(0, sizeof($source[$table]['rows']), []),
|
'rows' => array_fill(0, $rows, []),
|
||||||
];
|
];
|
||||||
// make sure the source has all the columns we want for the table
|
// fill the rows with the requested data, column-wise
|
||||||
$cols = array_flip($columns);
|
foreach ($columns as $c) {
|
||||||
$cols = array_intersect_key($cols, $source[$table]['columns']);
|
if (($index = array_search($c, $source[$table]['columns'], true)) === false) {
|
||||||
$this->assertSame(array_keys($cols), $columns, "Source for table $table does not contain all requested columns");
|
throw new exception("Expected column $table.$c is not present in test data");
|
||||||
// get a map of source value offsets and keys
|
}
|
||||||
$targets = array_flip(array_keys($source[$table]['columns']));
|
for ($a = 0; $a < $rows; $a++) {
|
||||||
foreach ($cols as $key => $order) {
|
$out[$table]['rows'][$a][] = $source[$table]['rows'][$a][$index];
|
||||||
// fill the column-spec
|
|
||||||
$out[$table]['columns'][$key] = $source[$table]['columns'][$key];
|
|
||||||
foreach ($source[$table]['rows'] as $index => $row) {
|
|
||||||
// fill each row column-wise with re-ordered values
|
|
||||||
$out[$table]['rows'][$index][$order] = $row[$targets[$key]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue