19 declare(strict_types=1);
29 protected function setUp(): void
38 $this->assertInstanceOf(ilTestEvaluationUserData::class, $this->testObj);
51 'questionsWorkedThrough',
62 $this->assertEquals($expected, $this->testObj->__sleep());
68 $this->testObj->setPassScoring($passScoring);
69 $this->assertEquals($passScoring, $this->testObj->getPassScoring());
75 $this->testObj->setName($name);
76 $this->assertEquals($name, $this->testObj->getName());
82 $this->testObj->setLogin($login);
83 $this->assertEquals($login, $this->testObj->getLogin());
88 $this->testObj->setSubmitted(
true);
89 $this->assertTrue($this->testObj->isSubmitted());
91 $this->testObj->setSubmitted(
false);
92 $this->assertFalse($this->testObj->isSubmitted());
99 $testEvaluationPassData->setReachedPoints($reachedPoints);
101 $this->testObj->addPass(0, $testEvaluationPassData);
103 $this->assertEquals($reachedPoints, $this->testObj->getReached());
110 $testEvaluationPassData->setMaxPoints($maxpoints);
112 $this->testObj->addPass(0, $testEvaluationPassData);
114 $this->assertEquals($maxpoints, $this->testObj->getMaxpoints());
122 $testEvaluationPassData->setReachedPoints($reachedpoints);
123 $testEvaluationPassData->setMaxPoints($maxpoints);
125 $this->testObj->addPass(0, $testEvaluationPassData);
127 $this->assertEquals(($reachedpoints / $maxpoints) * 100, $this->testObj->getReachedPointsInPercent());
132 $a_mark = new \ILIAS\Test\Scoring\Marks\Mark(
'testMark');
133 $this->testObj->setMark($a_mark);
134 $this->assertEquals($a_mark, $this->testObj->getMark());
141 $nrOfAnsweredQuestions = 5;
143 $testEvaluationPassData->setReachedPoints($reachedpoints);
144 $testEvaluationPassData->setMaxPoints($maxpoints);
145 $testEvaluationPassData->setNrOfAnsweredQuestions($nrOfAnsweredQuestions);
147 $this->testObj->addPass(0, $testEvaluationPassData);
149 $this->assertEquals($nrOfAnsweredQuestions, $this->testObj->getQuestionsWorkedThrough());
156 $testEvaluationPassData->setQuestionCount($questioncount);
158 $this->testObj->addPass(0, $testEvaluationPassData);
160 $this->assertEquals($questioncount, $this->testObj->getNumberOfQuestions());
166 $nrOfAnsweredQuestions = 3;
168 $testEvaluationPassData->setQuestionCount($questioncount);
169 $testEvaluationPassData->setNrOfAnsweredQuestions($nrOfAnsweredQuestions);
171 $this->testObj->addPass(0, $testEvaluationPassData);
173 $this->assertEquals(($nrOfAnsweredQuestions / $questioncount) * 100, $this->testObj->getQuestionsWorkedThroughInPercent());
180 $data1->setWorkingTime($workingtime1);
184 $data2->setWorkingTime($workingtime2);
186 $this->testObj->addPass(0, $data1);
187 $this->testObj->addPass(1, $data2);
189 $this->assertEquals($workingtime1 + $workingtime2, $this->testObj->getTimeOnTask());
194 $time = new \DateTimeImmutable();
195 $this->testObj->setFirstVisit($time);
197 $this->assertEquals($time, $this->testObj->getFirstVisit());
202 $time = new \DateTimeImmutable();
203 $this->testObj->setLastVisit($time);
205 $this->assertEquals($time, $this->testObj->getLastVisit());
212 $data1->setWorkingTime($workingtime1);
216 $data2->setWorkingTime($workingtime2);
218 $this->testObj->addPass(0, $data1);
219 $this->testObj->addPass(1, $data2);
221 $this->assertEquals([$data1, $data2], $this->testObj->getPasses());
226 $this->assertEquals(0, $this->testObj->getPassCount());
235 foreach ($data as $value) {
239 $this->assertEquals(count(array_unique($data)), $this->testObj->getPassCount());
244 $this->assertEquals(0, $this->testObj->getPassCount());
252 foreach ($data as $key => $value) {
253 $this->testObj->addPass($key, $value);
256 $this->assertEquals($expected, $this->testObj->getPass(0));
261 $this->assertEquals(0, $this->testObj->getPassCount());
270 foreach ($data as $value) {
274 $this->assertEquals(count(array_unique($data)), $this->testObj->getPassCount());
279 $question_title =
'testString';
281 $this->testObj->addQuestionTitle($question_id, $question_title);
283 $this->assertEquals($question_title, $this->testObj->getQuestionTitles()[$question_id]);
288 $this->assertNull($this->testObj->getQuestions());
291 'id' => $question_id = 22,
292 'o_id' => $original_id = 20,
293 'points' => $max_points = 15,
294 'sequence' => $sequence =
null 297 $this->testObj->addQuestion($original_id, $question_id, $max_points, $sequence, 0);
299 $this->assertEquals([$expected], $this->testObj->getQuestions());
305 'id' => $question_id = 22,
306 'o_id' => $original_id = 20,
307 'points' => $max_points = 15.0,
308 'sequence' => $sequence =
null 313 $this->testObj->addQuestion($original_id, $question_id, $max_points, $sequence, $pass);
315 $this->assertEquals($expected, $this->testObj->getQuestion($pass));
322 $pass->setQuestionCount($questioncount);
323 $this->testObj->addPass(0, $pass);
325 $this->assertEquals($questioncount, $this->testObj->getQuestionCount());
332 $pass->setReachedPoints($reachedpoints);
333 $this->testObj->addPass(0, $pass);
335 $this->assertEquals($reachedpoints, $this->testObj->getReachedPoints());
342 $pass->setMaxPoints($maxpoints);
343 $this->testObj->addPass(0, $pass);
345 $this->assertEquals($maxpoints, $this->testObj->getAvailablePoints());
353 $pass->setReachedPoints($reachedpoints);
354 $pass->setMaxPoints($maxpoints);
356 $this->testObj->addPass($pass_nr, $pass);
358 $this->assertEquals($reachedpoints / $maxpoints, $this->testObj->getReachedPointsInPercentForPass($pass_nr));
364 $this->testObj->setUserID(
$user_id);
365 $this->assertEquals(
$user_id, $this->testObj->getUserID());
testGetQuestionsWorkedThrough()
ilTestEvaluationUserData $testObj
Class ilTestEvaluationUserDataTest.
testGetQuestionsWorkedThroughInPercent()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
testGetReachedPointsInPercent()
testGetReachedPointsInPercentForPass()
testGetNumberOfQuestions()
test_instantiateObject_shouldReturnInstance()