ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestPassOverviewTableGUITest.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 $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(ilTestEvaluationGUI::class)->disableOriginalConstructor()->onlyMethods(['getObject'])->getMock();
52 $this->parentObj_mock->expects($this->any())->method('getObject')->willReturn($this->getTestObjMock());
53 $this->tableGui = new ilTestPassOverviewTableGUI($this->parentObj_mock, "");
54 }
55
57 {
58 $this->assertInstanceOf(ilTestPassOverviewTableGUI::class, $this->tableGui);
59 }
60
61 public function testNumericOrdering(): void
62 {
63 $this->assertTrue($this->tableGui->numericOrdering("pass"));
64 $this->assertTrue($this->tableGui->numericOrdering("date"));
65 $this->assertTrue($this->tableGui->numericOrdering("percentage"));
66 $this->assertFalse($this->tableGui->numericOrdering("randomText"));
67 }
68
69 public function testResultPresentationEnabled(): void
70 {
71 $this->assertIsBool($this->tableGui->isResultPresentationEnabled());
72 $this->tableGui->setResultPresentationEnabled(false);
73 $this->assertFalse($this->tableGui->isResultPresentationEnabled());
74 $this->tableGui->setResultPresentationEnabled(true);
75 $this->assertTrue($this->tableGui->isResultPresentationEnabled());
76 }
77
78 public function testPdfPresentationEnabled(): void
79 {
80 $this->assertIsBool($this->tableGui->isPdfPresentationEnabled());
81 $this->tableGui->setPdfPresentationEnabled(false);
82 $this->assertFalse($this->tableGui->isPdfPresentationEnabled());
83 $this->tableGui->setPdfPresentationEnabled(true);
84 $this->assertTrue($this->tableGui->isPdfPresentationEnabled());
85 }
86
88 {
89 $this->assertIsBool($this->tableGui->isObjectiveOrientedPresentationEnabled());
90 $this->tableGui->setObjectiveOrientedPresentationEnabled(false);
91 $this->assertFalse($this->tableGui->isObjectiveOrientedPresentationEnabled());
92 $this->tableGui->setObjectiveOrientedPresentationEnabled(true);
93 $this->assertTrue($this->tableGui->isObjectiveOrientedPresentationEnabled());
94 }
95
96 public function testActiveId(): void
97 {
98 $this->tableGui->setActiveId(20);
99 $this->assertEquals(20, $this->tableGui->getActiveId());
100 }
101
102 public function testPassDetailsCommand(): void
103 {
104 $this->assertIsString($this->tableGui->getPassDetailsCommand());
105 $this->tableGui->setPassDetailsCommand("testString");
106 $this->assertEquals("testString", $this->tableGui->getPassDetailsCommand());
107 }
108
109 public function testPassDeletionCommand(): void
110 {
111 $this->assertIsString($this->tableGui->getPassDeletionCommand());
112 $this->tableGui->setPassDeletionCommand("testString");
113 $this->assertEquals("testString", $this->tableGui->getPassDeletionCommand());
114 }
115}
Class ilTestBaseClass.
Output class for assessment test evaluation.
Class ilTestPassOverviewTableGUITest.
Class ilTestPassOverviewTableGUI.
setGlobalVariable(string $name, mixed $value)