summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2021-03-23 20:05:58 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-03-23 21:11:25 +0100
commitbaf1ca8ec9e3964c97c6e11ca9c6a56e38b8fe48 (patch)
tree146a42d1be66f2ca81443f0bf084cc70d4dc2a35 /tests
parent4e1d6eaa32524c119c4d2838e904aa02d3fced1b (diff)
DB: Don't show deleted feed items
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'tests')
-rw-r--r--tests/Unit/Db/ItemMapperAfterTest.php28
-rw-r--r--tests/Unit/Db/ItemMapperPaginatedTest.php45
2 files changed, 46 insertions, 27 deletions
diff --git a/tests/Unit/Db/ItemMapperAfterTest.php b/tests/Unit/Db/ItemMapperAfterTest.php
index dbb883fc9..5c536e1bf 100644
--- a/tests/Unit/Db/ItemMapperAfterTest.php
+++ b/tests/Unit/Db/ItemMapperAfterTest.php
@@ -78,12 +78,13 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
- ['feeds.id = :feedId']
+ ['feeds.id = :feedId'],
+ ['feeds.deleted_at = 0']
)
->will($this->returnSelf());
@@ -142,12 +143,13 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
['feeds.id = :feedId'],
+ ['feeds.deleted_at = 0'],
['items.unread = 1']
)
->will($this->returnSelf());
@@ -210,11 +212,12 @@ class ItemMapperAfterTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['folders.id = :folderId']
)
->will($this->returnSelf());
@@ -277,11 +280,12 @@ class ItemMapperAfterTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['folders.id = :folderId'],
['items.unread = 1']
)
@@ -342,10 +346,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.unread = 1']
)
@@ -405,10 +410,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.starred = 1']
)
@@ -468,10 +474,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId']
)
->will($this->returnSelf());
@@ -533,10 +540,11 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId']
)
->will($this->returnSelf());
@@ -574,4 +582,4 @@ class ItemMapperAfterTest extends MapperTestUtility
$this->assertEquals([Item::fromRow(['id' => 4])], $result);
}
-} \ No newline at end of file
+}
diff --git a/tests/Unit/Db/ItemMapperPaginatedTest.php b/tests/Unit/Db/ItemMapperPaginatedTest.php
index 2b4ac0c5f..e242833fb 100644
--- a/tests/Unit/Db/ItemMapperPaginatedTest.php
+++ b/tests/Unit/Db/ItemMapperPaginatedTest.php
@@ -81,10 +81,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
- ['feeds.user_id = :userId']
+ ['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0']
)
->will($this->returnSelf());
@@ -150,10 +151,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.id > :offset']
)
->will($this->returnSelf());
@@ -221,10 +223,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.id < :offset'],
['items.unread = 1']
)
@@ -235,13 +238,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['userId', 'jack'], ['offset', 10])
->will($this->returnSelf());
-
$this->builder->expects($this->exactly(1))
->method('setMaxResults')
->with(10)
->will($this->returnSelf());
-
$this->builder->expects($this->exactly(0))
->method('setFirstResult')
->with(10)
@@ -293,10 +294,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.id < :offset'],
['items.starred = 1']
)
@@ -367,10 +369,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
['items.id < :offset'],
@@ -441,9 +444,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.id < :offset']
@@ -513,9 +517,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.id > :offset']
@@ -583,9 +588,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.id < :offset'],
@@ -659,9 +665,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
+ ['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
['items.search_index LIKE :term0'],
@@ -751,10 +758,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x IS NULL'],
['items.id < :offset']
)
@@ -835,10 +843,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x IS NULL'],
['items.id < :offset'],
['items.unread = 1']
@@ -920,10 +929,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x IS NULL'],
['items.id > :offset'],
['items.unread = 1']
@@ -1008,10 +1018,11 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
['feeds.user_id = :userId'],
+ ['feeds.deleted_at = 0'],
['x = y'],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
@@ -1061,4 +1072,4 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->assertEquals([Item::fromRow(['id' => 4])], $result);
}
-} \ No newline at end of file
+}