357 : void
358 {
359 $srcRow = ['user_id' => 47349];
360 $mismatchUserIdRow = ['user_id' => 37, 'notification_id' => 48];
361 $matchUserIdRow = ['user_id' => $srcRow['user_id'], 'notification_id' => 380];
362 $targetId = 840;
363 $srcId = 5749;
364 $srcStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
365 $targetStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
366 $this->database->expects(self::exactly(2))->method('queryF')->withConsecutive(
367 [
368 'SELECT notification_id, user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC',
369 ['integer', 'integer'],
370 [0, $srcId],
371 ],
372 [
373 'SELECT DISTINCT user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC',
374 ['integer', 'integer'],
375 [0, $targetId],
376 ],
377 )->willReturnOnConsecutiveCalls($srcStatement, $targetStatement);
378
379 $this->database->expects(self::exactly(5))
380 ->method('fetchAssoc')
381 ->withConsecutive([$srcStatement], [$srcStatement], [$targetStatement], [$targetStatement], [$targetStatement])
382 ->willReturnOnConsecutiveCalls($srcRow, null, $matchUserIdRow, $mismatchUserIdRow, null);
383
384 $this->database->expects(self::once())->method('manipulateF')->with(
385 'DELETE FROM frm_notification WHERE notification_id = %s',
386 ['integer'],
387 [$matchUserIdRow['notification_id']]
388 );
389
390 $this->database->expects(self::once())->method('update')->with(
391 'frm_notification',
392 ['thread_id' => ['integer', $targetId]],
393 ['thread_id' => ['integer', $srcId]]
394 );
395
397 }
static mergeThreadNotifications($merge_source_thread_id, $merge_target_thread_id)