ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestPassDetailsOverviewTableGUITest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
29 
30  protected function setUp(): void
31  {
32  parent::setUp();
33 
34  $lng_mock = $this->createMock(ilLanguage::class);
35  $ctrl_mock = $this->createMock(ilCtrl::class);
36  $ctrl_mock->expects($this->any())
37  ->method("getFormAction")
38  ->willReturnCallback(function () {
39  return "testFormAction";
40  });
41 
42  $this->setGlobalVariable("lng", $lng_mock);
43  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
44  $this->setGlobalVariable("tpl", $this->createMock(ilGlobalPageTemplate::class));
45  $this->setGlobalVariable("component.repository", $this->createMock(ilComponentRepository::class));
46  $component_factory = $this->createMock(ilComponentFactory::class);
47  $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
48  $this->setGlobalVariable("component.factory", $component_factory);
49  $this->setGlobalVariable("ilDB", $this->createMock(ilDBInterface::class));
50 
51  $this->parentObj_mock = $this->getMockBuilder(ilObjTestGUI::class)->disableOriginalConstructor()->onlyMethods(array('getObject'))->getMock();
52  $this->parentObj_mock->expects($this->any())->method('getObject')->willReturn($this->createMock(ilObjTest::class));
53  $this->tableGui = new ilTestPassDetailsOverviewTableGUI(
54  $ctrl_mock,
55  $this->parentObj_mock,
56  ""
57  );
58  }
59 
61  {
62  $this->assertInstanceOf(ilTestPassDetailsOverviewTableGUI::class, $this->tableGui);
63  }
64 
65  public function testPdfGenerationRequest(): void
66  {
67  $this->assertIsBool($this->tableGui->isPdfGenerationRequest());
68  $this->tableGui->setIsPdfGenerationRequest(false);
69  $this->assertFalse($this->tableGui->isPdfGenerationRequest());
70  $this->tableGui->setIsPdfGenerationRequest(true);
71  $this->assertTrue($this->tableGui->isPdfGenerationRequest());
72  }
73 
74  public function testSingleAnswerScreenCmd(): void
75  {
76  $this->tableGui->setSingleAnswerScreenCmd("testString");
77  $this->assertEquals("testString", $this->tableGui->getSingleAnswerScreenCmd());
78  }
79 
80  public function testAnswerListAnchorEnabled(): void
81  {
82  $this->assertIsBool($this->tableGui->getAnswerListAnchorEnabled());
83  $this->tableGui->setAnswerListAnchorEnabled(false);
84  $this->assertFalse($this->tableGui->getAnswerListAnchorEnabled());
85  $this->tableGui->setAnswerListAnchorEnabled(true);
86  $this->assertTrue($this->tableGui->getAnswerListAnchorEnabled());
87  }
88 
89  public function testShowHintCount(): void
90  {
91  $this->assertIsBool($this->tableGui->getShowHintCount());
92  $this->tableGui->setShowHintCount(false);
93  $this->assertFalse($this->tableGui->getShowHintCount());
94  $this->tableGui->setShowHintCount(true);
95  $this->assertTrue($this->tableGui->getShowHintCount());
96  }
97 
98  public function testShowSuggestedSolution(): void
99  {
100  $this->assertIsBool($this->tableGui->getShowSuggestedSolution());
101  $this->tableGui->setShowSuggestedSolution(false);
102  $this->assertFalse($this->tableGui->getShowSuggestedSolution());
103  $this->tableGui->setShowSuggestedSolution(true);
104  $this->assertTrue($this->tableGui->getShowSuggestedSolution());
105  }
106 
107  public function testActiveId(): void
108  {
109  $this->tableGui->setActiveId(200);
110  $this->assertEquals(200, $this->tableGui->getActiveId());
111  }
112 
114  {
115  $this->assertIsBool($this->tableGui->isObjectiveOrientedPresentationEnabled());
116  $this->tableGui->setObjectiveOrientedPresentationEnabled(false);
117  $this->assertFalse($this->tableGui->isObjectiveOrientedPresentationEnabled());
118  $this->tableGui->setObjectiveOrientedPresentationEnabled(true);
119  $this->assertTrue($this->tableGui->isObjectiveOrientedPresentationEnabled());
120  }
121 
122  public function testMultipleObjectivesInvolved(): void
123  {
124  $this->assertIsBool($this->tableGui->areMultipleObjectivesInvolved());
125  $this->tableGui->setMultipleObjectivesInvolved(false);
126  $this->assertFalse($this->tableGui->areMultipleObjectivesInvolved());
127  $this->tableGui->setMultipleObjectivesInvolved(true);
128  $this->assertTrue($this->tableGui->areMultipleObjectivesInvolved());
129  }
130 
131  public function testPassColumnEnabled(): void
132  {
133  $this->assertIsBool($this->tableGui->isPassColumnEnabled());
134  $this->tableGui->setPassColumnEnabled(false);
135  $this->assertFalse($this->tableGui->isPassColumnEnabled());
136  $this->tableGui->setPassColumnEnabled(true);
137  $this->assertTrue($this->tableGui->isPassColumnEnabled());
138  }
139 }
Class ilObjTestGUI.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setGlobalVariable(string $name, $value)
Class ilTestBaseClass.