summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Db
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Db')
-rw-r--r--tests/Unit/Db/ItemMapperAfterTest.php139
-rw-r--r--tests/Unit/Db/ItemMapperPaginatedTest.php238
-rw-r--r--tests/Unit/Db/ItemMapperTest.php40
3 files changed, 42 insertions, 375 deletions
diff --git a/tests/Unit/Db/ItemMapperAfterTest.php b/tests/Unit/Db/ItemMapperAfterTest.php
index 5c91fa00d..eccebbcf5 100644
--- a/tests/Unit/Db/ItemMapperAfterTest.php
+++ b/tests/Unit/Db/ItemMapperAfterTest.php
@@ -62,11 +62,10 @@ 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(3))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
- ['items.shared_by = \'\''],
['feeds.user_id = :userId'],
['feeds.id = :feedId'],
['feeds.deleted_at = 0']
@@ -128,11 +127,10 @@ class ItemMapperAfterTest extends MapperTestUtility
->with('items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id')
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
- ['items.shared_by = \'\''],
['feeds.user_id = :userId'],
['feeds.id = :feedId'],
['feeds.deleted_at = 0'],
@@ -203,11 +201,10 @@ class ItemMapperAfterTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
- ['items.shared_by = \'\''],
['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
['folders.id = :folderId']
@@ -272,11 +269,10 @@ class ItemMapperAfterTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
['items.last_modified >= :updatedSince'],
- ['items.shared_by = \'\''],
['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
['folders.id = :folderId'],
@@ -323,121 +319,6 @@ class ItemMapperAfterTest extends MapperTestUtility
$this->assertEquals([Item::fromRow(['id' => 4])], $result);
}
- public function testFindAllSharedAfter()
- {
- $this->db->expects($this->once())
- ->method('getQueryBuilder')
- ->willReturn($this->builder);
-
- $this->builder->expects($this->once())
- ->method('select')
- ->with('items.*')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('from')
- ->with('news_items', 'items')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(2))
- ->method('andWhere')
- ->withConsecutive(
- ['items.last_modified >= :updatedSince'],
- ['items.shared_with = :sharedWith']
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(1))
- ->method('setParameters')
- ->with([
- 'updatedSince' => 1610903351,
- 'sharedWith' => 'jack',
- ])
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('orderBy')
- ->with('items.last_modified', 'DESC')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('addOrderBy')
- ->with('items.id', 'DESC')
- ->willReturnSelf();
-
- $this->builder->expects($this->once())
- ->method('execute')
- ->will($this->returnValue($this->cursor));
-
- $this->cursor->expects($this->exactly(2))
- ->method('fetch')
- ->willReturnOnConsecutiveCalls(
- ['id' => 4],
- false
- );
-
- $result = $this->class->findAllSharedAfter('jack', 1610903351, false);
- $this->assertEquals([Item::fromRow(['id' => 4])], $result);
- }
-
- public function testFindAllSharedAfterHideRead()
- {
- $this->db->expects($this->once())
- ->method('getQueryBuilder')
- ->willReturn($this->builder);
-
- $this->builder->expects($this->once())
- ->method('select')
- ->with('items.*')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('from')
- ->with('news_items', 'items')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(3))
- ->method('andWhere')
- ->withConsecutive(
- ['items.last_modified >= :updatedSince'],
- ['items.shared_with = :sharedWith'],
- ['items.unread = 1']
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(1))
- ->method('setParameters')
- ->with([
- 'updatedSince' => 1610903351,
- 'sharedWith' => 'jack'
- ])
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('orderBy')
- ->with('items.last_modified', 'DESC')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('addOrderBy')
- ->with('items.id', 'DESC')
- ->willReturnSelf();
-
- $this->builder->expects($this->once())
- ->method('execute')
- ->will($this->returnValue($this->cursor));
-
- $this->cursor->expects($this->exactly(2))
- ->method('fetch')
- ->willReturnOnConsecutiveCalls(
- ['id' => 4],
- false
- );
-
- $result = $this->class->findAllSharedAfter('jack', 1610903351, true);
- $this->assertEquals([Item::fromRow(['id' => 4])], $result);
- }
-
public function testFindAllAfterUnread()
{
$this->db->expects($this->once())
@@ -464,7 +345,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.deleted_at = 0'],
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['items.unread = :unread']
)
->will($this->returnSelf());
@@ -474,7 +355,6 @@ class ItemMapperAfterTest extends MapperTestUtility
->with([
'updatedSince' => 1610903351,
'userId' => 'jack',
- 'sharedWith' => 'jack'
])
->will($this->returnSelf());
@@ -534,7 +414,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.deleted_at = 0'],
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['items.starred = :starred']
)
->will($this->returnSelf());
@@ -544,7 +424,6 @@ class ItemMapperAfterTest extends MapperTestUtility
->with([
'updatedSince' => 1610903351,
'userId' => 'jack',
- 'sharedWith' => 'jack'
])
->will($this->returnSelf());
@@ -604,7 +483,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.deleted_at = 0'],
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith']
+ ['feeds.user_id = :userId']
)
->will($this->returnSelf());
@@ -613,7 +492,6 @@ class ItemMapperAfterTest extends MapperTestUtility
->with([
'updatedSince' => 1610903351,
'userId' => 'jack',
- 'sharedWith' => 'jack'
])
->will($this->returnSelf());
@@ -671,7 +549,7 @@ class ItemMapperAfterTest extends MapperTestUtility
->withConsecutive(
['items.last_modified >= :updatedSince'],
['feeds.deleted_at = 0'],
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith']
+ ['feeds.user_id = :userId']
)
->will($this->returnSelf());
@@ -680,7 +558,6 @@ class ItemMapperAfterTest extends MapperTestUtility
->with([
'updatedSince' => 1610903351,
'userId' => 'jack',
- 'sharedWith' => 'jack'
])
->will($this->returnSelf());
diff --git a/tests/Unit/Db/ItemMapperPaginatedTest.php b/tests/Unit/Db/ItemMapperPaginatedTest.php
index f9ed9b6e5..e0625aa0c 100644
--- a/tests/Unit/Db/ItemMapperPaginatedTest.php
+++ b/tests/Unit/Db/ItemMapperPaginatedTest.php
@@ -70,14 +70,14 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['feeds.deleted_at = 0']
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(2))
->method('setParameter')
- ->withConsecutive(['userId', 'jack'], ['sharedWith', 'jack'], ['offset', 10])
+ ->withConsecutive(['userId', 'jack'], ['offset', 10])
->will($this->returnSelf());
@@ -140,15 +140,15 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
['items.id > :offset']
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(2))
->method('setParameter')
- ->withConsecutive(['userId', 'jack'], ['sharedWith', 'jack'], ['offset', 10])
+ ->withConsecutive(['userId', 'jack'], ['offset', 10])
->will($this->returnSelf());
@@ -212,16 +212,16 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
['items.id < :offset'],
['items.unread = :unread']
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(2))
->method('setParameter')
- ->withConsecutive(['userId', 'jack'], ['sharedWith', 'jack'], ['offset', 10], ['unread', true])
+ ->withConsecutive(['userId', 'jack'], ['offset', 10], ['unread', true])
->will($this->returnSelf());
$this->builder->expects($this->exactly(1))
@@ -352,16 +352,16 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->builder->expects($this->exactly(4))
->method('andWhere')
->withConsecutive(
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
['items.id < :offset'],
['items.starred = :starred']
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(2))
->method('setParameter')
- ->withConsecutive(['userId', 'jack'], ['sharedWith', 'jack'], ['offset', 10], ['starred', true])
+ ->withConsecutive(['userId', 'jack'], ['offset', 10], ['starred', true])
->will($this->returnSelf());
@@ -427,7 +427,7 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$this->builder->expects($this->exactly(6))
->method('andWhere')
->withConsecutive(
- ['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'],
+ ['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
@@ -436,11 +436,10 @@ class ItemMapperPaginatedTest extends MapperTestUtility
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(5))
+ $this->builder->expects($this->exactly(4))
->method('setParameter')
->withConsecutive(
['userId', 'jack'],
- ['sharedWith', 'jack'],
['term0', '%key%'],
['term1', '%word%'],
['offset', 10],
@@ -506,13 +505,12 @@ 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(3))
->method('andWhere')
->withConsecutive(
['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
- ['items.shared_by = \'\''],
['items.id < :offset']
)
->will($this->returnSelf());
@@ -651,13 +649,12 @@ 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(3))
->method('andWhere')
->withConsecutive(
['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
- ['items.shared_by = \'\''],
['items.id > :offset']
)
->will($this->returnSelf());
@@ -723,13 +720,12 @@ 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(4))
->method('andWhere')
->withConsecutive(
['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
- ['items.shared_by = \'\''],
['items.id < :offset'],
['items.unread = :unread']
)
@@ -801,13 +797,12 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(['items', 'news_feeds', 'feeds', 'items.feed_id = feeds.id'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(6))
+ $this->builder->expects($this->exactly(5))
->method('andWhere')
->withConsecutive(
['feeds.deleted_at = 0'],
['feeds.user_id = :userId'],
['items.feed_id = :feedId'],
- ['items.shared_by = \'\''],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
['items.id < :offset']
@@ -900,7 +895,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(
['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
- ['items.shared_by = \'\''],
['x IS NULL'],
['items.id < :offset']
)
@@ -1069,7 +1063,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(
['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
- ['items.shared_by = \'\''],
['x IS NULL'],
['items.id < :offset'],
['items.unread = :unread']
@@ -1156,7 +1149,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(
['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
- ['items.shared_by = \'\''],
['x IS NULL'],
['items.id > :offset'],
['items.unread = :unread']
@@ -1246,7 +1238,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility
->withConsecutive(
['feeds.user_id = :userId'],
['feeds.deleted_at = 0'],
- ['items.shared_by = \'\''],
['x = y'],
['items.search_index LIKE :term0'],
['items.search_index LIKE :term1'],
@@ -1295,197 +1286,4 @@ class ItemMapperPaginatedTest extends MapperTestUtility
$result = $this->class->findAllFolder('jack', 2, 10, 10, false, false, ['key', 'word']);
$this->assertEquals([Item::fromRow(['id' => 4])], $result);
}
-
- public function testFindAllSharedWithUser()
- {
- $this->db->expects($this->once())
- ->method('getQueryBuilder')
- ->willReturn($this->builder);
-
- $this->builder->expects($this->once())
- ->method('select')
- ->with('items.*')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('from')
- ->with('news_items', 'items')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(2))
- ->method('andWhere')
- ->withConsecutive(
- ['items.shared_with = :sharedWith'],
- ['items.id < :offset']
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(2))
- ->method('setParameter')
- ->withConsecutive(
- ['sharedWith', 'jack'],
- ['offset', 10]
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(1))
- ->method('setMaxResults')
- ->with(10)
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('orderBy')
- ->with('items.last_modified', 'DESC')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('addOrderBy')
- ->with('items.id', 'DESC')
- ->willReturnSelf();
-
- $this->builder->expects($this->exactly(1))
- ->method('execute')
- ->will($this->returnValue($this->cursor));
-
- $this->cursor->expects($this->exactly(2))
- ->method('fetch')
- ->willReturnOnConsecutiveCalls(
- ['id' => 4],
- false
- );
-
- $result = $this->class->findAllSharedWithUser('jack', 10, 10, false, false, []);
- $this->assertEquals([Item::fromRow(['id' => 4])], $result);
- }
-
- public function testFindAllSharedWithUserHideRead()
- {
- $this->db->expects($this->once())
- ->method('getQueryBuilder')
- ->willReturn($this->builder);
-
- $this->builder->expects($this->once())
- ->method('select')
- ->with('items.*')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('from')
- ->with('news_items', 'items')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(3))
- ->method('andWhere')
- ->withConsecutive(
- ['items.shared_with = :sharedWith'],
- ['items.id < :offset'],
- ['items.unread = 1']
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(2))
- ->method('setParameter')
- ->withConsecutive(['sharedWith', 'jack'], ['offset', 10])
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(1))
- ->method('setMaxResults')
- ->with(10)
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('orderBy')
- ->with('items.last_modified', 'DESC')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('addOrderBy')
- ->with('items.id', 'DESC')
- ->willReturnSelf();
-
- $this->builder->expects($this->exactly(1))
- ->method('execute')
- ->will($this->returnValue($this->cursor));
-
- $this->cursor->expects($this->exactly(2))
- ->method('fetch')
- ->willReturnOnConsecutiveCalls(
- ['id' => 4],
- false
- );
-
- $result = $this->class->findAllSharedWithUser('jack', 10, 10, true, false, []);
- $this->assertEquals([Item::fromRow(['id' => 4])], $result);
- }
-
- public function testFindAllSharedWithUserSearch()
- {
- $this->db->expects($this->once())
- ->method('getQueryBuilder')
- ->willReturn($this->builder);
-
- $this->db->expects($this->exactly(2))
- ->method('escapeLikeParameter')
- ->will($this->returnArgument(0));
-
- $this->builder->expects($this->once())
- ->method('select')
- ->with('items.*')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('from')
- ->with('news_items', 'items')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(4))
- ->method('andWhere')
- ->withConsecutive(
- ['items.shared_with = :sharedWith'],
- ['items.search_index LIKE :term0'],
- ['items.search_index LIKE :term1'],
- ['items.id < :offset']
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(4))
- ->method('setParameter')
- ->withConsecutive(
- ['sharedWith', 'jack'],
- ['term0', '%key%'],
- ['term1', '%word%'],
- ['offset', 10]
- )
- ->will($this->returnSelf());
-
- $this->builder->expects($this->exactly(1))
- ->method('setMaxResults')
- ->with(10)
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('orderBy')
- ->with('items.last_modified', 'DESC')
- ->will($this->returnSelf());
-
- $this->builder->expects($this->once())
- ->method('addOrderBy')
- ->with('items.id', 'DESC')
- ->willReturnSelf();
-
- $this->builder->expects($this->exactly(1))
- ->method('execute')
- ->will($this->returnValue($this->cursor));
-
- $this->cursor->expects($this->exactly(2))
- ->method('fetch')
- ->willReturnOnConsecutiveCalls(
- ['id' => 4],
- false
- );
-
- $result = $this->class->findAllSharedWithUser('jack', 10, 10, false, false, ['key', 'word']);
- $this->assertEquals([Item::fromRow(['id' => 4])], $result);
- }
-
}
diff --git a/tests/Unit/Db/ItemMapperTest.php b/tests/Unit/Db/ItemMapperTest.php
index 0900c6b4e..ba73d93b8 100644
--- a/tests/Unit/Db/ItemMapperTest.php
+++ b/tests/Unit/Db/ItemMapperTest.php
@@ -93,7 +93,7 @@ class ItemMapperTest extends MapperTestUtility
$this->builder->expects($this->once())
->method('where')
- ->with('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with')
+ ->with('feeds.user_id = :user_id')
->will($this->returnSelf());
$this->builder->expects($this->once())
@@ -101,9 +101,9 @@ class ItemMapperTest extends MapperTestUtility
->with('feeds.deleted_at = 0')
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(1))
->method('setParameter')
- ->withConsecutive(['user_id', 'jack'], ['shared_with', 'jack'])
+ ->withConsecutive(['user_id', 'jack'])
->will($this->returnSelf());
$this->builder->expects($this->once())
@@ -154,7 +154,7 @@ class ItemMapperTest extends MapperTestUtility
$this->builder->expects($this->once())
->method('where')
- ->with('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with')
+ ->with('feeds.user_id = :user_id')
->will($this->returnSelf());
$this->builder->expects($this->exactly(2))
@@ -162,9 +162,9 @@ class ItemMapperTest extends MapperTestUtility
->withConsecutive(['feeds.deleted_at = 0'], ['key = :val'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(1))
->method('setParameter')
- ->withConsecutive(['user_id', 'jack'], ['shared_with', 'jack'])
+ ->withConsecutive(['user_id', 'jack'])
->will($this->returnSelf());
$this->builder->expects($this->once())
@@ -296,7 +296,7 @@ class ItemMapperTest extends MapperTestUtility
$this->builder->expects($this->once())
->method('where')
- ->with('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with')
+ ->with('feeds.user_id = :user_id')
->will($this->returnSelf());
$this->builder->expects($this->exactly(2))
@@ -304,9 +304,9 @@ class ItemMapperTest extends MapperTestUtility
->withConsecutive(['items.id = :item_id'], ['feeds.deleted_at = 0'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(2))
->method('setParameter')
- ->withConsecutive(['user_id', 'jack'], ['shared_with', 'jack'], ['item_id', 4])
+ ->withConsecutive(['user_id', 'jack'], ['item_id', 4])
->will($this->returnSelf());
$this->builder->expects($this->once())
@@ -389,20 +389,15 @@ class ItemMapperTest extends MapperTestUtility
$this->builder->expects($this->exactly(3))
->method('andWhere')
->withConsecutive(
- ['(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with'],
+ ['feeds.user_id = :user_id'],
['feeds.id = :feed_id'],
['items.guid_hash = :guid_hash']
)
->will($this->returnSelf());
- $this->builder->expects($this->exactly(4))
+ $this->builder->expects($this->exactly(3))
->method('setParameter')
- ->withConsecutive(
- ['user_id', 'jack'],
- ['shared_with', 'jack'],
- ['feed_id', 4],
- ['guid_hash', 'hash']
- )
+ ->withConsecutive(['user_id', 'jack'], ['feed_id', 4], ['guid_hash', 'hash'])
->will($this->returnSelf());
$this->builder->expects($this->once())
@@ -453,15 +448,12 @@ class ItemMapperTest extends MapperTestUtility
$this->builder->expects($this->exactly(1))
->method('where')
- ->withConsecutive(['(feeds.user_id = :userId AND items.shared_by = \'\') OR items.shared_with = :sharedWith'])
+ ->withConsecutive(['feeds.user_id = :userId'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(2))
+ $this->builder->expects($this->exactly(1))
->method('setParameter')
- ->withConsecutive(
- ['userId', 'jack'],
- ['sharedWith', 'jack']
- )
+ ->withConsecutive(['userId', 'jack'])
->will($this->returnSelf());
$this->builder->expects($this->exactly(1))
@@ -559,7 +551,7 @@ class ItemMapperTest extends MapperTestUtility
->withConsecutive(['id IN (:idList)'], ['unread != :unread'])
->will($this->returnSelf());
- $this->builder->expects($this->exactly(3))
+ $this->builder->expects($this->exactly(2))
->method('setParameter')
->withConsecutive(['unread', false], ['idList', [1, 2]])
->will($this->returnSelf());