ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilStudyProgrammeLPTest Class Reference

TestCase for the learning progress of users at a programme. More...

+ Inheritance diagram for ilStudyProgrammeLPTest:
+ Collaboration diagram for ilStudyProgrammeLPTest:

Public Member Functions

 testInitialLPActive ()
 
 testInitialLPDraft ()
 
 testInitialProgressOutdated ()
 
 testMarkAccredited ()
 
 testUnmarkAccredited ()
 
 testMarkNotRelevant ()
 
 testNewNodesAreNotRelevant ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 
 newUser ()
 
 setAllNodesActive ()
 
 assignNewUserToRoot ()
 

Protected Attributes

 $backupGlobals = FALSE
 

Detailed Description

TestCase for the learning progress of users at a programme.

Author
Michael Herren mh@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Richard Klees richa.nosp@m.rd.k.nosp@m.lees@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de
Version
1.0.0

Definition at line 14 of file ilStudyProgrammeLPTest.php.

Member Function Documentation

◆ assignNewUserToRoot()

ilStudyProgrammeLPTest::assignNewUserToRoot ( )
protected

Definition at line 65 of file ilStudyProgrammeLPTest.php.

65 {
66 $user = $this->newUser();
67 return array($this->root->assignUser($user->getId()), $user);
68 }

References newUser().

Referenced by testInitialLPActive(), testInitialLPDraft(), testInitialProgressOutdated(), testMarkAccredited(), testMarkNotRelevant(), testNewNodesAreNotRelevant(), and testUnmarkAccredited().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newUser()

ilStudyProgrammeLPTest::newUser ( )
protected

Definition at line 53 of file ilStudyProgrammeLPTest.php.

53 {
54 $user = new ilObjUser();
55 $user->create();
56 return $user;
57 }

Referenced by assignNewUserToRoot(), testMarkAccredited(), testMarkNotRelevant(), and testUnmarkAccredited().

+ Here is the caller graph for this function:

◆ setAllNodesActive()

ilStudyProgrammeLPTest::setAllNodesActive ( )
protected

Definition at line 59 of file ilStudyProgrammeLPTest.php.

59 {
60 $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
61 $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
62 $this->node2->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
63 }

References ilStudyProgramme\STATUS_ACTIVE.

Referenced by testInitialLPActive(), testMarkAccredited(), testMarkNotRelevant(), testNewNodesAreNotRelevant(), and testUnmarkAccredited().

+ Here is the caller graph for this function:

◆ setUp()

ilStudyProgrammeLPTest::setUp ( )
protected

Definition at line 17 of file ilStudyProgrammeLPTest.php.

17 {
18 PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
19
20 require_once("./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
21
22 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
23 ilUnitUtil::performInitialisation();
24
26 $this->root->putInTree(ROOT_FOLDER_ID);
27 $this->root->object_factory = new ilObjectFactoryWrapperMock();
28
31
32 $this->leaf1 = new ilStudyProgrammeLeafMock();
33 $this->leaf2 = new ilStudyProgrammeLeafMock();
34
35 $this->root->addNode($this->node1);
36 $this->root->addNode($this->node2);
37 $this->node1->addLeaf($this->leaf1);
38 $this->node2->addLeaf($this->leaf2);
39
40 global $tree;
41 $this->tree = $tree;
42
43 global $ilUser;
44 $this->user = $ilUser;
45 }
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
Mock for object factory.
Definition: mocks.php:66
Mock classes for tests.
Definition: mocks.php:21
global $ilUser
Definition: imgupload.php:15

References $ilUser, and ilObjStudyProgramme\createInstance().

+ Here is the call graph for this function:

◆ tearDown()

ilStudyProgrammeLPTest::tearDown ( )
protected

Definition at line 47 of file ilStudyProgrammeLPTest.php.

47 {
48 if ($this->root) {
49 $this->root->delete();
50 }
51 }

◆ testInitialLPActive()

ilStudyProgrammeLPTest::testInitialLPActive ( )

Definition at line 70 of file ilStudyProgrammeLPTest.php.

70 {
71 $this->setAllNodesActive();
72 $tmp = $this->assignNewUserToRoot();
73 $ass = $tmp[0];
74 $user = $tmp[1];
75
76 require_once("Services/Tracking/classes/class.ilLPStatusWrapper.php");
77 require_once("Services/Tracking/classes/class.ilLPStatus.php");
78 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
79 , ilLPStatusWrapper::_determineStatus($this->root->getId(), $user->getId())
80 );
81 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
82 , ilLPStatusWrapper::_determineStatus($this->node1->getId(), $user->getId())
83 );
84 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
85 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
86 );
87 }
static _determineStatus($a_obj_id, $a_usr_id)
Determine status.
const LP_STATUS_IN_PROGRESS_NUM

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testInitialLPDraft()

ilStudyProgrammeLPTest::testInitialLPDraft ( )

Definition at line 89 of file ilStudyProgrammeLPTest.php.

89 {
90 $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
91 $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
92 $this->node2->setStatus(ilStudyProgramme::STATUS_DRAFT)->update();
93
94 $tmp = $this->assignNewUserToRoot();
95 $user = $tmp[1];
96 $ass = $tmp[0];
97
98 require_once("Services/Tracking/classes/class.ilLPStatusWrapper.php");
99 require_once("Services/Tracking/classes/class.ilLPStatus.php");
100 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
101 , ilLPStatusWrapper::_determineStatus($this->root->getId(), $user->getId())
102 );
103 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
104 , ilLPStatusWrapper::_determineStatus($this->node1->getId(), $user->getId())
105 );
106 $this->assertEquals( ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM
107 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
108 );
109 }
const LP_STATUS_NOT_ATTEMPTED_NUM

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ilStudyProgramme\STATUS_ACTIVE, and ilStudyProgramme\STATUS_DRAFT.

+ Here is the call graph for this function:

◆ testInitialProgressOutdated()

ilStudyProgrammeLPTest::testInitialProgressOutdated ( )

Definition at line 111 of file ilStudyProgrammeLPTest.php.

111 {
112 $this->root->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
113 $this->node1->setStatus(ilStudyProgramme::STATUS_ACTIVE)->update();
114 $this->node2->setStatus(ilStudyProgramme::STATUS_OUTDATED)->update();
115
116 $tmp = $this->assignNewUserToRoot();
117 $user = $tmp[1];
118 $ass = $tmp[0];
119
120 require_once("Services/Tracking/classes/class.ilLPStatusWrapper.php");
121 require_once("Services/Tracking/classes/class.ilLPStatus.php");
122 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
123 , ilLPStatusWrapper::_determineStatus($this->root->getId(), $user->getId())
124 );
125 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
126 , ilLPStatusWrapper::_determineStatus($this->node1->getId(), $user->getId())
127 );
128 $this->assertEquals( ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM
129 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
130 );
131 }

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ilStudyProgramme\STATUS_ACTIVE, and ilStudyProgramme\STATUS_OUTDATED.

+ Here is the call graph for this function:

◆ testMarkAccredited()

ilStudyProgrammeLPTest::testMarkAccredited ( )

Definition at line 133 of file ilStudyProgrammeLPTest.php.

133 {
134 $this->setAllNodesActive();
135 $tmp = $this->assignNewUserToRoot();
136 $ass = $tmp[0];
137 $user = $tmp[1];
138
139 $user2 = $this->newUser();
140 $USER_ID = $user2->getId();
141
142 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
143 $node2_progress->markAccredited($USER_ID);
144
145 require_once("Services/Tracking/classes/class.ilLPStatusWrapper.php");
146 require_once("Services/Tracking/classes/class.ilLPStatus.php");
147 $this->assertEquals( ilLPStatus::LP_STATUS_COMPLETED_NUM
148 , ilLPStatusWrapper::_determineStatus($this->root->getId(), $user->getId())
149 );
150 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
151 , ilLPStatusWrapper::_determineStatus($this->node1->getId(), $user->getId())
152 );
153 $this->assertEquals( ilLPStatus::LP_STATUS_COMPLETED_NUM
154 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
155 );
156 }
const LP_STATUS_COMPLETED_NUM

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, newUser(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testMarkNotRelevant()

ilStudyProgrammeLPTest::testMarkNotRelevant ( )

Definition at line 188 of file ilStudyProgrammeLPTest.php.

188 {
189 $this->setAllNodesActive();
190 $tmp = $this->assignNewUserToRoot();
191 $ass = $tmp[0];
192 $user = $tmp[1];
193
194 $user2 = $this->newUser();
195 $USER_ID = $user2->getId();
196
197 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
198 $node2_progress->markNotRelevant($USER_ID);
199
200 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
201 , ilLPStatusWrapper::_determineStatus($this->root->getId(), $user->getId())
202 );
203 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
204 , ilLPStatusWrapper::_determineStatus($this->node1->getId(), $user->getId())
205 );
206 $this->assertEquals( ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM
207 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
208 );
209 }

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, newUser(), and setAllNodesActive().

+ Here is the call graph for this function:

◆ testNewNodesAreNotRelevant()

ilStudyProgrammeLPTest::testNewNodesAreNotRelevant ( )

Definition at line 212 of file ilStudyProgrammeLPTest.php.

212 {
213 $this->setAllNodesActive();
214 $tmp = $this->assignNewUserToRoot();
215 $ass = $tmp[0];
216 $user = $tmp[1];
217
219 $this->root->addNode($node3);
220
221 $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
222 $this->assertNotNull($node3_progress);
223 $this->assertEquals( ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM
224 , ilLPStatusWrapper::_determineStatus($node3->getId(), $user->getId())
225 );
226 }

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilObjStudyProgramme\createInstance(), ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, and setAllNodesActive().

+ Here is the call graph for this function:

◆ testUnmarkAccredited()

ilStudyProgrammeLPTest::testUnmarkAccredited ( )

Definition at line 158 of file ilStudyProgrammeLPTest.php.

158 {
159 $this->setAllNodesActive();
160 $tmp = $this->assignNewUserToRoot();
161 $ass = $tmp[0];
162 $user = $tmp[1];
163
164 $user2 = $this->newUser();
165 $USER_ID = $user2->getId();
166
167 $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
168 $node2_progress->markAccredited($USER_ID);
169
170 $this->assertEquals( ilLPStatus::LP_STATUS_COMPLETED_NUM
171 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
172 );
173
174 $node2_progress->unmarkAccredited();
175
176 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
177 , ilLPStatusWrapper::_determineStatus($this->root->getId(), $user->getId())
178 );
179 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
180 , ilLPStatusWrapper::_determineStatus($this->node1->getId(), $user->getId())
181 );
182 $this->assertEquals( ilLPStatus::LP_STATUS_IN_PROGRESS_NUM
183 , ilLPStatusWrapper::_determineStatus($this->node2->getId(), $user->getId())
184 );
185 }

References ilLPStatusWrapper\_determineStatus(), assignNewUserToRoot(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, newUser(), and setAllNodesActive().

+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilStudyProgrammeLPTest::$backupGlobals = FALSE
protected

Definition at line 15 of file ilStudyProgrammeLPTest.php.


The documentation for this class was generated from the following file: