ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestServiceGUITest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28
29 protected function setUp(): void
30 {
31 parent::setUp();
32
33 $this->addGlobal_ilTabs();
35 $this->addGlobal_ilHelp();
36 $this->addGlobal_rbacsystem();
37 $this->addGlobal_ilSetting();
38 $this->addGlobal_ilToolbar();
41
42 $this->testObj = new ilTestServiceGUI($this->getTestObjMock());
43 }
44
46 {
47 $this->assertInstanceOf(ilTestServiceGUI::class, $this->testObj);
48 }
49
50 public function testContextResultPresentation(): void
51 {
52 $this->testObj->setContextResultPresentation(false);
53 $this->assertFalse($this->testObj->isContextResultPresentation());
54
55 $this->testObj->setContextResultPresentation(true);
56 $this->assertTrue($this->testObj->isContextResultPresentation());
57 }
58
59 public function testParticipantData(): void
60 {
61 $mock = $this->createMock(ilTestParticipantData::class);
62 $this->testObj->setParticipantData($mock);
63 $this->assertEquals($mock, $this->testObj->getParticipantData());
64 }
65
66 public function testObjectiveOrientedContainer(): void
67 {
68 $mock = $this->createMock(ilTestObjectiveOrientedContainer::class);
69 $this->testObj->setObjectiveOrientedContainer($mock);
70 $this->assertEquals($mock, $this->testObj->getObjectiveOrientedContainer());
71 }
72
73 #[\PHPUnit\Framework\Attributes\DataProvider('buildFixedShufflerSeedDataProvider')]
74 public function testBuildFixedShufflerSeed(int $question_id, int $pass_id, int $active_id, int $return): void
75 {
76 $reflection = new ReflectionClass(ilTestShuffler::class);
77 $method = $reflection->getMethod('buildFixedShufflerSeed');
78 $ilTestShuffler = new ilTestShuffler($this->createMock(ILIAS\Refinery\Factory::class));
79
80 $this->assertEquals($return, $method->invoke($ilTestShuffler, $question_id, $pass_id, $active_id));
81 }
82
83 public static function buildFixedShufflerSeedDataProvider(): array
84 {
85 return [
86 [
87 'question_id' => 1,
88 'pass_id' => 1,
89 'active_id' => 1,
90 'return' => 10000004
91 ],
92 [
93 'question_id' => 9999999,
94 'pass_id' => 1,
95 'active_id' => 1,
96 'return' => 10000000
97 ],
98 [
99 'question_id' => 234342342342342334,
100 'pass_id' => 11,
101 'active_id' => 1634545234234232344,
102 'return' => 1634545234234232355
103 ],
104 [
105 'question_id' => 23434234,
106 'pass_id' => 11,
107 'active_id' => 9223372036854775804,
108 'return' => 9223372036854775804
109 ]
110 ];
111 }
112}
Class ilTestBaseClass.
Class ilTestServiceGUITest.
testBuildFixedShufflerSeed(int $question_id, int $pass_id, int $active_id, int $return)
static buildFixedShufflerSeedDataProvider()
Service GUI class for tests.
addGlobal_ilNavigationHistory()
addGlobal_GlobalScreenService()
addGlobal_ilObjDataCache()
addGlobal_rbacsystem()
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.