ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilTestRandomQuestionSetGeneralConfigFormGUITest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28
29 protected function setUp(): void
30 {
32 $ctrl_mock = $this->createMock(ilCtrl::class);
33 $lng_mock = $this->createMock(ilLanguage::class);
34 $lng_mock
35 ->method('txt')
36 ->willReturnCallback([self::class, 'lngTxtCallback'])
37 ;
38
39 $this->setGlobalVariable('lng', $lng_mock);
40 $this->setGlobalVariable('ilCtrl', $ctrl_mock);
41
42 $questionSetConfigGui_mock = $this->createMock(ilTestRandomQuestionSetConfigGUI::class);
43
45 $questionSetConfigGui_mock,
46 $this->createMock(ilTestRandomQuestionSetConfig::class)
47 );
48 }
49
51 {
52 $this->assertInstanceOf(ilTestRandomQuestionSetGeneralConfigFormGUI::class, $this->formGui);
53 }
54
55 public function testEditModeEnabled(): void
56 {
57 $expected = true;
58
59 $this->formGui->setEditModeEnabled($expected);
60
61 $this->assertEquals($expected, $this->formGui->isEditModeEnabled());
62 }
63
64 public static function lngTxtCallback(): string
65 {
66 return match (func_get_args()[0]) {
67 'tst_rnd_quest_set_cfg_general_form' => 'testTitle',
68 default => 'testValue'
69 };
70 }
71}
Class ilTestBaseClass.
setGlobalVariable(string $name, mixed $value)