ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMembershipTest.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24use PHPUnit\Framework\TestCase;
25
36class ilMembershipTest extends TestCase
37{
38 protected $backupGlobals = false;
39
40 protected function setUp() : void
41 {
42 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
43 ilUnitUtil::performInitialisation();
44 }
45
52 public function testMembership()
53 {
54 include_once './Services/Membership/classes/class.ilWaitingList.php';
55 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
56
57 $wait = new ilCourseWaitingList(999999);
58 $ret = $wait->addToList(111111);
59 $this->assertEquals($ret, true);
60
61 $wait->updateSubscriptionTime(111111, time());
62 $wait->removeFromList(111111);
63
64 $wait->addToList(111111);
65 $ret = $wait->isOnList(111111);
66 $this->assertEquals($ret, true);
67
68 $wait->addToList(111111);
70
71 $wait->addToList(111111);
73 }
74
80 public function testSubscription()
81 {
82 include_once './Services/Membership/classes/class.ilParticipants.php';
83 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
84
86 $part->addSubscriber(111111);
87 $part->updateSubscriptionTime(111111, time());
88 $part->updateSubject(111111, 'hallo');
89
90 $is = $part->isSubscriber(111111);
91 $this->assertEquals($is, true);
92
93 $is = ilParticipants::_isSubscriber(999999, 111111);
94 $this->assertEquals($is, true);
95
96 $part->deleteSubscriber(111111);
97 $is = $part->isSubscriber(111111);
98 $this->assertEquals($is, false);
99 }
100}
An exception for terminatinating execution or to throw for unit testing.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Unit tests for tree table @group needsInstalledILIAS.
testSubscription()
@group IL_Init
testMembership()
Waiting list tes @group IL_Init.
static _isSubscriber($a_obj_id, $a_usr_id)
check if user is subscriber
static _deleteUser($a_usr_id)
Delete user.
static _deleteAll($a_obj_id)
delete all
$ret
Definition: parser.php:6