ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilTestEvaluationDataTest Class Reference
+ Inheritance diagram for ilTestEvaluationDataTest:
+ Collaboration diagram for ilTestEvaluationDataTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test__sleep ()
 
 testDatasets ()
 
 testQuestionTitle ()
 
 testEvaluationFactory ()
 
- Public Member Functions inherited from ilTestBaseTestCase
 createInstanceOf (string $class_name, array $explicit_parameters=[])
 
 createTraitInstanceOf (string $class_name, array $explicit_parameters=[])
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilTestBaseTestCase
 setUp ()
 
 tearDown ()
 

Private Attributes

ilTestEvaluationData $testObj
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTestBaseTestCase
static callMethod ($obj, $name, array $args=[])
 
static getNonPublicPropertyValue (object $obj, string $name)
 
- Data Fields inherited from ilTestBaseTestCase
const string MOCKED_METHOD_WITHOUT_OUTPUT = 'MOCKED_METHOD_WITHOUT_OUTPUT'
 
const string DYNAMIC_CLASS = 'DynamicClass'
 
- Protected Attributes inherited from ilTestBaseTestCase
Container $dic = null
 
Container $backup_dic = null
 
- Static Protected Attributes inherited from ilTestBaseTestCase
static int $DYNAMIC_CLASS_COUNT = 0
 

Detailed Description

Deprecated:
11; Result/EvaluationData will be refined.

Definition at line 24 of file ilTestEvaluationDataTest.php.

Member Function Documentation

◆ setUp()

ilTestEvaluationDataTest::setUp ( )
protected

Definition at line 28 of file ilTestEvaluationDataTest.php.

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

◆ test__sleep()

ilTestEvaluationDataTest::test__sleep ( )

Definition at line 43 of file ilTestEvaluationDataTest.php.

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

◆ test_instantiateObject_shouldReturnInstance()

ilTestEvaluationDataTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 38 of file ilTestEvaluationDataTest.php.

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

◆ testDatasets()

ilTestEvaluationDataTest::testDatasets ( )

Definition at line 50 of file ilTestEvaluationDataTest.php.

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

◆ testEvaluationFactory()

ilTestEvaluationDataTest::testEvaluationFactory ( )

Definition at line 76 of file ilTestEvaluationDataTest.php.

References $data, $res, and null.

76  : void
77  {
78  $records = [];
79  $records[] = [
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  "pass" => 1,
91  "points" => 10.3,
92  "maxpoints" => 32,
93  "questioncount" => 32,
94  "answeredquestions" => 1,
95  "workingtime" => 28,
96  "tstamp" => 1731941437,
97  "obligations_answered" => true,
98  "exam_id" => "I0_T355_A7_P1",
99  "usr_id" => 6,
100  "firstname" => "root",
101  "lastname" => "user",
102  "title" => "",
103  "login" => "root",
104  "finalized_by" => null
105  ];
106  $records[] = ['first_access' => '2024-12-11 17:54:26'];
107  $records[] = null;
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  ->willReturn(null);
117  $test_obj
118  ->expects($this->once())
119  ->method('getTestParticipants')
120  ->willReturn([7]);
121  $test_obj
122  ->expects($this->once())
123  ->method('getVisitingTimeOfParticipant')
124  ->willReturn(
125  [
126  'first_access' => new \DateTimeImmutable(),
127  'last_access' => new \DateTimeImmutable()
128  ]
129  );
130 
131  $db = $this->createMock(ilDBInterface::class);
132  $db
133  ->expects($this->exactly(3))
134  ->method('fetchAssoc')
135  ->willReturnCallback(
136  function ($res) use (&$records) {
137  return array_shift($records);
138  }
139  );
140 
141  $factory = new ilTestEvaluationFactory($db, $test_obj);
142  $data = $factory->getEvaluationData();
143  $this->assertInstanceOf(ilTestEvaluationData::class, $data);
144 
145  $this->assertEquals(
146  [7],
147  $data->getParticipantIds()
148  );
149  $this->assertInstanceOf(
150  ilTestEvaluationUserData::class,
151  $data->getParticipant(7)
152  );
153  }
$res
Definition: ltiservices.php:66
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testQuestionTitle()

ilTestEvaluationDataTest::testQuestionTitle ( )

Definition at line 57 of file ilTestEvaluationDataTest.php.

57  : void
58  {
59  $expected = [
60  120 => 'abcd',
61  121 => 'Hello',
62  2150 => 'World',
63  ];
64 
65  foreach ($expected as $questionId => $questionTitle) {
66  $this->testObj->addQuestionTitle($questionId, $questionTitle);
67 
68  $this->assertEquals($questionTitle, $this->testObj->getQuestionTitle($questionId));
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 26 of file ilTestEvaluationDataTest.php.


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