1<?
php declare(strict_types=1);
7 return [6,
new DateTimeImmutable()];
13 $this->assertEquals($spp->getId(), 123);
23 $this->assertEquals($spp->getAssignmentId(), 321);
32 $this->assertEquals($spp->getNodeId(), 321);
41 $this->assertEquals($spp->getUserId(), 321);
50 $this->assertEquals($spp->getAmountOfPoints(), 321);
58 $this->expectException(\ilException::class);
68 $this->assertEquals($spp->getCurrentAmountOfPoints(), 321);
89 $this->assertEquals($spp->getStatus(), $status);
97 $this->expectException(\ilException::class);
108 $this->assertEquals($spp->getLastChangeBy(), $acting_usr);
109 $this->assertEquals($spp->getLastChange()->format(
'Y-m-d H:i:s'), $now->format(
'Y-m-d H:i:s'));
117 $ad =
new DateTimeImmutable();
119 $this->assertEquals($spp->getAssignmentDate()->format(
'Y-m-d'), $ad->format(
'Y-m-d'));
130 $this->assertEquals($now->format(
'Y-m-d'), $spp->getCompletionDate()->format(
'Y-m-d'));
131 $this->assertEquals($acting_usr, $spp->getCompletionBy());
134 $this->assertNull($spp->getCompletionDate());
135 $this->assertNull($spp->getCompletionBy());
143 $dl =
new DateTimeImmutable();
145 $this->assertEquals($spp->getDeadline()->format(
'Y-m-d'), $dl->format(
'Y-m-d'));
153 $dl = DateTimeImmutable::createFromFormat(
'Ymd',
'20201011');
155 $this->assertEquals($spp->getValidityOfQualification()->format(
'Ymd'),
'20201011');
175 $this->assertFalse($spp->isInvalidated());
176 $past = DateTimeImmutable::createFromFormat(
'Ymd',
'20180101');
178 ->withValidityOfQualification($past)
180 $this->assertTrue($spp->isInvalidated());
188 $this->expectException(\ilException::class);
189 $tomorrow = (
new DateTimeImmutable())->
add(
new DateInterval(
'P1D'));
198 $this->expectException(\ilException::class);
208 $this->assertEquals(
$success, $spp->isSuccessful());
213 $today =
new DateTimeImmutable();
214 $yesterday = $today->sub(
new DateInterval(
'P1D'));
215 $tomorrow = $today->add(
new DateInterval(
'P1D'));
219 ->withValidityOfQualification($today);
221 $this->assertNull($spp->hasValidQualification($today));
224 $this->assertTrue($spp->hasValidQualification($yesterday));
225 $this->assertTrue($spp->hasValidQualification($today));
226 $this->assertFalse($spp->hasValidQualification($tomorrow));
232 $now =
new DateTimeImmutable();
234 ->markRelevant($now, $usr);
236 $this->assertNull($spp->getCompletionBy());
237 $this->assertEquals($usr, $spp->getLastChangeBy());
246 $this->assertTrue($spp->hasIndividualModifications());
252 $now =
new DateTimeImmutable();
254 ->markNotRelevant($now, $usr);
256 $this->assertNull($spp->getCompletionBy());
257 $this->assertEquals($usr, $spp->getLastChangeBy());
266 $this->assertTrue($spp->hasIndividualModifications());
272 $now =
new DateTimeImmutable();
274 ->markFailed($now, $usr);
276 $this->assertNull($spp->getCompletionDate());
277 $this->assertNull($spp->getCompletionBy());
278 $this->assertEquals($usr, $spp->getLastChangeBy());
293 ->markNotFailed($now, $usr);
295 $this->assertNull($spp->getCompletionDate());
296 $this->assertNull($spp->getCompletionBy());
297 $this->assertEquals($usr, $spp->getLastChangeBy());
311 $now =
new DateTimeImmutable();
313 ->markAccredited($now, $usr);
315 $this->assertEquals($now, $spp->getCompletionDate());
316 $this->assertEquals($usr, $spp->getCompletionBy());
317 $this->assertEquals($usr, $spp->getLastChangeBy());
331 $now =
new DateTimeImmutable();
333 ->unmarkAccredited($now, $usr);
335 $this->assertNull($spp->getCompletionDate());
336 $this->assertNull($spp->getCompletionBy());
337 $this->assertNull($spp->getValidityOfQualification());
338 $this->assertEquals($usr, $spp->getLastChangeBy());
351 $triggering_obj = 777;
352 $now =
new DateTimeImmutable();
354 ->succeed($now, $triggering_obj);
356 $this->assertEquals($now, $spp->getCompletionDate());
357 $this->assertEquals($triggering_obj, $spp->getCompletionBy());
358 $this->assertEquals($triggering_obj, $spp->getLastChangeBy());
375 if (in_array($status, [
382 $this->assertTrue($spp->isTransitionAllowedTo($status));
384 $this->assertFalse($spp->isTransitionAllowedTo($status));
394 if (in_array($status, [
401 $this->assertTrue($spp->isTransitionAllowedTo($status));
403 $this->assertFalse($spp->isTransitionAllowedTo($status));
413 if (in_array($status, [
417 $this->assertTrue($spp->isTransitionAllowedTo($status));
419 $this->assertFalse($spp->isTransitionAllowedTo($status));
429 if (in_array($status, [
435 $this->assertTrue($spp->isTransitionAllowedTo($status));
437 $this->assertFalse($spp->isTransitionAllowedTo($status));
448 || $status === $spp->getStatus()
450 $this->assertTrue($spp->isTransitionAllowedTo($status));
452 $this->assertFalse($spp->isTransitionAllowedTo($status));
An exception for terminatinating execution or to throw for unit testing.
testAllowedTransitionsForIrrelevant($status)
@dataProvider status
test_completion()
@depends test_init_and_id
test_amount_of_points_invalid()
@depends test_init_and_id
test_current_amount_of_points()
@depends test_init_and_id
test_invalidate_non_expired_2()
@depends test_vq_date
testAllowedTransitionsForInProgress($status)
@dataProvider status
testIndividualPlan(ilStudyProgrammeProgress $spp)
@depends test_init_and_id
test_assignment_id()
@depends test_init_and_id
test_invalidate()
@depends test_vq_date
test_deadline()
@depends test_init_and_id
test_node_id()
@depends test_init_and_id
test_assignment_date()
@depends test_init_and_id
testAllowedTransitionsForFailed($status)
@dataProvider status
testAllowedTransitionsForAccredited($status)
@dataProvider status
test_vq_date()
@depends test_init_and_id
test_user_id()
@depends test_init_and_id
testWithLastChange()
@depends test_init_and_id
test_amount_of_points()
@depends test_init_and_id
testHasValidQualification()
test_status_invalid()
@depends test_init_and_id
test_status($status)
@dataProvider status
test_invalidate_non_expired_1()
@depends test_vq_date
testAllowedTransitionsForCompleted($status)
@dataProvider status
testIsSuccessful($status, $success)
@dataProvider status
Class ilStudyProgrammeProgress.
withIndividualModifications(bool $individual)
const STATUS_NOT_RELEVANT
hasIndividualModifications()