ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
24use PHPUnit\Framework\TestCase;
25
30class ilCourseTest extends TestCase
31{
32 protected $backupGlobals = false;
33 protected $preserveGlobalState = false;
34
35 protected function setUp() : void
36 {
37 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
38 ilUnitUtil::performInitialisation();
39 }
40
45 public function testMemberAgreement()
46 {
47 include_once 'Services/Membership/classes/class.ilMemberAgreement.php';
48
49 global $DIC;
50
51 $ilDB = $DIC['ilDB'];
52
53
54 $agree = new ilMemberAgreement(9999, 8888);
55 $agree->read();
56 $agree->setAccepted(true);
57 $agree->save();
58
59 $agree = new ilMemberAgreement(9999, 8888);
60 $agree->read();
61 $sta = $agree->isAccepted();
62 $this->assertEquals($sta, true);
63 $agree->delete();
64
65 $agree = new ilMemberAgreement(9999, 8888);
66 $agree->read();
67 $sta = $agree->isAccepted();
68 $this->assertEquals($sta, false);
69
70 $sta = ilMemberAgreement::_hasAccepted(9999, 8888);
71 $this->assertEquals($sta, false);
72
73 $agree = new ilMemberAgreement(9999, 8888);
74 $agree->read();
75 $agree->setAccepted(true);
76 $agree->save();
77
79 $this->assertEquals($sta, true);
80
82 $this->assertEquals($sta, true);
83
85 }
86}
An exception for terminatinating execution or to throw for unit testing.
Class ilCourseTest @group needsInstalledILIAS.
testMemberAgreement()
Test member agreement @group IL_Init.
static _hasAccepted($a_usr_id, $a_obj_id)
Check if user has accepted agreement.
static _hasAgreementsByObjId($a_obj_id)
Check if there is any user agreement.
static _hasAgreements()
Check if there is any user agreement.
static _deleteByUser($a_usr_id)
Delete all entries by user.
global $ilDB
$DIC
Definition: xapitoken.php:46