Definition at line 25 of file ilForumNotificationTest.php.
◆ setUp()
ilForumNotificationTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 421 of file ilForumNotificationTest.php.
References $DIC, and ILIAS\Repository\user().
425 $this->dic = is_object($DIC) ? clone
$DIC :
$DIC;
429 $DIC[
'ilDB'] = ($this->database = $this->createMock(ilDBInterface::class));
430 $DIC[
'ilUser'] = ($this->
user = $this->getMockBuilder(ilObjUser::class)->disableOriginalConstructor()->getMock());
431 $DIC[
'ilObjDataCache'] = $this->getMockBuilder(ilObjectDataCache::class)->disableOriginalConstructor()->getMock();
432 $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().
265 $subTree = [[
'child' => 3719,
'ref_id' => 3738,
'obj_id' => 182]];
266 $pathNode = [[
'child' =>
$refId,
'type' =>
'aa']];
268 $this->tree->expects(self::once())->method(
'getNodePath')->with($subTree[0][
'child'],
$refId)->willReturn($pathNode);
269 $this->tree->expects(self::once())->method(
'getNodeData')->with(
$refId)->willReturn($nodeData);
270 $this->tree->expects(self::once())->method(
'getSubTree')->with(
274 )->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();
◆ testDeleteNotificationAllUsers()
ilForumNotificationTest::testDeleteNotificationAllUsers |
( |
| ) |
|
Definition at line 309 of file ilForumNotificationTest.php.
312 $this->database->expects(self::once())->method(
'manipulateF')->with(
313 'DELETE FROM frm_notification WHERE frm_id = %s AND user_id_noti > %s',
314 [
'integer',
'integer'],
319 $instance->setForumId($forumId);
321 $instance->deleteNotificationAllUsers();
◆ 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();
◆ testExistsNotification()
ilForumNotificationTest::testExistsNotification |
( |
| ) |
|
Definition at line 399 of file ilForumNotificationTest.php.
405 $statement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
406 $this->database->expects(self::once())->method(
'queryF')->with(
407 'SELECT user_id FROM frm_notification WHERE user_id = %s AND frm_id = %s AND admin_force_noti = %s',
408 [
'integer',
'integer',
'integer'],
409 [$userId, $forumId, (
int) $adminForce]
410 )->willReturn($statement);
412 $this->database->expects(self::once())->method(
'numRows')->with($statement)->willReturn(8);
415 $instance->setForumId($forumId);
416 $instance->setUserId($userId);
418 $this->assertTrue($instance->existsNotification());
◆ 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());
◆ 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();
◆ 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());
◆ 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());
◆ 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());
◆ 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());
◆ testMergeThreadNotifications()
ilForumNotificationTest::testMergeThreadNotifications |
( |
| ) |
|
Definition at line 357 of file ilForumNotificationTest.php.
References ilForumNotification\mergeThreadNotifications().
359 $srcRow = [
'user_id' => 47349];
360 $mismatchUserIdRow = [
'user_id' => 37,
'notification_id' => 48];
361 $matchUserIdRow = [
'user_id' => $srcRow[
'user_id'],
'notification_id' => 380];
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(
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'],
373 'SELECT DISTINCT user_id FROM frm_notification WHERE frm_id = %s AND thread_id = %s ORDER BY user_id ASC',
374 [
'integer',
'integer'],
377 )->willReturnOnConsecutiveCalls($srcStatement, $targetStatement);
379 $this->database->expects(self::exactly(5))
380 ->method(
'fetchAssoc')
381 ->withConsecutive([$srcStatement], [$srcStatement], [$targetStatement], [$targetStatement], [$targetStatement])
382 ->willReturnOnConsecutiveCalls($srcRow, null, $matchUserIdRow, $mismatchUserIdRow, null);
384 $this->database->expects(self::once())->method(
'manipulateF')->with(
385 'DELETE FROM frm_notification WHERE notification_id = %s',
387 [$matchUserIdRow[
'notification_id']]
390 $this->database->expects(self::once())->method(
'update')->with(
392 [
'thread_id' => [
'integer', $targetId]],
393 [
'thread_id' => [
'integer', $srcId]]
static mergeThreadNotifications($merge_source_thread_id, $merge_target_thread_id)
◆ testRead()
ilForumNotificationTest::testRead |
( |
| ) |
|
Definition at line 325 of file ilForumNotificationTest.php.
329 'notification_id' => 789,
333 'admin_force_noti' => 20,
334 'user_toggle_noti' => 90,
335 'interested_events' => 8,
338 $mockStatement = $this->getMockBuilder(ilDBStatement::class)->disableOriginalConstructor()->getMock();
339 $this->database->expects(self::exactly(2))->method(
'fetchAssoc')->willReturn(
343 $this->database->expects(self::once())->method(
'queryF')->with(
344 'SELECT * FROM frm_notification WHERE frm_id = %s',
347 )->willReturn($mockStatement);
350 $instance->setForumId($forumId);
353 $row[
'user_id'] => $row,
354 ], $instance->read());
◆ testUpdate()
ilForumNotificationTest::testUpdate |
( |
| ) |
|
Definition at line 279 of file ilForumNotificationTest.php.
286 $this->database->expects(self::once())->method(
'manipulateF')->with(
287 'UPDATE frm_notification SET admin_force_noti = %s, user_toggle_noti = %s, ' .
288 'interested_events = %s WHERE user_id = %s AND frm_id = %s',
289 [
'integer',
'integer',
'integer',
'integer',
'integer'],
300 $instance->setAdminForce($adminForce);
301 $instance->setUserToggle($userToggle);
302 $instance->setInterestedEvents($events);
303 $instance->setUserId($userId);
304 $instance->setForumId($forumId);
◆ 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();
◆ $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: