ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestQuestionBrowserTableGUITest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
29 
30  protected function setUp(): void
31  {
32  parent::setUp();
33 
34  $lng_mock = $this->createMock(ilLanguage::class);
35  $lng_mock
36  ->method("txt")
37  ->willReturnCallback(function () {
38  return "testTranslation";
39  });
40 
41  $ctrl_mock = $this->createMock(ilCtrl::class);
42  $ctrl_mock
43  ->method("getFormAction")
44  ->willReturnCallback(function () {
45  return "testFormAction";
46  });
47 
48  $mainTpl_mock = $this->createMock(ilGlobalPageTemplate::class);
49  $db_mock = $this->createMock(ilDBInterface::class);
50  $tree_mock = $this->createMock(ilTree::class);
51  $this->setGlobalVariable("lng", $lng_mock);
52  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
53  $this->setGlobalVariable("tpl", $mainTpl_mock);
54  $this->setGlobalVariable("tree", $tree_mock);
55  $this->setGlobalVariable("ilDB", $db_mock);
56  $this->setGlobalVariable("ilUser", $this->createMock(ilObjUser::class));
57  $this->setGlobalVariable("ilObjDataCache", $this->createMock(ilObjectDataCache::class));
58  $this->addGlobal_ilLog();
59  $component_factory = $this->createMock(ilComponentFactory::class);
60  $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
61  $this->setGlobalVariable("component.factory", $component_factory);
62 
63  $component_repository = $this->createMock(ilComponentRepository::class);
64  $this->setGlobalVariable("component.repository", $component_repository);
65 
66  $this->parentObj_mock = $this->getMockBuilder(ilObjTestGUI::class)->disableOriginalConstructor()->onlyMethods(array('getObject'))->getMock();
67  $this->parentObj_mock->method('getObject')->willReturn($this->createMock(ilObjTest::class));
68  $this->tableGui = new ilTestQuestionBrowserTableGUI(
69  $this->getMockBuilder(ilTabsGUI::class)->disableOriginalConstructor()->getMock(),
70  $tree_mock,
71  $db_mock,
72  $this->createMock(ilLogger::class),
73  $component_repository,
74  $this->getMockBuilder(ilObjTest::class)->disableOriginalConstructor()->getMock(),
75  $this->createMock(ilAccessHandler::class),
76  $this->createMock(\ILIAS\HTTP\GlobalHttpState::class),
77  new \ILIAS\Refinery\Factory(
78  new \ILIAS\Data\Factory(),
79  $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock()
80  ),
81  $this->createMock(ILIAS\UI\Factory::class),
82  $this->createMock(ILIAS\UI\Renderer::class),
83  $this->createMock(ILIAS\Test\InternalRequestService::class),
84  $this->createMock(ILIAS\TestQuestionPool\QuestionInfoService::class)
85  );
86  }
87 
89  {
90  $this->assertInstanceOf(ilTestQuestionBrowserTableGUI::class, $this->tableGui);
91  }
92 
93  public function testWriteAccess(): void
94  {
95  $this->tableGui->setWriteAccess(false);
96  $this->assertFalse($this->tableGui->hasWriteAccess());
97  $this->tableGui->setWriteAccess(true);
98  $this->assertTrue($this->tableGui->hasWriteAccess());
99  }
100 }
Class ilObjTestGUI.
Class ChatMainBarProvider .
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTestQuestionBrowserTableGUITest.