ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LinkStandardGUIRequestTest.php
Go to the documentation of this file.
1<?php
2
19namespace IntLink;
20
21use PHPUnit\Framework\TestCase;
22use ILIAS;
23use ilLanguage;
24
28class LinkStandardGUIRequestTest extends TestCase
29{
30 protected function tearDown(): void
31 {
32 }
33
34 protected function getRequest(array $get, array $post): \ILIAS\COPage\IntLink\StandardGUIRequest
35 {
36 $http_mock = $this->createMock(ILIAS\HTTP\Services::class);
37 $lng_mock = $this->createMock(ilLanguage::class);
38 $data = new \ILIAS\Data\Factory();
39 $refinery = new \ILIAS\Refinery\Factory($data, $lng_mock);
40 return new \ILIAS\COPage\IntLink\StandardGUIRequest(
41 $http_mock,
43 $get,
44 $post
45 );
46 }
47
48 public function testSelectedId(): void
49 {
50 $request = $this->getRequest(
51 [
52 "sel_id" => "123"
53 ],
54 [
55 ]
56 );
57
58 $this->assertEquals(
59 123,
60 $request->getSelectedId()
61 );
62 }
63
64 public function testDo(): void
65 {
66 $request = $this->getRequest(
67 [
68 "do" => "set"
69 ],
70 [
71 ]
72 );
73
74 $this->assertEquals(
75 "set",
76 $request->getDo()
77 );
78 }
79
80 public function testMediaPoolFolder(): void
81 {
82 $request = $this->getRequest(
83 [
84 "mep_fold" => "14"
85 ],
86 [
87 ]
88 );
89
90 $this->assertEquals(
91 14,
92 $request->getMediaPoolFolder()
93 );
94 }
95
96 public function testLinkType(): void
97 {
98 $request = $this->getRequest(
99 [
100 "link_type" => "mytype"
101 ],
102 [
103 ]
104 );
105
106 $this->assertEquals(
107 "mytype",
108 $request->getLinkType()
109 );
110 }
111
112 public function testLinkParentObjId(): void
113 {
114 $request = $this->getRequest(
115 [
116 "link_par_obj_id" => "13"
117 ],
118 [
119 ]
120 );
121
122 $this->assertEquals(
123 13,
124 $request->getLinkParentObjId()
125 );
126 }
127
128 public function testLinkParentFolderId(): void
129 {
130 $request = $this->getRequest(
131 [
132 "link_par_fold_id" => "18"
133 ],
134 [
135 ]
136 );
137
138 $this->assertEquals(
139 18,
140 $request->getLinkParentFolderId()
141 );
142 }
143
144 public function testLinkParentRefId(): void
145 {
146 $request = $this->getRequest(
147 [
148 "link_par_ref_id" => "22"
149 ],
150 [
151 ]
152 );
153
154 $this->assertEquals(
155 22,
156 $request->getLinkParentRefId()
157 );
158 }
159
160 public function testUserSearchString(): void
161 {
162 $request = $this->getRequest(
163 [
164 ],
165 [
166 "usr_search_str" => "term"
167 ]
168 );
169
170 $this->assertEquals(
171 "term",
172 $request->getUserSearchStr()
173 );
174 }
175}
language handling
$post
Definition: ltitoken.php:46
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.