ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestServiceGUITest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28 
29  protected function setUp(): void
30  {
31  parent::setUp();
32 
33  $this->addGlobal_lng();
34  $this->addGlobal_ilAccess();
35  $this->addGlobal_tpl();
36  $this->addGlobal_ilCtrl();
37  $this->addGlobal_ilias();
38  $this->addGlobal_tree();
39  $this->addGlobal_ilDB();
40  $this->addGlobal_ilUser();
42  $this->addGlobal_ilTabs();
43  $this->addGlobal_ilObjDataCache();
44  $this->addGlobal_ilHelp();
45  $this->addGlobal_ilLog();
46  $this->addGlobal_rbacsystem();
47  $this->addGlobal_ilSetting();
48  $this->addGlobal_ilToolbar();
51  $this->addGlobal_uiFactory();
52  $this->addGlobal_uiRenderer();
53 
54  $this->testObj = new ilTestServiceGUI($this->getTestObjMock());
55  }
56 
58  {
59  $this->assertInstanceOf(ilTestServiceGUI::class, $this->testObj);
60  }
61 
62  public function testContextResultPresentation(): void
63  {
64  $this->testObj->setContextResultPresentation(false);
65  $this->assertFalse($this->testObj->isContextResultPresentation());
66 
67  $this->testObj->setContextResultPresentation(true);
68  $this->assertTrue($this->testObj->isContextResultPresentation());
69  }
70 
71  public function testParticipantData(): void
72  {
73  $mock = $this->createMock(ilTestParticipantData::class);
74  $this->testObj->setParticipantData($mock);
75  $this->assertEquals($mock, $this->testObj->getParticipantData());
76  }
77 
78  public function testObjectiveOrientedContainer(): void
79  {
80  $mock = $this->createMock(ilTestObjectiveOrientedContainer::class);
81  $this->testObj->setObjectiveOrientedContainer($mock);
82  $this->assertEquals($mock, $this->testObj->getObjectiveOrientedContainer());
83  }
84 
85  public function testGetCommand(): void
86  {
87  $this->assertEquals("testCmd", $this->testObj->getCommand("testCmd"));
88  }
89 
91  {
92  $seeds = [
93  [
94  'question_id' => 1,
95  'pass_id' => 1,
96  'active_id' => 1,
97  'return' => 10000004
98  ],
99  [
100  'question_id' => 9999999,
101  'pass_id' => 1,
102  'active_id' => 1,
103  'return' => 10000000
104  ],
105  [
106  'question_id' => 234342342342342334,
107  'pass_id' => 11,
108  'active_id' => 1634545234234232344,
109  'return' => 1634545234234232355
110  ],
111  [
112  'question_id' => 23434234,
113  'pass_id' => 11,
114  'active_id' => 9223372036854775804,
115  'return' => 9223372036854775804
116  ]
117  ];
118 
119  $reflection = new \ReflectionClass(ilTestShuffler::class);
120  $method = $reflection->getMethod('buildFixedShufflerSeed');
121  $method->setAccessible(true);
122 
123  $refinery = new \ILIAS\Refinery\Factory(
124  new \ILIAS\Data\Factory(),
125  $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
126  );
127  $shuffler = new ilTestShuffler($refinery);
128 
129  foreach ($seeds as $seed) {
130  $fixed_seed = $method->invoke($shuffler, $seed['question_id'], $seed['pass_id'], $seed['active_id']);
131  $this->assertEquals($seed['return'], $fixed_seed);
132  }
133  }
134 }
Class ChatMainBarProvider .
Class ilTestServiceGUITest.
Class ilTestBaseClass.
Service GUI class for tests.
Refinery Factory $refinery