19 declare(strict_types=1);
39 protected function setUp(): void
41 $this->iass_object = $this->createMock(ilObjIndividualAssessment::class);
42 $this->grading = $this->createMock(ilIndividualAssessmentUserGrading::class);
43 $this->obj_user = $this->createMock(ilObjUser::class);
55 $this->assertInstanceOf(ilIndividualAssessmentMember::class, $obj);
61 ->expects($this->once())
63 ->willReturn(
"testRecord")
73 $this->assertEquals(
"testRecord", $obj->record());
79 ->expects($this->once())
80 ->method(
"getInternalNote")
81 ->willReturn(
"internalNote")
91 $this->assertEquals(
"internalNote", $obj->internalNote());
103 $this->assertNull($obj->examinerId());
116 $this->assertEquals(3434, $obj->examinerId());
128 $this->assertNull($obj->changerId());
142 $this->assertEquals(5656, $obj->changerId());
154 $this->assertNull($obj->changeTime());
169 $this->assertEquals(
'2021-11-25', $obj->changeTime()->format(
'Y-m-d'));
175 ->expects($this->once())
187 $this->assertTrue($obj->notify());
192 $notificator = $this->createMock(ilIndividualAssessmentNotificator::class);
195 ->expects($this->once())
196 ->method(
"isFinalized")
207 $this->expectException(ilIndividualAssessmentException::class);
208 $this->expectExceptionMessage(
'must finalize before notification');
209 $obj->maybeSendNotification($notificator);
214 $notificator = $this->createMock(ilIndividualAssessmentNotificator::class);
217 ->expects($this->once())
218 ->method(
"isFinalized")
222 ->expects($this->once())
234 $this->assertEquals($obj, $obj->maybeSendNotification($notificator));
240 ->expects($this->once())
252 $this->assertEquals(22, $obj->id());
258 ->expects($this->once())
270 $this->assertEquals(22, $obj->assessmentId());
282 $this->assertEquals($this->iass_object, $obj->assessment());
288 ->expects($this->once())
289 ->method(
"isFinalized")
300 $this->assertTrue($obj->finalized());
316 $settings = $this->createMock(ilIndividualAssessmentSettings::class);
318 ->expects($this->once())
319 ->method(
"isFileRequired")
324 ->expects($this->once())
325 ->method(
"getSettings")
326 ->willReturn($settings)
330 ->expects($this->once())
332 ->willReturn($filename)
342 $this->assertFalse($obj->mayBeFinalized());
358 $settings = $this->createMock(ilIndividualAssessmentSettings::class);
360 ->expects($this->once())
361 ->method(
"isFileRequired")
366 ->expects($this->once())
367 ->method(
"getSettings")
368 ->willReturn($settings)
372 ->expects($this->once())
373 ->method(
"getLearningProgress")
374 ->willReturn($lp_status)
377 ->expects($this->once())
378 ->method(
"isFinalized")
389 $this->assertTrue($obj->mayBeFinalized());
394 $settings = $this->createMock(ilIndividualAssessmentSettings::class);
396 ->expects($this->once())
397 ->method(
"isFileRequired")
402 ->expects($this->once())
403 ->method(
"getSettings")
404 ->willReturn($settings)
408 ->expects($this->once())
409 ->method(
"getLearningProgress")
413 ->expects($this->once())
414 ->method(
"isFinalized")
425 $this->assertFalse($obj->mayBeFinalized());
441 $settings = $this->createMock(ilIndividualAssessmentSettings::class);
443 ->expects($this->once())
444 ->method(
"isFileRequired")
449 ->expects($this->once())
450 ->method(
"getSettings")
451 ->willReturn($settings)
455 ->expects($this->once())
456 ->method(
"getLearningProgress")
457 ->willReturn($lp_status)
467 $this->assertFalse($obj->mayBeFinalized());
479 $new_obj = $obj->withExaminerId(333);
481 $this->assertNull($obj->examinerId());
482 $this->assertEquals(333, $new_obj->examinerId());
494 $new_obj = $obj->withChangerId(534);
496 $this->assertNull($obj->changerId());
497 $this->assertEquals(534, $new_obj->changerId());
511 $this->assertNull($obj->changeTime());
512 $this->assertEquals(
"2021-11-25", $new_obj->changeTime()->format(
"Y-m-d"));
518 ->expects($this->once())
519 ->method(
"getLastname")
520 ->willReturn(
"lastname")
530 $this->assertEquals(
"lastname", $obj->lastname());
536 ->expects($this->once())
537 ->method(
"getFirstname")
538 ->willReturn(
"firstname")
548 $this->assertEquals(
"firstname", $obj->firstname());
554 ->expects($this->once())
556 ->willReturn(
"login")
566 $this->assertEquals(
"login", $obj->login());
572 ->expects($this->once())
573 ->method(
"getFullName")
574 ->willReturn(
"first last")
584 $this->assertEquals(
"first last", $obj->name());
590 ->expects($this->once())
591 ->method(
"getLearningProgress")
614 $this->assertEquals(22222, $obj->notificationTS());
620 ->expects($this->once())
622 ->willReturn(
"place")
632 $this->assertEquals(
"place", $obj->place());
638 ->expects($this->once())
639 ->method(
"getEventTime")
650 $this->assertEquals(
"2021-11-25", $obj->eventTime()->format(
"Y-m-d"));
656 ->expects($this->once())
658 ->willReturn(
"file_name")
668 $this->assertEquals(
"file_name", $obj->fileName());
674 ->expects($this->once())
675 ->method(
"isFileVisible")
686 $this->assertTrue($obj->viewFile());
698 $this->assertEquals($this->grading, $obj->getGrading());
710 $new_grading = $this->createMock(ilIndividualAssessmentUserGrading::class);
711 $new_grading = $new_grading->withFinalized(
true);
712 $new_obj = $obj->withGrading($new_grading);
714 $this->assertNotEquals($new_grading, $obj->getGrading());
715 $this->assertEquals($new_grading, $new_obj->getGrading());
test_changeTime_not_set()
test_mayBeFinalized_already_finalized()
test_maybeSendNotification_not_notify()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
test_mayBeFinalized_file_required_filename_empty(?string $filename)
fileNamesDataProvider
test_examinerId_not_set()
test_mayBeFinalized_with_positive_lp_status(int $lp_status)
positiveLPStatusDataProvider
static negativeLPStatusDataProvider()
Edit the record of a user, set LP.
test_maybeSendNotification_not_finalized()
static positiveLPStatusDataProvider()
test_mayBeFinalized_with_negative_lp_status(int $lp_status)
negativeLPStatusDataProvider
static fileNamesDataProvider()