mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Sundry article test fixes; things are still broken
This commit is contained in:
parent
30dbd850e3
commit
9fb57defa2
15 changed files with 412 additions and 362 deletions
|
@ -1926,7 +1926,7 @@ class Database {
|
|||
$setData = array_filter($data, function($v, $k) {
|
||||
// filter out anyhing with a value of null (no change), as well as the "rea" key as it required special handling
|
||||
return isset($v) && $k !== "read";
|
||||
});
|
||||
}, \ARRAY_FILTER_USE_BOTH);
|
||||
[$set, $setTypes, $setValues] = $this->generateSet($setData, ['read' => "bool", 'starred' => "bool", 'hidden' => "bool", 'note' => "str"]);
|
||||
$set = $set ? "$set, " : "";
|
||||
$set .= "read = case when id in (select article from valid_read) then ? else \"read\" end";
|
||||
|
@ -1939,11 +1939,11 @@ class Database {
|
|||
[$inClause, $inTypes, $inValues] = $this->generateIn($context->editions ?: (array) $context->edition, "int");
|
||||
$out = $this->db->prepare(
|
||||
"WITH RECURSIVE
|
||||
target_articles(article) as (
|
||||
target_articles as (
|
||||
{$subq->getQuery()}
|
||||
),
|
||||
valid_read as (
|
||||
select article from (
|
||||
select selected_editions.article from (
|
||||
select max(id) as edition, article from arsse_editions where id in ($inClause) group by article
|
||||
) as selected_editions join (
|
||||
SELECT max(id) as edition, article from arsse_editions group by article
|
||||
|
@ -1953,11 +1953,11 @@ class Database {
|
|||
set
|
||||
$set
|
||||
where
|
||||
article in (select article from target_articles)",
|
||||
id in (select id from target_articles)",
|
||||
$subq->getTypes(), $inTypes, $setTypes
|
||||
)->run(
|
||||
$subq->getValues(), $inValues, $setValues
|
||||
);
|
||||
)->changes();
|
||||
} else {
|
||||
// set up the "SET" clause for the update
|
||||
$setData = array_filter($data, function($v) {
|
||||
|
@ -1971,18 +1971,18 @@ class Database {
|
|||
// prepare the rest of the query
|
||||
$out = $this->db->prepare(
|
||||
"WITH RECURSIVE
|
||||
target_articles(article) as (
|
||||
target_articles as (
|
||||
{$subq->getQuery()}
|
||||
)
|
||||
update arsse_articles
|
||||
set
|
||||
$set
|
||||
where
|
||||
article in (select article from target_articles)",
|
||||
id in (select id from target_articles)",
|
||||
$subq->getTypes(), $setTypes
|
||||
)->run(
|
||||
$subq->getValues(), $setValues
|
||||
);
|
||||
)->changes();
|
||||
}
|
||||
$tr->commit();
|
||||
return $out;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,8 @@ use JKingWeb\Arsse\Arsse;
|
|||
use DateTimeImmutable as Date;
|
||||
|
||||
trait SeriesCleanup {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesCleanup(): void {
|
||||
// set up the configuration
|
||||
Arsse::$conf->import([
|
||||
|
|
|
@ -10,6 +10,7 @@ use JKingWeb\Arsse\Arsse;
|
|||
use JKingWeb\Arsse\Test\Result;
|
||||
|
||||
trait SeriesFeed {
|
||||
protected static $drv;
|
||||
protected $matches;
|
||||
|
||||
protected function setUpSeriesFeed(): void {
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace JKingWeb\Arsse\TestCase\Database;
|
|||
use JKingWeb\Arsse\Arsse;
|
||||
|
||||
trait SeriesFolder {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesFolder(): void {
|
||||
$this->data = [
|
||||
'arsse_users' => [
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace JKingWeb\Arsse\TestCase\Database;
|
|||
use JKingWeb\Arsse\Arsse;
|
||||
|
||||
trait SeriesIcon {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesIcon(): void {
|
||||
// set up the test data
|
||||
$this->data = [
|
||||
|
|
|
@ -11,6 +11,7 @@ use JKingWeb\Arsse\Database;
|
|||
use JKingWeb\Arsse\Context\Context;
|
||||
|
||||
trait SeriesLabel {
|
||||
protected static $drv;
|
||||
protected $checkLabels;
|
||||
|
||||
protected function setUpSeriesLabel(): void {
|
||||
|
|
|
@ -10,6 +10,8 @@ use JKingWeb\Arsse\Test\Database;
|
|||
use JKingWeb\Arsse\Arsse;
|
||||
|
||||
trait SeriesMeta {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesMeta(): void {
|
||||
$dataBare = [
|
||||
'arsse_meta' => [
|
||||
|
|
|
@ -10,6 +10,8 @@ use JKingWeb\Arsse\Arsse;
|
|||
use JKingWeb\Arsse\Database;
|
||||
|
||||
trait SeriesMiscellany {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesMiscellany(): void {
|
||||
static::setConf([
|
||||
'dbDriver' => static::$dbDriverClass,
|
||||
|
|
|
@ -10,6 +10,8 @@ use JKingWeb\Arsse\Arsse;
|
|||
use JKingWeb\Arsse\Misc\Date;
|
||||
|
||||
trait SeriesSession {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesSession(): void {
|
||||
// set up the configuration
|
||||
static::setConf([
|
||||
|
|
|
@ -13,6 +13,8 @@ use JKingWeb\Arsse\Feed\Exception as FeedException;
|
|||
use JKingWeb\Arsse\Misc\Date;
|
||||
|
||||
trait SeriesSubscription {
|
||||
protected static $drv;
|
||||
|
||||
public function setUpSeriesSubscription(): void {
|
||||
$this->data = [
|
||||
'arsse_users' => [
|
||||
|
|
|
@ -10,6 +10,8 @@ use JKingWeb\Arsse\Arsse;
|
|||
use JKingWeb\Arsse\Database;
|
||||
|
||||
trait SeriesTag {
|
||||
protected static $drv;
|
||||
|
||||
protected $checkMembers;
|
||||
protected $checkTags;
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace JKingWeb\Arsse\TestCase\Database;
|
|||
use JKingWeb\Arsse\Arsse;
|
||||
|
||||
trait SeriesToken {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesToken(): void {
|
||||
// set up the test data
|
||||
$past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute"));
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace JKingWeb\Arsse\TestCase\Database;
|
|||
use JKingWeb\Arsse\Arsse;
|
||||
|
||||
trait SeriesUser {
|
||||
protected static $drv;
|
||||
|
||||
protected function setUpSeriesUser(): void {
|
||||
$this->data = [
|
||||
'arsse_users' => [
|
||||
|
|
|
@ -10,6 +10,7 @@ use JKingWeb\Arsse\Database;
|
|||
|
||||
/** @covers \JKingWeb\Arsse\Database */
|
||||
class TestDatabase extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||
protected static $drv;
|
||||
protected $db = null;
|
||||
|
||||
public function setUp(): void {
|
||||
|
|
Loading…
Reference in a new issue