Definition at line 25 of file ilForumNotificationTest.php.
 
◆ setUp()
  
  
      
        
          | ilForumNotificationTest::setUp  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Definition at line 423 of file ilForumNotificationTest.php.
References $DIC, and ILIAS\Repository\user().
  427         $this->dic = is_object($DIC) ? clone 
$DIC : 
$DIC;
   431         $DIC[
'ilDB'] = ($this->database = $this->createMock(ilDBInterface::class));
   432         $DIC[
'ilUser'] = ($this->
user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock());
   433         $DIC[
'ilObjDataCache'] = $this->getMockBuilder(ilObjectDataCache::class)->disableOriginalConstructor()->getMock();
   434         $DIC[
'tree'] = ($this->tree = $this->getMockBuilder(ilTree::class)->disableOriginalConstructor()->getMock());
 Customizing of pimple-DIC for ILIAS. 
 
 
 
 
◆ tearDown()
  
  
      
        
          | ilForumNotificationTest::tearDown  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
 
◆ testCheckForumsExistsInsert()
      
        
          | ilForumNotificationTest::testCheckForumsExistsInsert  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 260 of file ilForumNotificationTest.php.
References $refId, and ilForumNotification\checkForumsExistsInsert().
  267         $subTree = [[
'child' => 3719, 
'ref_id' => 3738, 
'obj_id' => 182]];
   268         $pathNode = [[
'child' => 
$refId, 
'type' => 
'aa']];
   270         $this->tree->expects(self::once())->method(
'getNodeData')->with(
$refId)->willReturn($nodeData);
   271         $this->tree->expects(self::once())->method(
'getNodePath')->with($subTree[0][
'child'], 
$refId)->willReturn($pathNode);
   272         $this->tree->expects(self::once())->method(
'getSubTree')->with(
   276         )->willReturn($subTree);
 
static checkForumsExistsInsert(int $ref_id, int $user_id)
 
 
 
 
◆ testConstruct()
      
        
          | ilForumNotificationTest::testConstruct  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ testDeleteAdminForce()
      
        
          | ilForumNotificationTest::testDeleteAdminForce  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 196 of file ilForumNotificationTest.php.
  201         $this->database->expects(self::once())->method(
'manipulateF')->with(
   203                         DELETE FROM frm_notification   206                         AND             admin_force_noti = %s   207                         AND             user_id_noti > %s',
   208             [
'integer', 
'integer', 
'integer', 
'integer'],
   209             [$userId, $forumId, 1, 0]
   213         $instance->setUserId($userId);
   214         $instance->setForumId($forumId);
   216         $instance->deleteAdminForce();
 Class ilForumNotification. 
 
 
 
 
◆ testDeleteNotificationAllUsers()
      
        
          | ilForumNotificationTest::testDeleteNotificationAllUsers  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 311 of file ilForumNotificationTest.php.
  314         $this->database->expects(self::once())->method(
'manipulateF')->with(
   315             'DELETE FROM frm_notification WHERE frm_id = %s AND user_id_noti > %s',
   316             [
'integer', 
'integer'],
   321         $instance->setForumId($forumId);
   323         $instance->deleteNotificationAllUsers();
 Class ilForumNotification. 
 
 
 
 
◆ testDeleteUserToggle()
      
        
          | ilForumNotificationTest::testDeleteUserToggle  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 219 of file ilForumNotificationTest.php.
  223         $this->database->expects(self::once())->method(
'manipulateF')->with(
   225                         DELETE FROM frm_notification   228                         AND             admin_force_noti = %s   229                         AND             user_toggle_noti = %s   230                         AND             user_id_noti > %s',
   231             [
'integer', 
'integer', 
'integer', 
'integer', 
'integer'],
   232             [$userId, $forumId, 1, 1, 0]
   236         $instance->setUserId($userId);
   237         $instance->setForumId($forumId);
   238         $instance->deleteUserToggle();
 Class ilForumNotification. 
 
 
 
 
◆ testExistsNotification()
      
        
          | ilForumNotificationTest::testExistsNotification  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 401 of file ilForumNotificationTest.php.
  407         $statement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
   408         $this->database->expects(self::once())->method(
'queryF')->with(
   409             'SELECT user_id FROM frm_notification WHERE user_id = %s AND frm_id = %s AND admin_force_noti = %s',
   410             [
'integer', 
'integer', 
'integer'],
   411             [$userId, $forumId, (
int) $adminForce]
   412         )->willReturn($statement);
   414         $this->database->expects(self::once())->method(
'numRows')->with($statement)->willReturn(8);
   417         $instance->setForumId($forumId);
   418         $instance->setUserId($userId);
   420         $this->assertTrue($instance->existsNotification());
 Class ilForumNotification. 
 
 
 
 
◆ testGetterAndSetter()
      
        
          | ilForumNotificationTest::testGetterAndSetter  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 40 of file ilForumNotificationTest.php.
   43         $instance->setNotificationId(1);
    44         $this->assertSame(1, $instance->getNotificationId());
    45         $instance->setUserId(2);
    46         $this->assertSame(2, $instance->getUserId());
    47         $instance->setForumId(3);
    48         $this->assertSame(3, $instance->getForumId());
    49         $instance->setThreadId(4);
    50         $this->assertSame(4, $instance->getThreadId());
    51         $instance->setInterestedEvents(5);
    52         $this->assertSame(5, $instance->getInterestedEvents());
    53         $instance->setAdminForce(
true);
    54         $this->assertTrue($instance->getAdminForce());
    55         $instance->setUserToggle(
true);
    56         $this->assertTrue($instance->getUserToggle());
    57         $instance->setForumRefId(6);
    58         $this->assertSame(6, $instance->getForumRefId());
    59         $instance->setUserIdNoti(7);
    60         $this->assertSame(7, $instance->getUserIdNoti());
 Class ilForumNotification. 
 
 
 
 
◆ testInsertAdminForce()
      
        
          | ilForumNotificationTest::testInsertAdminForce  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 159 of file ilForumNotificationTest.php.
References ILIAS\Repository\user().
  168         $this->
user->expects(self::once())->method(
'getId')->willReturn($objUserId);
   170         $this->database->expects(self::once())->method(
'nextId')->willReturn($nextId);
   171         $this->database->expects(self::once())->method(
'manipulateF')->with(
   173                         INSERT INTO frm_notification   174                                 (notification_id, user_id, frm_id, admin_force_noti, user_toggle_noti, user_id_noti)   175                         VALUES(%s, %s, %s, %s, %s, %s)',
   176             [
'integer', 
'integer', 
'integer', 
'integer', 
'integer', 
'integer'],
   188         $instance->setUserId($userId);
   189         $instance->setForumId($forumId);
   190         $instance->setAdminForce($adminForce);
   191         $instance->setUserToggle($userToggle);
   193         $instance->insertAdminForce();
 Class ilForumNotification. 
 
 
 
 
◆ testIsAdminForceNotification()
      
        
          | ilForumNotificationTest::testIsAdminForceNotification  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 63 of file ilForumNotificationTest.php.
   68         $mockStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
    69         $this->database->expects(self::once())->method(
'queryF')->with(
    71                         SELECT admin_force_noti FROM frm_notification    74                         AND user_id_noti > %s ',
    75             [
'integer', 
'integer', 
'integer'],
    76             [$userId, $forumId, 0]
    77         )->willReturn($mockStatement);
    78         $this->database->expects(self::once())->method(
'fetchAssoc')->with($mockStatement)->willReturn([
'admin_force_noti' => 
'1']);
    81         $instance->setForumId($forumId);
    82         $instance->setUserId($userId);
    84         $this->assertTrue($instance->isAdminForceNotification());
 Class ilForumNotification. 
 
 
 
 
◆ testIsAdminForceNotificationFailed()
      
        
          | ilForumNotificationTest::testIsAdminForceNotificationFailed  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 87 of file ilForumNotificationTest.php.
   92         $mockStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
    93         $this->database->expects(self::once())->method(
'queryF')->with(
    95                         SELECT admin_force_noti FROM frm_notification    98                         AND user_id_noti > %s ',
    99             [
'integer', 
'integer', 
'integer'],
   100             [$userId, $forumId, 0]
   101         )->willReturn($mockStatement);
   102         $this->database->expects(self::once())->method(
'fetchAssoc')->with($mockStatement)->willReturn(null);
   105         $instance->setForumId($forumId);
   106         $instance->setUserId($userId);
   108         $this->assertFalse($instance->isAdminForceNotification());
 Class ilForumNotification. 
 
 
 
 
◆ testIsUserToggleNotification()
      
        
          | ilForumNotificationTest::testIsUserToggleNotification  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 111 of file ilForumNotificationTest.php.
  116         $mockStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
   117         $this->database->expects(self::once())->method(
'queryF')->with(
   119                         SELECT user_toggle_noti FROM frm_notification   122                         AND user_id_noti > %s',
   123             [
'integer', 
'integer', 
'integer'],
   124             [$userId, $forumId, 0]
   125         )->willReturn($mockStatement);
   126         $this->database->expects(self::once())->method(
'fetchAssoc')->with($mockStatement)->willReturn([
'user_toggle_noti' => 
'1']);
   129         $instance->setForumId($forumId);
   130         $instance->setUserId($userId);
   132         $this->assertTrue($instance->isUserToggleNotification());
 Class ilForumNotification. 
 
 
 
 
◆ testIsUserToggleNotificationFailed()
      
        
          | ilForumNotificationTest::testIsUserToggleNotificationFailed  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 135 of file ilForumNotificationTest.php.
  140         $mockStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
   141         $this->database->expects(self::once())->method(
'queryF')->with(
   143                         SELECT user_toggle_noti FROM frm_notification   146                         AND user_id_noti > %s',
   147             [
'integer', 
'integer', 
'integer'],
   148             [$userId, $forumId, 0]
   149         )->willReturn($mockStatement);
   150         $this->database->expects(self::once())->method(
'fetchAssoc')->with($mockStatement)->willReturn(null);
   153         $instance->setForumId($forumId);
   154         $instance->setUserId($userId);
   156         $this->assertFalse($instance->isUserToggleNotification());
 Class ilForumNotification. 
 
 
 
 
◆ testMergeThreadNotifications()
      
        
          | ilForumNotificationTest::testMergeThreadNotifications  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 359 of file ilForumNotificationTest.php.
References ilForumNotification\mergeThreadNotifications().
  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         $this->database->expects(self::exactly(2))->method(
'queryF')->withConsecutive(
   370                 'SELECT notification_id, user_id FROM frm_notification WHERE frm_id = %s AND  thread_id = %s ORDER BY user_id ASC',
   371                 [
'integer', 
'integer'],
   375                 'SELECT DISTINCT user_id FROM frm_notification WHERE frm_id = %s AND  thread_id = %s ORDER BY user_id ASC',
   376                 [
'integer', 
'integer'],
   379         )->willReturnOnConsecutiveCalls($srcStatement, $targetStatement);
   381         $this->database->expects(self::exactly(5))
   382                        ->method(
'fetchAssoc')
   383                        ->withConsecutive([$srcStatement], [$srcStatement], [$targetStatement], [$targetStatement], [$targetStatement])
   384                        ->willReturnOnConsecutiveCalls($srcRow, null, $matchUserIdRow, $mismatchUserIdRow, null);
   386         $this->database->expects(self::once())->method(
'manipulateF')->with(
   387             'DELETE FROM frm_notification WHERE notification_id = %s',
   389             [$matchUserIdRow[
'notification_id']]
   392         $this->database->expects(self::once())->method(
'update')->with(
   394             [
'thread_id' => [
'integer', $targetId]],
   395             [
'thread_id' => [
'integer', $srcId]]
 static mergeThreadNotifications($merge_source_thread_id, $merge_target_thread_id)
 
 
 
 
◆ testRead()
      
        
          | ilForumNotificationTest::testRead  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 327 of file ilForumNotificationTest.php.
  331             'notification_id' => 789,
   335             'admin_force_noti' => 20,
   336             'user_toggle_noti' => 90,
   337             'interested_events' => 8,
   340         $mockStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
   341         $this->database->expects(self::exactly(2))->method(
'fetchAssoc')->willReturn(
   345         $this->database->expects(self::once())->method(
'queryF')->with(
   346             'SELECT * FROM frm_notification WHERE frm_id = %s',
   349         )->willReturn($mockStatement);
   352         $instance->setForumId($forumId);
   355             $row[
'user_id'] => $row,
   356         ], $instance->read());
 Class ilForumNotification. 
 
 
 
 
◆ testUpdate()
      
        
          | ilForumNotificationTest::testUpdate  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 281 of file ilForumNotificationTest.php.
  288         $this->database->expects(self::once())->method(
'manipulateF')->with(
   289             'UPDATE frm_notification SET admin_force_noti = %s, user_toggle_noti = %s, ' .
   290             'interested_events = %s WHERE user_id = %s AND frm_id = %s',
   291             [
'integer', 
'integer', 
'integer', 
'integer', 
'integer'],
   302         $instance->setAdminForce($adminForce);
   303         $instance->setUserToggle($userToggle);
   304         $instance->setInterestedEvents($events);
   305         $instance->setUserId($userId);
   306         $instance->setForumId($forumId);
 Class ilForumNotification. 
 
 
 
 
◆ testupdateUserToggle()
      
        
          | ilForumNotificationTest::testupdateUserToggle  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 241 of file ilForumNotificationTest.php.
  247         $this->database->expects(self::once())->method(
'manipulateF')->with(
   248             'UPDATE frm_notification SET user_toggle_noti = %s WHERE user_id = %s AND frm_id = %s AND admin_force_noti = %s',
   249             [
'integer', 
'integer', 
'integer', 
'integer'],
   250             [$userToggle, $userId, $forumId, 1]
   254         $instance->setUserId($userId);
   255         $instance->setForumId($forumId);
   256         $instance->setUserToggle($userToggle);
   257         $instance->updateUserToggle();
 Class ilForumNotification. 
 
 
 
 
◆ $database
  
  
      
        
          | ilForumNotificationTest::$database | 
         
       
   | 
  
private   | 
  
 
 
◆ $dic
  
  
      
        
          | Container ilForumNotificationTest::$dic = null | 
         
       
   | 
  
private   | 
  
 
 
◆ $tree
  
  
      
        
          | ilForumNotificationTest::$tree | 
         
       
   | 
  
private   | 
  
 
 
◆ $user
  
  
      
        
          | ilForumNotificationTest::$user | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following file: