ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
mocks.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2015 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
12require_once("Services/Tracking/classes/class.ilLPStatus.php");
13
17require_once("Modules/StudyProgramme/classes/interfaces/interface.ilStudyProgrammeLeaf.php");
18require_once("Services/Object/classes/class.ilObject2.php");
19
21{
22 public function __construct($a_id = 0, $a_call_by_reference = true)
23 {
24 parent::__construct($a_id, $a_call_by_reference);
25 if ($a_id == 0) {
26 parent::create();
27 }
28 }
29
30 // from ilObject2
31 public function initType()
32 {
33 $this->type = "crsr";
34 }
35
36 // from ilStudyProgrammeLeaf
37 /*public function getParentId() {
38 global $DIC;
39 $tree = $DIC['tree'];
40 if (!$tree->isInTree($this->getRefId())) {
41 return null;
42 }
43
44 $nd = $tree->getParentNodeData($this->getRefId());
45 return $nd["obj_id"];
46 }*/
47
48 // Mark this leaf as completed for a user.
49 public function markCompletedFor($a_user_id)
50 {
51 global $DIC;
52 $ilAppEventHandler = $DIC['ilAppEventHandler'];
53
54 $ilAppEventHandler->raise("Services/Tracking", "updateStatus", array(
55 "obj_id" => $this->getId(),
56 "usr_id" => $a_user_id,
58 "percentage" => 100
59 ));
60 }
61}
62
66require_once("Modules/StudyProgramme/classes/class.ilObjectFactoryWrapper.php");
67
69{
70 public function getInstanceByRefId($a_ref_id, $stop_on_error = true)
71 {
72 if (ilObject::_lookupType($a_ref_id, true) == "mock") {
73 return new ilStudyProgrammeLeafMock($a_ref_id);
74 }
75 return ilObjectFactoryWrapper::singleton()->getInstanceByRefId($a_ref_id, $stop_on_error);
76 }
77}
78
83{
84 public $events;
85
86 public function __construct()
87 {
88 $this->events = array();
89 }
90
91 public function raise($a_component, $a_event, $a_parameters)
92 {
93 $this->events[] = array( "component" => $a_component
94 , "event" => $a_event
95 , "parameters" => $a_parameters
96 );
97 }
98}
An exception for terminatinating execution or to throw for unit testing.
Mock for ilAppEventHandler.
Definition: mocks.php:83
const LP_STATUS_COMPLETED_NUM
Class ilObject2 This is an intermediate progress of ilObject class.
Mock for object factory.
Definition: mocks.php:69
getInstanceByRefId($a_ref_id, $stop_on_error=true)
Definition: mocks.php:70
Class ilObjectFactoryWrapper.
static _lookupType($a_id, $a_reference=false)
lookup object type
Mock classes for tests.
Definition: mocks.php:21
__construct($a_id=0, $a_call_by_reference=true)
Constructor @access public.
Definition: mocks.php:22
markCompletedFor($a_user_id)
Definition: mocks.php:49
The interface a class has to fullfill if it should be used as leaf in a program.
getId()
Get the ILIAS object id of the leaf.
global $DIC
Definition: saml.php:7