ILIAS  release_8 Revision v8.23
ilTestServiceGUITest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
33  $this->addGlobal_lng();
34  $this->addGlobal_tpl();
35  $this->addGlobal_ilCtrl();
36  $this->addGlobal_ilias();
37  $this->addGlobal_tree();
38  $this->addGlobal_ilDB();
40  $this->addGlobal_ilTabs();
41  $this->addGlobal_ilObjDataCache();
42 
43  $this->testObj = new ilTestServiceGUI($this->createMock(ilObjTest::class));
44  }
45 
47  {
48  $this->assertInstanceOf(ilTestServiceGUI::class, $this->testObj);
49  }
50 
51  public function testContextResultPresentation(): void
52  {
53  $this->testObj->setContextResultPresentation(false);
54  $this->assertFalse($this->testObj->isContextResultPresentation());
55 
56  $this->testObj->setContextResultPresentation(true);
57  $this->assertTrue($this->testObj->isContextResultPresentation());
58  }
59 
60  public function testParticipantData(): void
61  {
62  $mock = $this->createMock(ilTestParticipantData::class);
63  $this->testObj->setParticipantData($mock);
64  $this->assertEquals($mock, $this->testObj->getParticipantData());
65  }
66 
67  public function testObjectiveOrientedContainer(): void
68  {
69  $mock = $this->createMock(ilTestObjectiveOrientedContainer::class);
70  $this->testObj->setObjectiveOrientedContainer($mock);
71  $this->assertEquals($mock, $this->testObj->getObjectiveOrientedContainer());
72  }
73 
74  public function testGetCommand(): void
75  {
76  $this->assertEquals("testCmd", $this->testObj->getCommand("testCmd"));
77  }
78 
80  {
81  $seeds = [
82  [
83  'question_id' => 1,
84  'pass_id' => 1,
85  'active_id' => 1,
86  'return' => 10000004
87  ],
88  [
89  'question_id' => 9999999,
90  'pass_id' => 1,
91  'active_id' => 1,
92  'return' => 10000000
93  ],
94  [
95  'question_id' => 234342342342342334,
96  'pass_id' => 11,
97  'active_id' => 1634545234234232344,
98  'return' => 1634545234234232355
99  ],
100  [
101  'question_id' => 23434234,
102  'pass_id' => 11,
103  'active_id' => 9223372036854775804,
104  'return' => 9223372036854775804
105  ]
106  ];
107 
108  $reflection = new \ReflectionClass(ilTestServiceGUI::class);
109  $method = $reflection->getMethod('buildFixedShufflerSeed');
110  $method->setAccessible(true);
111 
112  foreach ($seeds as $seed) {
113  $fixed_seed = $method->invoke($this->testObj, $seed['question_id'], $seed['pass_id'], $seed['active_id']);
114  $this->assertEquals($seed['return'], $fixed_seed);
115  }
116  }
117 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTestBaseClass.
Service GUI class for tests.