ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCourseTest.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 
29 {
30  protected $backupGlobals = false;
31  protected $preserveGlobalState = false;
32 
33  protected function setUp()
34  {
35  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
36  ilUnitUtil::performInitialisation();
37  }
38 
43  public function testMemberAgreement()
44  {
45  include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
46 
47  global $DIC;
48 
49  $ilDB = $DIC['ilDB'];
50 
51 
52  $agree = new ilMemberAgreement(9999, 8888);
53  $agree->read();
54  $agree->setAccepted(true);
55  $agree->save();
56 
57  $agree = new ilMemberAgreement(9999, 8888);
58  $agree->read();
59  $sta = $agree->isAccepted();
60  $this->assertEquals($sta, true);
61  $agree->delete();
62 
63  $agree = new ilMemberAgreement(9999, 8888);
64  $agree->read();
65  $sta = $agree->isAccepted();
66  $this->assertEquals($sta, false);
67 
68  $sta = ilMemberAgreement::_hasAccepted(9999, 8888);
69  $this->assertEquals($sta, false);
70 
71  $agree = new ilMemberAgreement(9999, 8888);
72  $agree->read();
73  $agree->setAccepted(true);
74  $agree->save();
75 
77  $this->assertEquals($sta, true);
78 
80  $this->assertEquals($sta, true);
81 
83  }
84 }
global $DIC
Definition: saml.php:7
Class ilCourseTest needsInstalledILIAS.
testMemberAgreement()
Test member agreement IL_Init.
static _hasAccepted($a_usr_id, $a_obj_id)
Check if user has accepted agreement.
static _deleteByUser($a_usr_id)
Delete all entries by user.
static _hasAgreements()
Check if there is any user agreement.
static _hasAgreementsByObjId($a_obj_id)
Check if there is any user agreement.
global $ilDB