5require_once(__DIR__.
"/mocks.php");
 
   19                PHPUnit_Framework_Error_Deprecated::$enabled = FALSE;
 
   21                require_once(
"./Modules/StudyProgramme/classes/class.ilObjStudyProgramme.php");
 
   23                include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
 
   24                ilUnitUtil::performInitialisation();
 
   27                $this->root->putInTree(ROOT_FOLDER_ID);
 
   36                $this->root->addNode($this->node1);
 
   37                $this->root->addNode($this->node2);
 
   38                $this->node1->addLeaf($this->leaf1);
 
   39                $this->node2->addLeaf($this->leaf2);
 
   52                        $this->root->delete();
 
   70                return array($this->root->assignUser($user->getId()), $user);
 
   79                $root_progresses = $this->root->getProgressesOf($user->getId());
 
   80                $this->assertCount(1, $root_progresses);
 
   81                $root_progress = $root_progresses[0];
 
   83                                                   , $root_progress->getStatus());
 
   84                $this->assertEquals( $this->root->getPoints()
 
   85                                                   , $root_progress->getAmountOfPoints());
 
   86                $this->assertEquals(0, $root_progress->getCurrentAmountOfPoints());
 
   87                $this->assertEquals($this->root->getId(), $root_progress->getStudyProgramme()->getId());
 
   88                $this->assertEquals($ass->getId(), $root_progress->getAssignment()->getId());
 
   89                $this->assertEquals($user->getId(), $root_progress->getUserId());
 
   90                $this->assertNull($root_progress->getLastChangeBy());
 
   91                $this->assertNull($root_progress->getCompletionBy());
 
   93                $node1_progresses = $this->node1->getProgressesOf($user->getId());
 
   94                $this->assertCount(1, $node1_progresses);
 
   95                $node1_progress = $node1_progresses[0];
 
   97                                                   , $node1_progress->getStatus());
 
   98                $this->assertEquals( $this->node1->getPoints()
 
   99                                                   , $node1_progress->getAmountOfPoints());
 
  100                $this->assertEquals(0, $node1_progress->getCurrentAmountOfPoints());
 
  101                $this->assertEquals($this->node1->getId(), $node1_progress->getStudyProgramme()->getId());
 
  102                $this->assertEquals($ass->getId(), $node1_progress->getAssignment()->getId());
 
  103                $this->assertEquals($user->getId(), $node1_progress->getUserId());
 
  104                $this->assertNull($node1_progress->getLastChangeBy());
 
  105                $this->assertNull($node1_progress->getCompletionBy());
 
  107                $node2_progresses = $this->node2->getProgressesOf($user->getId());
 
  108                $this->assertCount(1, $node2_progresses);
 
  109                $node2_progress = $node2_progresses[0];
 
  111                                                   , $node2_progress->getStatus());
 
  112                $this->assertEquals( $this->node2->getPoints()
 
  113                                                   , $node2_progress->getAmountOfPoints());
 
  114                $this->assertEquals(0, $node2_progress->getCurrentAmountOfPoints());
 
  115                $this->assertEquals($this->node2->getId(), $node2_progress->getStudyProgramme()->getId());
 
  116                $this->assertEquals($ass->getId(), $node2_progress->getAssignment()->getId());
 
  117                $this->assertEquals($user->getId(), $node2_progress->getUserId());
 
  118                $this->assertNull($node2_progress->getLastChangeBy());
 
  119                $this->assertNull($node2_progress->getCompletionBy());
 
  131                $root_progresses = $this->root->getProgressesOf($user->getId());
 
  132                $root_progress = $root_progresses[0];
 
  134                                                   , $root_progress->getStatus());
 
  136                $node1_progresses = $this->node1->getProgressesOf($user->getId());
 
  137                $node1_progress = $node1_progresses[0];
 
  139                                                   , $node1_progress->getStatus());
 
  141                $node2_progresses = $this->node2->getProgressesOf($user->getId());
 
  142                $node2_progress = $node2_progresses[0];
 
  144                                                   , $node2_progress->getStatus());
 
  156                $root_progresses = $this->root->getProgressesOf($user->getId());
 
  157                $root_progress = $root_progresses[0];
 
  159                                                   , $root_progress->getStatus());
 
  161                $node1_progresses = $this->node1->getProgressesOf($user->getId());
 
  162                $node1_progress = $node1_progresses[0];
 
  164                                                   , $node1_progress->getStatus());
 
  166                $node2_progresses = $this->node2->getProgressesOf($user->getId());
 
  167                $node2_progress = $node2_progresses[0];
 
  169                                                   , $node2_progress->getStatus());
 
  179                $root_progresses = $this->root->getProgressesOf($user->getId());
 
  180                $this->assertCount(1, $root_progresses);
 
  190                $USER_ID = $user2->getId();
 
  192                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  193                $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
 
  195                $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
 
  200                $ts_before_change = $node2_progress->getLastChange()->get(
IL_CAL_DATETIME);
 
  201                $node2_progress->markAccredited($USER_ID);
 
  202                $ts_after_change = $node2_progress->getLastChange()->get(
IL_CAL_DATETIME);
 
  204                $this->assertTrue($node2_progress->isSuccessful());
 
  205                $this->assertEquals($root_progress->getAmountOfPoints(), $root_progress->getCurrentAmountOfPoints());
 
  211                $this->assertEquals($USER_ID, $node2_progress->getCompletionBy());
 
  212                $this->assertLessThanOrEqual($ts_before_change, $ts_after_change);
 
  222                $USER_ID = $user2->getId();
 
  224                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  225                $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
 
  226                $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
 
  232                $ts_before_change = $node2_progress->getLastChange()->get(
IL_CAL_DATETIME);
 
  233                $node2_progress->markAccredited($USER_ID);
 
  234                $node2_progress->unmarkAccredited();
 
  235                $ts_after_change = $node2_progress->getLastChange()->get(
IL_CAL_DATETIME);
 
  242                $this->assertEquals(NULL, $node2_progress->getCompletionBy());
 
  243                $this->assertLessThanOrEqual($ts_before_change, $ts_after_change);
 
  254                $USER_ID = $user2->getId();
 
  256                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  257                $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
 
  258                $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
 
  259                $ts_before_change = $node2_progress->getLastChange()->get(
IL_CAL_DATETIME);
 
  260                $node2_progress->markNotRelevant($USER_ID);
 
  261                $ts_after_change = $node2_progress->getLastChange()->get(
IL_CAL_DATETIME);
 
  265                $this->assertEquals($USER_ID, $node2_progress->getCompletionBy());
 
  266                $this->assertLessThanOrEqual($ts_before_change, $ts_after_change);
 
  267                $this->assertTrue($node2_progress->hasIndividualModifications());
 
  278                $this->root->addNode($node3);
 
  280                $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
 
  281                $this->assertNotNull($node3_progress);
 
  292                $NEW_AMOUNT_OF_POINTS_1 = 205;
 
  295                $node2_progress1 = array_shift($this->node2->getProgressesOf($user1->getId()));
 
  296                $node2_progress1->setRequiredAmountOfPoints($NEW_AMOUNT_OF_POINTS_1, $this->
user->getId());
 
  298                $this->assertEquals($NEW_AMOUNT_OF_POINTS_1, $node2_progress1->getAmountOfPoints());
 
  307                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  308                $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
 
  309                $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
 
  322                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  323                $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
 
  324                $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
 
  337                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  338                $node1_progress = array_shift($this->node1->getProgressesOf($user->getId()));
 
  339                $node2_progress = array_shift($this->node2->getProgressesOf($user->getId()));
 
  341                $this->assertTrue($root_progress->canBeCompleted());
 
  342                $this->assertTrue($node1_progress->canBeCompleted());
 
  343                $this->assertTrue($node2_progress->canBeCompleted());
 
  347                $NEW_AMOUNT_OF_POINTS = 3003;
 
  351                $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
 
  357                $this->assertLessThan($NEW_AMOUNT_OF_POINTS, $this->node1->getPoints() + $this->node2->getPoints());
 
  359                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  360                $this->assertFalse($root_progress->canBeCompleted());
 
  364                $NEW_AMOUNT_OF_POINTS = 3003;
 
  369                $this->root->addNode($node3);
 
  370                $node3->setPoints($NEW_AMOUNT_OF_POINTS)
 
  379                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  380                $node3_progress = array_shift($node3->getProgressesOf($user->getId()));
 
  382                $this->assertFalse($root_progress->canBeCompleted());
 
  383                $this->assertFalse($node3_progress->canBeCompleted());
 
  394                $root_progresses = $this->root->getProgressesOf($user->getId());
 
  395                $this->assertCount(0, $root_progresses);
 
  396                $node1_progresses = $this->root->getProgressesOf($user->getId());
 
  397                $this->assertCount(0, $node1_progresses);
 
  398                $node2_progresses = $this->root->getProgressesOf($user->getId());
 
  399                $this->assertCount(0, $node2_progresses);
 
  409                $NEW_AMOUNT_OF_POINTS = 201;
 
  412                $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
 
  415                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  427                $NEW_AMOUNT_OF_POINTS = 202;
 
  430                $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
 
  433                $ass->updateFromProgram();
 
  434                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  435                $this->assertEquals($NEW_AMOUNT_OF_POINTS, $root_progress->getAmountOfPoints());
 
  447                $NEW_AMOUNT_OF_POINTS = 203;
 
  450                $this->root->setPoints($NEW_AMOUNT_OF_POINTS)
 
  453                $root_progress = array_shift($this->root->getProgressesOf($user->getId()));
 
  454                $ass->updateFromProgram();
 
  455                $this->assertEquals($NEW_AMOUNT_OF_POINTS, $root_progress->getAmountOfPoints());
 
  471                $NEW_AMOUNT_OF_POINTS_1 = 205;
 
  473                $NEW_AMOUNT_OF_POINTS_2 = 206;
 
  475                $this->assertNotEquals($NEW_AMOUNT_OF_POINTS_1, $NEW_AMOUNT_OF_POINTS_2);
 
  477                $node2_progress1 = array_shift($this->node2->getProgressesOf($user1->getId()));
 
  478                $node2_progress2 = array_shift($this->node2->getProgressesOf($user2->getId()));
 
  480                $node2_progress1->setRequiredAmountOfPoints($NEW_AMOUNT_OF_POINTS_1, $this->
user->getId());
 
  482                $this->node2->setPoints($NEW_AMOUNT_OF_POINTS_2)
 
  484                $this->root->updateAllAssignments();
 
  486                $this->assertEquals($NEW_AMOUNT_OF_POINTS_1, $node2_progress1->getAmountOfPoints());
 
  487                $this->assertEquals($NEW_AMOUNT_OF_POINTS_2, $node2_progress2->getAmountOfPoints());
 
  503                $progress = $this->node1->getProgressForAssignment($ass1->getId());
 
  505                                                   , $progress->getStatus());
 
  506                $progress->markAccredited($this->
user->getId());
 
  517                $progress = $this->node1->getProgressForAssignment($ass1->getId());
 
  518                $this->assertFalse($progress->hasIndividualModifications());
 
  527                $progress = $this->node1->getProgressForAssignment($ass1->getId());
 
  528                $progress->setRequiredAmountOfPoints(1000, $this->
user->getId());
 
  529                $this->assertTrue($progress->hasIndividualModifications());
 
  538                $progress = $this->node1->getProgressForAssignment($ass1->getId());
 
  539                $progress->markNotRelevant($this->
user->getId());
 
  540                $this->assertTrue($progress->hasIndividualModifications());
 
  549                $progress = $this->node1->getProgressForAssignment($ass1->getId());
 
  550                $progress->markAccredited($this->
user->getId());
 
  551                $this->assertFalse($progress->hasIndividualModifications());
 
  561                $USER_ID = $user2->getId();
 
  563                $this->node1->setTitle(
"node1");
 
  564                $this->node1->update();
 
  565                $this->node2->setTitle(
"node2");
 
  566                $this->node2->update();
 
  568                $names = $this->root->getProgressForAssignment($ass->getId())
 
  569                                        ->getNamesOfCompletedOrAccreditedChildren();
 
  570                $this->assertEquals(
$names, array());
 
  572                $this->node1->getProgressForAssignment($ass->getId())->markAccredited($USER_ID);
 
  573                $names = $this->root->getProgressForAssignment($ass->getId())
 
  574                                        ->getNamesOfCompletedOrAccreditedChildren();
 
  575                $this->assertEquals(
$names, array(
"node1"));
 
  577                $this->node2->getProgressForAssignment($ass->getId())->markAccredited($USER_ID);
 
  578                $names = $this->root->getProgressForAssignment($ass->getId())
 
  579                                        ->getNamesOfCompletedOrAccreditedChildren();
 
  580                $this->assertEquals(
$names, array(
"node1", 
"node2"));
 
  588                $depth1->putInTree(ROOT_FOLDER_ID);
 
  589                $depth1->addNode($depth2);
 
  590                $depth2->addNode($depth3);
 
  591                $depth3->addNode($depth4);
 
  599                $assignment = $depth1->assignUser($user->getId());
 
  600                $progress4 = $depth4->getProgressForAssignment($assignment->getId());
 
  601                $progress4->markAccredited(6);
 
  603                $progress1 = $depth1->getProgressForAssignment($assignment->getId());
 
  604                $progress2 = $depth2->getProgressForAssignment($assignment->getId());
 
  605                $progress3 = $depth3->getProgressForAssignment($assignment->getId());
 
  607                $this->assertTrue($progress1->isSuccessful());
 
  608                $this->assertTrue($progress2->isSuccessful());
 
  609                $this->assertTrue($progress3->isSuccessful());
 
  610                $this->assertTrue($progress4->isSuccessful());
 
An exception for terminatinating execution or to throw for unit testing.
static createInstance()
Create an instance of ilObjStudyProgramme, put in cache.
const STATUS_NOT_RELEVANT
TestCase for the progress of users at a programme.
testHasDeviationToProgram1()
testHasDeviationToProgram3()
testOutdatedNodesCantBeSetToRelevant()
QUA-Objekte, welche "Inaktiv" sind können bei Studierenden-Studienplänen nicht von "nicht relevant" a...
testGetNamesOfCompletedOrAccreditedChildren()
testHasDeviationToProgram2()
testNoImplicitPointUpdate()
testNewNodesAreNotRelevant()
testHasDeviationToProgram4()
testExplicitPointUpdate2()
testIndividualRequiredPoints()
testInitialProgressDraft()
testInitialProgressActive()
testExplicitPointUpdate1()
testMaximimPossibleAmountOfPoints1()
testNoUpdateOnModifiedNodes()
testCompletionOnDeeplyNestedProgresses()
testInitialProgressOutdated()
testUserDeletionDeletesAssignments()
testMaximimPossibleAmountOfPoints2()