ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestDynamicQuestionSetStatisticTableGUITest.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  $lng_mock->expects($this->any())
36  ->method("txt")
37  ->willReturnCallback(function () {
38  return "testTranslation";
39  });
40  $ctrl_mock = $this->createMock(ilCtrl::class);
41  $ctrl_mock->expects($this->any())
42  ->method("getFormAction")
43  ->willReturnCallback(function () {
44  return "testFormAction";
45  });
46 
47  $this->setGlobalVariable("lng", $lng_mock);
48  $this->setGlobalVariable("ilCtrl", $ctrl_mock);
49  $this->setGlobalVariable("tpl", $this->createMock(ilGlobalPageTemplate::class));
50  $this->setGlobalVariable("component.repository", $this->createMock(ilComponentRepository::class));
51  $component_factory = $this->createMock(ilComponentFactory::class);
52  $component_factory->method("getActivePluginsInSlot")->willReturn(new ArrayIterator());
53  $this->setGlobalVariable("component.factory", $component_factory);
54  $this->setGlobalVariable("ilDB", $this->createMock(ilDBInterface::class));
55 
56  $this->parentObj_mock = $this->getMockBuilder(ilObjTestGUI::class)->disableOriginalConstructor()->onlyMethods(array('getObject'))->getMock();
57  $this->parentObj_mock->expects($this->any())->method('getObject')->willReturn($this->createMock(ilObjTest::class));
58  $this->tableGui = new ilTestDynamicQuestionSetStatisticTableGUI(
59  $ctrl_mock,
60  $lng_mock,
61  $this->parentObj_mock,
62  "",
63  0
64  );
65  }
66 
68  {
69  $this->assertInstanceOf(ilTestDynamicQuestionSetStatisticTableGUI::class, $this->tableGui);
70  }
71 
72  public function testFilterSelection(): void
73  {
74  $this->assertNull($this->tableGui->getFilterSelection());
75 
76  $this->tableGui->setFilterSelection(new ilTestDynamicQuestionSetFilterSelection());
77  $this->assertInstanceOf(
78  ilTestDynamicQuestionSetFilterSelection::class,
79  $this->tableGui->getFilterSelection()
80  );
81  }
82 
83  public function testInitTitle(): void
84  {
85  $this->tableGui->initTitle("tastas");
86  $this->assertEquals("testTranslation", $this->tableGui->title);
87  }
88 
89  public function testTaxIds(): void
90  {
91  $this->assertIsArray($this->tableGui->getTaxIds());
92  $expected = [10, 1250, 1233591, 12350];
93  $this->tableGui->setTaxIds($expected);
94  $this->assertEquals($expected, $this->tableGui->getTaxIds());
95  }
96 
97  public function testAnswerStatusFilterEnabled(): void
98  {
99  $this->assertIsBool($this->tableGui->isAnswerStatusFilterEnabled());
100  $this->tableGui->setAnswerStatusFilterEnabled(false);
101  $this->assertFalse($this->tableGui->isAnswerStatusFilterEnabled());
102  $this->tableGui->setAnswerStatusFilterEnabled(true);
103  $this->assertTrue($this->tableGui->isAnswerStatusFilterEnabled());
104  }
105 
106  public function testTaxonomyFilterEnabled(): void
107  {
108  $this->assertIsBool($this->tableGui->isTaxonomyFilterEnabled());
109  $this->tableGui->setTaxonomyFilterEnabled(false);
110  $this->assertFalse($this->tableGui->isTaxonomyFilterEnabled());
111  $this->tableGui->setTaxonomyFilterEnabled(true);
112  $this->assertTrue($this->tableGui->isTaxonomyFilterEnabled());
113  }
114 }
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.