ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestQuestionBrowserTableGUITest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
29
30 protected function setUp(): void
31 {
32 parent::setUp();
33
34 $this->addGlobal_ilSetting();
35
36 $lng_mock = $this->createMock(ilLanguage::class);
37 $lng_mock
38 ->method("txt")
39 ->willReturnCallback(function () {
40 return "testTranslation";
41 });
42
43 $ctrl_mock = $this->createMock(ilCtrl::class);
44 $ctrl_mock
45 ->method("getFormAction")
46 ->willReturnCallback(function () {
47 return "testFormAction";
48 });
49
50 $mainTpl_mock = $this->createMock(ilGlobalPageTemplate::class);
51 $db_mock = $this->createMock(ilDBInterface::class);
52 $tree_mock = $this->createMock(ilTree::class);
53 $this->setGlobalVariable("lng", $lng_mock);
54 $this->setGlobalVariable("ilCtrl", $ctrl_mock);
55 $this->setGlobalVariable("tpl", $mainTpl_mock);
56 $this->setGlobalVariable("tree", $tree_mock);
57 $this->setGlobalVariable("ilDB", $db_mock);
58 $this->setGlobalVariable("ilObjDataCache", $this->createMock(ilObjectDataCache::class));
59
60 $component_factory = $this->createMock(ilComponentFactory::class);
61 $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
62 $this->setGlobalVariable("component.factory", $component_factory);
63
64 $component_repository = $this->createMock(ilComponentRepository::class);
65 $this->setGlobalVariable("component.repository", $component_repository);
66
67 $this->parentObj_mock = $this->getMockBuilder(ilObjTestGUI::class)->disableOriginalConstructor()->onlyMethods(['getObject'])->getMock();
68 $this->parentObj_mock->method('getObject')->willReturn($this->getTestObjMock());
69 $this->tableGui = new ilTestQuestionBrowserTableGUI(
70 $this->getMockBuilder(ilTabsGUI::class)->disableOriginalConstructor()->getMock(),
71 $tree_mock,
72 $db_mock,
73 $this->createMock(ILIAS\Test\Logging\TestLogger::class),
74 $component_repository,
75 $this->getMockBuilder(ilObjTest::class)->disableOriginalConstructor()->getMock(),
76 $this->createMock(ilObjUser::class),
77 $this->createMock(ilAccessHandler::class),
78 $this->createMock(\ILIAS\HTTP\GlobalHttpState::class),
79 new \ILIAS\Refinery\Factory(
80 new \ILIAS\Data\Factory(),
81 $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
82 ),
83 $this->createMock(ILIAS\UI\Factory::class),
84 $this->createMock(ILIAS\UI\Renderer::class),
85 $this->createMock(ILIAS\Test\RequestDataCollector::class),
86 $this->createMock(ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository::class),
87 $lng_mock,
88 $ctrl_mock,
89 $mainTpl_mock,
90 $this->createMock(ilUIService::class),
91 $this->createMock(ILIAS\Data\Factory::class),
92 $this->createMock(ILIAS\Taxonomy\DomainService::class),
93 fn(int $questionPoolId) => 'testLink'
94 );
95 }
96
98 {
99 $this->assertInstanceOf(ilTestQuestionBrowserTableGUI::class, $this->tableGui);
100 }
101}
Class ilObjTestGUI.
Class ilTestBaseClass.
Class ilTestQuestionBrowserTableGUITest.
@ilCtrl_Calls ilTestQuestionBrowserTableGUI: ilFormPropertyDispatchGUI
setGlobalVariable(string $name, mixed $value)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.