From dd4617d3685fe0db59b8cd82848933fa2a118c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Sun, 28 Feb 2021 21:30:58 +0100 Subject: Fix findFromUser, testFindAllFromUserWithParams, testFindAllFromUser Signed-off-by: Marco Nassabain --- tests/Unit/Db/ItemMapperTest.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/Unit/Db/ItemMapperTest.php b/tests/Unit/Db/ItemMapperTest.php index e42df1bf7..b4a5ab118 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') + ->with('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with') ->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(1)) + $this->builder->expects($this->exactly(2)) ->method('setParameter') - ->withConsecutive(['user_id', 'jack']) + ->withConsecutive(['user_id', 'jack'], ['shared_with', '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') + ->with('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with') ->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(1)) - ->method('setParameter') - ->withConsecutive(['user_id', 'jack']) + $this->builder->expects($this->exactly(2)) + ->method('setParameter') + ->withConsecutive(['user_id', 'jack'], ['shared_with', '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') + ->with('(feeds.user_id = :user_id AND items.shared_by = \'\') OR items.shared_with = :shared_with') ->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(2)) + $this->builder->expects($this->exactly(3)) ->method('setParameter') - ->withConsecutive(['user_id', 'jack'], ['item_id', 4]) + ->withConsecutive(['user_id', 'jack'], ['shared_with', 'jack'], ['item_id', 4]) ->will($this->returnSelf()); $this->builder->expects($this->once()) -- cgit v1.2.3