361 $srcRow = [
'user_id' => 47349];
362 $mismatchUserIdRow = [
'user_id' => 37,
'notification_id' => 48];
363 $matchUserIdRow = [
'user_id' => $srcRow[
'user_id'],
'notification_id' => 380];
366 $srcStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
367 $targetStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
368 $consecutive_query_string = [
369 'SELECT notification_id, user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC',
370 'SELECT DISTINCT user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC' 372 $consecutive_query_value = [[0, $srcId], [0, $targetId]];
373 $this->database->expects(self::exactly(2))->method(
'queryF')->with(
374 $this->callback(
function ($value) use (&$consecutive_query_string) {
375 $this->assertSame(array_shift($consecutive_query_string), $value);
378 $this->identicalTo([
'integer',
'integer']),
379 $this->callback(
function ($value) use (&$consecutive_query_value) {
380 $this->assertSame(array_shift($consecutive_query_value), $value);
383 )->willReturnOnConsecutiveCalls($srcStatement, $targetStatement);
385 $consecutive_fetch = [
392 $this->database->expects(self::exactly(5))
393 ->method(
'fetchAssoc')
395 $this->callback(
function ($value) use (&$consecutive_fetch) {
396 $this->assertSame(array_shift($consecutive_fetch), $value);
400 ->willReturnOnConsecutiveCalls($srcRow, null, $matchUserIdRow, $mismatchUserIdRow, null);
402 $this->database->expects(self::once())->method(
'manipulateF')->with(
403 'DELETE FROM frm_notification WHERE notification_id = %s',
405 [$matchUserIdRow[
'notification_id']]
408 $this->database->expects(self::once())->method(
'update')->with(
410 [
'thread_id' => [
'integer', $targetId]],
411 [
'thread_id' => [
'integer', $srcId]]
static mergeThreadNotifications($merge_source_thread_id, $merge_target_thread_id)