Browse Source

Sundry article test fixes; things are still broken

redup
J. King 1 year ago
parent
commit
9fb57defa2
  1. 16
      lib/Database.php
  2. 733
      tests/cases/Database/SeriesArticle.php
  3. 2
      tests/cases/Database/SeriesCleanup.php
  4. 1
      tests/cases/Database/SeriesFeed.php
  5. 2
      tests/cases/Database/SeriesFolder.php
  6. 2
      tests/cases/Database/SeriesIcon.php
  7. 1
      tests/cases/Database/SeriesLabel.php
  8. 2
      tests/cases/Database/SeriesMeta.php
  9. 2
      tests/cases/Database/SeriesMiscellany.php
  10. 2
      tests/cases/Database/SeriesSession.php
  11. 2
      tests/cases/Database/SeriesSubscription.php
  12. 2
      tests/cases/Database/SeriesTag.php
  13. 2
      tests/cases/Database/SeriesToken.php
  14. 2
      tests/cases/Database/SeriesUser.php
  15. 1
      tests/cases/Database/TestDatabase.php

16
lib/Database.php

@ -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;

733
tests/cases/Database/SeriesArticle.php

File diff suppressed because it is too large

2
tests/cases/Database/SeriesCleanup.php

@ -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([

1
tests/cases/Database/SeriesFeed.php

@ -10,6 +10,7 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Test\Result;
trait SeriesFeed {
protected static $drv;
protected $matches;
protected function setUpSeriesFeed(): void {

2
tests/cases/Database/SeriesFolder.php

@ -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' => [

2
tests/cases/Database/SeriesIcon.php

@ -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 = [

1
tests/cases/Database/SeriesLabel.php

@ -11,6 +11,7 @@ use JKingWeb\Arsse\Database;
use JKingWeb\Arsse\Context\Context;
trait SeriesLabel {
protected static $drv;
protected $checkLabels;
protected function setUpSeriesLabel(): void {

2
tests/cases/Database/SeriesMeta.php

@ -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' => [

2
tests/cases/Database/SeriesMiscellany.php

@ -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,

2
tests/cases/Database/SeriesSession.php

@ -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([

2
tests/cases/Database/SeriesSubscription.php

@ -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' => [

2
tests/cases/Database/SeriesTag.php

@ -10,6 +10,8 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\Database;
trait SeriesTag {
protected static $drv;
protected $checkMembers;
protected $checkTags;

2
tests/cases/Database/SeriesToken.php

@ -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"));

2
tests/cases/Database/SeriesUser.php

@ -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' => [

1
tests/cases/Database/TestDatabase.php

@ -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…
Cancel
Save