ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestInfoScreenToolbarGUITest.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  global $DIC;
32  parent::setUp();
33 
34  $this->addGlobal_ilAccess();
35  $this->addGlobal_ilCtrl();
36  $this->addGlobal_lng();
37  $this->addGlobal_uiFactory();
38  $this->addGlobal_uiRenderer();
39  $this->addGlobal_ilUser();
40  $this->addGlobal_tpl();
41  $this->addGlobal_ilToolbar();
42 
43 
44  $this->testInfoScreenToolbarGUI = new ilTestInfoScreenToolbarGUI(
45  $this->createMock(ilObjTest::class),
46  $this->createMock(ilTestPlayerFixedQuestionSetGUI::class),
47  $this->createMock(ilTestQuestionSetConfig::class),
48  $this->createMock(ilTestSession::class),
49  $DIC['ilDB'],
50  $DIC['ilAccess'],
51  $DIC['ilCtrl'],
52  $DIC['lng'],
53  $DIC['ui.factory'],
54  $DIC['ui.renderer'],
55  $DIC['tpl'],
56  $DIC['ilToolbar']
57  );
58  }
59 
61  {
62  $this->assertInstanceOf(ilTestInfoScreenToolbarGUI::class, $this->testInfoScreenToolbarGUI);
63  }
64 
65  public function testSessionLockString(): void
66  {
67  $this->assertEquals('', $this->testInfoScreenToolbarGUI->getSessionLockString());
68 
69  $this->testInfoScreenToolbarGUI->setSessionLockString("testString");
70 
71  $this->assertEquals("testString", $this->testInfoScreenToolbarGUI->getSessionLockString());
72  }
73 
74  public function testInfoMessages(): void
75  {
76  $this->assertIsArray($this->testInfoScreenToolbarGUI->getInfoMessages());
77 
78  $expected = ["test1", "test2", "3test", "4test"];
79 
80  foreach ($expected as $value) {
81  $this->testInfoScreenToolbarGUI->addInfoMessage($value);
82  }
83 
84  $this->assertEquals($expected, $this->testInfoScreenToolbarGUI->getInfoMessages());
85  }
86 
87  public function testFailureMessages(): void
88  {
89  $this->assertIsArray($this->testInfoScreenToolbarGUI->getFailureMessages());
90 
91  $expected = ["test1", "test2", "3test", "4test"];
92 
93  foreach ($expected as $value) {
94  $this->testInfoScreenToolbarGUI->addFailureMessage($value);
95  }
96 
97  $this->assertEquals($expected, $this->testInfoScreenToolbarGUI->getFailureMessages());
98  }
99 }
Class ilTestInfoScreenToolbarGUITest.
ilTestInfoScreenToolbarGUI $testInfoScreenToolbarGUI
global $DIC
Definition: feed.php:28
Class ilTestBaseClass.