ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestRandomQuestionSetGeneralConfigFormGUITest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 {
34 
35  protected function setUp(): void
36  {
37  parent::setUp();
38  $ctrl_mock = $this->createMock(ilCtrl::class);
39  $lng_mock = $this->createMock(ilLanguage::class);
40  $lng_mock->expects($this->any())
41  ->method("txt")
42  ->willReturnCallback([self::class, "lngTxtCallback"]);
43 
44  $this->setGlobalVariable("lng", $lng_mock);
45  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
46 
47  $testObject_mock = $this->createMock(ilObjTest::class);
48  $questionSetConfigGui_mock = $this->createMock(ilTestRandomQuestionSetConfigGUI::class);
49  $this->questionSetConfig_mock = $this->createMock(ilTestRandomQuestionSetConfig::class);
50 
52  $ctrl_mock,
53  $lng_mock,
54  $testObject_mock,
55  $questionSetConfigGui_mock,
56  $this->questionSetConfig_mock
57  );
58  }
59 
61  {
62  $this->assertInstanceOf(ilTestRandomQuestionSetGeneralConfigFormGUI::class, $this->formGui);
63  }
64 
65  public function testEditModeEnabled(): void
66  {
67  $expected = true;
68 
69  $this->formGui->setEditModeEnabled($expected);
70 
71  $this->assertEquals($expected, $this->formGui->isEditModeEnabled());
72  }
73 
74  public static function lngTxtCallback(): string
75  {
76  $args = func_get_args();
77  switch ($args[0]) {
78  case "tst_rnd_quest_set_cfg_general_form":
79  return "testTitle";
80  default:
81  return "testValue";
82  }
83  }
84 }
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.