diff options
author | Marco Nassabain <marco.nassabain@hotmail.com> | 2021-02-28 23:26:22 +0100 |
---|---|---|
committer | Sean Molenaar <SMillerDev@users.noreply.github.com> | 2021-04-08 22:31:21 +0200 |
commit | 80dec257c275b61792b97b5f53aa6fc90661e8a7 (patch) | |
tree | 21e42407fa9aa838c539c468da13c70a679e9379 /tests | |
parent | af02560363bfc3942978f4650140672079f54701 (diff) |
✅ Update find shared items tests
- testFindAllSharedWithUser
- testFindAllSharedWithUserHideRead
- testFindAllSharedWithUserSearch
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Unit/Db/ItemMapperPaginatedTest.php | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/tests/Unit/Db/ItemMapperPaginatedTest.php b/tests/Unit/Db/ItemMapperPaginatedTest.php index f6703739a..f9ed9b6e5 100644 --- a/tests/Unit/Db/ItemMapperPaginatedTest.php +++ b/tests/Unit/Db/ItemMapperPaginatedTest.php @@ -1312,14 +1312,20 @@ class ItemMapperPaginatedTest extends MapperTestUtility ->with('news_items', 'items') ->will($this->returnSelf()); - $this->builder->expects($this->exactly(1)) + $this->builder->expects($this->exactly(2)) ->method('andWhere') - ->with('items.shared_with = :sharedWith') + ->withConsecutive( + ['items.shared_with = :sharedWith'], + ['items.id < :offset'] + ) ->will($this->returnSelf()); - $this->builder->expects($this->exactly(1)) + $this->builder->expects($this->exactly(2)) ->method('setParameter') - ->with('sharedWith', 'jack') + ->withConsecutive( + ['sharedWith', 'jack'], + ['offset', 10] + ) ->will($this->returnSelf()); $this->builder->expects($this->exactly(1)) @@ -1327,11 +1333,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility ->with(10) ->will($this->returnSelf()); - $this->builder->expects($this->exactly(1)) - ->method('setFirstResult') - ->with(10) - ->will($this->returnSelf()); - $this->builder->expects($this->once()) ->method('orderBy') ->with('items.last_modified', 'DESC') @@ -1373,17 +1374,18 @@ class ItemMapperPaginatedTest extends MapperTestUtility ->with('news_items', 'items') ->will($this->returnSelf()); - $this->builder->expects($this->exactly(2)) + $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(1)) + $this->builder->expects($this->exactly(2)) ->method('setParameter') - ->with('sharedWith', 'jack') + ->withConsecutive(['sharedWith', 'jack'], ['offset', 10]) ->will($this->returnSelf()); $this->builder->expects($this->exactly(1)) @@ -1391,11 +1393,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility ->with(10) ->will($this->returnSelf()); - $this->builder->expects($this->exactly(1)) - ->method('setFirstResult') - ->with(10) - ->will($this->returnSelf()); - $this->builder->expects($this->once()) ->method('orderBy') ->with('items.last_modified', 'DESC') @@ -1441,21 +1438,23 @@ class ItemMapperPaginatedTest extends MapperTestUtility ->with('news_items', 'items') ->will($this->returnSelf()); - $this->builder->expects($this->exactly(3)) + $this->builder->expects($this->exactly(4)) ->method('andWhere') ->withConsecutive( ['items.shared_with = :sharedWith'], ['items.search_index LIKE :term0'], - ['items.search_index LIKE :term1'] + ['items.search_index LIKE :term1'], + ['items.id < :offset'] ) ->will($this->returnSelf()); - $this->builder->expects($this->exactly(3)) + $this->builder->expects($this->exactly(4)) ->method('setParameter') ->withConsecutive( ['sharedWith', 'jack'], ['term0', '%key%'], - ['term1', '%word%'] + ['term1', '%word%'], + ['offset', 10] ) ->will($this->returnSelf()); @@ -1464,11 +1463,6 @@ class ItemMapperPaginatedTest extends MapperTestUtility ->with(10) ->will($this->returnSelf()); - $this->builder->expects($this->exactly(1)) - ->method('setFirstResult') - ->with(10) - ->will($this->returnSelf()); - $this->builder->expects($this->once()) ->method('orderBy') ->with('items.last_modified', 'DESC') |