ILIAS  release_8 Revision v8.24
ilTestPlayerConfirmationModalTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
28
29 protected function setUp(): void
30 {
31 parent::setUp();
32
33 $this->testObj = new ilTestPlayerConfirmationModal();
34 }
35
37 {
38 $this->assertInstanceOf(ilTestPlayerConfirmationModal::class, $this->testObj);
39 }
40
41 public function testModalId(): void
42 {
43 $this->testObj->setModalId("12345");
44 $this->assertEquals("12345", $this->testObj->getModalId());
45 }
46
47 public function testHeaderText(): void
48 {
49 $this->testObj->setHeaderText("testString");
50 $this->assertEquals("testString", $this->testObj->getHeaderText());
51 }
52
53 public function testConfirmationText(): void
54 {
55 $this->testObj->setConfirmationText("testString");
56 $this->assertEquals("testString", $this->testObj->getConfirmationText());
57 }
58
59 public function testConfirmationCheckboxName(): void
60 {
61 $this->testObj->setConfirmationCheckboxName("testString");
62 $this->assertEquals("testString", $this->testObj->getConfirmationCheckboxName());
63 }
64
65 public function testConfirmationCheckboxLabel(): void
66 {
67 $this->testObj->setConfirmationCheckboxLabel("testString");
68 $this->assertEquals("testString", $this->testObj->getConfirmationCheckboxLabel());
69 }
70
71 public function testAddButton(): void
72 {
73 $this->addGlobal_lng();
74 $expected = [];
75
76 foreach ([51, 291, 15, 681] as $id) {
77 $button = ilLinkButton::getInstance();
78 $button->setId((string) $id);
79 $expected[] = $button;
80 }
81
82 foreach ($expected as $button) {
83 $this->testObj->addButton($button);
84 }
85
86 $this->assertEquals($expected, $this->testObj->getButtons());
87 }
88
89 public function testAddParameter(): void
90 {
91 $this->addGlobal_ilCtrl();
92
93 $this->addGlobal_lng();
94 $expected = [];
95
96 foreach ([51, 291, 15, 681] as $id) {
97 $hiddenInput = new ilHiddenInputGUI("postVar" . "_" . $id);
98 $expected[] = $hiddenInput;
99 }
100
101 foreach ($expected as $hiddenInput) {
102 $this->testObj->addParameter($hiddenInput);
103 }
104
105 $this->assertEquals($expected, $this->testObj->getParameters());
106 }
107
109 {
110 $this->assertFalse($this->testObj->isConfirmationCheckboxRequired());
111
112 $this->testObj->setConfirmationCheckboxName("testName");
113 $this->testObj->setConfirmationCheckboxLabel("testLabel");
114 $this->assertTrue($this->testObj->isConfirmationCheckboxRequired());
115 }
116
117 public function testBuildModalButtonInstance(): void
118 {
119 $this->addGlobal_lng();
120
121 $result = $this->testObj->buildModalButtonInstance("201");
122 $this->assertInstanceOf(ilLinkButton::class, $result);
123 $this->assertEquals("201", $result->getId());
124 }
125}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTestBaseClass.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...