ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
Results\Toplist\DataRetrievalTest Class Reference

Class DataRetrievalTest. More...

+ Inheritance diagram for Results\Toplist\DataRetrievalTest:
+ Collaboration diagram for Results\Toplist\DataRetrievalTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 
 test_getColumns_shouldReturnAllColumns ()
 
 test_getColumns_shouldReturnOnlySelectedColumns ()
 
 test_formatTime_shouldReturnZeroTime ()
 
 test_formatTime_shouldReturnFormattedTime ()
 
- 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

DataRetrieval $tableObj
 
ilObjTest $testObjMock
 

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

Class DataRetrievalTest.

Author
Marvin Beym mbeym.nosp@m.@dat.nosp@m.abay..nosp@m.de

Definition at line 34 of file DataRetrievalTest.php.

Member Function Documentation

◆ setUp()

Results\Toplist\DataRetrievalTest::setUp ( )
protected

Reimplemented from ilTestBaseTestCase.

Definition at line 40 of file DataRetrievalTest.php.

40 : void
41 {
42 global $DIC;
43 parent::setUp();
44
45 $this->addGlobal_ilCtrl();
46 $this->addGlobal_lng();
47 $this->addGlobal_ilUser();
48
49 $this->testObjMock = $this->getTestObjMock();
50
51 $this->tableObj = new DataRetrieval(
52 $this->testObjMock,
53 $this->createMock(TestTopListRepository::class),
54 $DIC['lng'],
55 $DIC['ilUser'],
56 $DIC['ui.factory'],
57 $DIC['ui.renderer'],
58 $this->createMock(Factory::class),
59 TopListType::GENERAL,
60 TopListOrder::BY_SCORE,
61 $this->createMock(ParticipantRepository::class)
62 );
63 }
global $DIC
Definition: shib_login.php:26

References $DIC, addGlobal_ilCtrl(), addGlobal_ilUser(), addGlobal_lng(), and getTestObjMock().

+ Here is the call graph for this function:

◆ test_formatTime_shouldReturnFormattedTime()

Results\Toplist\DataRetrievalTest::test_formatTime_shouldReturnFormattedTime ( )

Definition at line 111 of file DataRetrievalTest.php.

111 : void
112 {
113 $this->assertEquals('01:00:00', $this->tableObj->formatTime(3600));
114 $this->assertEquals('00:02:00', $this->tableObj->formatTime(120));
115 $this->assertEquals('00:02:01', $this->tableObj->formatTime(121));
116 $this->assertEquals('03:09:40', $this->tableObj->formatTime(11380));
117 }

◆ test_formatTime_shouldReturnZeroTime()

Results\Toplist\DataRetrievalTest::test_formatTime_shouldReturnZeroTime ( )

Definition at line 106 of file DataRetrievalTest.php.

106 : void
107 {
108 $this->assertEquals('00:00:00', $this->tableObj->formatTime(0));
109 }

◆ test_getColumns_shouldReturnAllColumns()

Results\Toplist\DataRetrievalTest::test_getColumns_shouldReturnAllColumns ( )

Definition at line 70 of file DataRetrievalTest.php.

70 : void
71 {
72 $this->testObjMock->method('getHighscoreAchievedTS')->willReturn(true);
73 $this->testObjMock->method('getHighscoreScore')->willReturn(true);
74 $this->testObjMock->method('getHighscorePercentage')->willReturn(true);
75 $this->testObjMock->method('getHighscoreWTime')->willReturn(true);
76
77 $columns = $this->tableObj->getColumns();
78 $this->assertIsArray($columns);
79 $this->assertNotEmpty($columns);
80 $this->assertArrayHasKey('is_actor', $columns);
81 $this->assertArrayHasKey('rank', $columns);
82 $this->assertArrayHasKey('participant', $columns);
83 $this->assertArrayHasKey('achieved', $columns);
84 $this->assertArrayHasKey('score', $columns);
85 $this->assertArrayHasKey('percentage', $columns);
86 $this->assertArrayHasKey('workingtime', $columns);
87 }

◆ test_getColumns_shouldReturnOnlySelectedColumns()

Results\Toplist\DataRetrievalTest::test_getColumns_shouldReturnOnlySelectedColumns ( )

Definition at line 89 of file DataRetrievalTest.php.

89 : void
90 {
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('getHighscoreWTime')->willReturn(false);
95
96 $columns = $this->tableObj->getColumns();
97 $this->assertIsArray($columns);
98 $this->assertNotEmpty($columns);
99 $this->assertArrayHasKey('achieved', $columns);
100 $this->assertArrayHasKey('percentage', $columns);
101
102 $this->assertArrayNotHasKey('score', $columns);
103 $this->assertArrayNotHasKey('workingtime', $columns);
104 }

◆ test_instantiateObject_shouldReturnInstance()

Results\Toplist\DataRetrievalTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 65 of file DataRetrievalTest.php.

65 : void
66 {
67 $this->assertInstanceOf(DataRetrieval::class, $this->tableObj);
68 }

Field Documentation

◆ $tableObj

DataRetrieval Results\Toplist\DataRetrievalTest::$tableObj
private

Definition at line 36 of file DataRetrievalTest.php.

◆ $testObjMock

ilObjTest Results\Toplist\DataRetrievalTest::$testObjMock
private

Definition at line 38 of file DataRetrievalTest.php.


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