ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 {
31 parent::setUp();
32 $ctrl_mock = $this->createMock(ilCtrl::class);
33 $lng_mock = $this->createMock(ilLanguage::class);
34 $lng_mock
35 ->expects($this->any())
36 ->method('txt')
37 ->willReturnCallback([self::class, 'lngTxtCallback'])
38 ;
39
40 $this->setGlobalVariable('lng', $lng_mock);
41 $this->setGlobalVariable('ilCtrl', $ctrl_mock);
42
43 $questionSetConfigGui_mock = $this->createMock(ilTestRandomQuestionSetConfigGUI::class);
44
46 $questionSetConfigGui_mock,
47 $this->createMock(ilTestRandomQuestionSetConfig::class)
48 );
49 }
50
52 {
53 $this->assertInstanceOf(ilTestRandomQuestionSetGeneralConfigFormGUI::class, $this->formGui);
54 }
55
56 public function testEditModeEnabled(): void
57 {
58 $expected = true;
59
60 $this->formGui->setEditModeEnabled($expected);
61
62 $this->assertEquals($expected, $this->formGui->isEditModeEnabled());
63 }
64
65 public static function lngTxtCallback(): string
66 {
67 return match (func_get_args()[0]) {
68 'tst_rnd_quest_set_cfg_general_form' => 'testTitle',
69 default => 'testValue'
70 };
71 }
72}
Class ilTestBaseClass.
setGlobalVariable(string $name, mixed $value)