ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 33 of file DataRetrievalTest.php.

Member Function Documentation

◆ setUp()

Results\Toplist\DataRetrievalTest::setUp ( )
protected

Definition at line 39 of file DataRetrievalTest.php.

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

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

◆ test_formatTime_shouldReturnFormattedTime()

Results\Toplist\DataRetrievalTest::test_formatTime_shouldReturnFormattedTime ( )

Definition at line 109 of file DataRetrievalTest.php.

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

◆ test_formatTime_shouldReturnZeroTime()

Results\Toplist\DataRetrievalTest::test_formatTime_shouldReturnZeroTime ( )

Definition at line 104 of file DataRetrievalTest.php.

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

◆ test_getColumns_shouldReturnAllColumns()

Results\Toplist\DataRetrievalTest::test_getColumns_shouldReturnAllColumns ( )

Definition at line 68 of file DataRetrievalTest.php.

68  : void
69  {
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('getHighscoreWTime')->willReturn(true);
74 
75  $columns = $this->tableObj->getColumns();
76  $this->assertIsArray($columns);
77  $this->assertNotEmpty($columns);
78  $this->assertArrayHasKey('is_actor', $columns);
79  $this->assertArrayHasKey('rank', $columns);
80  $this->assertArrayHasKey('participant', $columns);
81  $this->assertArrayHasKey('achieved', $columns);
82  $this->assertArrayHasKey('score', $columns);
83  $this->assertArrayHasKey('percentage', $columns);
84  $this->assertArrayHasKey('workingtime', $columns);
85  }

◆ test_getColumns_shouldReturnOnlySelectedColumns()

Results\Toplist\DataRetrievalTest::test_getColumns_shouldReturnOnlySelectedColumns ( )

Definition at line 87 of file DataRetrievalTest.php.

87  : void
88  {
89  $this->testObjMock->method('getHighscoreAchievedTS')->willReturn(true);
90  $this->testObjMock->method('getHighscoreScore')->willReturn(false);
91  $this->testObjMock->method('getHighscorePercentage')->willReturn(true);
92  $this->testObjMock->method('getHighscoreWTime')->willReturn(false);
93 
94  $columns = $this->tableObj->getColumns();
95  $this->assertIsArray($columns);
96  $this->assertNotEmpty($columns);
97  $this->assertArrayHasKey('achieved', $columns);
98  $this->assertArrayHasKey('percentage', $columns);
99 
100  $this->assertArrayNotHasKey('score', $columns);
101  $this->assertArrayNotHasKey('workingtime', $columns);
102  }

◆ test_instantiateObject_shouldReturnInstance()

Results\Toplist\DataRetrievalTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 63 of file DataRetrievalTest.php.

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

Field Documentation

◆ $tableObj

DataRetrieval Results\Toplist\DataRetrievalTest::$tableObj
private

Definition at line 35 of file DataRetrievalTest.php.

◆ $testObjMock

ilObjTest Results\Toplist\DataRetrievalTest::$testObjMock
private

Definition at line 37 of file DataRetrievalTest.php.


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