|
|
@ -8,111 +8,111 @@ use JKingWeb\Arsse\Feed\Exception as FeedException; |
|
|
|
use Phake; |
|
|
|
|
|
|
|
trait SeriesSubscription { |
|
|
|
function setUpSeries() { |
|
|
|
$this->data = [ |
|
|
|
'arsse_users' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => 'str', |
|
|
|
'password' => 'str', |
|
|
|
'name' => 'str', |
|
|
|
'rights' => 'int', |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
["admin@example.net", '$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', "Hard Lip Herbert", UserDriver::RIGHTS_GLOBAL_ADMIN], // password is hash of "secret" |
|
|
|
["jane.doe@example.com", "", "Jane Doe", UserDriver::RIGHTS_NONE], |
|
|
|
["john.doe@example.com", "", "John Doe", UserDriver::RIGHTS_NONE], |
|
|
|
], |
|
|
|
protected $data = [ |
|
|
|
'arsse_users' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => 'str', |
|
|
|
'password' => 'str', |
|
|
|
'name' => 'str', |
|
|
|
'rights' => 'int', |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
["jane.doe@example.com", "", "Jane Doe", UserDriver::RIGHTS_NONE], |
|
|
|
["john.doe@example.com", "", "John Doe", UserDriver::RIGHTS_NONE], |
|
|
|
], |
|
|
|
'arsse_folders' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'owner' => "str", |
|
|
|
'parent' => "int", |
|
|
|
'name' => "str", |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
[1, "john.doe@example.com", null, "Technology"], |
|
|
|
[2, "john.doe@example.com", 1, "Software"], |
|
|
|
[3, "john.doe@example.com", 1, "Rocketry"], |
|
|
|
[4, "jane.doe@example.com", null, "Politics"], |
|
|
|
[5, "john.doe@example.com", null, "Politics"], |
|
|
|
[6, "john.doe@example.com", 2, "Politics"], |
|
|
|
] |
|
|
|
], |
|
|
|
'arsse_folders' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'owner' => "str", |
|
|
|
'parent' => "int", |
|
|
|
'name' => "str", |
|
|
|
], |
|
|
|
'arsse_feeds' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'url' => "str", |
|
|
|
'title' => "str", |
|
|
|
'username' => "str", |
|
|
|
'password' => "str", |
|
|
|
'next_fetch' => "datetime", |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
[1,"http://example.com/feed1", "Ook", "", "",strtotime("now")], |
|
|
|
[2,"http://example.com/feed2", "Eek", "", "",strtotime("now - 1 hour")], |
|
|
|
[3,"http://example.com/feed3", "Ack", "", "",strtotime("now + 1 hour")], |
|
|
|
] |
|
|
|
'rows' => [ |
|
|
|
[1, "john.doe@example.com", null, "Technology"], |
|
|
|
[2, "john.doe@example.com", 1, "Software"], |
|
|
|
[3, "john.doe@example.com", 1, "Rocketry"], |
|
|
|
[4, "jane.doe@example.com", null, "Politics"], |
|
|
|
[5, "john.doe@example.com", null, "Politics"], |
|
|
|
[6, "john.doe@example.com", 2, "Politics"], |
|
|
|
] |
|
|
|
], |
|
|
|
'arsse_feeds' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'url' => "str", |
|
|
|
'title' => "str", |
|
|
|
'username' => "str", |
|
|
|
'password' => "str", |
|
|
|
'next_fetch' => "datetime", |
|
|
|
], |
|
|
|
'arsse_subscriptions' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'owner' => "str", |
|
|
|
'feed' => "int", |
|
|
|
'title' => "str", |
|
|
|
'folder' => "int", |
|
|
|
'pinned' => "bool", |
|
|
|
'order_type' => "int", |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
[1,"john.doe@example.com",2,null,null,1,2], |
|
|
|
[2,"jane.doe@example.com",2,null,null,0,0], |
|
|
|
[3,"john.doe@example.com",3,"Ook",2,0,1], |
|
|
|
] |
|
|
|
'rows' => [] // filled in the series setup |
|
|
|
], |
|
|
|
'arsse_subscriptions' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'owner' => "str", |
|
|
|
'feed' => "int", |
|
|
|
'title' => "str", |
|
|
|
'folder' => "int", |
|
|
|
'pinned' => "bool", |
|
|
|
'order_type' => "int", |
|
|
|
], |
|
|
|
'arsse_articles' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'feed' => "int", |
|
|
|
'url_title_hash' => "str", |
|
|
|
'url_content_hash' => "str", |
|
|
|
'title_content_hash' => "str", |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
[1,2,"","",""], |
|
|
|
[2,2,"","",""], |
|
|
|
[3,2,"","",""], |
|
|
|
[4,2,"","",""], |
|
|
|
[5,2,"","",""], |
|
|
|
[6,3,"","",""], |
|
|
|
[7,3,"","",""], |
|
|
|
[8,3,"","",""], |
|
|
|
] |
|
|
|
'rows' => [ |
|
|
|
[1,"john.doe@example.com",2,null,null,1,2], |
|
|
|
[2,"jane.doe@example.com",2,null,null,0,0], |
|
|
|
[3,"john.doe@example.com",3,"Ook",2,0,1], |
|
|
|
] |
|
|
|
], |
|
|
|
'arsse_articles' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'feed' => "int", |
|
|
|
'url_title_hash' => "str", |
|
|
|
'url_content_hash' => "str", |
|
|
|
'title_content_hash' => "str", |
|
|
|
], |
|
|
|
'arsse_marks' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'article' => "int", |
|
|
|
'owner' => "str", |
|
|
|
'read' => "bool", |
|
|
|
'starred' => "bool", |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
[1,1,"jane.doe@example.com",1,0], |
|
|
|
[2,2,"jane.doe@example.com",1,0], |
|
|
|
[3,3,"jane.doe@example.com",1,0], |
|
|
|
[4,4,"jane.doe@example.com",1,0], |
|
|
|
[5,5,"jane.doe@example.com",1,0], |
|
|
|
[6,6,"jane.doe@example.com",1,0], |
|
|
|
[7,7,"jane.doe@example.com",1,0], |
|
|
|
[8,8,"jane.doe@example.com",1,0], |
|
|
|
[9, 1,"john.doe@example.com",1,0], |
|
|
|
[10,7,"john.doe@example.com",1,0], |
|
|
|
[11,8,"john.doe@example.com",0,0], |
|
|
|
] |
|
|
|
'rows' => [ |
|
|
|
[1,2,"","",""], |
|
|
|
[2,2,"","",""], |
|
|
|
[3,2,"","",""], |
|
|
|
[4,2,"","",""], |
|
|
|
[5,2,"","",""], |
|
|
|
[6,3,"","",""], |
|
|
|
[7,3,"","",""], |
|
|
|
[8,3,"","",""], |
|
|
|
] |
|
|
|
], |
|
|
|
'arsse_marks' => [ |
|
|
|
'columns' => [ |
|
|
|
'id' => "int", |
|
|
|
'article' => "int", |
|
|
|
'owner' => "str", |
|
|
|
'read' => "bool", |
|
|
|
'starred' => "bool", |
|
|
|
], |
|
|
|
'rows' => [ |
|
|
|
[1,1,"jane.doe@example.com",1,0], |
|
|
|
[2,2,"jane.doe@example.com",1,0], |
|
|
|
[3,3,"jane.doe@example.com",1,0], |
|
|
|
[4,4,"jane.doe@example.com",1,0], |
|
|
|
[5,5,"jane.doe@example.com",1,0], |
|
|
|
[6,6,"jane.doe@example.com",1,0], |
|
|
|
[7,7,"jane.doe@example.com",1,0], |
|
|
|
[8,8,"jane.doe@example.com",1,0], |
|
|
|
[9, 1,"john.doe@example.com",1,0], |
|
|
|
[10,7,"john.doe@example.com",1,0], |
|
|
|
[11,8,"john.doe@example.com",0,0], |
|
|
|
] |
|
|
|
], |
|
|
|
]; |
|
|
|
|
|
|
|
function setUpSeries() { |
|
|
|
$this->data['arsse_feeds']['rows'] = [ |
|
|
|
[1,"http://example.com/feed1", "Ook", "", "",strtotime("now")], |
|
|
|
[2,"http://example.com/feed2", "Eek", "", "",strtotime("now - 1 hour")], |
|
|
|
[3,"http://example.com/feed3", "Ack", "", "",strtotime("now + 1 hour")], |
|
|
|
]; |
|
|
|
$this->primeDatabase($this->data); |
|
|
|
// initialize a partial mock of the Database object to later manipulate the feedUpdate method |
|
|
|
Data::$db = Phake::PartialMock(Database::class, $this->drv); |
|
|
|
$this->user = "john.doe@example.com"; |
|
|
|