◆ setUp()
ComponentHelperTest::setUp |
( |
| ) |
|
◆ test_cachesCanonicalName()
ComponentHelperTest::test_cachesCanonicalName |
( |
| ) |
|
Definition at line 88 of file ComponentHelperTest.php.
89 {
90 $name1 = $this->mock->getCanonicalName();
91 $name2 = $this->mock->getCanonicalName();
92 $this->assertEquals($name1, $name2);
93 $this->assertEquals(1, $this->mock->called_gcnbfqn);
94 }
◆ test_check_arg_instanceof_not_ok()
ComponentHelperTest::test_check_arg_instanceof_not_ok |
( |
| ) |
|
Definition at line 181 of file ComponentHelperTest.php.
182 {
183 try {
184 $this->mock->_checkArgInstanceOf("some_arg", $this, ComponentMock::class);
185 $this->assertFalse("This should not happen.");
186 } catch (\InvalidArgumentException $e) {
187 $this->assertEquals("Argument 'some_arg': expected ComponentMock, got ComponentHelperTest", $e->getMessage());
188 }
189 }
◆ test_check_arg_instanceof_ok()
ComponentHelperTest::test_check_arg_instanceof_ok |
( |
| ) |
|
Definition at line 172 of file ComponentHelperTest.php.
173 {
174 try {
175 $this->mock->_checkArgInstanceOf("some_arg", $this->mock, ComponentMock::class);
176 } catch (\InvalidArgumentException $e) {
177 $this->assertFalse("This should not happen.");
178 }
179 }
◆ test_check_arg_is_element_ok()
ComponentHelperTest::test_check_arg_is_element_ok |
( |
| ) |
|
Definition at line 193 of file ComponentHelperTest.php.
194 {
195 try {
196 $this->mock->_checkArgIsElement("some_arg", "bar", array("foo", "bar"), "foobar");
197 } catch (\InvalidArgumentException $e) {
198 $this->assertFalse("This should not happen.");
199 }
200 }
◆ test_check_arg_list_elements_multi_class_not_ok()
ComponentHelperTest::test_check_arg_list_elements_multi_class_not_ok |
( |
| ) |
|
Definition at line 258 of file ComponentHelperTest.php.
259 {
261 try {
262 $this->mock->_checkArgListElements(
"some_arg",
$l, array(
"Class1",
"Class2"));
263 $this->assertFalse("This should not happen.");
264 } catch (\InvalidArgumentException $e) {
265 $this->assertEquals("Argument 'some_arg': expected Class1, Class2, got Class3", $e->getMessage());
266 }
267 }
References $l.
◆ test_check_arg_list_elements_multi_class_ok()
ComponentHelperTest::test_check_arg_list_elements_multi_class_ok |
( |
| ) |
|
Definition at line 248 of file ComponentHelperTest.php.
249 {
251 try {
252 $this->mock->_checkArgListElements(
"some_arg",
$l, array(
"Class1",
"Class2"));
253 } catch (\InvalidArgumentException $e) {
254 $this->assertFalse("This should not happen.");
255 }
256 }
References $l.
◆ test_check_arg_list_elements_no_ok()
ComponentHelperTest::test_check_arg_list_elements_no_ok |
( |
| ) |
|
Definition at line 237 of file ComponentHelperTest.php.
238 {
240 try {
241 $this->mock->_checkArgListElements(
"some_arg",
$l, array(
"Class1"));
242 $this->assertFalse("This should not happen.");
243 } catch (\InvalidArgumentException $e) {
244 $this->assertEquals("Argument 'some_arg': expected Class1, got Class2", $e->getMessage());
245 }
246 }
References $l.
◆ test_check_arg_list_elements_ok()
ComponentHelperTest::test_check_arg_list_elements_ok |
( |
| ) |
|
Definition at line 227 of file ComponentHelperTest.php.
228 {
230 try {
231 $this->mock->_checkArgListElements(
"some_arg",
$l, array(
"Class1"));
232 } catch (\InvalidArgumentException $e) {
233 $this->assertFalse("This should not happen.");
234 }
235 }
References $l.
◆ test_check_arg_list_elements_string_or_int_not_ok()
ComponentHelperTest::test_check_arg_list_elements_string_or_int_not_ok |
( |
| ) |
|
Definition at line 279 of file ComponentHelperTest.php.
280 {
282 try {
283 $this->mock->_checkArgListElements(
"some_arg",
$l, array(
"string",
"int"));
284 $this->assertFalse("This should not happen.");
285 } catch (\InvalidArgumentException $e) {
286 $this->assertEquals("Argument 'some_arg': expected string, int, got Class1", $e->getMessage());
287 }
288 }
References $l.
◆ test_check_arg_list_elements_string_or_int_ok()
ComponentHelperTest::test_check_arg_list_elements_string_or_int_ok |
( |
| ) |
|
Definition at line 269 of file ComponentHelperTest.php.
270 {
271 $l = array(1,
"foo");
272 try {
273 $this->mock->_checkArgListElements(
"some_arg",
$l, array(
"string",
"int"));
274 } catch (\InvalidArgumentException $e) {
275 $this->assertFalse("This should not happen.");
276 }
277 }
References $l.
◆ test_check_arg_list_not_ok_1()
ComponentHelperTest::test_check_arg_list_not_ok_1 |
( |
| ) |
|
Definition at line 304 of file ComponentHelperTest.php.
305 {
306 $l = array(
"a" => 1,
"b" => 2, 4 => 3);
307 try {
308 $this->mock->_checkArgList(
"some_arg",
$l,
function ($k, $v) {
309 return is_string($k) && is_int($v);
310 }, function ($k, $v) {
311 return "expected keys of type string and integer values, got ($k => $v)";
312 });
313 $this->assertFalse("This should not happen.");
314 } catch (\InvalidArgumentException $e) {
315 $m =
"expected keys of type string and integer values, got (4 => 3)";
316 $this->assertEquals("Argument 'some_arg': $m", $e->getMessage());
317 }
318 }
References $l, and $m.
◆ test_check_arg_list_not_ok_2()
ComponentHelperTest::test_check_arg_list_not_ok_2 |
( |
| ) |
|
Definition at line 320 of file ComponentHelperTest.php.
321 {
322 $l = array(
"a" => 1,
"b" => 2,
"c" =>
"d");
323 try {
324 $this->mock->_checkArgList(
"some_arg",
$l,
function ($k, $v) {
325 return is_string($k) && is_int($v);
326 }, function ($k, $v) {
327 return "expected keys of type string and integer values, got ($k => $v)";
328 });
329
330 $this->assertFalse("This should not happen.");
331 } catch (\InvalidArgumentException $e) {
332 $m =
"expected keys of type string and integer values, got (c => d)";
333 $this->assertEquals("Argument 'some_arg': $m", $e->getMessage());
334 }
335 }
References $l, and $m.
◆ test_check_arg_list_ok()
ComponentHelperTest::test_check_arg_list_ok |
( |
| ) |
|
Definition at line 290 of file ComponentHelperTest.php.
291 {
292 $l = array(
"a" => 1,
"b" => 2,
"c" => 3);
293 try {
294 $this->mock->_checkArgList(
"some_arg",
$l,
function ($k, $v) {
295 return is_string($k) && is_int($v);
296 }, function ($k, $v) {
297 return "expected keys of type string and integer values, got ($k => $v)";
298 });
299 } catch (\InvalidArgumentException $e) {
300 $this->assertFalse("This should not happen.");
301 }
302 }
References $l.
◆ test_check_arg_not_ok()
ComponentHelperTest::test_check_arg_not_ok |
( |
| ) |
|
Definition at line 105 of file ComponentHelperTest.php.
106 {
107 try {
108 $this->mock->_checkArg("some_arg", false, "some message");
109 $this->assertFalse("This should not happen.");
110 } catch (\InvalidArgumentException $e) {
111 $this->assertEquals("Argument 'some_arg': some message", $e->getMessage());
112 }
113 }
◆ test_check_arg_ok()
ComponentHelperTest::test_check_arg_ok |
( |
| ) |
|
Definition at line 96 of file ComponentHelperTest.php.
97 {
98 try {
99 $this->mock->_checkArg("some_arg", true, "some message");
100 } catch (\InvalidArgumentException $e) {
101 $this->assertFalse("This should not happen.");
102 }
103 }
◆ test_check_bool_arg_not_ok()
ComponentHelperTest::test_check_bool_arg_not_ok |
( |
| ) |
|
Definition at line 162 of file ComponentHelperTest.php.
163 {
164 try {
165 $this->mock->_checkBoolArg("some_arg", 1);
166 $this->assertFalse("This should not happen.");
167 } catch (\InvalidArgumentException $e) {
168 $this->assertEquals("Argument 'some_arg': expected bool, got integer '1'", $e->getMessage());
169 }
170 }
◆ test_check_bool_arg_ok()
ComponentHelperTest::test_check_bool_arg_ok |
( |
| ) |
|
Definition at line 153 of file ComponentHelperTest.php.
154 {
155 try {
156 $this->mock->_checkBoolArg("some_arg", true);
157 } catch (\InvalidArgumentException $e) {
158 $this->assertFalse("This should not happen.");
159 }
160 }
◆ test_check_float_arg_not_ok()
ComponentHelperTest::test_check_float_arg_not_ok |
( |
| ) |
|
Definition at line 346 of file ComponentHelperTest.php.
347 {
348 try {
349 $this->mock->_checkFloatArg("some_arg", "foo");
350 $this->assertFalse("This should not happen.");
351 } catch (\InvalidArgumentException $e) {
352 $this->assertEquals("Argument 'some_arg': expected float, got string 'foo'", $e->getMessage());
353 }
354 }
◆ test_check_float_arg_ok()
ComponentHelperTest::test_check_float_arg_ok |
( |
| ) |
|
Definition at line 337 of file ComponentHelperTest.php.
338 {
339 try {
340 $this->mock->_checkFloatArg("some_arg", 1.73);
341 } catch (\InvalidArgumentException $e) {
342 $this->assertFalse("This should not happen.");
343 }
344 }
◆ test_check_int_arg_not_ok()
ComponentHelperTest::test_check_int_arg_not_ok |
( |
| ) |
|
Definition at line 124 of file ComponentHelperTest.php.
125 {
126 try {
127 $this->mock->_checkIntArg("some_arg", "foo");
128 $this->assertFalse("This should not happen.");
129 } catch (\InvalidArgumentException $e) {
130 $this->assertEquals("Argument 'some_arg': expected integer, got string 'foo'", $e->getMessage());
131 }
132 }
◆ test_check_int_arg_ok()
ComponentHelperTest::test_check_int_arg_ok |
( |
| ) |
|
Definition at line 115 of file ComponentHelperTest.php.
116 {
117 try {
118 $this->mock->_checkIntArg("some_arg", 1);
119 } catch (\InvalidArgumentException $e) {
120 $this->assertFalse("This should not happen.");
121 }
122 }
◆ test_check_string_arg_is_element_not_ok()
ComponentHelperTest::test_check_string_arg_is_element_not_ok |
( |
| ) |
|
Definition at line 202 of file ComponentHelperTest.php.
203 {
204 try {
205 $this->mock->_checkArgIsElement("some_arg", "baz", array("foo", "bar"), "foobar");
206 $this->assertFalse("This should not happen.");
207 } catch (\InvalidArgumentException $e) {
208 $this->assertEquals("Argument 'some_arg': expected foobar, got 'baz'", $e->getMessage());
209 }
210 }
◆ test_check_string_arg_not_ok()
ComponentHelperTest::test_check_string_arg_not_ok |
( |
| ) |
|
Definition at line 143 of file ComponentHelperTest.php.
144 {
145 try {
146 $this->mock->_checkStringArg("some_arg", 1);
147 $this->assertFalse("This should not happen.");
148 } catch (\InvalidArgumentException $e) {
149 $this->assertEquals("Argument 'some_arg': expected string, got integer '1'", $e->getMessage());
150 }
151 }
◆ test_check_string_arg_ok()
ComponentHelperTest::test_check_string_arg_ok |
( |
| ) |
|
Definition at line 134 of file ComponentHelperTest.php.
135 {
136 try {
137 $this->mock->_checkStringArg("some_arg", "bar");
138 } catch (\InvalidArgumentException $e) {
139 $this->assertFalse("This should not happen.");
140 }
141 }
◆ test_getCanonicalName()
ComponentHelperTest::test_getCanonicalName |
( |
| ) |
|
Definition at line 82 of file ComponentHelperTest.php.
83 {
84 $c = new \ILIAS\UI\Component\Test\TestComponent(
"foo");
85 $this->assertEquals(
"Test Component Test",
$c->getCanonicalName());
86 }
References $c.
◆ test_to_array_with_array()
ComponentHelperTest::test_to_array_with_array |
( |
| ) |
|
Definition at line 212 of file ComponentHelperTest.php.
213 {
214 $foo = array("foo", "bar");
215 $res = $this->mock->_toArray($foo);
216
217 $this->assertEquals($foo,
$res);
218 }
foreach($_POST as $key=> $value) $res
References $res.
◆ test_to_array_with_int()
ComponentHelperTest::test_to_array_with_int |
( |
| ) |
|
The documentation for this class was generated from the following file: