mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-31 21:12:41 +00:00
Adapt the rest of the test series
This commit is contained in:
parent
dccd4caede
commit
a75fad53ca
10 changed files with 456 additions and 404 deletions
|
@ -16,7 +16,16 @@ use JKingWeb\Arsse\Test\DatabaseInformation;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
abstract class Base extends \JKingWeb\Arsse\Test\AbstractTest{
|
abstract class Base extends \JKingWeb\Arsse\Test\AbstractTest{
|
||||||
|
use SeriesMiscellany;
|
||||||
|
use SeriesMeta;
|
||||||
|
use SeriesUser;
|
||||||
|
use SeriesSession;
|
||||||
|
use SeriesFolder;
|
||||||
|
use SeriesFeed;
|
||||||
|
use SeriesSubscription;
|
||||||
use SeriesArticle;
|
use SeriesArticle;
|
||||||
|
use SeriesLabel;
|
||||||
|
use SeriesCleanup;
|
||||||
|
|
||||||
/** @var \JKingWeb\Arsse\Test\DatabaseInformation */
|
/** @var \JKingWeb\Arsse\Test\DatabaseInformation */
|
||||||
protected static $dbInfo;
|
protected static $dbInfo;
|
||||||
|
@ -62,6 +71,7 @@ abstract class Base extends \JKingWeb\Arsse\Test\AbstractTest{
|
||||||
// get the name of the test's test series
|
// get the name of the test's test series
|
||||||
$this->series = $this->findTraitofTest($this->getName());
|
$this->series = $this->findTraitofTest($this->getName());
|
||||||
static::clearData();
|
static::clearData();
|
||||||
|
static::setConf();
|
||||||
if (strlen(static::$failureReason)) {
|
if (strlen(static::$failureReason)) {
|
||||||
$this->markTestSkipped(static::$failureReason);
|
$this->markTestSkipped(static::$failureReason);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesCleanup {
|
trait SeriesCleanup {
|
||||||
public function setUpSeries() {
|
protected function setUpSeriesCleanup() {
|
||||||
// set up the configuration
|
// set up the configuration
|
||||||
Arsse::$conf->import([
|
Arsse::$conf->import([
|
||||||
'userSessionTimeout' => "PT1H",
|
'userSessionTimeout' => "PT1H",
|
||||||
|
@ -135,6 +135,10 @@ trait SeriesCleanup {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesCleanup() {
|
||||||
|
unset($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
public function testCleanUpOrphanedFeeds() {
|
public function testCleanUpOrphanedFeeds() {
|
||||||
Arsse::$db->feedCleanup();
|
Arsse::$db->feedCleanup();
|
||||||
$now = gmdate("Y-m-d H:i:s");
|
$now = gmdate("Y-m-d H:i:s");
|
||||||
|
|
|
@ -12,26 +12,7 @@ use JKingWeb\Arsse\Feed\Exception as FeedException;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesFeed {
|
trait SeriesFeed {
|
||||||
protected $matches = [
|
protected function setUpSeriesFeed() {
|
||||||
[
|
|
||||||
'id' => 4,
|
|
||||||
'edited' => '2000-01-04 00:00:00',
|
|
||||||
'guid' => '804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180',
|
|
||||||
'url_title_hash' => 'f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8',
|
|
||||||
'url_content_hash' => 'f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3',
|
|
||||||
'title_content_hash' => 'ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 5,
|
|
||||||
'edited' => '2000-01-05 00:00:00',
|
|
||||||
'guid' => 'db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41',
|
|
||||||
'url_title_hash' => 'd40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022',
|
|
||||||
'url_content_hash' => '834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900',
|
|
||||||
'title_content_hash' => '43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function setUpSeries() {
|
|
||||||
// set up the test data
|
// set up the test data
|
||||||
$past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute"));
|
$past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute"));
|
||||||
$future = gmdate("Y-m-d H:i:s", strtotime("now + 1 minute"));
|
$future = gmdate("Y-m-d H:i:s", strtotime("now + 1 minute"));
|
||||||
|
@ -163,6 +144,28 @@ trait SeriesFeed {
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
$this->matches = [
|
||||||
|
[
|
||||||
|
'id' => 4,
|
||||||
|
'edited' => '2000-01-04 00:00:00',
|
||||||
|
'guid' => '804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180',
|
||||||
|
'url_title_hash' => 'f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8',
|
||||||
|
'url_content_hash' => 'f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3',
|
||||||
|
'title_content_hash' => 'ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 5,
|
||||||
|
'edited' => '2000-01-05 00:00:00',
|
||||||
|
'guid' => 'db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41',
|
||||||
|
'url_title_hash' => 'd40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022',
|
||||||
|
'url_content_hash' => '834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900',
|
||||||
|
'title_content_hash' => '43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesFeed() {
|
||||||
|
unset($this->data, $this->matches);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testListLatestItems() {
|
public function testListLatestItems() {
|
||||||
|
|
|
@ -10,45 +10,51 @@ use JKingWeb\Arsse\Arsse;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesFolder {
|
trait SeriesFolder {
|
||||||
protected $data = [
|
protected function setUpSeriesFolder() {
|
||||||
'arsse_users' => [
|
$this->data = [
|
||||||
'columns' => [
|
'arsse_users' => [
|
||||||
'id' => 'str',
|
'columns' => [
|
||||||
'password' => 'str',
|
'id' => 'str',
|
||||||
'name' => 'str',
|
'password' => 'str',
|
||||||
|
'name' => 'str',
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
["jane.doe@example.com", "", "Jane Doe"],
|
||||||
|
["john.doe@example.com", "", "John Doe"],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_folders' => [
|
||||||
["jane.doe@example.com", "", "Jane Doe"],
|
'columns' => [
|
||||||
["john.doe@example.com", "", "John Doe"],
|
'id' => "int",
|
||||||
|
'owner' => "str",
|
||||||
|
'parent' => "int",
|
||||||
|
'name' => "str",
|
||||||
|
],
|
||||||
|
/* Layout translates to:
|
||||||
|
Jane
|
||||||
|
Politics
|
||||||
|
John
|
||||||
|
Technology
|
||||||
|
Software
|
||||||
|
Politics
|
||||||
|
Rocketry
|
||||||
|
Politics
|
||||||
|
*/
|
||||||
|
'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",
|
protected function tearDownSeriesFolder() {
|
||||||
'owner' => "str",
|
unset($this->data);
|
||||||
'parent' => "int",
|
}
|
||||||
'name' => "str",
|
|
||||||
],
|
|
||||||
/* Layout translates to:
|
|
||||||
Jane
|
|
||||||
Politics
|
|
||||||
John
|
|
||||||
Technology
|
|
||||||
Software
|
|
||||||
Politics
|
|
||||||
Rocketry
|
|
||||||
Politics
|
|
||||||
*/
|
|
||||||
'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"],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function testAddARootFolder() {
|
public function testAddARootFolder() {
|
||||||
$user = "john.doe@example.com";
|
$user = "john.doe@example.com";
|
||||||
|
|
|
@ -12,241 +12,244 @@ use JKingWeb\Arsse\Misc\Date;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesLabel {
|
trait SeriesLabel {
|
||||||
protected $data = [
|
protected function setUpSeriesLabel() {
|
||||||
'arsse_users' => [
|
$this->data = [
|
||||||
'columns' => [
|
'arsse_users' => [
|
||||||
'id' => 'str',
|
'columns' => [
|
||||||
'password' => 'str',
|
'id' => 'str',
|
||||||
'name' => 'str',
|
'password' => 'str',
|
||||||
|
'name' => 'str',
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
["jane.doe@example.com", "", "Jane Doe"],
|
||||||
|
["john.doe@example.com", "", "John Doe"],
|
||||||
|
["john.doe@example.org", "", "John Doe"],
|
||||||
|
["john.doe@example.net", "", "John Doe"],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_folders' => [
|
||||||
["jane.doe@example.com", "", "Jane Doe"],
|
'columns' => [
|
||||||
["john.doe@example.com", "", "John Doe"],
|
'id' => "int",
|
||||||
["john.doe@example.org", "", "John Doe"],
|
'owner' => "str",
|
||||||
["john.doe@example.net", "", "John Doe"],
|
'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"],
|
||||||
|
[7, "john.doe@example.net", null, "Technology"],
|
||||||
|
[8, "john.doe@example.net", 7, "Software"],
|
||||||
|
[9, "john.doe@example.net", null, "Politics"],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
],
|
'arsse_feeds' => [
|
||||||
'arsse_folders' => [
|
'columns' => [
|
||||||
'columns' => [
|
'id' => "int",
|
||||||
'id' => "int",
|
'url' => "str",
|
||||||
'owner' => "str",
|
],
|
||||||
'parent' => "int",
|
'rows' => [
|
||||||
'name' => "str",
|
[1,"http://example.com/1"],
|
||||||
|
[2,"http://example.com/2"],
|
||||||
|
[3,"http://example.com/3"],
|
||||||
|
[4,"http://example.com/4"],
|
||||||
|
[5,"http://example.com/5"],
|
||||||
|
[6,"http://example.com/6"],
|
||||||
|
[7,"http://example.com/7"],
|
||||||
|
[8,"http://example.com/8"],
|
||||||
|
[9,"http://example.com/9"],
|
||||||
|
[10,"http://example.com/10"],
|
||||||
|
[11,"http://example.com/11"],
|
||||||
|
[12,"http://example.com/12"],
|
||||||
|
[13,"http://example.com/13"],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_subscriptions' => [
|
||||||
[1, "john.doe@example.com", null, "Technology"],
|
'columns' => [
|
||||||
[2, "john.doe@example.com", 1, "Software"],
|
'id' => "int",
|
||||||
[3, "john.doe@example.com", 1, "Rocketry"],
|
'owner' => "str",
|
||||||
[4, "jane.doe@example.com", null, "Politics"],
|
'feed' => "int",
|
||||||
[5, "john.doe@example.com", null, "Politics"],
|
'folder' => "int",
|
||||||
[6, "john.doe@example.com", 2, "Politics"],
|
],
|
||||||
[7, "john.doe@example.net", null, "Technology"],
|
'rows' => [
|
||||||
[8, "john.doe@example.net", 7, "Software"],
|
[1,"john.doe@example.com",1,null],
|
||||||
[9, "john.doe@example.net", null, "Politics"],
|
[2,"john.doe@example.com",2,null],
|
||||||
]
|
[3,"john.doe@example.com",3,1],
|
||||||
],
|
[4,"john.doe@example.com",4,6],
|
||||||
'arsse_feeds' => [
|
[5,"john.doe@example.com",10,5],
|
||||||
'columns' => [
|
[6,"jane.doe@example.com",1,null],
|
||||||
'id' => "int",
|
[7,"jane.doe@example.com",10,null],
|
||||||
'url' => "str",
|
[8,"john.doe@example.org",11,null],
|
||||||
|
[9,"john.doe@example.org",12,null],
|
||||||
|
[10,"john.doe@example.org",13,null],
|
||||||
|
[11,"john.doe@example.net",10,null],
|
||||||
|
[12,"john.doe@example.net",2,9],
|
||||||
|
[13,"john.doe@example.net",3,8],
|
||||||
|
[14,"john.doe@example.net",4,7],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_articles' => [
|
||||||
[1,"http://example.com/1"],
|
'columns' => [
|
||||||
[2,"http://example.com/2"],
|
'id' => "int",
|
||||||
[3,"http://example.com/3"],
|
'feed' => "int",
|
||||||
[4,"http://example.com/4"],
|
'url' => "str",
|
||||||
[5,"http://example.com/5"],
|
'title' => "str",
|
||||||
[6,"http://example.com/6"],
|
'author' => "str",
|
||||||
[7,"http://example.com/7"],
|
'published' => "datetime",
|
||||||
[8,"http://example.com/8"],
|
'edited' => "datetime",
|
||||||
[9,"http://example.com/9"],
|
'content' => "str",
|
||||||
[10,"http://example.com/10"],
|
'guid' => "str",
|
||||||
[11,"http://example.com/11"],
|
'url_title_hash' => "str",
|
||||||
[12,"http://example.com/12"],
|
'url_content_hash' => "str",
|
||||||
[13,"http://example.com/13"],
|
'title_content_hash' => "str",
|
||||||
]
|
'modified' => "datetime",
|
||||||
],
|
],
|
||||||
'arsse_subscriptions' => [
|
'rows' => [
|
||||||
'columns' => [
|
[1,1,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
'id' => "int",
|
[2,1,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
'owner' => "str",
|
[3,2,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
'feed' => "int",
|
[4,2,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
'folder' => "int",
|
[5,3,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[6,3,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[7,4,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[8,4,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[9,5,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[10,5,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[11,6,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[12,6,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[13,7,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[14,7,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[15,8,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[16,8,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[17,9,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[18,9,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[19,10,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
||||||
|
[20,10,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
||||||
|
[101,11,'http://example.com/1','Article title 1','','2000-01-01 00:00:00','2000-01-01 00:00:01','<p>Article content 1</p>','e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda','f5cb8bfc1c7396dc9816af212a3e2ac5221585c2a00bf7ccb6aabd95dcfcd6a6','fb0bc8f8cb08913dc5a497db700e327f1d34e4987402687d494a5891f24714d4','18fdd4fa93d693128c43b004399e5c9cea6c261ddfa002518d3669f55d8c2207','2000-01-01 01:00:00'],
|
||||||
|
[102,11,'http://example.com/2','Article title 2','','2000-01-02 00:00:00','2000-01-02 00:00:02','<p>Article content 2</p>','5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7','0e86d2de822a174fe3c44a466953e63ca1f1a58a19cbf475fce0855d4e3d5153','13075894189c47ffcfafd1dfe7fbb539f7c74a69d35a399b3abf8518952714f9','2abd0a8cba83b8214a66c8f0293ba63e467d720540e29ff8ddcdab069d4f1c9e','2000-01-02 02:00:00'],
|
||||||
|
[103,12,'http://example.com/3','Article title 3','','2000-01-03 00:00:00','2000-01-03 00:00:03','<p>Article content 3</p>','31a6594500a48b59fcc8a075ce82b946c9c3c782460d088bd7b8ef3ede97ad92','f74b06b240bd08abf4d3fdfc20dba6a6f6eb8b4f1a00e9a617efd63a87180a4b','b278380e984cefe63f0e412b88ffc9cb0befdfa06fdc00bace1da99a8daff406','ad622b31e739cd3a3f3c788991082cf4d2f7a8773773008e75f0572e58cd373b','2000-01-03 03:00:00'],
|
||||||
|
[104,12,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:04','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9','2000-01-04 04:00:00'],
|
||||||
|
[105,13,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:05','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba','2000-01-05 05:00:00'],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_enclosures' => [
|
||||||
[1,"john.doe@example.com",1,null],
|
'columns' => [
|
||||||
[2,"john.doe@example.com",2,null],
|
'article' => "int",
|
||||||
[3,"john.doe@example.com",3,1],
|
'url' => "str",
|
||||||
[4,"john.doe@example.com",4,6],
|
'type' => "str",
|
||||||
[5,"john.doe@example.com",10,5],
|
],
|
||||||
[6,"jane.doe@example.com",1,null],
|
'rows' => [
|
||||||
[7,"jane.doe@example.com",10,null],
|
[102,"http://example.com/text","text/plain"],
|
||||||
[8,"john.doe@example.org",11,null],
|
[103,"http://example.com/video","video/webm"],
|
||||||
[9,"john.doe@example.org",12,null],
|
[104,"http://example.com/image","image/svg+xml"],
|
||||||
[10,"john.doe@example.org",13,null],
|
[105,"http://example.com/audio","audio/ogg"],
|
||||||
[11,"john.doe@example.net",10,null],
|
|
||||||
[12,"john.doe@example.net",2,9],
|
|
||||||
[13,"john.doe@example.net",3,8],
|
|
||||||
[14,"john.doe@example.net",4,7],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'arsse_articles' => [
|
|
||||||
'columns' => [
|
|
||||||
'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' => [
|
|
||||||
[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"],
|
|
||||||
[3,2,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[4,2,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[5,3,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[6,3,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[7,4,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[8,4,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[9,5,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[10,5,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[11,6,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[12,6,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[13,7,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[14,7,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[15,8,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[16,8,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[17,9,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[18,9,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[19,10,null,null,null,null,null,null,null,"","","","2000-01-01T00:00:00Z"],
|
|
||||||
[20,10,null,null,null,null,null,null,null,"","","","2010-01-01T00:00:00Z"],
|
|
||||||
[101,11,'http://example.com/1','Article title 1','','2000-01-01 00:00:00','2000-01-01 00:00:01','<p>Article content 1</p>','e433653cef2e572eee4215fa299a4a5af9137b2cefd6283c85bd69a32915beda','f5cb8bfc1c7396dc9816af212a3e2ac5221585c2a00bf7ccb6aabd95dcfcd6a6','fb0bc8f8cb08913dc5a497db700e327f1d34e4987402687d494a5891f24714d4','18fdd4fa93d693128c43b004399e5c9cea6c261ddfa002518d3669f55d8c2207','2000-01-01 01:00:00'],
|
|
||||||
[102,11,'http://example.com/2','Article title 2','','2000-01-02 00:00:00','2000-01-02 00:00:02','<p>Article content 2</p>','5be8a5a46ecd52ed132191c8d27fb1af6b3d4edc00234c5d9f8f0e10562ed3b7','0e86d2de822a174fe3c44a466953e63ca1f1a58a19cbf475fce0855d4e3d5153','13075894189c47ffcfafd1dfe7fbb539f7c74a69d35a399b3abf8518952714f9','2abd0a8cba83b8214a66c8f0293ba63e467d720540e29ff8ddcdab069d4f1c9e','2000-01-02 02:00:00'],
|
|
||||||
[103,12,'http://example.com/3','Article title 3','','2000-01-03 00:00:00','2000-01-03 00:00:03','<p>Article content 3</p>','31a6594500a48b59fcc8a075ce82b946c9c3c782460d088bd7b8ef3ede97ad92','f74b06b240bd08abf4d3fdfc20dba6a6f6eb8b4f1a00e9a617efd63a87180a4b','b278380e984cefe63f0e412b88ffc9cb0befdfa06fdc00bace1da99a8daff406','ad622b31e739cd3a3f3c788991082cf4d2f7a8773773008e75f0572e58cd373b','2000-01-03 03:00:00'],
|
|
||||||
[104,12,'http://example.com/4','Article title 4','','2000-01-04 00:00:00','2000-01-04 00:00:04','<p>Article content 4</p>','804e517d623390e71497982c77cf6823180342ebcd2e7d5e32da1e55b09dd180','f3615c7f16336d3ea242d35cf3fc17dbc4ee3afb78376bf49da2dd7a5a25dec8','f11c2b4046f207579aeb9c69a8c20ca5461cef49756ccfa5ba5e2344266da3b3','ab2da63276acce431250b18d3d49b988b226a99c7faadf275c90b751aee05be9','2000-01-04 04:00:00'],
|
|
||||||
[105,13,'http://example.com/5','Article title 5','','2000-01-05 00:00:00','2000-01-05 00:00:05','<p>Article content 5</p>','db3e736c2c492f5def5c5da33ddcbea1824040e9ced2142069276b0a6e291a41','d40da96e39eea6c55948ccbe9b3d275b5f931298288dbe953990c5f496097022','834240f84501b5341d375414718204ec421561f3825d34c22bf9182203e42900','43b970ac6ec5f8a9647b2c7e4eed8b1d7f62e154a95eed748b0294c1256764ba','2000-01-05 05:00:00'],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'arsse_enclosures' => [
|
|
||||||
'columns' => [
|
|
||||||
'article' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'type' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [
|
|
||||||
[102,"http://example.com/text","text/plain"],
|
|
||||||
[103,"http://example.com/video","video/webm"],
|
|
||||||
[104,"http://example.com/image","image/svg+xml"],
|
|
||||||
[105,"http://example.com/audio","audio/ogg"],
|
|
||||||
|
|
||||||
]
|
]
|
||||||
],
|
|
||||||
'arsse_editions' => [
|
|
||||||
'columns' => [
|
|
||||||
'id' => "int",
|
|
||||||
'article' => "int",
|
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_editions' => [
|
||||||
[1,1],
|
'columns' => [
|
||||||
[2,2],
|
'id' => "int",
|
||||||
[3,3],
|
'article' => "int",
|
||||||
[4,4],
|
],
|
||||||
[5,5],
|
'rows' => [
|
||||||
[6,6],
|
[1,1],
|
||||||
[7,7],
|
[2,2],
|
||||||
[8,8],
|
[3,3],
|
||||||
[9,9],
|
[4,4],
|
||||||
[10,10],
|
[5,5],
|
||||||
[11,11],
|
[6,6],
|
||||||
[12,12],
|
[7,7],
|
||||||
[13,13],
|
[8,8],
|
||||||
[14,14],
|
[9,9],
|
||||||
[15,15],
|
[10,10],
|
||||||
[16,16],
|
[11,11],
|
||||||
[17,17],
|
[12,12],
|
||||||
[18,18],
|
[13,13],
|
||||||
[19,19],
|
[14,14],
|
||||||
[20,20],
|
[15,15],
|
||||||
[101,101],
|
[16,16],
|
||||||
[102,102],
|
[17,17],
|
||||||
[103,103],
|
[18,18],
|
||||||
[104,104],
|
[19,19],
|
||||||
[105,105],
|
[20,20],
|
||||||
[202,102],
|
[101,101],
|
||||||
[203,103],
|
[102,102],
|
||||||
[204,104],
|
[103,103],
|
||||||
[205,105],
|
[104,104],
|
||||||
[305,105],
|
[105,105],
|
||||||
[1001,20],
|
[202,102],
|
||||||
]
|
[203,103],
|
||||||
],
|
[204,104],
|
||||||
'arsse_marks' => [
|
[205,105],
|
||||||
'columns' => [
|
[305,105],
|
||||||
'subscription' => "int",
|
[1001,20],
|
||||||
'article' => "int",
|
]
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
'modified' => "datetime"
|
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_marks' => [
|
||||||
[1, 1,1,1,'2000-01-01 00:00:00'],
|
'columns' => [
|
||||||
[5, 19,1,0,'2000-01-01 00:00:00'],
|
'subscription' => "int",
|
||||||
[5, 20,0,1,'2010-01-01 00:00:00'],
|
'article' => "int",
|
||||||
[7, 20,1,0,'2010-01-01 00:00:00'],
|
'read' => "bool",
|
||||||
[8, 102,1,0,'2000-01-02 02:00:00'],
|
'starred' => "bool",
|
||||||
[9, 103,0,1,'2000-01-03 03:00:00'],
|
'modified' => "datetime"
|
||||||
[9, 104,1,1,'2000-01-04 04:00:00'],
|
],
|
||||||
[10,105,0,0,'2000-01-05 05:00:00'],
|
'rows' => [
|
||||||
[11, 19,0,0,'2017-01-01 00:00:00'],
|
[1, 1,1,1,'2000-01-01 00:00:00'],
|
||||||
[11, 20,1,0,'2017-01-01 00:00:00'],
|
[5, 19,1,0,'2000-01-01 00:00:00'],
|
||||||
[12, 3,0,1,'2017-01-01 00:00:00'],
|
[5, 20,0,1,'2010-01-01 00:00:00'],
|
||||||
[12, 4,1,1,'2017-01-01 00:00:00'],
|
[7, 20,1,0,'2010-01-01 00:00:00'],
|
||||||
]
|
[8, 102,1,0,'2000-01-02 02:00:00'],
|
||||||
],
|
[9, 103,0,1,'2000-01-03 03:00:00'],
|
||||||
'arsse_labels' => [
|
[9, 104,1,1,'2000-01-04 04:00:00'],
|
||||||
'columns' => [
|
[10,105,0,0,'2000-01-05 05:00:00'],
|
||||||
'id' => "int",
|
[11, 19,0,0,'2017-01-01 00:00:00'],
|
||||||
'owner' => "str",
|
[11, 20,1,0,'2017-01-01 00:00:00'],
|
||||||
'name' => "str",
|
[12, 3,0,1,'2017-01-01 00:00:00'],
|
||||||
|
[12, 4,1,1,'2017-01-01 00:00:00'],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
'rows' => [
|
'arsse_labels' => [
|
||||||
[1,"john.doe@example.com","Interesting"],
|
'columns' => [
|
||||||
[2,"john.doe@example.com","Fascinating"],
|
'id' => "int",
|
||||||
[3,"jane.doe@example.com","Boring"],
|
'owner' => "str",
|
||||||
[4,"john.doe@example.com","Lonely"],
|
'name' => "str",
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
[1,"john.doe@example.com","Interesting"],
|
||||||
|
[2,"john.doe@example.com","Fascinating"],
|
||||||
|
[3,"jane.doe@example.com","Boring"],
|
||||||
|
[4,"john.doe@example.com","Lonely"],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
'arsse_label_members' => [
|
||||||
'arsse_label_members' => [
|
'columns' => [
|
||||||
'columns' => [
|
'label' => "int",
|
||||||
'label' => "int",
|
'article' => "int",
|
||||||
'article' => "int",
|
'subscription' => "int",
|
||||||
'subscription' => "int",
|
'assigned' => "bool",
|
||||||
'assigned' => "bool",
|
],
|
||||||
|
'rows' => [
|
||||||
|
[1, 1,1,1],
|
||||||
|
[2, 1,1,1],
|
||||||
|
[1,19,5,1],
|
||||||
|
[2,20,5,1],
|
||||||
|
[1, 5,3,0],
|
||||||
|
[2, 5,3,1],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'rows' => [
|
];
|
||||||
[1, 1,1,1],
|
|
||||||
[2, 1,1,1],
|
|
||||||
[1,19,5,1],
|
|
||||||
[2,20,5,1],
|
|
||||||
[1, 5,3,0],
|
|
||||||
[2, 5,3,1],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function setUpSeries() {
|
|
||||||
$this->checkLabels = ['arsse_labels' => ["id","owner","name"]];
|
$this->checkLabels = ['arsse_labels' => ["id","owner","name"]];
|
||||||
$this->checkMembers = ['arsse_label_members' => ["label","article","subscription","assigned"]];
|
$this->checkMembers = ['arsse_label_members' => ["label","article","subscription","assigned"]];
|
||||||
$this->user = "john.doe@example.com";
|
$this->user = "john.doe@example.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesLabel() {
|
||||||
|
unset($this->data, $this->checkLabels, $this->checkMembers, $this->user);
|
||||||
|
}
|
||||||
|
|
||||||
public function testAddALabel() {
|
public function testAddALabel() {
|
||||||
$user = "john.doe@example.com";
|
$user = "john.doe@example.com";
|
||||||
$labelID = $this->nextID("arsse_labels");
|
$labelID = $this->nextID("arsse_labels");
|
||||||
|
|
|
@ -10,26 +10,29 @@ use JKingWeb\Arsse\Test\Database;
|
||||||
use JKingWeb\Arsse\Arsse;
|
use JKingWeb\Arsse\Arsse;
|
||||||
|
|
||||||
trait SeriesMeta {
|
trait SeriesMeta {
|
||||||
protected $dataBare = [
|
protected function setUpSeriesMeta() {
|
||||||
'arsse_meta' => [
|
$dataBare = [
|
||||||
'columns' => [
|
'arsse_meta' => [
|
||||||
'key' => 'str',
|
'columns' => [
|
||||||
'value' => 'str',
|
'key' => 'str',
|
||||||
|
'value' => 'str',
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
//['schema_version', "".\JKingWeb\Arsse\Database::SCHEMA_VERSION],
|
||||||
|
['album',"A Farewell to Kings"],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'rows' => [
|
];
|
||||||
//['schema_version', "".\JKingWeb\Arsse\Database::SCHEMA_VERSION],
|
|
||||||
['album',"A Farewell to Kings"],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function setUpSeries() {
|
|
||||||
// the schema_version key is a special case, and to avoid jumping through hoops for every test we deal with it now
|
// the schema_version key is a special case, and to avoid jumping through hoops for every test we deal with it now
|
||||||
$this->data = $this->dataBare;
|
$this->data = $dataBare;
|
||||||
// as far as tests are concerned the schema version is part of the expectations primed into the database
|
// as far as tests are concerned the schema version is part of the expectations primed into the database
|
||||||
array_unshift($this->data['arsse_meta']['rows'], ['schema_version', "".Database::SCHEMA_VERSION]);
|
array_unshift($this->data['arsse_meta']['rows'], ['schema_version', "".Database::SCHEMA_VERSION]);
|
||||||
// but it's already been inserted by the driver, so we prime without it
|
// but it's already been inserted by the driver, so we prime without it
|
||||||
$this->primeDatabase($this->dataBare);
|
$this->primeDatabase($dataBare);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesMeta() {
|
||||||
|
unset($this->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddANewValue() {
|
public function testAddANewValue() {
|
||||||
|
|
|
@ -10,6 +10,15 @@ use JKingWeb\Arsse\Arsse;
|
||||||
use JKingWeb\Arsse\Database;
|
use JKingWeb\Arsse\Database;
|
||||||
|
|
||||||
trait SeriesMiscellany {
|
trait SeriesMiscellany {
|
||||||
|
protected function setUpSeriesMiscellany() {
|
||||||
|
static::setConf([
|
||||||
|
'dbDriver' => static::$dbInfo->driverClass,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesMiscellany() {
|
||||||
|
}
|
||||||
|
|
||||||
public function testListDrivers() {
|
public function testListDrivers() {
|
||||||
$exp = [
|
$exp = [
|
||||||
'JKingWeb\\Arsse\\Db\\SQLite3\\Driver' => Arsse::$lang->msg("Driver.Db.SQLite3.Name"),
|
'JKingWeb\\Arsse\\Db\\SQLite3\\Driver' => Arsse::$lang->msg("Driver.Db.SQLite3.Name"),
|
||||||
|
|
|
@ -11,9 +11,9 @@ use JKingWeb\Arsse\Misc\Date;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesSession {
|
trait SeriesSession {
|
||||||
public function setUpSeries() {
|
protected function setUpSeriesSession() {
|
||||||
// set up the configuration
|
// set up the configuration
|
||||||
Arsse::$conf->import([
|
static::setConf([
|
||||||
'userSessionTimeout' => "PT1H",
|
'userSessionTimeout' => "PT1H",
|
||||||
'userSessionLifetime' => "PT24H",
|
'userSessionLifetime' => "PT24H",
|
||||||
]);
|
]);
|
||||||
|
@ -51,6 +51,10 @@ trait SeriesSession {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesSession() {
|
||||||
|
unset($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
public function testResumeAValidSession() {
|
public function testResumeAValidSession() {
|
||||||
$exp1 = [
|
$exp1 = [
|
||||||
'id' => "80fa94c1a11f11e78667001e673b2560",
|
'id' => "80fa94c1a11f11e78667001e673b2560",
|
||||||
|
|
|
@ -12,112 +12,116 @@ use JKingWeb\Arsse\Feed\Exception as FeedException;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesSubscription {
|
trait SeriesSubscription {
|
||||||
protected $data = [
|
|
||||||
'arsse_users' => [
|
|
||||||
'columns' => [
|
|
||||||
'id' => 'str',
|
|
||||||
'password' => 'str',
|
|
||||||
'name' => 'str',
|
|
||||||
],
|
|
||||||
'rows' => [
|
|
||||||
["jane.doe@example.com", "", "Jane Doe"],
|
|
||||||
["john.doe@example.com", "", "John Doe"],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'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_feeds' => [
|
|
||||||
'columns' => [
|
|
||||||
'id' => "int",
|
|
||||||
'url' => "str",
|
|
||||||
'title' => "str",
|
|
||||||
'username' => "str",
|
|
||||||
'password' => "str",
|
|
||||||
'next_fetch' => "datetime",
|
|
||||||
'favicon' => "str",
|
|
||||||
],
|
|
||||||
'rows' => [] // filled in the series setup
|
|
||||||
],
|
|
||||||
'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],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'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,"","",""],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'arsse_marks' => [
|
|
||||||
'columns' => [
|
|
||||||
'article' => "int",
|
|
||||||
'subscription' => "int",
|
|
||||||
'read' => "bool",
|
|
||||||
'starred' => "bool",
|
|
||||||
],
|
|
||||||
'rows' => [
|
|
||||||
[1,2,1,0],
|
|
||||||
[2,2,1,0],
|
|
||||||
[3,2,1,0],
|
|
||||||
[4,2,1,0],
|
|
||||||
[5,2,1,0],
|
|
||||||
[1,1,1,0],
|
|
||||||
[7,3,1,0],
|
|
||||||
[8,3,0,0],
|
|
||||||
]
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
public function setUpSeries() {
|
public function setUpSeriesSubscription() {
|
||||||
|
$this->data = [
|
||||||
|
'arsse_users' => [
|
||||||
|
'columns' => [
|
||||||
|
'id' => 'str',
|
||||||
|
'password' => 'str',
|
||||||
|
'name' => 'str',
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
["jane.doe@example.com", "", "Jane Doe"],
|
||||||
|
["john.doe@example.com", "", "John Doe"],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'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_feeds' => [
|
||||||
|
'columns' => [
|
||||||
|
'id' => "int",
|
||||||
|
'url' => "str",
|
||||||
|
'title' => "str",
|
||||||
|
'username' => "str",
|
||||||
|
'password' => "str",
|
||||||
|
'next_fetch' => "datetime",
|
||||||
|
'favicon' => "str",
|
||||||
|
],
|
||||||
|
'rows' => [] // filled in the series setup
|
||||||
|
],
|
||||||
|
'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],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'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,"","",""],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'arsse_marks' => [
|
||||||
|
'columns' => [
|
||||||
|
'article' => "int",
|
||||||
|
'subscription' => "int",
|
||||||
|
'read' => "bool",
|
||||||
|
'starred' => "bool",
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
[1,2,1,0],
|
||||||
|
[2,2,1,0],
|
||||||
|
[3,2,1,0],
|
||||||
|
[4,2,1,0],
|
||||||
|
[5,2,1,0],
|
||||||
|
[1,1,1,0],
|
||||||
|
[7,3,1,0],
|
||||||
|
[8,3,0,0],
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
$this->data['arsse_feeds']['rows'] = [
|
$this->data['arsse_feeds']['rows'] = [
|
||||||
[1,"http://example.com/feed1", "Ook", "", "",strtotime("now"),''],
|
[1,"http://example.com/feed1", "Ook", "", "",strtotime("now"),''],
|
||||||
[2,"http://example.com/feed2", "eek", "", "",strtotime("now - 1 hour"),'http://example.com/favicon.ico'],
|
[2,"http://example.com/feed2", "eek", "", "",strtotime("now - 1 hour"),'http://example.com/favicon.ico'],
|
||||||
[3,"http://example.com/feed3", "Ack", "", "",strtotime("now + 1 hour"),''],
|
[3,"http://example.com/feed3", "Ack", "", "",strtotime("now + 1 hour"),''],
|
||||||
];
|
];
|
||||||
// initialize a partial mock of the Database object to later manipulate the feedUpdate method
|
// initialize a partial mock of the Database object to later manipulate the feedUpdate method
|
||||||
Arsse::$db = Phake::partialMock(Database::class, $this->drv);
|
Arsse::$db = Phake::partialMock(Database::class, static::$drv);
|
||||||
$this->user = "john.doe@example.com";
|
$this->user = "john.doe@example.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function tearDownSeriesSubscription() {
|
||||||
|
unset($this->data, $this->user);
|
||||||
|
}
|
||||||
|
|
||||||
public function testAddASubscriptionToAnExistingFeed() {
|
public function testAddASubscriptionToAnExistingFeed() {
|
||||||
$url = "http://example.com/feed1";
|
$url = "http://example.com/feed1";
|
||||||
$subID = $this->nextID("arsse_subscriptions");
|
$subID = $this->nextID("arsse_subscriptions");
|
||||||
|
|
|
@ -11,21 +11,27 @@ use JKingWeb\Arsse\User\Driver as UserDriver;
|
||||||
use Phake;
|
use Phake;
|
||||||
|
|
||||||
trait SeriesUser {
|
trait SeriesUser {
|
||||||
protected $data = [
|
protected function setUpSeriesUser() {
|
||||||
'arsse_users' => [
|
$this->data = [
|
||||||
'columns' => [
|
'arsse_users' => [
|
||||||
'id' => 'str',
|
'columns' => [
|
||||||
'password' => 'str',
|
'id' => 'str',
|
||||||
'name' => 'str',
|
'password' => 'str',
|
||||||
'rights' => 'int',
|
'name' => 'str',
|
||||||
|
'rights' => 'int',
|
||||||
|
],
|
||||||
|
'rows' => [
|
||||||
|
["admin@example.net", '$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', "Hard Lip Herbert", 100], // password is hash of "secret"
|
||||||
|
["jane.doe@example.com", "", "Jane Doe", 0],
|
||||||
|
["john.doe@example.com", "", "John Doe", 0],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'rows' => [
|
];
|
||||||
["admin@example.net", '$2y$10$PbcG2ZR3Z8TuPzM7aHTF8.v61dtCjzjK78gdZJcp4UePE8T9jEgBW', "Hard Lip Herbert", 100], // password is hash of "secret"
|
}
|
||||||
["jane.doe@example.com", "", "Jane Doe", 0],
|
|
||||||
["john.doe@example.com", "", "John Doe", 0],
|
protected function tearDownSeriesUser() {
|
||||||
],
|
unset($this->data);
|
||||||
],
|
}
|
||||||
];
|
|
||||||
|
|
||||||
public function testCheckThatAUserExists() {
|
public function testCheckThatAUserExists() {
|
||||||
$this->assertTrue(Arsse::$db->userExists("jane.doe@example.com"));
|
$this->assertTrue(Arsse::$db->userExists("jane.doe@example.com"));
|
||||||
|
|
Loading…
Reference in a new issue