@@ -100,7 +100,6 @@ public function testPublishNewGroupShare() {
100100 ->willReturn ($ event );
101101 $ event ->expects ($ this ->exactly (3 ))->method ('setApp ' )->with ('forms ' )->willReturn ($ event );
102102 $ event ->expects ($ this ->exactly (3 ))->method ('setType ' )->with ('forms_newshare ' )->willReturn ($ event );
103- $ event ->expects ($ this ->exactly (3 ))->method ('setAffectedUser ' )->withConsecutive (['user1 ' ], ['user2 ' ], ['user3 ' ])->willReturn ($ event );
104103 $ event ->expects ($ this ->exactly (3 ))->method ('setAuthor ' )->with ('currentUser ' )->willReturn ($ event );
105104 $ event ->expects ($ this ->exactly (3 ))->method ('setObject ' )->with ('form ' , 5 )->willReturn ($ event );
106105 $ event ->expects ($ this ->exactly (3 ))->method ('setSubject ' )->with ('newgroupshare ' , [
@@ -110,11 +109,20 @@ public function testPublishNewGroupShare() {
110109 'groupId ' => 'sharedGroup '
111110 ])->willReturn ($ event );
112111
112+ $ affectedUsers = [];
113+ $ event ->expects ($ this ->exactly (3 ))
114+ ->method ('setAffectedUser ' )
115+ ->willReturnCallback (function ($ userId ) use (&$ affectedUsers , &$ event ) {
116+ $ affectedUsers [] = $ userId ;
117+ return $ event ;
118+ });
119+
113120 $ this ->manager ->expects ($ this ->exactly (3 ))
114121 ->method ('publish ' )
115122 ->with ($ event );
116123
117124 $ this ->activityManager ->publishNewGroupShare ($ form , $ groupId );
125+ $ this ->assertEquals (['user1 ' , 'user2 ' , 'user3 ' ], $ affectedUsers );
118126 }
119127
120128 public function testPublishNewCircleShare () {
@@ -135,7 +143,6 @@ public function testPublishNewCircleShare() {
135143 ->willReturn ($ event );
136144 $ event ->expects ($ this ->exactly (4 ))->method ('setApp ' )->with ('forms ' )->willReturn ($ event );
137145 $ event ->expects ($ this ->exactly (4 ))->method ('setType ' )->with ('forms_newshare ' )->willReturn ($ event );
138- $ event ->expects ($ this ->exactly (4 ))->method ('setAffectedUser ' )->withConsecutive (['userId ' ], ['user1 ' ], ['user2 ' ], ['user3 ' ])->willReturn ($ event );
139146 $ event ->expects ($ this ->exactly (4 ))->method ('setAuthor ' )->with ('currentUser ' )->willReturn ($ event );
140147 $ event ->expects ($ this ->exactly (4 ))->method ('setObject ' )->with ('form ' , 5 )->willReturn ($ event );
141148 $ event ->expects ($ this ->exactly (4 ))->method ('setSubject ' )->with ('newcircleshare ' , [
@@ -144,12 +151,20 @@ public function testPublishNewCircleShare() {
144151 'formHash ' => 'abcdefg12345 ' ,
145152 'circleId ' => $ circleId
146153 ])->willReturn ($ event );
154+ $ affectedUsers = [];
155+ $ event ->expects ($ this ->exactly (3 ))
156+ ->method ('setAffectedUser ' )
157+ ->willReturnCallback (function ($ userId ) use (&$ affectedUsers , &$ event ) {
158+ $ affectedUsers [] = $ userId ;
159+ return $ event ;
160+ });
147161
148162 $ this ->manager ->expects ($ this ->exactly (4 ))
149163 ->method ('publish ' )
150164 ->with ($ event );
151165
152166 $ this ->activityManager ->publishNewCircleShare ($ form , $ circleId );
167+ $ this ->assertEquals (['user1 ' , 'user2 ' , 'user3 ' ], $ affectedUsers );
153168 }
154169
155170 public function testPublishNewCircleShare_circlesDisabled () {
@@ -255,19 +270,26 @@ public function testPublishNewSharedSubmission(int $shareType, string $shareWith
255270 ->willReturn ($ event );
256271 $ event ->expects ($ this ->exactly (count ($ expected )))->method ('setApp ' )->with ('forms ' )->willReturn ($ event );
257272 $ event ->expects ($ this ->exactly (count ($ expected )))->method ('setType ' )->with ('forms_newsharedsubmission ' )->willReturn ($ event );
258- $ event ->expects ($ this ->exactly (count ($ expected )))->method ('setAffectedUser ' )->withConsecutive (...[...$ expected ])->willReturn ($ event );
259273 $ event ->expects ($ this ->exactly (count ($ expected )))->method ('setAuthor ' )->with ('submittingUser ' )->willReturn ($ event );
260274 $ event ->expects ($ this ->exactly (count ($ expected )))->method ('setObject ' )->with ('form ' , 5 )->willReturn ($ event );
261275 $ event ->expects ($ this ->exactly (count ($ expected )))->method ('setSubject ' )->with ('newsubmission ' , [
262276 'userId ' => 'submittingUser ' ,
263277 'formTitle ' => 'TestForm-Title ' ,
264278 'formHash ' => 'abcdefg12345 '
265279 ])->willReturn ($ event );
280+ $ affectedUsers = [];
281+ $ event ->expects ($ this ->exactly (3 ))
282+ ->method ('setAffectedUser ' )
283+ ->willReturnCallback (function ($ userId ) use (&$ affectedUsers , &$ event ) {
284+ $ affectedUsers [] = $ userId ;
285+ return $ event ;
286+ });
266287
267288 $ this ->manager ->expects ($ this ->exactly (count ($ expected )))
268289 ->method ('publish ' )
269290 ->with ($ event );
270291
271292 $ this ->activityManager ->publishNewSharedSubmission ($ form , $ shareType , $ shareWith , $ submitterId );
293+ $ this ->assertEquals ($ expected , $ affectedUsers );
272294 }
273295}
0 commit comments