19 declare(strict_types=1);
39 protected function setUp(): void
44 $this->addGlobal_ilCtrl();
45 $this->addGlobal_lng();
46 $this->addGlobal_ilUser();
48 $this->testObjMock = $this->getTestObjMock();
52 $this->createMock(TestTopListRepository::class),
57 $this->createMock(Factory::class),
59 TopListOrder::BY_SCORE
65 $this->assertInstanceOf(DataRetrieval::class, $this->tableObj);
70 $this->testObjMock->method(
'getHighscoreAchievedTS')->willReturn(
true);
71 $this->testObjMock->method(
'getHighscoreScore')->willReturn(
true);
72 $this->testObjMock->method(
'getHighscorePercentage')->willReturn(
true);
73 $this->testObjMock->method(
'getHighscoreHints')->willReturn(
true);
74 $this->testObjMock->method(
'getHighscoreWTime')->willReturn(
true);
76 $columns = $this->tableObj->getColumns();
77 $this->assertIsArray($columns);
78 $this->assertNotEmpty($columns);
79 $this->assertArrayHasKey(
'is_actor', $columns);
80 $this->assertArrayHasKey(
'rank', $columns);
81 $this->assertArrayHasKey(
'participant', $columns);
82 $this->assertArrayHasKey(
'achieved', $columns);
83 $this->assertArrayHasKey(
'score', $columns);
84 $this->assertArrayHasKey(
'percentage', $columns);
85 $this->assertArrayHasKey(
'hints', $columns);
86 $this->assertArrayHasKey(
'workingtime', $columns);
91 $this->testObjMock->method(
'getHighscoreAchievedTS')->willReturn(
true);
92 $this->testObjMock->method(
'getHighscoreScore')->willReturn(
false);
93 $this->testObjMock->method(
'getHighscorePercentage')->willReturn(
true);
94 $this->testObjMock->method(
'getHighscoreHints')->willReturn(
true);
95 $this->testObjMock->method(
'getHighscoreWTime')->willReturn(
false);
97 $columns = $this->tableObj->getColumns();
98 $this->assertIsArray($columns);
99 $this->assertNotEmpty($columns);
100 $this->assertArrayHasKey(
'achieved', $columns);
101 $this->assertArrayHasKey(
'percentage', $columns);
102 $this->assertArrayHasKey(
'hints', $columns);
104 $this->assertArrayNotHasKey(
'score', $columns);
105 $this->assertArrayNotHasKey(
'workingtime', $columns);
110 $this->assertEquals(
'00:00:00', $this->tableObj->formatTime(0));
115 $this->assertEquals(
'01:00:00', $this->tableObj->formatTime(3600));
116 $this->assertEquals(
'00:02:00', $this->tableObj->formatTime(120));
117 $this->assertEquals(
'00:02:01', $this->tableObj->formatTime(121));
118 $this->assertEquals(
'03:09:40', $this->tableObj->formatTime(11380));
test_formatTime_shouldReturnFormattedTime()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_getColumns_shouldReturnAllColumns()
test_instantiateObject_shouldReturnInstance()
test_getColumns_shouldReturnOnlySelectedColumns()
test_formatTime_shouldReturnZeroTime()