ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUITest.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  global $DIC;
33  parent::setUp();
34 
35  $this->addGlobal_tpl();
37  $this->addGlobal_ilAccess();
38 
39  $lng_mock = $this->createMock(ilLanguage::class);
40  $lng_mock->expects($this->any())
41  ->method("txt")
42  ->willReturnCallback(function () {
43  return "testTranslation";
44  });
45  $this->setGlobalVariable("lng", $lng_mock);
46 
47  $ctrl_mock = $this->createMock(ilCtrl::class);
48  $ctrl_mock->expects($this->any())
49  ->method("getFormAction")
50  ->willReturnCallback(function () {
51  return "testFormAction";
52  });
53  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
54 
55  $component_factory = $this->createMock(ilComponentFactory::class);
56  $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
57  $this->setGlobalVariable("component.factory", $component_factory);
58 
59  $objTest_mock = $this->createMock(ilObjTest::class);
60  $objTest_mock->expects($this->any())
61  ->method("getTestQuestions")
62  ->willReturnCallback(function () {
63  return [];
64  });
65  $objTest_mock->expects($this->any())
66  ->method("getPotentialRandomTestQuestions")
67  ->willReturnCallback(function () {
68  return [];
69  });
70 
71  $this->parentObj_mock = $this->getMockBuilder(ilTestScoringByQuestionsGUI::class)
72  ->disableOriginalConstructor()->onlyMethods(['getObject'])->getMock();
73  $this->parentObj_mock->expects($this->any())->method('getObject')->willReturn($objTest_mock);
74 
75  $this->tableGui = new ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI($this->parentObj_mock, $DIC['ilAccess']);
76  }
77 
79  {
80  $this->assertInstanceOf(ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI::class, $this->tableGui);
81  }
82 }
global $DIC
Definition: feed.php:28
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.