ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestEvaluationDataTest Class Reference

Class ilTestEvaluationDataTest. More...

+ Inheritance diagram for ilTestEvaluationDataTest:
+ Collaboration diagram for ilTestEvaluationDataTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test__sleep ()
 
 testDatasets ()
 
 testQuestionTitle ()
 
 testEvaluationFactory ()
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilTestBaseTestCase
 setUp ()
 
 tearDown ()
 
 setGlobalVariable (string $name, $value)
 
 getGlobalTemplateMock ()
 
 getDatabaseMock ()
 
 getIliasMock ()
 
 addGlobal_ilAccess ()
 
 addGlobal_ilUser ()
 
 addGlobal_objDefinition ()
 
 addGlobal_tree ()
 
 addGlobal_ilSetting ()
 
 addGlobal_rbacsystem ()
 
 addGlobal_ilRbacAdmin ()
 
 addGlobal_ilCtrl ()
 
 addGlobal_lng ()
 
 addGlobal_filesystem ()
 
 addGlobal_upload ()
 
 addGlobal_ilDB ()
 
 addGlobal_ilBench ()
 
 addGlobal_ilLog ()
 
 addGlobal_ilias ()
 
 addGlobal_ilErr ()
 
 addGlobal_GlobalScreenService ()
 
 addGlobal_ilNavigationHistory ()
 
 addGlobal_ilAppEventHandler ()
 
 addGlobal_tpl ()
 
 addGlobal_ilComponentRepository ()
 
 addGlobal_ilComponentFactory ()
 
 addGlobal_ilTabs ()
 
 addGlobal_ilObjDataCache ()
 
 addGlobal_ilLocator ()
 
 addGlobal_rbacreview ()
 
 addGlobal_ilToolbar ()
 
 addGlobal_http ()
 
 addGlobal_ilIliasIniFile ()
 
 addGlobal_ilLoggerFactory ()
 
 addGlobal_ilHelp ()
 
 addGlobal_ui ()
 
 addGlobal_uiFactory ()
 
 addGlobal_uiRenderer ()
 
 addGlobal_refinery ()
 
 addGlobal_skillService ()
 
 addGlobal_objectService ()
 
 addGlobal_resourceStorage ()
 
 getTestObjMock ()
 

Private Attributes

ilTestEvaluationData $testObj
 

Additional Inherited Members

- Protected Attributes inherited from ilTestBaseTestCase
Container $dic = null
 

Detailed Description

Member Function Documentation

◆ setUp()

ilTestEvaluationDataTest::setUp ( )
protected

Definition at line 29 of file ilTestEvaluationDataTest.php.

29  : void
30  {
31  parent::setUp();
32  $user_data = [
35  ];
36  $this->testObj = new ilTestEvaluationData($user_data);
37  }

◆ test__sleep()

ilTestEvaluationDataTest::test__sleep ( )

Definition at line 45 of file ilTestEvaluationDataTest.php.

45  : void
46  {
47  $expected = ['question_titles', 'participants', 'statistics', 'arr_filter', 'datasets', 'test'];
48 
49  $this->assertEquals($expected, $this->testObj->__sleep());
50  }

◆ test_instantiateObject_shouldReturnInstance()

ilTestEvaluationDataTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 40 of file ilTestEvaluationDataTest.php.

40  : void
41  {
42  $this->assertInstanceOf(ilTestEvaluationData::class, $this->testObj);
43  }

◆ testDatasets()

ilTestEvaluationDataTest::testDatasets ( )

Definition at line 52 of file ilTestEvaluationDataTest.php.

52  : void
53  {
54  $this->testObj->setDatasets(20);
55 
56  $this->assertEquals(20, $this->testObj->getDatasets());
57  }

◆ testEvaluationFactory()

ilTestEvaluationDataTest::testEvaluationFactory ( )

Definition at line 76 of file ilTestEvaluationDataTest.php.

References $data, and ILIAS\MetaData\Repository\Validation\Data\__construct().

76  : void
77  {
78  $records = [];
79  $records[7] = [
80  "active_id" => 7 ,
81  "question_fi" => 9,
82  "result_points" => 1.2,
83  "answered" => true,
84  "manual" => 1,
85  "original_id" => null,
86  "questiontitle" => "some title",
87  "qpl_maxpoints" => 2.4,
88  "submitted" => true,
89  "last_finished_pass" => 1,
90  "active_fi" => 7 ,
91  "pass" => 1,
92  "points" => 10.3,
93  "maxpoints" => 32,
94  "questioncount" => 32,
95  "answeredquestions" => 1,
96  "workingtime" => 28,
97  "tstamp" => 1731941437,
98  "hint_count" => 0,
99  "hint_points" => 0,
100  "obligations_answered" => true,
101  "exam_id" => "I0_T355_A7_P1",
102  "usr_id" => 6,
103  "firstname" => "root",
104  "lastname" => "user",
105  "title" => "",
106  "login" => "root"
107  ];
108 
109  $test_obj = $this->createMock(ilObjTest::class);
110  $test_obj
111  ->expects($this->once())
112  ->method('getPassScoring');
113  $test_obj
114  ->expects($this->once())
115  ->method('getAccessFilteredParticipantList');
116  $test_obj
117  ->expects($this->once())
118  ->method('getTestParticipants');
119 
120  $factory = new class ($test_obj, $records) extends ilTestEvaluationFactory {
121  public function __construct(
122  protected ilObjTest $test_obj,
123  protected array $records
124  ) {
125  }
126  protected function queryEvaluationData(array $active_ids): array
127  {
128  return $this->records;
129  }
130  protected function getVisitTimeOfParticipant(int $active_id): array
131  {
132  return [
133  'firstvisit' => 1731941437,
134  'lastvisit' => 1731941537
135  ];
136  }
137  protected function addQuestionsToParticipantPasses(ilTestEvaluationData $evaluation_data): ilTestEvaluationData
138  {
139  return $evaluation_data;
140  }
141  };
142 
143  $data = $factory->getEvaluationData();
144  $this->assertInstanceOf(ilTestEvaluationData::class, $data);
145  $this->assertEquals(
146  [7],
147  $data->getParticipantIds()
148  );
149  $this->assertInstanceOf(ilTestEvaluationUserData::class, $data->getParticipant(7));
150  }
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

◆ testQuestionTitle()

ilTestEvaluationDataTest::testQuestionTitle ( )

Definition at line 59 of file ilTestEvaluationDataTest.php.

59  : void
60  {
61  $expected = [
62  120 => "abcd",
63  121 => "Hello",
64  2150 => "World",
65  ];
66 
67  foreach ($expected as $questionId => $questionTitle) {
68  $this->testObj->addQuestionTitle($questionId, $questionTitle);
69  }
70 
71  $this->assertEquals($expected, $this->testObj->getQuestionTitles());
72 
73  $this->assertEquals($expected[2150], $this->testObj->getQuestionTitle(2150));
74  }

Field Documentation

◆ $testObj

ilTestEvaluationData ilTestEvaluationDataTest::$testObj
private

Definition at line 27 of file ilTestEvaluationDataTest.php.


The documentation for this class was generated from the following file: