From 80dec257c275b61792b97b5f53aa6fc90661e8a7 Mon Sep 17 00:00:00 2001 From: Marco Nassabain Date: Sun, 28 Feb 2021 23:26:22 +0100 Subject: =?UTF-8?q?=E2=9C=85=20Update=20find=20shared=20items=20tests=20-?= =?UTF-8?q?=20testFindAllSharedWithUser=20-=20testFindAllSharedWithUserHid?= =?UTF-8?q?eRead=20-=20testFindAllSharedWithUserSearch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marco Nassabain --- tests/Unit/Db/ItemMapperPaginatedTest.php | 46 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'tests') 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') -- cgit v1.2.3